Compare commits

...

76 Commits

Author SHA1 Message Date
张冬雪
72bb6294e3 更新 'README.md' 2021-10-26 16:21:32 +08:00
c1b2823298 [贡献值记录加入个break属性] 2021-10-21 10:22:55 +08:00
9f4f923b8e [转让权证销售单价变真实数据] 2021-10-21 09:48:22 +08:00
83e96cd64d [...] 2021-10-21 09:20:34 +08:00
9c257e5303 [原下单页面去掉统一下单页面,服务券提货券商品详情页面调整] 2021-10-20 17:45:52 +08:00
d69486541b [发布优惠券提货券index报错] 2021-10-20 16:37:18 +08:00
6b2293f8eb [重置企业认证后跳转路径] 2021-10-20 14:53:02 +08:00
61c306bcc0 [员工修改手机不可修改且员工列表头像换cover] 2021-10-20 11:35:56 +08:00
a450e594b4 [核销tags样式调整及企业信息完善页面加入经营范围] 2021-10-20 10:59:09 +08:00
163df819ac [设置加个默认头像] 2021-10-20 10:02:15 +08:00
8ea7a49dcb [企业认证前-2去创建企业] 2021-10-20 09:59:13 +08:00
e32aeb507c [拒绝退货图片类型改数组] 2021-10-19 17:17:03 +08:00
47f969767f [退货相关跳转页面兼容处理] 2021-10-19 17:03:57 +08:00
3aa6fb1882 [贡献值记录模块调整] 2021-10-19 13:22:17 +08:00
2d7da5d5c6 [发货单退货单详情名称统一发货单退货单流程跑通及退货单调用子组件接口不好用完善接口] 2021-10-19 11:40:04 +08:00
1b41b40de9 [转让权证加转让价格判断] 2021-10-19 09:15:13 +08:00
9156029027 [修改银行卡列表返回上一页app和H5兼容问题] 2021-10-18 17:40:13 +08:00
f46c33d827 [...] 2021-10-18 16:33:52 +08:00
f53fcec0a9 我的零钱提现银行卡添加银行卡] 2021-10-18 16:26:24 +08:00
a9e877c850 [.当前贡献值交易总额,eb记录页面高度处理] 2021-10-18 15:23:43 +08:00
8bd3f5e1aa [app端处理总成成交额保留小数点后四位] 2021-10-18 14:34:34 +08:00
335a2a6515 [发布优惠券没有商品列表新增缺省图片] 2021-10-18 14:24:44 +08:00
a5186e5d0b [优惠券得使用规则加校验及优惠券规则为null处理为空] 2021-10-18 11:20:14 +08:00
c2f108a77b [...] 2021-10-18 10:05:26 +08:00
4854c04fb7 [...] 2021-10-15 17:24:43 +08:00
199c61af55 [优惠券跳转商品确认页面需要跟小程序一直,可以选择优惠券] 2021-10-15 15:08:13 +08:00
2855bb58e6 [.区块链z证书展示格式等冲突处理] 2021-10-15 15:06:29 +08:00
6155d93548 [...修复会员中心成为会员样式及会员特权可切换显示] 2021-10-15 11:50:32 +08:00
唐明明
45c79ef478 移出apisRequer冗余文件 2021-10-15 10:37:06 +08:00
唐明明
e18e3b8829 同步 2021-10-15 10:20:41 +08:00
zhangmanman
992be56ee9 调试一键登录安卓版 2021-10-11 18:13:02 +08:00
唐明明
0c19bec510 调试安卓一键登录 2021-10-11 16:33:52 +08:00
唐明明
ce1f3ff02f 修复部分bug 2021-10-09 17:21:18 +08:00
zhangmanman
09c68e4289 Merge branch 'main' of https://git.yuzhankeji.cn/TmOct5/barter-app into main 2021-09-27 17:18:02 +08:00
zhangmanman
c699dd2f15 修改我的资产 2021-09-27 17:17:54 +08:00
唐明明
81ff53730b merge 2021-09-25 10:13:52 +08:00
唐明明
3b765af414 同步 2021-09-25 10:12:59 +08:00
zhangmanman
0cdc28c1ec 更新通证权益相关页面 2021-09-23 17:39:38 +08:00
zhangmanman
db42cc974c 更新通证权益相关页面 2021-09-23 17:38:46 +08:00
唐明明
a06c2c78e9 merge 2021-09-23 10:37:13 +08:00
唐明明
6dc47050b6 优化企业广场分类选择 2021-09-23 10:36:15 +08:00
zhangmanman
0d77682f00 更新代码 2021-09-23 10:19:38 +08:00
zhangmanman
ec3c9428b3 更新代码 2021-09-23 10:18:51 +08:00
唐明明
2d0beda790 统一请求接口方法 2021-09-23 09:59:04 +08:00
唐明明
6a90c8dc8d 访客记录新增字段 2021-09-22 17:52:16 +08:00
唐明明
8c35ad5956 mrege 2021-09-22 17:39:43 +08:00
唐明明
b06e4f8109 新增资产权证转让管理部分页面增加分页 2021-09-22 17:37:58 +08:00
4b23dba0cc ['核销记录样式改版,新增老板端筛选记录,优惠券首页新增返回按钮'] 2021-09-22 12:00:35 +08:00
aa1788fa8d [...] 2021-09-18 17:19:17 +08:00
17074af70d ['核销记录优惠券核销和权证核销'] 2021-09-18 17:17:38 +08:00
唐明明
b7cacb38c7 权证发起转让 2021-09-18 17:13:47 +08:00
唐明明
ac4552a3ee 调整支付成功页面字段 2021-09-18 15:31:50 +08:00
唐明明
d8d5766c86 merge 2021-09-18 15:19:56 +08:00
唐明明
7ebb45e5ab 使用优惠券购买权证流程调整新增支付成功提示页面 2021-09-18 15:17:31 +08:00
zhangmanman
f7fc27944d 更新优惠券领取 2021-09-18 14:04:18 +08:00
zhangmanman
5464ff258a 更新优惠券领取 2021-09-18 14:03:01 +08:00
bb083ee368 [''完善优惠券核销] 2021-09-18 13:20:06 +08:00
f9c3a8e4fd Merge branch 'main' of https://git.yuzhankeji.cn/TmOct5/barter-app 2021-09-18 13:10:15 +08:00
05c7870f99 ['] 2021-09-18 13:02:56 +08:00
唐明明
bab69de284 交易市场 2021-09-18 12:00:49 +08:00
唐明明
314f43f0cc merge 2021-09-17 17:39:12 +08:00
唐明明
cf873ca6f3 转让市场 2021-09-17 17:37:10 +08:00
0fa8736ed3 ['我的推广二维码展示形式及个人中中心接口对接'] 2021-09-17 15:34:25 +08:00
d0412c96dc ['我的资产新增Eb记录'] 2021-09-17 14:05:05 +08:00
5d9e2a101b ['设置中心修改头像昵称退出登录'] 2021-09-17 13:35:02 +08:00
1d2c408b8b ['首页更多跳转更多优惠券列表'] 2021-09-17 13:09:03 +08:00
1635540868 [我的资产新增已使用列表详情] 2021-09-17 11:31:03 +08:00
43d3210fa5 ['数权字段改权证'] 2021-09-17 10:25:50 +08:00
84698c20bf ['我的资产-我的足迹'] 2021-09-17 10:21:39 +08:00
0e7dcb68c7 [...] 2021-09-17 10:03:56 +08:00
b22684ea86 [...] 2021-09-17 10:01:35 +08:00
e9d6eae051 ['我的资产-我的优惠券'] 2021-09-17 09:45:15 +08:00
唐明明
db187bc774 merge 2021-09-16 18:17:35 +08:00
唐明明
f77b357b3e 商品管理模块 2021-09-16 18:10:28 +08:00
zhangmanman
bcbb98ec4a 更新员工工作台商品详情 2021-09-16 17:55:19 +08:00
zhangmanman
2a10a0dcec 更新员工工作台商品详情 2021-09-16 17:50:51 +08:00
364 changed files with 93767 additions and 12715 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
unpackage

View File

@@ -14,6 +14,10 @@
{
"launchtype" : "local"
},
"mp-weixin" :
{
"launchtype" : "local"
},
"type" : "uniCloud"
}
]

5
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,5 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/

12
.idea/barter-app(new-app).iml generated Normal file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/barter-appnew-app.iml" filepath="$PROJECT_DIR$/.idea/barter-appnew-app.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

47
App.vue
View File

@@ -1,23 +1,36 @@
<script>
export default {
onLaunch () {
console.log('App Launch')
},
onShow () {
console.log('App Show')
},
onHide () {
console.log('App Hide')
},
globalData: {
mainColor: "white"
}
export default {
onLaunch() {
// if (typeof WeixinJSBridge == 'object' && typeof WeixinJSBridge.invoke == 'function') {
// handleFontSize()
// } else {
// document.addEventListener('WeixinJSBridgeReady', handleFontSize, false);
// }
// function handleFontSize() {
// // 设置网页字体为默认大小
// WeixinJSBridge.invoke('setFontSizeCallback', { fontSize: 0 })
// // 重写设置网页字体大小的事件
// WeixinJSBridge.on('menu:setfont', function() {
// WeixinJSBridge.invoke('setFontSizeCallback', { fontSize: 0 })
// })
// }
},
onShow() {
console.log('App Show');
},
onHide() {
console.log('App Hide');
},
globalData: {
mainColor: 'white'
}
};
</script>
<style lang="scss">
@import "uview-ui/index.scss";
page{
background: #f5f5f5;
}
@import 'uview-ui/index.scss';
page {
background: #f5f5f5;
-webkit-text-size-adjust: 100% !important;
}
</style>

View File

@@ -1,5 +1,5 @@
# 易货App
因项目太大无法上传文件废弃新指向https://git.yuzhankeji.cn/UzTech/EB_Barter_App.git
_开发临时存储资源存放在/static/dev目录下_

View File

@@ -31,13 +31,13 @@ const request = (parameter) => {
'Authorization': store.getters.getToken || ''
}
console.log('parameterDbug', parameter)
// console.log('parameterDbug', parameter)
// 加载提示
uni.showLoading({
title: '加载中',
mask : true
});
// uni.showLoading({
// title: '加载中',
// mask : true
// });
// 请求实例
return new Promise((resolve, reject) => {
uni.request({

View File

@@ -3,7 +3,7 @@
* moduleName: 地址
*/
import request from '../request.js'
import { request } from '../index'
// 地址列表
const addresses = () => {

View File

@@ -3,7 +3,7 @@
* moduleName: 优惠券相关
*/
import request from '../request.js'
import { request } from '../index'
// 我的优惠券
const myCoupon = (data) => {
@@ -33,7 +33,7 @@ const getCouponsInfoById = (id) => {
// 根据企业id获取企业首页的轮播图列表
const couponsByCompanyId = (data) => {
return request({
url: 'coupons',
url: 'coupons/all',
method: 'get',
data: data
})

View File

@@ -55,11 +55,19 @@ const employeesPut = (id, data) => {
})
}
// 员工管理工具 手太欠
const employeesTool = () => {
return request({
url: 'companies/employees/permission'
})
}
export {
employees,
employeesConfig,
addEmployees,
employeesInfo,
employeesDelete,
employeesPut
employeesPut,
employeesTool
}

View File

@@ -18,7 +18,8 @@ const mall = data => {
// 商品列表
const list = data => {
return request({
url: "mall/goods"
url: "mall/goods",
data
})
}
@@ -55,7 +56,7 @@ const managesGoodsBurn = data => {
})
}
// 商品管理-商品上架
// 商品管理-商品上架 ********已废弃
const managesGoodsOnsale = id => {
return request({
url: 'manages/goods/'+id+'/onsale',
@@ -63,7 +64,7 @@ const managesGoodsOnsale = id => {
})
}
// 商品管理-商品下架
// 商品管理-商品下架 ********已废弃
const managesGoodsOffsale = id => {
return request({
url: 'manages/goods/'+id+'/offsale',
@@ -71,7 +72,7 @@ const managesGoodsOffsale = id => {
})
}
// 发布商品前置 manages/goods/create
// 发布商品前置
const managesGoodsCreateBefore = () => {
return request({
url: 'manages/goods/create'
@@ -102,6 +103,113 @@ const managesCreate = (data) => {
})
}
// 商品认证
const managesGoodsAuth = (id, data) => {
return request({
url: 'manages/goods/' + id + '/extends',
method:'POST',
data
})
}
// 商品删除
const managesGoodsDelete = id => {
return request({
url: 'manages/goods/' + id,
method:'DELETE'
})
}
// 产品信息
const managesGoodsEdit = id => {
return request({
url: 'manages/goods/' + id
})
}
// 区块链证书
const managesChain = (id) => {
return request({
url: 'mall/goods/'+ id + '/chain'
})
}
// 商品认证
const managesAttestation = (id) => {
return request({
url: 'mall/goods/'+ id +'/message'
})
}
// 商品溯源
const managesTracedTo = (id) => {
return request({
url: 'mall/goods/'+ id +'/trace'
})
}
// 领取优惠券
const managesCoupons = (id) => {
return request({
url: 'coupons/'+ id +'/grant',
method: 'POST'
})
}
// 产品编辑
const managesGoodsPut = (id, data) => {
return request({
url: 'manages/goods/' + id,
method: 'PUT',
data
})
}
// 产品附加信息
const managesGoodsExtends = id => {
return request({
url: 'manages/goods/' + id + '/extends',
})
}
// 通证权益 搜索页面
const searchUrl = (apiUrl,data) => {
return request({
url : apiUrl,
data: data
})
}
// 商品分类
const goodsCategory = () => {
return request({
url : 'mall/categories'
})
}
// 企业行业分类
const companyCategory = () => {
return request({
url : 'companies/industry'
})
}
// 商品分类搜索-默认关键字
const randgoodsUrl = (apiUrl, data) => {
return request({
url: apiUrl,
data: data
})
}
// 商品确认商品信息页面get 下单页 post
const mallBuyGoods = (data, method) => {
return request({
url: 'mall/buy/goods',
method: method,
data: data
})
}
export {
mall,
list,
@@ -114,5 +222,19 @@ export {
managesGoodsCreateBefore,
managesGoodsCreate,
managesCategory,
managesCreate
managesGoodsAuth,
managesGoodsDelete,
managesGoodsEdit,
managesCreate,
managesChain,
managesAttestation,
managesTracedTo,
managesCoupons,
managesGoodsPut,
managesGoodsExtends,
searchUrl,
goodsCategory,
companyCategory,
randgoodsUrl,
mallBuyGoods
}

102
apis/interfaces/market.js Normal file
View File

@@ -0,0 +1,102 @@
/**
* Web唐明明
* 匆匆数载恍如梦,岁月迢迢华发增。
* 碌碌无为枉半生,一朝惊醒万事空。
* moduleName: 转让市场
*/
import { request } from '../index'
// 转让市场
const markets = data => {
return request({
url: 'markets',
data
})
}
// 转让市场记录
const marketsLogs = data => {
return request({
url: 'markets/orders',
data
})
}
// 转让详情
const marketsInfo = id => {
return request({
url: 'markets/' + id
})
}
// 提交支付订单
const marketsBuy = (id, data) => {
return request({
url: 'markets/' + id + '/create',
method: 'POST',
data
})
}
// 转让市场支付
const marketsPay = (id, platform) => {
return request({
url: 'markets/pay/' + id + '/' + platform
})
}
// 转让权证信息
const marketsCreateInfo = symbol => {
return request({
url: 'markets/user/markets/create',
data: { symbol }
})
}
// 提交权证转让
const marketsCreate = data => {
return request({
url: 'markets/user/markets/create',
method: 'POST',
data
})
}
// 转让管理
const marketsMag = data => {
return request({
url: 'markets/user/markets',
data
})
}
// 取消转让
const marketsCancel = id => {
return request({
url: 'markets/' + id + '/cancel',
method: 'POST'
})
}
// 我的成交理事
const marketsOrdersLogs = (data, name) => {
return request({
url: 'markets/orders/' + name,
data
})
}
export {
markets,
marketsLogs,
marketsInfo,
marketsBuy,
marketsPay,
marketsCreateInfo,
marketsCreate,
marketsMag,
marketsCancel,
marketsOrdersLogs
}

99
apis/interfaces/mine.js Normal file
View File

@@ -0,0 +1,99 @@
/**
* Web-zdx
* moduleName:个人中心相关操作
*/
import {
request
} from '../index'
// 关注店铺
const shopSubscribe = (id) => {
return request({
url: 'mall/shops/subscribe/' + id,
method: 'POST'
})
}
// 我的关注店铺列表
const shopSubscribeList = (page) => {
return request({
url: 'mall/shops/subscribe',
method: 'get',
data: {
page: page
}
})
}
// 关于我们
const aboutUs = () => {
return request({
url: 'articles/about'
})
}
// 获取用户信息
const getUserInfo = () => {
return request({
url: 'user/app'
})
}
// 获取用户设置中心的信息
const getUserSettingInfo = () => {
return request({
url: 'user/setting'
})
}
// 账号余额等信息
const chaineb = (data) => {
return request({
url: 'user/account/chaineb',
method: 'get',
data: data
})
}
// 我的足迹
const browsers = (page) => {
return request({
url: 'mall/goods/browsers',
method: 'get',
data: {
page: page,
page_size: 20
}
})
}
// 修改用户头像或昵称
const resetUserInfo = (data) => {
return request({
url: 'user/' + data.key,
method: 'PUT',
data: {
value: data.value
}
})
}
// 我的推广码
const appcode = () => {
return request({
url: 'user/appcode'
})
}
export {
shopSubscribe,
shopSubscribeList,
aboutUs,
getUserInfo,
getUserSettingInfo,
chaineb,
browsers,
resetUserInfo,
appcode
}

View File

@@ -3,7 +3,7 @@
* moduleName: 我的数权
*/
import request from '../request.js'
import { request } from '../index'
// 我的数权
const mallWarrants = (data) => {
@@ -13,6 +13,7 @@ const mallWarrants = (data) => {
data: data
})
}
// 我的数权Id获取数权详情
const mallWarrantsList = (symbol) => {
return request({
@@ -23,6 +24,7 @@ const mallWarrantsList = (symbol) => {
}
})
}
// 确认提货
const mallWarrantsSure = (data) => {
return request({
@@ -31,6 +33,7 @@ const mallWarrantsSure = (data) => {
data: data
})
}
// 我的邮寄订单,我的提货单
const mallShipmentsPostShop = (apiUrl,data) => {
return request({
@@ -39,6 +42,7 @@ const mallShipmentsPostShop = (apiUrl,data) => {
data: data
})
}
// 根据提货单的no 获取提货单的详情
const mallShipmentsInfo = (no) => {
return request({
@@ -46,6 +50,7 @@ const mallShipmentsInfo = (no) => {
method: 'GET'
})
}
// 取消提货单
const mallShipmentsCancel = (shipmentNo) => {
return request({
@@ -103,6 +108,7 @@ const mallRefundsInfo = (no) => {
method: 'GET'
})
}
// 确认退货mall/refunds/{refund}/deliver
const mallRefundsDeliver = (data) => {
return request({

View File

@@ -24,7 +24,24 @@ const eb = (no) => {
})
}
// 微信支付
const wxPay = (data) => {
return request({
url: 'mall/pay/' + data.order_no + '/wechat',
data: data,
method:'get'
})
}
// EB支付
const ebPay = (data) => {
return request({
url: 'mall/pay/' + data.order_no + '/eb'
})
}
export {
buy,
eb
eb,
wxPay,
ebPay
}

31
apis/interfaces/scan.js Normal file
View File

@@ -0,0 +1,31 @@
/**
* Web-zdx
* moduleName:核销相关操作
*/
import { request } from '../index'
// 扫码前置条件 get 核销前置 post 表示核销
const scanInfo = (apiUrl,data,method) => {
return request({
url: apiUrl,
method:method,
data:data
})
}
// 核销记录
const scanList = (apiUrl,data) => {
return request({
url: apiUrl,
method:'GET',
data:data
})
}
export {
scanInfo,
scanList
}

View File

@@ -54,4 +54,5 @@ export {
editInfo,
putShop,
deleteShop
}

View File

@@ -15,7 +15,7 @@ const index = () => {
})
}
// 成交客户
// 成交客户 *********已废弃
const customer = data => {
return request({
url: 'mall/statistics',
@@ -23,6 +23,14 @@ const customer = data => {
})
}
// 成交客户
const orderUsers = data => {
return request({
url: 'manages/order_users',
data
})
}
// 访客记录
const visitors = data => {
return request({
@@ -47,10 +55,113 @@ const basicsInfo = (method, data) => {
})
}
// 营销推广码
const companiesCode = () => {
return request({
url: 'companies/code'
})
}
// 退货单列表
const storeReturn = (data) => {
return request({
url: 'manages/refunds',
data: data
})
}
// 退货单详情
const orderDetails = (refund_id) => {
return request({
url: 'manages/refunds/' + refund_id
})
}
// 退货单-操作日志
const orderJournal = (refund_id) => {
return request({
url: 'mall/refunds/' + refund_id + '/logs'
})
}
// 退货单签收
const storeSign = (refund_id) => {
return request({
url: 'manages/refunds/' + refund_id + '/sign'
})
}
// 退货单-退货
const storeToken = (refund_id) => {
return request({
url: 'manages/refunds/' + refund_id + '/retoken'
})
}
// 退货单-审核
const storeAudit = (refund_id, data) => {
return request({
url: 'manages/refunds/' + refund_id + '/audit',
method: 'POST',
data: data
})
}
// 提货单列表
const storeDeliver = (data) => {
return request({
url: 'manages/shipments',
data: data
})
}
// 提货单详情
const deliverDetails = (shipment__no) => {
return request({
url: 'manages/shipments/' + shipment__no
})
}
// 提货单发货前置
const deliverFront = (shipment__no) => {
return request({
url: 'manages/shipments/' + shipment__no + '/deliver'
})
}
// 提货单发货
const deliverForm = (shipment__no, data) => {
return request({
url: 'manages/shipments/' + shipment__no + '/deliver',
method: 'POST',
data: data
})
}
// 提货单物流
const deliverLogistic = (shipment__no) => {
return request({
url: 'manages/shipments/' + shipment__no + '/logistic'
})
}
export {
index,
customer,
orderUsers,
visitors,
basicsConfig,
basicsInfo
basicsInfo,
companiesCode,
storeReturn,
orderDetails,
orderJournal,
storeSign,
storeToken,
storeAudit,
storeDeliver,
deliverDetails,
deliverFront,
deliverForm,
deliverLogistic
}

View File

@@ -16,10 +16,11 @@ const identities = () => {
}
// 开通会员
const vipOrder = id =>{
const vipOrder = (id, data) =>{
return request({
url : 'user/identities/create/' + id,
method : 'POST'
method : 'POST',
data : data
})
}
@@ -30,8 +31,25 @@ const vipWechatPay = id => {
})
}
// 开通身份内容
const vipCont = (id, data) =>{
return request({
url : 'user/identities/create/' + id,
data : data
})
}
// 会员开通协议
const userAgree = () =>{
return request({
url : 'articles/agreement/openvip'
})
}
export {
identities,
vipOrder,
vipWechatPay
vipWechatPay,
vipCont,
userAgree
}

167
apis/interfaces/wallet.js Normal file
View File

@@ -0,0 +1,167 @@
/**
* Web唐明明
* 匆匆数载恍如梦,岁月迢迢华发增。
* 碌碌无为枉半生,一朝惊醒万事空。
* moduleName: 钱包
*/
import {request} from '../index.js'
// 导出助记词
const seed = () => {
return request({
url: 'chain/safe/seed'
})
}
const hash = (data) => {
return request({
url: 'chain/wallet/hash',
method: 'POST',
data: data
})
}
// 收款码
const code = () => {
return request({
url: 'chain/account/code'
})
}
// 原石余额
const sum = () => {
return request({
url: 'chain/account/balance'
})
}
// 原石价格
const price = () => {
return request({
url: 'nodes/price'
})
}
// 账户记录
const logs = (data) => {
return request({
url: 'chain/account/logs',
data: data
})
}
// 设置安全密码
const security = (data) => {
return request({
url: 'chain/safe/security',
method: 'POST',
data
})
}
// 转账
const transfer = (data) => {
return request({
url: 'chain/account/transfer',
method: 'POST',
data
})
}
// 钱包私钥
const privatekey = (code) => {
return request({
url : "chain/safe/private_key",
data: {
code
}
})
}
// 获取可提现信息
const withdraw = () => {
return request({
url : "withdraw"
})
}
// 提现记录
const withdrawLogs = (data) => {
return request({
url : "withdraw/logs",
data:data
})
}
// 提现
const withdrawDo = (data) => {
return request({
url : "withdraw",
method: 'POST',
data:data
})
}
// 验证支付密码是否正确
const securityCheck = (password) => {
return request({
url : "chain/safe/security/check",
method: 'POST',
data:{
code : password,
}
})
}
// 修改密码
const securityReset = (data) => {
return request({
url : "chain/safe/security",
method: 'PUT',
data:data
})
}
// 提现服务条款
const cmsWithdraw = () => {
return request({
url : "cms/withdraw"
})
}
// 私钥规则
const keyrules = () => {
return request({
url: 'cms/keyrules'
})
}
// 能量球转红包前置,获取能量球的基本信息
const accountCashs = (data) => {
return request({
url: 'user/account/cashs',
data:data
})
}
export {
seed,
hash,
code,
sum,
price,
logs,
security,
transfer,
privatekey,
withdraw,
withdrawLogs,
withdrawDo,
securityCheck,
securityReset,
cmsWithdraw,
keyrules,
accountCashs
}

View File

@@ -0,0 +1,123 @@
/**
* zdx
* moduleName: 提现模块
*/
import {
request
} from '../index.js'
// 添加前置条件
const accountsCreate = () => {
return request({
url: 'withdraws/accounts/create'
})
}
// 添加银行卡
const withdrawsAccounts = (data) => {
return request({
url: 'withdraws/accounts',
method: 'POST',
data: data
})
}
// 银行卡列表
const withdrawsAccountsList = (data) => {
return request({
url: 'withdraws/accounts',
method: 'get',
data: data
})
}
// 编辑银行卡前置
const accountsCreateEdit = (id) => {
return request({
url: 'withdraws/accounts/'+id+'/edit'
})
}
// 编辑银行卡
const withdrawsAccountsEdits = (data) => {
return request({
url: 'withdraws/accounts/'+data.bank_account_id,
method: 'PUT',
data: data
})
}
// 删除银行卡
const withdrawsAccountsDelete = (id) => {
return request({
url: 'withdraws/accounts/'+id,
method: 'DELETE'
})
}
// 提现前置记录
const withdrawsIndexCreate = () => {
return request({
url: 'withdraws/index/create'
})
}
// 提现接口
const withdrawsIndex = (data) => {
return request({
url: 'withdraws/index',
method: 'POST',
data: data
})
}
// 提现记录
const withdrawsIndexLists = (data) => {
return request({
url: 'withdraws/index',
method: 'get',
data: data
})
}
// 能量碎片记录
const userAccoutScores = (data) => {
return request({
url: 'user/account/scores',
method: 'get',
data: data
})
}
// 能量球转红包前置
const cashsCreate = () => {
return request({
url: 'user/account/cashs/create',
method: 'get'
})
}
// 能量球转红包
const accountCashs = (data) => {
return request({
url: 'user/account/cashs',
method: 'POST',
data: data
})
}
export {
accountsCreate,
withdrawsAccounts,
withdrawsAccountsList,
accountsCreateEdit,
withdrawsAccountsEdits,
withdrawsAccountsDelete,
withdrawsIndexCreate,
withdrawsIndex,
withdrawsIndexLists,
userAccoutScores,
accountCashs,
cashsCreate
}

View File

@@ -1,113 +0,0 @@
/**
*/
import store from '@/store'
// 基础配置
const config = {
apiUrl: 'https://e-chain.cnskl.com/api/',
timeout: 60000
}
let loginHintState = false
// 网络请求
const request = (parameter) => {
// 检查url配置
if (parameter.url === 'undefined' || parameter.url === '') {
uni.showToast({
title: '请求地址不能为空',
icon: 'none'
})
return
}
// 注入header
config.header = {
'Accept': 'application/json',
'Authorization': store.getters.getToken || ''
}
// 请求实例
return new Promise((resolve, reject) => {
uni.request({
url: config.apiUrl + parameter.url,
timeout: config.timeout,
header: config.header || {},
data: parameter.data || {},
method: parameter.method || 'GET',
success: res => {
if (res.header.Authorization) {
updateToken('token', res.header.Authorization)
}
if (res.statusCode === 200) {
const resolveData = res.data
if (resolveData.status_code === 200) {
resolve(resolveData.data)
return
}
if (resolveData.status_code === 401) {
loginHint()
return
}
reject(resolveData)
return
}
errToast(res.statusCode)
}
})
})
}
// 处理一些http请求错误提示
const errToast = (code) => {
switch (code) {
case 404:
uni.showToast({
title: code + '接口不存在,请联系系统管理员',
icon: 'none'
})
break;
case 405:
uni.showToast({
title: code + '请检查接口请求方式错误',
icon: 'none'
})
break;
case 500:
uni.showToast({
title: code + '服务端错误,请检查服务器信息',
icon: 'none'
})
break;
case 401:
console.log('没有权限')
break;
}
}
// 更新token
const updateToken = (token) => {
store.commit('setToken', token)
}
// 处理登录提示
const loginHint = () => {
if (loginHintState) return
if (!loginHintState) loginHintState = true
updateToken('')
uni.showModal({
title: '登录提示',
content: '您的登录信息已过期,请重新登录',
confirmColor: '#0055ff',
showCancel: false,
success: res => {
loginHintState = false
if (res.confirm) uni.reLaunch({
url: '/pages/login/login'
})
}
})
}
export default request

View File

@@ -21,20 +21,18 @@
<view class="coupon-right-des" v-if='item.type.value === 2'>{{item.price_text}}</view>
<view class="coupon-right-day">剩余{{item.time.expire}}</view>
</view>
<view class="coupon-to-used" @click="$router.push({name:'CouponDetail',query:{id:item.coupon_grant_id}})">
去使用
</view>
<view class="coupon-to-used" v-if="item.status.status !== 3" @click="couponDetailGo(item.coupon_grant_id)"> 去使用 </view>
</view>
</view>
<view class="check-all" v-if="item.coupon_count>2" @click="$router.push({name:'CouponMoreList', query:{id:item.coupon_id}})">
<view class="check-all" v-if="item.coupon_count>2" @click="couponMoreListGo(item.coupon_id)">
查看全部{{item.coupon_count}}张优惠券 <uni-icons type="arrowright" size="16" color="#cacaca"></uni-icons>
</view>
<!-- 已使用未使用标识 -->
<image class="used" v-if='item.status.status === 2' src="/static/images/has_used.png" mode="widthFix" />
<image class="used" v-if="item.status.status === 3" src="/static/images/has_un_used.png" mode="widthFix" />
<view class="has-used-bg" v-if="item.status.status === 2 || item.status.status === 3"></view>
<!-- <view class="has-used-bg" v-if="item.status.status === 2 || item.status.status === 3"></view> -->
</view>
<!-- <u-toast ref="uToast" /> -->
<u-toast ref="uToast" />
</view>
@@ -54,11 +52,26 @@
return {
};
},
methods:{
couponDetailGo(id) {
// this.$router.push({name: 'CouponDetail', query: {id: id}})
uni.navigateTo({
url:'/pages/property/coupon/detail?id='+id
})
},
couponMoreListGo(id) {
// this.$router.push({name:'CouponMoreList', query:{id: id}})
uni.navigateTo({
url: '/pages/property/coupon/couponMore?id='+id
})
}
}
}
</script>
<style lang="scss" scoped>
$padding:20rpx;
.coupon-item {
margin: $padding $padding;
position: relative;
@@ -139,7 +152,7 @@
box-sizing: border-box;
.money {
font-size: 70rpx;
font-size: 50rpx;
font-weight: bold;
}
}

File diff suppressed because one or more lines are too long

View File

@@ -17,7 +17,7 @@
<view class="name1 ellipsis-2">{{item.goods_sku.goods_name}}</view>
<!-- <span>{{item.account.balance}}</span> -->
</view>
<view class="sku">权个数 <span>x {{item.qty}}</span> </view>
<view class="sku">个数 <span>x {{item.qty}}</span> </view>
<!-- <view class="sku">提货方式 <span> {{item.type_text}}</span> </view> -->
</view>
</view>
@@ -39,7 +39,7 @@
// 跳转到商品详情页面
goDetail(id) {
uni.navigateTo({
url: '/pages/goods/detail?id=' + id
url: '/pages/goods/details?id=' + id
})
}
}

View File

@@ -18,8 +18,9 @@
<view class="name1 ellipsis-2">{{item.goods_sku.goods_name}}</view>
<!-- <span>{{item.account.balance}}</span> -->
</view>
<view class="sku">权个数 <span>x {{item.qty}}</span> </view>
<view class="sku">提货方式 <span> {{item.type_text}}</span> </view>
<view class="sku">个数 <span>x {{item.qty}}</span> </view>
<view class="sku" v-if="item.goods_type === 2">使用方式 <span> 门店使用</span> </view>
<view class="sku" v-else>提货方式 <span> {{item.type_text}}</span> </view>
</view>
</view>
</view>
@@ -40,7 +41,7 @@
// 跳转到商品详情页面
goDetail(id) {
uni.navigateTo({
url: '/pages/goods/detail?id='+id
url: '/pages/goods/details?id='+id
})
}
}

View File

@@ -1,6 +1,6 @@
<template>
<view class="OrderTemplate" >
<view class="top" >
<view class="top" v-if="isTop">
<view class="company">
<view class="company-logo">
<image :src="item.shop.cover" mode="aspectFill" />
@@ -18,7 +18,7 @@
<view class="name1 ellipsis-2">{{item.goods.goods_name}}</view>
<!-- <span>{{item.account.balance}}</span> -->
</view>
<view class="sku">权个数 <span>x {{item.account.balance}}</span> </view>
<view class="sku">个数 <span>x {{item.account.balance}}</span> </view>
</view>
</view>
</view>
@@ -33,7 +33,11 @@
};
},
props:{
item:Object
item : Object,
isTop : {
type: Boolean,
default: true
}
},
onShow() {
console.log(this.item,'onshow,numtempa')
@@ -42,7 +46,7 @@
// 跳转到商品详情页面
goDetail(id) {
uni.navigateTo({
url: '/pages/goods/detail?id='+id
url: '/pages/goods/details?id='+id
})
},
// 复制
@@ -113,13 +117,11 @@
justify-content: flex-start;
box-sizing: border-box;
margin-top: 36rpx;
.goods-img {
width: 120rpx;
height: 120rpx;
border-radius: 10rpx;
}
.goods {
flex: 1;
margin-left: 20rpx;

View File

@@ -0,0 +1,129 @@
<template>
<view>
<block v-if="list.length > 0">
<view class="record--item" v-for="(item, index) in list" :key="index" v-if="item && !hash">
<view class="title ellipsis-1">{{item.rule.title}} <span> {{item.coin?' ('+item.coin+'个能量球) ':''}} </span></view>
<view class="time ellipsis-1">{{item.created_at || '-'}}</view>
<view class="webkit-box variation">
<view class="ellipsis" :class="item.amount<0 ? 'add': 'remove'">{{item.amount}}</view>
<view class="symbol">{{item.amount>0?'现金红包收入':'现金红包支出'}}</view>
</view>
</view>
<view class="record--item record--item1" v-for="(item, index) in list" :key="index" v-if="item && hash">
<view class="title ellipsis-1">{{item.hash}}</view>
<view class="time ellipsis-1">{{item.block_time || '-'}}</view>
<view class="webkit-box variation">
<view class="ellipsis" :class="item.is_in ? 'add': 'remove'">
{{item.is_in ? '+': '-'}}{{item.amount}}</view>
<view class="symbol">{{item.assets.symbol}}</view>
</view>
</view>
</block>
<block v-else>
<no-list v-if='logsType === ""' name='no-record' txt="没有任何记录~" />
<no-list v-if='logsType === "in"' name='no-in' txt="没有任何收入记录~" />
<no-list v-if='logsType === "out"' name='no-out' txt="没有任何支出记录~" />
</block>
</view>
</template>
<script>
export default {
name: "property",
props: {
list: {
type: Array,
default: () => {
return []
}
},
logsType: {
type: String
},
hash: {
type: Boolean
}
},
data() {
return {
};
}
}
</script>
<style lang="scss" scoped>
.record--item1 {
padding: $padding 330rpx $padding 0 !important;
}
.record--item {
padding: $padding 220rpx $padding 0;
border-bottom: solid 1rpx #f7f7f7;
position: relative;
min-height: 50rpx;
.variation {
position: absolute;
right: 0;
top: $margin;
bottom: $margin;
width: 300rpx;
text-align: right;
font-weight: bold;
&>label {
font-size: 80%;
}
.symbol {
color: #666;
font-weight: normal;
font-size: $title-size-m;
}
.add {
color: $mian-color;
font-size: 36rpx;
}
.remove {
font-size: 36rpx;
color: $mian-color;
}
}
.title {
line-height: 50rpx;
font-size: 30rpx;
word-break: break-word;
span{
font-size: 24rpx;
color: #999;
}
}
.time {
font-size: 26rpx;
color: #999;
padding-top: 6rpx;
}
}
// 数据空
.record--null {
padding-top: $padding * 3;
text-align: center;
color: $mian-color;
font-size: $title-size;
height: 50vh;
box-sizing: border-box;
line-height: 60rpx;
image {
width: 168rpx;
}
}
</style>

View File

@@ -27,10 +27,16 @@
</view>
<view class="member-cont">
<view class="member-tips">
<view class="member-tips-title">会员升级/续费</view>
<view class="member-tips-time">有效期2022年10月1日</view>
<view class="member-tips-title" v-if="wordData.grade == 1">会员升级/续费</view>
<view class="member-tips-title" v-else-if="wordData.grade == 2">续费</view>
<view class="member-tips-title" v-else>企业会员</view>
<view class="member-tips-time nowrap">有效期{{wordData.identity}}</view>
</view>
<view class="member-btn" @click="$Router.push({name: 'Vip'})">
<view class="member-btn" v-if="wordData.grade == 3">
<image class="member-btn-icon" src="../../static/icons/store_icon_vip.png" mode="aspectFill"></image>
<view class="member-btn-name">已满级</view>
</view>
<view class="member-btn" @click="$Router.push({name: 'Vip'})" v-else>
<image class="member-btn-icon" src="../../static/icons/store_icon_vip.png" mode="aspectFill"></image>
<view class="member-btn-name">去升级</view>
</view>
@@ -58,19 +64,19 @@
<view class="text">转让权证</view>
</view> -->
<view class="general-item">
<view class="number">{{wordData.top.barter_total || 0}}</view>
<view class="text">收益</view>
<view class="number">{{wordData.top.order_total.toFixed(2) || 0}}</view>
<view class="text">交易</view>
</view>
<view class="general-item" @click="$Router.push({name: 'GoodsMag'})">
<view class="number">{{wordData.middle.sale || 0}}</view>
<view class="text">在售权证</view>
</view>
<view class="general-item">
<view class="number">{{wordData.top.barter_total || 0}}</view>
<view class="general-item" @click="$Router.push({name: 'Return'})">
<view class="number">{{wordData.order.refund || 0}}</view>
<view class="text">退货单处理</view>
</view>
<view class="general-item">
<view class="number">{{wordData.top.barter_total || 0}}</view>
<view class="general-item" @click="$Router.push({name: 'Deliver'})">
<view class="number">{{wordData.order.deliver|| 0}}</view>
<view class="text">发货单处理</view>
</view>
</view>
@@ -117,7 +123,7 @@
<image class="icon" src="@/static/icons/tool_icon_02.png" mode="aspectFill"></image>
<view class="title">优惠券管理</view>
</view>
<view class="store-item" @click="$Router.push({name: 'Collection'})">
<view class="store-item">
<image class="icon" src="@/static/icons/tool_icon_03.png" mode="aspectFill"></image>
<view class="title">收款管理</view>
</view>
@@ -132,7 +138,7 @@
<image class="icon" src="@/static/icons/tool_icon_05.png" mode="aspectFill"></image>
<view class="title">智能名片</view>
</view> -->
<view class="store-item">
<view class="store-item" @click="$Router.push({name: 'Spread'})">
<image class="icon" src="@/static/icons/tool_icon_06.png" mode="aspectFill"></image>
<view class="title">营销推广码</view>
</view>
@@ -162,7 +168,16 @@
order : {}
}
}
}
},
identityData:{
type: Object,
default: () => {
return {
time : {},
grade : {}
}
}
}
}
}
</script>

View File

@@ -0,0 +1,269 @@
<template>
<view>
<view class="OrderInfo">
<!-- 订单状态 -->
<view class="order-status">
<block v-if="listType == 'deliver'">
<view class="info">
{{info.state_text}}
</view>
</block>
<block v-else>
<view class="info" v-if="info.state">
{{info.state.text}}
<span>{{info.state.remark}}</span>
</view>
</block>
<image src="../../static/icons/fire.png" mode="widthFix"></image>
</view>
<!-- 订单信息 -->
<view class="goods-info1">
<view class="top">
<view class="company">
<view class="company-logo" v-if="info.shop">
<image :src="info.shop.cover" mode="aspectFill" />
<view class="name nowrap">{{info.shop.name}}</view>
</view>
<view class="flexrow">
<view class="no nowrap" v-if="listType == 'deliver'">发货单号 {{info.shipment_no}}</view>
<view class="no nowrap" v-else>退货单号 {{info.refund_no}}</view>
</view>
</view>
</view>
<view class="goods-info">
<image class="goods-img" v-if="info.goods_sku" :src="info.goods_sku.cover" mode="aspectFill" />
<view class="goods" v-if="info.goods_sku">
<view class="nowrap name">{{info.goods_sku.goods_name}}</view>
<view class="sku">数权个数 <span>x {{info.qty}}</span> </view>
</view>
</view>
</view>
<view class="goods-info1" >
<view class="goods-type">创建{{listType == 'deliver'?'发货':'退货'}}时间 <span>{{info.created_at}}</span></view>
<view class="goods-type">运费 <span>自行承担运费</span></view>
<view class="goods-type">{{listType === 'deliver'?'发货':'退货'}}数量 <span>{{info.qty}}</span></view>
</view>
<view class="goods-info1" v-if="listType === 'deliver' && info.express">
<view class="goods-type" v-if="info.express">收件人姓名 <span>{{info.express.name || '--'}}</span></view>
<view class="goods-type" v-if="info.express" @click="call(info.express.mobile)">收件人电话 <span>{{info.express.mobile || '--'}}</span></view>
<view class="goods-type" v-if="info.express">收货地址 <span>{{info.express.full_address || '--'}}</span></view>
<view class="goods-type" v-if="info.express">发货快递 <span>{{info.express.express_name || '--'}}</span></view>
<view class="goods-type" v-if="info.express">快递单号 <span>{{info.express.express_no || '--'}}</span></view>
</view>
<view class="goods-info1" v-else>
<view class="goods-type" v-if="info.express">退货单快递<span>{{info.express.company || '--'}}</span></view>
<view class="goods-type" v-if="info.express">退货快递单号 <span>{{info.express.number || '--'}}</span></view>
</view>
<!-- 操作相关 -->
<view class="actions">
<view class="nowPay" @click="orderRun">返回列表</view>
<view v-if="listType != 'deliver'" @click="$Router.push({name: 'storeJournal', params: {id: info.refund_id}})" class="nowPay">查看退货日志</view>
</view>
</view>
</view>
</template>
<script>
export default {
name:"storeOrderDet",
props:{
// 数据列表
info : {},
listType: ''
},
created() {
},
methods: {
// 返回上一页
orderRun() {
uni.navigateBack({
delta: 1
})
},
call(number){
uni.makePhoneCall({
phoneNumber:number
})
}
}
}
</script>
<style lang="scss" scoped>
.OrderInfo {
width: 100%;
min-height: 100vh;
box-sizing: border-box;
background-color: #F7F7F7;
padding-bottom: 80rpx;
}
.order-status {
width: 100%;
height: 300rpx;
background-image: linear-gradient(to bottom, $main-color, $main-color-light);
color: #Fff;
font-size: 36rpx;
padding: 30rpx 50rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
.info {
font-size: 36rpx;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
box-sizing: border-box;
span {
font-size: 28rpx;
padding-top: 30rpx;
}
}
image {
width: 200rpx;
}
}
// 订单信息
.goods-info1 {
padding: 20rpx 40rpx;
background-color: #fff;
margin-bottom: $margin;
.top {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 30rpx 0;
border-bottom: solid 1rpx #EFF4F2;
.company-logo {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
image {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
margin-right: 20rpx;
}
.name {
width: 600rpx;
font-size: 30rpx;
color: #484848;
font-weight: bold;
}
.no {
margin-top: 30rpx !important;
font-size: $title-size*0.8;
color: #999;
}
}
}
.goods-info {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
box-sizing: border-box;
margin-top: 40rpx;
.goods-img {
width: 120rpx;
height: 120rpx;
border-radius: 10rpx;
}
.goods {
width: calc(100% - 120rpx);
padding: 0 20rpx;
box-sizing: border-box;
.sku {
flex: 1;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
margin-top: 20rpx;
font-size: 28rpx;
color: #999;
}
}
}
.goods-type {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 30rpx 0;
border-bottom: solid 1rpx #f7f7f7;
}
}
// 操作按钮
.actions {
position: fixed;
bottom: 0;
left: 0;
right: 0;
border-top: solid 1rpx #f2f2f2;
padding-top: 18rpx;
padding-right: 30rpx;
padding-left: 30rpx;
height: 110rpx;
background: white;
display: flex;
flex-wrap: wrap;
flex-direction: row-reverse;
.nowPay {
margin-left: 20rpx;
height: 54rpx;
line-height: 50rpx;
box-sizing: border-box;
border: solid 1rpx #747788;
padding: 0 20rpx;
font-size: 26rpx;
border-radius: 40rpx;
margin-top: 10rpx;
&.actions-color {
color: #e1293f;
border-color: #ec96a0;
}
}
.cancelOrder {
padding: 10rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
background-color: #DD524D;
}
.logistics {
background-color: $main-color;
padding: 10rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
}
.sign {
background-color: #DD524D;
padding: 10rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
}
.evaluate {
background-color: $main-color;
padding: 10rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
}
}
</style>

View File

@@ -0,0 +1,288 @@
<template>
<view class="returnCont">
<block v-if="list.length > 0">
<view class="returnList" v-for="(item, index) in list" :key="index">
<view class="MallRefundsTemplate">
<view class="top">
<view class="company">
<view class="company-logo" v-if="item.shop">
<image :src="item.shop.cover" mode="aspectFill" />
<view class="company-name nowrap">{{item.shop.name}}</view>
</view>
<view class="no nowrap" v-if="listType == 'deliver'">退货单号 {{item.shipment_no}}</view>
<view class="no nowrap" v-else>退货单号 {{item.refund_no}}</view>
</view>
<view class="status" style="color:#ff5500;" v-if="listType == 'deliver'">{{item.state_text}}
</view>
<view class="status" style="color:#ff5500;" v-else>{{item.state.text}}</view>
</view>
<view class="goods-info" @click="goDetail(item.goods_sku.goods_id)" v-if="item.goods_sku">
<image class="goods-img" :src="item.goods_sku.cover" mode="aspectFill" />
<view class="goods">
<view class="name nowrap">{{item.goods_sku.goods_name}}</view>
<view class="sku">数权个数 <span>x {{item.qty}}</span> </view>
</view>
</view>
</view>
<view class="actions">
<view v-if="item.can">
<view v-if="item.can.audit"
@click="$Router.push({name: 'Examine', params: {id: item.refund_id}})"
class="nowPay actions-color">订单审核</view>
<view v-if="item.can.sign" @click="goSigns(item.refund_id, index)" class="nowPay actions-color">
订单签收</view>
<view v-if="item.can.reToken" @click="goReTokens(item.refund_id, index)"
class="nowPay actions-color">确认退货</view>
<view v-if="item.can.logistic"
@click="$Router.push({name: 'Logistic', params: {id: item.shipment_no}})"
class="nowPay actions-color">查看物流</view>
<view v-if="item.can.deliver"
@click="$Router.push({name: 'DeliverForm', params: {id: item.shipment_no}})"
class="nowPay actions-color">我要发货</view>
</view>
<view v-if="listType == 'deliver'" class="nowPay"
@click="$Router.push({name: 'storeOrderDetails', params: {id: item.shipment_no, type: listType}})">
查看详情</view>
<view v-else class="nowPay"
@click="$Router.push({name: 'storeOrderDetails', params: {id: item.refund_id, type: 'return'}})">
查看详情</view>
</view>
</view>
</block>
<view v-else class="pack-center">
<image src="/static/icons/order-null.png"></image>
<view>{{toast}}</view>
</view>
</view>
</template>
<script>
export default {
name: "goodsList",
props: {
// 数据列表
list: {
type: Array,
default: () => {
return new Array
}
},
listType: '',
// 列表空提示
toast: {
type: String,
default: '暂无订单数据 -_-!'
},
},
created() {},
methods: {
goSigns(id,index) {
this.$emit('goSign',{id:id,index:index});
},
goReTokens(id,index){
this.$emit('goReToken',{id:id,index:index});
}
}
}
</script>
<style lang="scss" scoped>
// 列表
.returnList {
background-color: #FFFFFF;
padding: $padding;
box-sizing: border-box;
margin-top: $margin;
}
.MallRefundsTemplate {
position: relative;
z-index: 0;
}
// 顶部信息
.top {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding-bottom: 20rpx;
border-bottom: solid 1rpx #f7f7f7;
position: relative;
z-index: 0;
.company-logo {
display: flex;
width: 90%;
image {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
margin-right: 20rpx;
}
.company-name {
font-size: 30rpx;
color: #484848;
font-weight: bold;
width: calc(100% - 40rpx);
padding: 0 20rpx;
box-sizing: border-box;
}
}
.no {
margin-top: 10rpx;
font-size: $title-size*0.8;
color: #999;
}
.status {
color: #999;
font-size: $title-size*.9;
position: absolute;
top: 0;
right: 0;
}
}
// 商品信息
.goods-info {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
box-sizing: border-box;
margin-top: 36rpx;
.goods-img {
width: 120rpx;
height: 120rpx;
border-radius: 10rpx;
}
.goods {
flex: 1;
width: calc(100% - 120rpx);
padding: 0 20rpx;
box-sizing: border-box;
margin-bottom: 10rpx;
.name {
width: 100%;
font-size: 30rpx;
span {
font-size: 32rpx;
font-weight: normal;
}
}
.sku {
flex: 1;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
margin-top: 10rpx;
font-size: 28rpx;
color: #999;
}
}
}
.flexrow {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
width: 100%;
.copy {
color: $main-color;
font-size: $title-size*0.8;
font-weight: 400;
padding: 0 30rpx;
}
}
// 操作按钮
.actions {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
box-sizing: border-box;
flex-wrap: wrap;
flex: 1;
font-size: 28rpx;
color: #fff;
border-top: solid 1rpx #EFF4F2;
margin-top: $margin;
.nowPay {
padding: 4rpx 20rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
color: #999;
border: solid 1rpx #cacaca;
&.actions-color {
color: #e1293f;
border-color: #ec96a0;
}
}
.cancelOrder {
padding: 10rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
background-color: #DD524D;
}
.logistics {
background-color: $main-color;
padding: 10rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
}
.sign {
background-color: #DD524D;
padding: 10rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
}
.evaluate {
background-color: $main-color;
padding: 10rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
}
}
// 暂无订单
.pack-center {
text-align: center;
font-size: $title-size-sm;
color: $text-gray;
padding-top: 50%;
image {
width: $uni-img-size-lg * 2;
height: $uni-img-size-lg * 2;
border-radius: $uni-border-radius-circle;
margin-bottom: $margin;
}
}
</style>

View File

@@ -1,25 +1,62 @@
<template>
<view class="staff">
员工啦
<!-- 员工权限工具 -->
<!-- <view class="tool-flex store">
<view class="store-item" @click="$Router.push({name: 'Verification'})">
<image class="icon" src="@/static/icons/tool_icon_00.png" mode="aspectFill"></image>
<view class="title">扫码验证</view>
</view>
<view class="store-item" @click="$Router.push({name: 'GoodsMag'})">
<image class="icon" src="@/static/icons/tool_icon_01.png" mode="aspectFill"></image>
<view class="title">商品权证</view>
</view>
<view class="store-item" @click="$Router.push({name: 'CouponsMag'})">
<image class="icon" src="@/static/icons/tool_icon_02.png" mode="aspectFill"></image>
<view class="title">优惠券管理</view>
</view>
<view class="store-item" @click="$Router.push({name: 'Collection'})">
<image class="icon" src="@/static/icons/tool_icon_03.png" mode="aspectFill"></image>
<view class="title">收款管理</view>
</view>
</view> -->
<!-- 员工权限工具 -->
<view class="tool-flex store">
<!-- manage-scan -->
<view class="store-item" @click="$Router.push({name: 'Verification'})" v-if="toolList.manageScan">
<image class="icon" src="@/static/icons/tool_icon_00.png" mode="aspectFill"></image>
<view class="title">扫码核销</view>
<image class="arrow" src="@/static/icons/equity_arrow_right.png" mode="aspectFill"></image>
</view>
<!-- manage-goods -->
<view class="store-item" @click="$Router.push({name: 'GoodsMag'})" v-if="toolList.manageGoods">
<image class="icon" src="@/static/icons/tool_icon_01.png" mode="aspectFill"></image>
<view class="title">商品权证</view>
<image class="arrow" src="@/static/icons/equity_arrow_right.png" mode="aspectFill"></image>
</view>
<!-- manage-employee -->
<view class="store-item" @click="$Router.push({name: 'Employees'})" v-if="toolList.manageEmployee">
<image class="icon" src="@/static/icons/tool_icon_08.png" mode="aspectFill"></image>
<view class="title">员工管理</view>
<image class="arrow" src="@/static/icons/equity_arrow_right.png" mode="aspectFill"></image>
</view>
<!-- order-refund -->
<view class="store-item" @click="$Router.push({name: 'Return'})" v-if="toolList.orderRefund">
<image class="icon" src="@/static/icons/tool_icon_07.png" mode="aspectFill"></image>
<view class="title">退换货管理</view>
<image class="arrow" src="@/static/icons/equity_arrow_right.png" mode="aspectFill"></image>
</view>
<!-- order-shipment -->
<view class="store-item" @click="$Router.push({name: 'Deliver'})" v-if="toolList.orderShipment">
<image class="icon" src="@/static/icons/tool_icon_04.png" mode="aspectFill"></image>
<view class="title">发货单管理</view>
<image class="arrow" src="@/static/icons/equity_arrow_right.png" mode="aspectFill"></image>
</view>
<!-- manageStore -->
<view class="store-item" @click="$Router.push({name: 'shopLists'})" v-if="toolList.manageStore">
<image class="icon" src="@/static/icons/tool_icon_07.png" mode="aspectFill"></image>
<view class="title">部门/门店</view>
<image class="arrow" src="@/static/icons/equity_arrow_right.png" mode="aspectFill"></image>
</view>
<!-- manage-coupons -->
<view class="store-item" @click="$Router.push({name: 'CouponsMag'})" v-if="toolList.manageCoupons">
<image class="icon" src="@/static/icons/tool_icon_02.png" mode="aspectFill"></image>
<view class="title">优惠券管理</view>
<image class="arrow" src="@/static/icons/equity_arrow_right.png" mode="aspectFill"></image>
</view>
<view class="store-item" @click="$Router.push({name: 'Spread'})">
<image class="icon" src="@/static/icons/tool_icon_06.png" mode="aspectFill"></image>
<view class="title">营销推广码</view>
<image class="arrow" src="@/static/icons/equity_arrow_right.png" mode="aspectFill"></image>
</view>
</view>
</view>
</template>
@@ -27,46 +64,12 @@
export default {
name:"store-staff",
props:{
// 店铺统计
top: {
type: Object,
default: ()=> {
return {
barter_total: 0,
trading_day : 0,
eb_in : 0,
cash_in : 0
}
}
},
// 店铺概况
middle: {
type: Object,
default: ()=> {
return {
visitors : 0,
clinch : 0,
employees: 0,
sale : 0,
hold : 0,
transfer : 0
}
}
},
// 店铺订单
order: {
type: Object,
default: ()=> {
return {
not_shipped : 0,
already_shipped : 0,
not_pick : 0,
already_pick : 0,
after_sale : 0
}
}
}
}
// 员工数据
toolList: {},
},
created() {
// console.log(this.$props.toolList)
}
}
</script>
@@ -76,7 +79,7 @@
.statistical{
display: flex;
background: $text-price;
padding: $padding ($padding/2) $padding*5;
padding: $padding ($padding/2) $padding*2;
flex-wrap: wrap;
justify-content: space-between;
.item{
@@ -95,15 +98,15 @@
}
// 店铺概况
.general{
margin: -$margin*4 $margin 0 $margin;
margin: -$margin*2 $margin 0 $margin;
.general-box{
background-color: white;
border-radius: $radius/2;
display: flex;
padding: $padding $padding/2;
padding: $padding - 20 $padding/2;
flex-wrap: wrap;
.general-item{
width: 33.33%;
width: 50%;
text-align: center;
padding: $padding/2;
box-sizing: border-box;
@@ -122,27 +125,34 @@
}
// 店铺工具
.tool-flex{
background: white;
border-radius: $radius/2;
padding: $padding/2;
margin: $margin;
display: flex;
flex-wrap: wrap;
margin: $margin*2 $margin $margin;
.store-item{
padding: $padding/2;
text-align: center;
width: 25%;
background: white;
border-radius: $radius/2;
padding: $padding/2;
box-sizing: border-box;
margin-bottom: $margin;
display: flex;
position: relative;
.icon{
width: 68rpx;
height: 68rpx;
width: 54rpx;
height: 54rpx;
margin-right: $margin - 15;
vertical-align: top;
}
.title{
font-size: $title-size-sm;
line-height: 58rpx;
font-size: $title-size-m;
color: $text-gray;
padding-top: $padding/3;
}
.arrow {
width: 38rpx;
height: 38rpx;
filter: brightness(.9);
position: absolute;
right: $padding - 20;
top: $padding - 6;
}
}
.order-item{
position: relative;

182
components/v-tabs/readme.md Normal file
View File

@@ -0,0 +1,182 @@
## 插件说明
> 这是 `v-tabs` 插件的升级版本,参数上有很大变动,支持 `H5` `小程序` `手机端`,如果是在之前的插件上升级的话,请注意参数的变更,触发的事件没有变更。
## 使用说明
### 1、最基本用法
- 视图文件
```html
<v-tabs v-model="current" :tabs="tabs" @change="changeTab"></v-tabs>
```
- 脚本文件
```js
export default {
data() {
return {
current: 0,
tabs: ['军事', '国内', '新闻新闻', '军事', '国内', '新闻', '军事', '国内', '新闻']
}
},
methods: {
changeTab(index) {
console.log('当前选中的项:' + index)
}
}
}
```
### 2、平铺整个屏幕
- 视图文件
```html
<v-tabs v-model="activeTab" :scroll="false" :tabs="['全部', '进行中', '已完成']"></v-tabs>
```
- 脚本文件
```js
export default {
data() {
return {
activeTab: 0
}
}
}
```
### 3、胶囊用法
- 视图文件
```html
<v-tabs v-model="current" :tabs="tabs" :pills="true" line-height="0" activeColor="#fff" @change="changeTab"></v-tabs>
```
- 脚本文件
```js
data() {
return {
current: 2,
tabs: [
'军事',
'国内',
'新闻新闻',
'军事',
'国内',
'新闻',
'军事',
'国内',
'新闻',
],
},
methods: {
changeTab(index) {
console.log('当前选中索引:' + index)
}
}
}
```
## 文档说明
### 1、属性说明
| 参数 | 类型 | 默认值 | 说明 |
| :---------------: | :-----: | :-------: | :----------------------------------------: |
| value | Number | 0 | 必传(双向绑定的值) |
| color | String | '#333' | 默认文字颜色 |
| activeColor | String | '#2979ff' | 选中文字的颜色 |
| fontSize | String | '28rpx' | 默认文字大小(rpx 或 px) |
| bold | Boolean | true | 是否加粗选中项 |
| scroll | Boolean | true | 是否显示滚动条,平铺设置 false |
| height | String | '70rpx' | tab 高度(rpx 或 px) |
| lineHeight | String | '10rpx' | 滑块高度(rpx 或 px) |
| lineColor | String | '#2979ff' | 滑块的颜色 |
| lineScale | Number | 0.5 | 滑块宽度缩放值 |
| lineRadius | String | '10rpx' | 滑块圆角宽度(rpx 或 px) |
| pills | Boolean | false | 是否开启胶囊 |
| pillsColor | String | '#2979ff' | 胶囊背景颜色(rpx 或 px) |
| pillsBorderRadius | String | '10rpx' | 胶囊圆角宽度(rpx 或 px) |
| field | String | '' | 如果 tabs 子项是对象,输入需要展示的键名 |
| bgColor | String | '#fff' | 背景色,支持 linear-gradient 渐变 |
| padding | String | '0' | 整个 tab padding 属性 |
| fixed | Boolean | false | 是否固定在顶部 |
| paddingItem | String | '0 22rpx' | 选项的边距(设置上下不生效,需要设置高度) |
### 2、事件说明
| 名称 | 参数 | 说明 |
| :----: | :---: | :--------------------------------: |
| change | index | 改变选中项触发, index 选中项的下标 |
## 更新日志
### 2020-09-24
1. 修复 `v-tabs` 第一次可能出现第一个标签显示不完整的情况
2. 修改了 `pages/tabs/order` 示例文件
### 2020-09-21
1. 修复添加 `fixed` 属性后,滚动条无效
2. 修复选项很少的情况下,下划线计算计算错误
3. 新增 `paddingItem` 属性,设置选项左右边距(上下边距需要设置 `height` 属性,或者设置 `padding` 属性)
**写在最后:**
欢迎各位老铁反馈 bug ,本人后端 PHP 一枚,只是应为感兴趣前端,自己琢磨,自己搞。如果你在使用的过程中有什么不合理,需要优化的,都可以在下面评论(或加我 QQ: 1207791534本人看见后回复、修正感谢。
### 2020-09-17
1. 紧急修复 bug横向滑动不了的情况
### 2020-09-16
1. 新增 `fixed` 属性,是否固定在顶部,示例地址:`pages/tabs/tabs-static`
2. 优化之前的页面结构
**注意:**
1. 使用 `padding` 属性的时候,尽量不要左右边距,会导致下划线位置不对
2. 如果不绑定 `v-model` 会导致 `change` 事件改变的时候,下划线不跟随问题
### 2020-09-09
1. 修复 `width` 错误dom 加载的时候没有及时获取到 `data` 属性导致的。
### 2020-08-29
1. 优化异步改变 `tabs` 后,下划线不初始化问题
2. `github` 地址上有图 2 的源码,需要的自行下载,页面路径:`pages/tabs/order`
### 2020-08-20
1. 优化 `节点查询``选中渲染`
2. 优化支付宝中 `createSelectorQuery()` 的影响
### 2020-08-19
1. 优化 `change` 事件触发机制
### 2020-08-16
1. 修改默认高度为 `70rpx`
2. 新增属性 `bgColor`,可设置背景颜色,默认 `#fff`
3. 新增整个 `tab``padding` 属性,默认 `0`
### 2020-08-13
1. 全新的 `v-tabs 2.0`
2. 支持 `H5` `小程序` `APP`
3. 属性高度可配置
## 预览
![v-tabs 2.0.1.gif](https://tva1.sinaimg.cn/large/007S8ZIlgy1ghsv40mj76g30ai0i2tsd.gif)
![v-tabs 2.0.2.gif](https://img-cdn-aliyun.dcloud.net.cn/stream/plugin_screens/42f3a920-a674-11ea-8a24-ffee00625e2e_1.png?v=1597912963)

View File

@@ -0,0 +1,337 @@
<template>
<view :id="elId" class="v-tabs">
<scroll-view
id="scrollContainer"
:scroll-x="scroll"
:scroll-left="scroll ? scrollLeft : 0"
:scroll-with-animation="scroll"
:style="{ position: fixed ? 'fixed' : 'relative', zIndex: 99 }"
>
<view
class="v-tabs__container"
:style="{
display: scroll ? 'inline-flex' : 'flex',
whiteSpace: scroll ? 'nowrap' : 'normal',
background: bgColor,
height,
padding
}"
>
<view
class="v-tabs__container-item"
v-for="(v, i) in tabs"
:key="i"
:style="{
color: current == i ? activeColor : color,
fontSize: current == i ? fontSize : fontSize,
fontWeight: bold && current == i ? 'bold' : '',
justifyContent: !scroll ? 'center' : '',
flex: scroll ? '' : 1,
padding: paddingItem
}"
@click="change(i)"
>
{{ field ? v[field] : v.title }}
</view>
<view
v-if="!pills"
class="v-tabs__container-line"
:style="{
background: lineColor,
width: lineWidth + 'px',
height: lineHeight,
borderRadius: lineRadius,
left: lineLeft + 'px',
transform: `translateX(-${lineWidth / 2}px)`
}"
></view>
<view
v-else
class="v-tabs__container-pills"
:style="{
background: pillsColor,
borderRadius: pillsBorderRadius,
left: pillsLeft + 'px',
width: currentWidth + 'px',
height
}"
></view>
</view>
</scroll-view>
<view
class="v-tabs__placeholder"
:style="{
height: fixed ? height : '0',
padding
}"
></view>
</view>
</template>
<script>
/**
* v-tabs
* @property {Number} value 选中的下标
* @property {Array} tabs tabs 列表
* @property {String} bgColor = '#fff' 背景颜色
* @property {String} color = '#333' 默认颜色
* @property {String} activeColor = '#2979ff' 选中文字颜色
* @property {String} fontSize = '28rpx' 默认文字大小
* @property {String} activeFontSize = '28rpx' 选中文字大小
* @property {Boolean} bold = [true | false] 选中文字是否加粗
* @property {Boolean} scroll = [true | false] 是否滚动
* @property {String} height = '60rpx' tab 的高度
* @property {String} lineHeight = '10rpx' 下划线的高度
* @property {String} lineColor = '#2979ff' 下划线的颜色
* @property {Number} lineScale = 0.5 下划线的宽度缩放比例
* @property {String} lineRadius = '10rpx' 下划线圆角
* @property {Boolean} pills = [true | false] 是否胶囊样式
* @property {String} pillsColor = '#2979ff' 胶囊背景色
* @property {String} pillsBorderRadius = '10rpx' 胶囊圆角大小
* @property {String} field 如果是对象,显示的键名
* @property {Boolean} fixed = [true | false] 是否固定
* @property {String} paddingItem = '0 22rpx' 选项的边距
*
* @event {Function(current)} change 改变标签触发
*/
export default {
props: {
value: {
type: Number,
default: 0
},
tabs: {
type: Array,
default() {
return []
}
},
bgColor: {
type: String,
default: '#fff'
},
padding: {
type: String,
default: '0'
},
color: {
type: String,
default: '#333'
},
activeColor: {
type: String,
default: '#2979ff'
},
fontSize: {
type: String,
default: '28rpx'
},
activeFontSize: {
type: String,
default: '32rpx'
},
bold: {
type: Boolean,
default: true
},
scroll: {
type: Boolean,
default: true
},
height: {
type: String,
default: '70rpx'
},
lineColor: {
type: String,
default: '#2979ff'
},
lineHeight: {
type: String,
default: '10rpx'
},
lineScale: {
type: Number,
default: 0.5
},
lineRadius: {
type: String,
default: '10rpx'
},
pills: {
type: Boolean,
deafult: false
},
pillsColor: {
type: String,
default: '#2979ff'
},
pillsBorderRadius: {
type: String,
default: '10rpx'
},
field: {
type: String,
default: ''
},
fixed: {
type: Boolean,
default: false
},
paddingItem: {
type: String,
default: '0 22rpx'
}
},
data() {
return {
elId: '',
lineWidth: 30,
currentWidth: 0, // 当前选项的宽度
lineLeft: 0, // 滑块距离左侧的位置
pillsLeft: 0, // 胶囊距离左侧的位置
scrollLeft: 0, // 距离左边的位置
containerWidth: 0, // 容器的宽度
current: 0 // 当前选中项
}
},
watch: {
value(newVal) {
this.current = newVal
this.$nextTick(() => {
this.getTabItemWidth()
})
},
current(newVal) {
this.$emit('input', newVal)
},
tabs(newVal) {
this.$nextTick(() => {
this.getTabItemWidth()
})
}
},
methods: {
// 产生随机字符串
randomString(len) {
len = len || 32
let $chars =
'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678' /****默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/
let maxPos = $chars.length
let pwd = ''
for (let i = 0; i < len; i++) {
pwd += $chars.charAt(Math.floor(Math.random() * maxPos))
}
return pwd
},
// 切换事件
change(index) {
if (this.current !== index) {
this.current = index
this.$emit('change', index)
}
},
// 获取左移动位置
getTabItemWidth() {
let query = uni
.createSelectorQuery()
// #ifndef MP-ALIPAY
.in(this)
// #endif
// 获取容器的宽度
query
.select(`#scrollContainer`)
.boundingClientRect((data) => {
if (!this.containerWidth && data) {
this.containerWidth = data.width
}
})
.exec()
// 获取所有的 tab-item 的宽度
query
.selectAll('.v-tabs__container-item')
.boundingClientRect((data) => {
if (!data) {
return
}
let lineLeft = 0
let currentWidth = 0
if (data) {
for (let i = 0; i < data.length; i++) {
if (i < this.current) {
lineLeft += data[i].width
} else if (i == this.current) {
currentWidth = data[i].width
} else {
break
}
}
}
// 当前滑块的宽度
this.currentWidth = currentWidth
// 缩放后的滑块宽度
this.lineWidth = currentWidth * this.lineScale * 1
// 滑块作移动的位置
this.lineLeft = lineLeft + currentWidth / 2
// 胶囊距离左侧的位置
this.pillsLeft = lineLeft
// 计算滚动的距离左侧的位置
if (this.scroll) {
this.scrollLeft = this.lineLeft - this.containerWidth / 2
}
})
.exec()
}
},
mounted() {
this.elId = 'xfjpeter_' + this.randomString()
this.current = this.value
this.$nextTick(() => {
this.getTabItemWidth()
})
}
}
</script>
<style lang="scss" scoped>
.v-tabs {
width: 100%;
box-sizing: border-box;
overflow: hidden;
::-webkit-scrollbar {
display: none;
}
&__container {
min-width: 100%;
position: relative;
display: inline-flex;
align-items: center;
white-space: nowrap;
overflow: hidden;
&-item {
display: flex;
align-items: center;
height: 100%;
position: relative;
z-index: 10;
// padding: 0 11px;
transition: all 0.3s;
white-space: nowrap;
}
&-line {
position: absolute;
bottom: 0;
transition: all 0.3s linear;
}
&-pills {
position: absolute;
transition: all 0.3s linear;
z-index: 9;
}
}
}
</style>

View File

@@ -0,0 +1,218 @@
<script>
import Painter from './painter'
import { equal } from './util'
export default {
name: 'VueCanvasPoster',
props: {
painting: {
type: Object,
default: function() {
return {}
}
},
dirty: {
type: Boolean,
default: false
},
widthPixels: {
type: Number,
default: 750
}
},
watch: {
painting: {
handler(newVal, oldVal) {
if (this.isNeedRefresh(newVal, oldVal)) {
this.paintCount = 0
this.startPaint()
}
},
deep: true,
immediate: true
}
},
data() {
return {
paintCount: 0,
painterStyle: '',
canvasWidthInPx: 375,
canvasHeightInPx: 375,
width: 100,
height: 100,
canvas: null,
ctx: null
}
},
render(h) {
return h('div', [
h('canvas', {
ref: 'canvas',
class: 'canvas',
style: this.painterStyle
})
])
},
mounted() {
this.$nextTick(() => {
this.canvas = this.$refs.canvas // 指定canvas
this.ctx = this.canvas.getContext('2d') //设置2D渲染区域
})
},
methods: {
/**
* 判断一个 object 是否为 空
* @param {object} object
*/
isEmpty(object) {
for (const i in object) {
return false
}
return true
},
isNeedRefresh(newVal, oldVal) {
if (!newVal || this.isEmpty(newVal) || (this.dirty && equal(newVal, oldVal))) {
return false
}
return true
},
// 开始绘画
startPaint() {
if (this.isEmpty(this.painting)) {
return
}
setStringPrototype(1)
// 下载图片
this.downloadImages()
.then(res => {
const { width, height } = res
if (!width || !height) {
console.error(`You should set width and height correctly for painter, width: ${width}, height: ${height}`)
return
}
this.canvasWidthInPx = width.toPx()
if (this.widthPixels) {
// 重设宽度,高度
setStringPrototype(this.widthPixels / this.canvasWidthInPx)
this.canvasWidthInPx = this.widthPixels
}
this.canvasHeightInPx = height.toPx()
this.painterStyle = `width:${this.canvasWidthInPx}px;height:${this.canvasHeightInPx}px;`
this.canvas = this.$refs.canvas // 指定canvas
this.canvas.width = this.canvasWidthInPx
this.canvas.height = this.canvasHeightInPx
const ctx = this.canvas.getContext('2d') //设置2D渲染区域
const pen = new Painter(ctx, res)
pen.paint(() => {
var imageBase64 = this.canvas.toDataURL('image/png')
this.$emit('success', imageBase64)
})
})
.catch(err => {
this.$emit('fail', err)
})
},
// 下载所有图片
downloadImages() {
return new Promise((resolve) => {
let preCount = 0
let completeCount = 0
const paintCopy = JSON.parse(JSON.stringify(this.painting))
if (paintCopy.background) {
preCount++
this.loadImage(paintCopy.background).then(
image => {
paintCopy.background = image
completeCount++
preCount === completeCount && resolve(paintCopy)
},
err => {
completeCount++
preCount === completeCount && resolve(paintCopy)
console.log(err)
}
)
}
if (paintCopy.views) {
for (const view of paintCopy.views) {
if (view && view.type === 'image' && view.url) {
preCount++
/* eslint-disable no-loop-func */
this.loadImage(view.url).then(
image => {
completeCount++
view.url = image
// 获得一下图片信息,供后续裁减使用
view.sWidth = image.width
view.sHeight = image.height
preCount === completeCount && resolve(paintCopy)
},
err => {
completeCount++
preCount === completeCount && resolve(paintCopy)
console.log(err)
}
)
}
}
}
preCount === 0 && resolve(paintCopy)
// if (preCount !== completeCount) {
// reject('paintCopy');
// }
})
},
// 下载图片
loadImage(src) {
return new Promise((resolve, reject) => {
if (src.startsWith('#')) {
resolve(src)
return
}
const img = new Image()
img.onload = () => resolve(img)
img.onerror = () => reject(`下载图片失败 ${src}`)
img.crossOrigin = 'anonymous'
img.src = src
if (img.complete === true) {
// Inline XML images may fail to parse, throwing an Error later on
setTimeout(() => resolve(img), 500)
}
})
}
}
}
function setStringPrototype(scale) {
/* eslint-disable no-extend-native */
/**
* 是否支持负数
* @param {Boolean} minus 是否支持负数
*/
String.prototype.toPx = function toPx(minus, baseSize) {
if (this === '0') {
return 0
}
let reg
if (minus) {
reg = /^-?[0-9]+([.]{1}[0-9]+){0,1}(px|%)$/g
} else {
reg = /^[0-9]+([.]{1}[0-9]+){0,1}(px|%)$/g
}
const results = reg.exec(this)
const unit = results[2]
const value = parseFloat(this)
let res = 0
if (unit === 'px') {
res = Math.round(value * (scale || 1))
} else if (unit === '%') {
res = Math.round((value * baseSize) / 100)
}
return res
}
}
</script>
<style scoped>
.canvas {
position: fixed;
top: 2000px;
}
</style>

View File

@@ -0,0 +1,102 @@
/* eslint-disable */
export const api = {
isGradient: function(bg) {
if (bg && (bg.startsWith('linear') || bg.startsWith('radial'))) {
return true
}
return false
},
doGradient: function(bg, width, height, ctx) {
if (bg.startsWith('linear')) {
linearEffect(width, height, bg, ctx)
} else if (bg.startsWith('radial')) {
radialEffect(width, height, bg, ctx)
}
}
}
function analizeGrad(string) {
const colorPercents = string.substring(0, string.length - 1).split('%,')
const colors = []
const percents = []
for (let colorPercent of colorPercents) {
colors.push(colorPercent.substring(0, colorPercent.lastIndexOf(' ')).trim())
percents.push(colorPercent.substring(colorPercent.lastIndexOf(' '), colorPercent.length) / 100)
}
return { colors: colors, percents: percents }
}
function radialEffect(width, height, bg, ctx) {
const colorPer = analizeGrad(bg.match(/radial-gradient\((.+)\)/)[1])
const grd = ctx.createRadialGradient(0, 0, 0, 0, 0, width < height ? height / 2 : width / 2)
for (let i = 0; i < colorPer.colors.length; i++) {
grd.addColorStop(colorPer.percents[i], colorPer.colors[i])
}
ctx.fillStyle = grd
//ctx.fillRect(-(width / 2), -(height / 2), width, height);
}
function analizeLinear(bg, width, height) {
const direction = bg.match(/([-]?\d{1,3})deg/)
const dir = direction && direction[1] ? parseFloat(direction[1]) : 0
let coordinate
switch (dir) {
case 0:
coordinate = [0, -height / 2, 0, height / 2]
break
case 90:
coordinate = [width / 2, 0, -width / 2, 0]
break
case -90:
coordinate = [-width / 2, 0, width / 2, 0]
break
case 180:
coordinate = [0, height / 2, 0, -height / 2]
break
case -180:
coordinate = [0, -height / 2, 0, height / 2]
break
default:
let x1 = 0
let y1 = 0
let x2 = 0
let y2 = 0
if (direction[1] > 0 && direction[1] < 90) {
x1 = width / 2 - (((width / 2) * Math.tan(((90 - direction[1]) * Math.PI * 2) / 360) - height / 2) * Math.sin((2 * (90 - direction[1]) * Math.PI * 2) / 360)) / 2
y2 = Math.tan(((90 - direction[1]) * Math.PI * 2) / 360) * x1
x2 = -x1
y1 = -y2
} else if (direction[1] > -180 && direction[1] < -90) {
x1 = -(width / 2) + (((width / 2) * Math.tan(((90 - direction[1]) * Math.PI * 2) / 360) - height / 2) * Math.sin((2 * (90 - direction[1]) * Math.PI * 2) / 360)) / 2
y2 = Math.tan(((90 - direction[1]) * Math.PI * 2) / 360) * x1
x2 = -x1
y1 = -y2
} else if (direction[1] > 90 && direction[1] < 180) {
x1 = width / 2 + ((-(width / 2) * Math.tan(((90 - direction[1]) * Math.PI * 2) / 360) - height / 2) * Math.sin((2 * (90 - direction[1]) * Math.PI * 2) / 360)) / 2
y2 = Math.tan(((90 - direction[1]) * Math.PI * 2) / 360) * x1
x2 = -x1
y1 = -y2
} else {
x1 = -(width / 2) - ((-(width / 2) * Math.tan(((90 - direction[1]) * Math.PI * 2) / 360) - height / 2) * Math.sin((2 * (90 - direction[1]) * Math.PI * 2) / 360)) / 2
y2 = Math.tan(((90 - direction[1]) * Math.PI * 2) / 360) * x1
x2 = -x1
y1 = -y2
}
coordinate = [x1, y1, x2, y2]
break
}
return coordinate
}
function linearEffect(width, height, bg, ctx) {
const param = analizeLinear(bg, width, height)
const grd = ctx.createLinearGradient(param[0], param[1], param[2], param[3])
const content = bg.match(/linear-gradient\((.+)\)/)[1]
const colorPer = analizeGrad(content.substring(content.indexOf(',') + 1))
for (let i = 0; i < colorPer.colors.length; i++) {
grd.addColorStop(colorPer.percents[i], colorPer.colors[i])
}
ctx.fillStyle = grd
//ctx.fillRect(-(width / 2), -(height / 2), width, height);
}

View File

@@ -0,0 +1,20 @@
import VueCanvasPoster from './canvas-poster'
export function install(Vue) {
Vue.component('vue-canvas-poster', VueCanvasPoster)
}
export { VueCanvasPoster }
const myPlugin = {
install
}
export default myPlugin
// Auto-install
let GlobalVue = null
if (typeof window !== 'undefined') {
GlobalVue = window.Vue
} else if (typeof global !== 'undefined') {
GlobalVue = global.Vue
}
if (GlobalVue) {
GlobalVue.use(myPlugin)
}

View File

@@ -0,0 +1,647 @@
const QR = require('./qrcode.js')
const GD = require('./gradient.js')
export default class Painter {
constructor(ctx, data) {
this.ctx = ctx
this.data = data
this.globalWidth = {}
this.globalHeight = {}
}
paint(callback) {
this.style = {
width: this.data.width.toPx(),
height: this.data.height.toPx()
}
this._background()
if (this.data.views && this.data.views.length > 0) {
for (const view of this.data.views) {
this._drawAbsolute(view)
}
}
callback && callback()
}
_background() {
this.ctx.save()
const { width, height } = this.style
const bg = this.data.background
this.ctx.translate(width / 2, height / 2)
this._doClip(this.data.borderRadius, width, height)
if (!bg) {
// 如果未设置背景,则默认使用透明色
this.ctx.fillStyle = 'transparent'
this.ctx.fillRect(-(width / 2), -(height / 2), width, height)
} else if (bg.src) {
// 背景填充图片
this.ctx.drawImage(bg, -(width / 2), -(height / 2), width, height)
}else if (bg.startsWith('#') || bg.startsWith('rgba') || bg.toLowerCase() === 'transparent') {
// 背景填充颜色
this.ctx.fillStyle = bg
this.ctx.fillRect(-(width / 2), -(height / 2), width, height)
} else if (GD.api.isGradient(bg)) {
GD.api.doGradient(bg, width, height, this.ctx)
this.ctx.fillRect(-(width / 2), -(height / 2), width, height)
}
this.ctx.restore()
}
_drawAbsolute(view) {
if (!(view && view.type)) {
// 过滤无效 view
return
}
// 证明 css 为数组形式,需要合并
if (view.css && view.css.length) {
/* eslint-disable no-param-reassign */
view.css = Object.assign(...view.css)
}
switch (view.type) {
case 'image':
this._drawAbsImage(view)
break
case 'text':
this._fillAbsText(view)
break
case 'rect':
this._drawAbsRect(view)
break
case 'qrcode':
this._drawQRCode(view)
break
default:
break
}
}
_border({ borderRadius = 0, width, height, borderWidth = 0, borderStyle = 'solid' }) {
let r1 = 0,
r2 = 0,
r3 = 0,
r4 = 0
const minSize = Math.min(width, height)
if (borderRadius) {
const border = borderRadius.split(/\s+/)
if (border.length === 4) {
r1 = Math.min(border[0].toPx(false, minSize), width / 2, height / 2)
r2 = Math.min(border[1].toPx(false, minSize), width / 2, height / 2)
r3 = Math.min(border[2].toPx(false, minSize), width / 2, height / 2)
r4 = Math.min(border[3].toPx(false, minSize), width / 2, height / 2)
} else {
r1 = r2 = r3 = r4 = Math.min(borderRadius && borderRadius.toPx(false, minSize), width / 2, height / 2)
}
}
const lineWidth = borderWidth && borderWidth.toPx(false, minSize)
this.ctx.lineWidth = lineWidth
if (borderStyle === 'dashed') {
this.ctx.setLineDash([(lineWidth * 4) / 3, (lineWidth * 4) / 3])
// this.ctx.lineDashOffset = 2 * lineWidth
} else if (borderStyle === 'dotted') {
this.ctx.setLineDash([lineWidth, lineWidth])
}
const notSolid = borderStyle !== 'solid'
this.ctx.beginPath()
notSolid && r1 === 0 && this.ctx.moveTo(-width / 2 - lineWidth, -height / 2 - lineWidth / 2) // 顶边虚线规避重叠规则
r1 !== 0 && this.ctx.arc(-width / 2 + r1, -height / 2 + r1, r1 + lineWidth / 2, 1 * Math.PI, 1.5 * Math.PI) //左上角圆弧
this.ctx.lineTo(r2 === 0 ? (notSolid ? width / 2 : width / 2 + lineWidth / 2) : width / 2 - r2, -height / 2 - lineWidth / 2) // 顶边线
notSolid && r2 === 0 && this.ctx.moveTo(width / 2 + lineWidth / 2, -height / 2 - lineWidth) // 右边虚线规避重叠规则
r2 !== 0 && this.ctx.arc(width / 2 - r2, -height / 2 + r2, r2 + lineWidth / 2, 1.5 * Math.PI, 2 * Math.PI) // 右上角圆弧
this.ctx.lineTo(width / 2 + lineWidth / 2, r3 === 0 ? (notSolid ? height / 2 : height / 2 + lineWidth / 2) : height / 2 - r3) // 右边线
notSolid && r3 === 0 && this.ctx.moveTo(width / 2 + lineWidth, height / 2 + lineWidth / 2) // 底边虚线规避重叠规则
r3 !== 0 && this.ctx.arc(width / 2 - r3, height / 2 - r3, r3 + lineWidth / 2, 0, 0.5 * Math.PI) // 右下角圆弧
this.ctx.lineTo(r4 === 0 ? (notSolid ? -width / 2 : -width / 2 - lineWidth / 2) : -width / 2 + r4, height / 2 + lineWidth / 2) // 底边线
notSolid && r4 === 0 && this.ctx.moveTo(-width / 2 - lineWidth / 2, height / 2 + lineWidth) // 左边虚线规避重叠规则
r4 !== 0 && this.ctx.arc(-width / 2 + r4, height / 2 - r4, r4 + lineWidth / 2, 0.5 * Math.PI, 1 * Math.PI) // 左下角圆弧
this.ctx.lineTo(-width / 2 - lineWidth / 2, r1 === 0 ? (notSolid ? -height / 2 : -height / 2 - lineWidth / 2) : -height / 2 + r1) // 左边线
notSolid && r1 === 0 && this.ctx.moveTo(-width / 2 - lineWidth, -height / 2 - lineWidth / 2) // 顶边虚线规避重叠规则
if (!notSolid) {
this.ctx.closePath()
}
}
/**
* 根据 borderRadius 进行裁减
*/
_doClip(borderRadius, width, height, borderStyle) {
if (borderRadius && width && height) {
// 防止在某些机型上周边有黑框现象,此处如果直接设置 fillStyle 为透明,在 Android 机型上会导致被裁减的图片也变为透明, iOS 和 IDE 上不会
// globalAlpha 在 1.9.90 起支持,低版本下无效,但把 fillStyle 设为了 white相对默认的 black 要好点
this.ctx.globalAlpha = 0
this.ctx.fillStyle = 'white'
this._border({
borderRadius,
width,
height,
borderStyle
})
this.ctx.fill()
// 在 ios 的 6.6.6 版本上 clip 有 bug禁掉此类型上的 clip也就意味着在此版本微信的 ios 设备下无法使用 border 属性
this.ctx.clip()
this.ctx.globalAlpha = 1
}
}
/**
* 画边框
*/
_doBorder(view, width, height) {
if (!view.css) {
return
}
const { borderRadius, borderWidth, borderColor, borderStyle } = view.css
if (!borderWidth) {
return
}
this.ctx.save()
this._preProcess(view, true)
this.ctx.strokeStyle = borderColor || 'black'
this._border({
borderRadius,
width,
height,
borderWidth,
borderStyle
})
this.ctx.stroke()
this.ctx.restore()
}
_preProcess(view, notClip) {
let width = 0
let height
let extra
const paddings = this._doPaddings(view)
switch (view.type) {
case 'text': {
const textArray = view.text.split('\n')
// 处理多个连续的'\n'
for (let i = 0; i < textArray.length; ++i) {
if (textArray[i] === '') {
textArray[i] = ' '
}
}
// const fontWeight = view.css.fontWeight === 'bold' ? 'bold' : 'normal'
const fontWeightArr = ['normal', 'bold', 'bolder', 'lighter', '100', '200', '300', '400', '500', '600', '700', '800', '900']
const fontWeight = fontWeightArr.includes(view.css.fontWeight) ? view.css.fontWeight : 'normal'
const textStyle = view.css.textStyle === 'italic' ? 'italic' : 'normal'
let textIndent = view.css.textIndent ? view.css.textIndent.toPx() : 0
if (!view.css.fontSize) {
view.css.fontSize = '20rpx'
}
this.ctx.font = `${textStyle} ${fontWeight} ${view.css.fontSize.toPx()}px "${view.css.fontFamily || 'sans-serif'}"`
// 计算行数
let lines = 0
const linesArray = []
for (let i = 0; i < textArray.length; ++i) {
const textLength = this.ctx.measureText(textArray[i]).width
// 最小长度
const minWidth = view.css.fontSize.toPx() + paddings[1] + paddings[3]
let partWidth = view.css.width ? view.css.width.toPx(false, this.style.width) - paddings[1] - paddings[3] : textLength
if (partWidth < minWidth) {
partWidth = minWidth
}
// textIndent 最大为一行
textIndent = textIndent > partWidth ? partWidth : textIndent
const calLines = Math.ceil((textLength + textIndent) / partWidth)
// 取最长的作为 width
width = partWidth > width ? partWidth : width
lines += calLines
linesArray[i] = calLines
}
lines = view.css.maxLines < lines ? view.css.maxLines : lines
const lineHeight = view.css.lineHeight ? view.css.lineHeight.toPx() : view.css.fontSize.toPx()
height = lineHeight * lines
extra = {
textIndent,
lines: lines,
lineHeight: lineHeight,
textArray: textArray,
linesArray: linesArray
}
break
}
case 'image': {
// 有css却未设置width或height则默认为auto
if (view.css) {
if (!view.css.width) {
view.css.width = 'auto'
}
if (!view.css.height) {
view.css.height = 'auto'
}
}
if (!view.css || (view.css.width === 'auto' && view.css.height === 'auto')) {
width = Math.round(view.sWidth)
height = Math.round(view.sHeight)
} else if (view.css.width === 'auto') {
height = view.css.height.toPx(false, this.style.height)
width = (view.sWidth / view.sHeight) * height
} else if (view.css.height === 'auto') {
width = view.css.width.toPx(false, this.style.width)
height = (view.sHeight / view.sWidth) * width
} else {
width = view.css.width.toPx(false, this.style.width)
height = view.css.height.toPx(false, this.style.height)
}
break
}
default:
if (!(view.css.width && view.css.height)) {
console.error('You should set width and height')
return
}
width = view.css.width.toPx(false, this.style.width)
height = view.css.height.toPx(false, this.style.height)
break
}
let x
if (view.css && view.css.right) {
if (typeof view.css.right === 'string') {
x = this.style.width - view.css.right.toPx(true, this.style.width)
} else {
// 可以用数组方式,把文字长度计算进去
// [right, 文字id, 乘数(默认 1]
const rights = view.css.right
x = this.style.width - rights[0].toPx(true, this.style.width) - this.globalWidth[rights[1]] * (rights[2] || 1)
}
} else if (view.css && view.css.left) {
if (typeof view.css.left === 'string') {
x = view.css.left.toPx(true, this.style.width)
} else {
const lefts = view.css.left
x = lefts[0].toPx(true, this.style.width) + this.globalWidth[lefts[1]] * (lefts[2] || 1)
}
} else {
x = 0
}
//const y = view.css && view.css.bottom ? this.style.height - height - view.css.bottom.toPx(true) : (view.css && view.css.top ? view.css.top.toPx(true) : 0);
let y
if (view.css && view.css.bottom) {
y = this.style.height - height - view.css.bottom.toPx(true, this.style.height)
} else {
if (view.css && view.css.top) {
if (typeof view.css.top === 'string') {
y = view.css.top.toPx(true, this.style.height)
} else {
const tops = view.css.top
y = tops[0].toPx(true, this.style.height) + this.globalHeight[tops[1]] * (tops[2] || 1)
}
} else {
y = 0
}
}
const angle = view.css && view.css.rotate ? this._getAngle(view.css.rotate) : 0
// 当设置了 right 时,默认 align 用 right反之用 left
const align = view.css && view.css.align ? view.css.align : view.css && view.css.right ? 'right' : 'left'
const verticalAlign = view.css && view.css.verticalAlign ? view.css.verticalAlign : 'top'
// 记录绘制时的画布
let xa = 0
switch (align) {
case 'center':
xa = x
break
case 'right':
xa = x - width / 2
break
default:
xa = x + width / 2
break
}
let ya = 0
switch (verticalAlign) {
case 'center':
ya = y
break
case 'bottom':
ya = y - height / 2
break
default:
ya = y + height / 2
break
}
this.ctx.translate(xa, ya)
// 记录该 view 的有效点击区域
// TODO ,旋转和裁剪的判断
// 记录在真实画布上的左侧
let left = x
if (align === 'center') {
left = x - width / 2
} else if (align === 'right') {
left = x - width
}
var top = y
if (verticalAlign === 'center') {
top = y - height / 2
} else if (verticalAlign === 'bottom') {
top = y - height
}
if (view.rect) {
view.rect.left = left
view.rect.top = top
view.rect.right = left + width
view.rect.bottom = top + height
view.rect.x = view.css && view.css.right ? x - width : x
view.rect.y = y
} else {
view.rect = {
left: left,
top: top,
right: left + width,
bottom: top + height,
x: view.css && view.css.right ? x - width : x,
y: y
}
}
view.rect.left = view.rect.left - paddings[3]
view.rect.top = view.rect.top - paddings[0]
view.rect.right = view.rect.right + paddings[1]
view.rect.bottom = view.rect.bottom + paddings[2]
if (view.type === 'text') {
view.rect.minWidth = view.css.fontSize.toPx() + paddings[1] + paddings[3]
}
this.ctx.rotate(angle)
if (!notClip && view.css && view.css.borderRadius && view.type !== 'rect') {
this._doClip(view.css.borderRadius, width, height, view.css.borderStyle)
}
this._doShadow(view)
if (view.id) {
this.globalWidth[view.id] = width
this.globalHeight[view.id] = height
}
return {
width: width,
height: height,
x: x,
y: y,
extra: extra
}
}
_doPaddings(view) {
const { padding } = view.css ? view.css : {}
let pd = [0, 0, 0, 0]
if (padding) {
const pdg = padding.split(/\s+/)
if (pdg.length === 1) {
const x = pdg[0].toPx()
pd = [x, x, x, x]
}
if (pdg.length === 2) {
const x = pdg[0].toPx()
const y = pdg[1].toPx()
pd = [x, y, x, y]
}
if (pdg.length === 3) {
const x = pdg[0].toPx()
const y = pdg[1].toPx()
const z = pdg[2].toPx()
pd = [x, y, z, y]
}
if (pdg.length === 4) {
const x = pdg[0].toPx()
const y = pdg[1].toPx()
const z = pdg[2].toPx()
const a = pdg[3].toPx()
pd = [x, y, z, a]
}
}
return pd
}
// 画文字的背景图片
_doBackground(view) {
this.ctx.save()
const { width: rawWidth, height: rawHeight } = this._preProcess(view, true)
const { background } = view.css
let pd = this._doPaddings(view)
const width = rawWidth + pd[1] + pd[3]
const height = rawHeight + pd[0] + pd[2]
this._doClip(view.css.borderRadius, width, height, view.css.borderStyle)
if (GD.api.isGradient(background)) {
GD.api.doGradient(background, width, height, this.ctx)
} else {
this.ctx.fillStyle = background
}
this.ctx.fillRect(-(width / 2), -(height / 2), width, height)
this.ctx.restore()
}
_drawQRCode(view) {
this.ctx.save()
const { width, height } = this._preProcess(view)
QR.api.draw(view.content, this.ctx, -width / 2, -height / 2, width, height, view.css.background, view.css.color)
this.ctx.restore()
this._doBorder(view, width, height)
}
_drawAbsImage(view) {
if (!view.url) {
return
}
this.ctx.save()
const { width, height } = this._preProcess(view)
// 图片失败
if (typeof view.url === 'string') {
this.ctx.fillStyle = '#ddd'
this.ctx.fillRect(-(width / 2), -(height / 2), width, height)
this.ctx.restore()
return
}
// 获得缩放到图片大小级别的裁减框
let rWidth = view.sWidth
let rHeight = view.sHeight
let startX = 0
let startY = 0
// 绘画区域比例
const cp = width / height
// 原图比例
const op = view.sWidth / view.sHeight
if (cp >= op) {
rHeight = rWidth / cp
startY = Math.round((view.sHeight - rHeight) / 2)
} else {
rWidth = rHeight * cp
startX = Math.round((view.sWidth - rWidth) / 2)
}
if (view.css && view.css.mode === 'scaleToFill') {
this.ctx.drawImage(view.url, -(width / 2), -(height / 2), width, height)
} else {
this.ctx.drawImage(view.url, startX, startY, rWidth, rHeight, -(width / 2), -(height / 2), width, height)
view.rect.startX = startX / view.sWidth
view.rect.startY = startY / view.sHeight
view.rect.endX = (startX + rWidth) / view.sWidth
view.rect.endY = (startY + rHeight) / view.sHeight
}
this.ctx.restore()
this._doBorder(view, width, height)
}
_fillAbsText(view) {
if (!view.text) {
return
}
if (view.css.background) {
// 生成背景
this._doBackground(view)
}
this.ctx.save()
const { width, height, extra } = this._preProcess(view, view.css.background && view.css.borderRadius)
this.ctx.fillStyle = view.css.color || 'black'
const { lines, lineHeight, textArray, linesArray, textIndent } = extra
// 如果设置了id则保留 text 的长度
if (view.id) {
let textWidth = 0
for (let i = 0; i < textArray.length; ++i) {
const _w = this.ctx.measureText(textArray[i]).width
textWidth = _w > textWidth ? _w : textWidth
}
this.globalWidth[view.id] = width ? (textWidth < width ? textWidth : width) : textWidth
}
let lineIndex = 0
let tabWidth = 0
for (let j = 0; j < textArray.length; ++j) {
const preLineLength = Math.ceil(textArray[j].length / linesArray[j])
const firstLineLength = Math.ceil(((width - textIndent) / width) * (textArray[j].length / linesArray[j]))
let start = 0
let alreadyCount = 0
for (let i = 0; i < linesArray[j]; ++i) {
// 绘制行数大于最大行数,则直接跳出循环
if (lineIndex >= lines) {
break
}
tabWidth = i == 0 ? textIndent : 0
alreadyCount = i == 0 ? firstLineLength : preLineLength
let text = textArray[j].substr(start, alreadyCount)
let measuredWith = this.ctx.measureText(text).width
// 如果测量大小小于width一个字符的大小则进行补齐如果测量大小超出 width则进行减除
// 如果已经到文本末尾,也不要进行该循环
while (start + alreadyCount <= textArray[j].length && (width - measuredWith - tabWidth > view.css.fontSize.toPx() || measuredWith - width > view.css.fontSize.toPx())) {
if (measuredWith < width) {
text = textArray[j].substr(start, ++alreadyCount)
} else {
if (text.length <= 1) {
// 如果只有一个字符时,直接跳出循环
break
}
text = textArray[j].substr(start, --alreadyCount)
// break
}
measuredWith = this.ctx.measureText(text).width
}
start += text.length
// 如果是最后一行了,发现还有未绘制完的内容,则加...
if (lineIndex === lines - 1 && (j < textArray.length - 1 || start < textArray[j].length)) {
while (this.ctx.measureText(`${text}...`).width > width) {
if (text.length <= 1) {
// 如果只有一个字符时,直接跳出循环
break
}
text = text.substring(0, text.length - 1)
}
text += '...'
measuredWith = this.ctx.measureText(text).width
}
this.ctx.textAlign = view.css.textAlign ? view.css.textAlign : 'left'
let x
let lineX
switch (view.css.textAlign) {
case 'center':
x = 0
lineX = x - measuredWith / 2 + tabWidth
break
case 'right':
x = width / 2
lineX = x - measuredWith + tabWidth
break
default:
x = -(width / 2) + tabWidth
lineX = x
break
}
const y = -(height / 2) + (lineIndex === 0 ? view.css.fontSize.toPx() : view.css.fontSize.toPx() + lineIndex * lineHeight)
lineIndex++
if (view.css.textStyle === 'stroke') {
this.ctx.strokeText(text, x, y, measuredWith)
} else {
this.ctx.fillText(text, x, y, measuredWith)
}
const fontSize = view.css.fontSize.toPx()
if (view.css.textDecoration) {
this.ctx.lineWidth = fontSize / 13
this.ctx.beginPath()
if (/\bunderline\b/.test(view.css.textDecoration)) {
this.ctx.moveTo(lineX, y)
this.ctx.lineTo(lineX + measuredWith, y)
}
if (/\boverline\b/.test(view.css.textDecoration)) {
this.ctx.moveTo(lineX, y - fontSize)
this.ctx.lineTo(lineX + measuredWith, y - fontSize)
}
if (/\bline-through\b/.test(view.css.textDecoration)) {
this.ctx.moveTo(lineX, y - fontSize / 3)
this.ctx.lineTo(lineX + measuredWith, y - fontSize / 3)
}
this.ctx.closePath()
this.ctx.strokeStyle = view.css.color
this.ctx.stroke()
}
}
}
this.ctx.restore()
this._doBorder(view, width, height)
}
_drawAbsRect(view) {
this.ctx.save()
const { width, height } = this._preProcess(view)
if (GD.api.isGradient(view.css.color)) {
GD.api.doGradient(view.css.color, width, height, this.ctx)
} else {
this.ctx.fillStyle = view.css.color
}
const { borderRadius, borderStyle, borderWidth } = view.css
this._border({
borderRadius,
width,
height,
borderWidth,
borderStyle
})
this.ctx.fill()
this.ctx.restore()
this._doBorder(view, width, height)
}
// shadow 支持 (x, y, blur, color), 不支持 spread
// shadow:0px 0px 10px rgba(0,0,0,0.1);
_doShadow(view) {
if (!view.css || !view.css.shadow) {
return
}
const box = view.css.shadow.replace(/,\s+/g, ',').split(/\s+/)
if (box.length > 4) {
console.error("shadow don't spread option")
return
}
this.ctx.shadowOffsetX = parseInt(box[0], 10)
this.ctx.shadowOffsetY = parseInt(box[1], 10)
this.ctx.shadowBlur = parseInt(box[2], 10)
this.ctx.shadowColor = box[3]
}
_getAngle(angle) {
return (Number(angle) * Math.PI) / 180
}
}

View File

@@ -0,0 +1,781 @@
/* eslint-disable */
// alignment pattern
var adelta = [
0, 11, 15, 19, 23, 27, 31,
16, 18, 20, 22, 24, 26, 28, 20, 22, 24, 24, 26, 28, 28, 22, 24, 24,
26, 26, 28, 28, 24, 24, 26, 26, 26, 28, 28, 24, 26, 26, 26, 28, 28
];
// version block
var vpat = [
0xc94, 0x5bc, 0xa99, 0x4d3, 0xbf6, 0x762, 0x847, 0x60d,
0x928, 0xb78, 0x45d, 0xa17, 0x532, 0x9a6, 0x683, 0x8c9,
0x7ec, 0xec4, 0x1e1, 0xfab, 0x08e, 0xc1a, 0x33f, 0xd75,
0x250, 0x9d5, 0x6f0, 0x8ba, 0x79f, 0xb0b, 0x42e, 0xa64,
0x541, 0xc69
];
// final format bits with mask: level << 3 | mask
var fmtword = [
0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976, //L
0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0, //M
0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed, //Q
0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b //H
];
// 4 per version: number of blocks 1,2; data width; ecc width
var eccblocks = [
1, 0, 19, 7, 1, 0, 16, 10, 1, 0, 13, 13, 1, 0, 9, 17,
1, 0, 34, 10, 1, 0, 28, 16, 1, 0, 22, 22, 1, 0, 16, 28,
1, 0, 55, 15, 1, 0, 44, 26, 2, 0, 17, 18, 2, 0, 13, 22,
1, 0, 80, 20, 2, 0, 32, 18, 2, 0, 24, 26, 4, 0, 9, 16,
1, 0, 108, 26, 2, 0, 43, 24, 2, 2, 15, 18, 2, 2, 11, 22,
2, 0, 68, 18, 4, 0, 27, 16, 4, 0, 19, 24, 4, 0, 15, 28,
2, 0, 78, 20, 4, 0, 31, 18, 2, 4, 14, 18, 4, 1, 13, 26,
2, 0, 97, 24, 2, 2, 38, 22, 4, 2, 18, 22, 4, 2, 14, 26,
2, 0, 116, 30, 3, 2, 36, 22, 4, 4, 16, 20, 4, 4, 12, 24,
2, 2, 68, 18, 4, 1, 43, 26, 6, 2, 19, 24, 6, 2, 15, 28,
4, 0, 81, 20, 1, 4, 50, 30, 4, 4, 22, 28, 3, 8, 12, 24,
2, 2, 92, 24, 6, 2, 36, 22, 4, 6, 20, 26, 7, 4, 14, 28,
4, 0, 107, 26, 8, 1, 37, 22, 8, 4, 20, 24, 12, 4, 11, 22,
3, 1, 115, 30, 4, 5, 40, 24, 11, 5, 16, 20, 11, 5, 12, 24,
5, 1, 87, 22, 5, 5, 41, 24, 5, 7, 24, 30, 11, 7, 12, 24,
5, 1, 98, 24, 7, 3, 45, 28, 15, 2, 19, 24, 3, 13, 15, 30,
1, 5, 107, 28, 10, 1, 46, 28, 1, 15, 22, 28, 2, 17, 14, 28,
5, 1, 120, 30, 9, 4, 43, 26, 17, 1, 22, 28, 2, 19, 14, 28,
3, 4, 113, 28, 3, 11, 44, 26, 17, 4, 21, 26, 9, 16, 13, 26,
3, 5, 107, 28, 3, 13, 41, 26, 15, 5, 24, 30, 15, 10, 15, 28,
4, 4, 116, 28, 17, 0, 42, 26, 17, 6, 22, 28, 19, 6, 16, 30,
2, 7, 111, 28, 17, 0, 46, 28, 7, 16, 24, 30, 34, 0, 13, 24,
4, 5, 121, 30, 4, 14, 47, 28, 11, 14, 24, 30, 16, 14, 15, 30,
6, 4, 117, 30, 6, 14, 45, 28, 11, 16, 24, 30, 30, 2, 16, 30,
8, 4, 106, 26, 8, 13, 47, 28, 7, 22, 24, 30, 22, 13, 15, 30,
10, 2, 114, 28, 19, 4, 46, 28, 28, 6, 22, 28, 33, 4, 16, 30,
8, 4, 122, 30, 22, 3, 45, 28, 8, 26, 23, 30, 12, 28, 15, 30,
3, 10, 117, 30, 3, 23, 45, 28, 4, 31, 24, 30, 11, 31, 15, 30,
7, 7, 116, 30, 21, 7, 45, 28, 1, 37, 23, 30, 19, 26, 15, 30,
5, 10, 115, 30, 19, 10, 47, 28, 15, 25, 24, 30, 23, 25, 15, 30,
13, 3, 115, 30, 2, 29, 46, 28, 42, 1, 24, 30, 23, 28, 15, 30,
17, 0, 115, 30, 10, 23, 46, 28, 10, 35, 24, 30, 19, 35, 15, 30,
17, 1, 115, 30, 14, 21, 46, 28, 29, 19, 24, 30, 11, 46, 15, 30,
13, 6, 115, 30, 14, 23, 46, 28, 44, 7, 24, 30, 59, 1, 16, 30,
12, 7, 121, 30, 12, 26, 47, 28, 39, 14, 24, 30, 22, 41, 15, 30,
6, 14, 121, 30, 6, 34, 47, 28, 46, 10, 24, 30, 2, 64, 15, 30,
17, 4, 122, 30, 29, 14, 46, 28, 49, 10, 24, 30, 24, 46, 15, 30,
4, 18, 122, 30, 13, 32, 46, 28, 48, 14, 24, 30, 42, 32, 15, 30,
20, 4, 117, 30, 40, 7, 47, 28, 43, 22, 24, 30, 10, 67, 15, 30,
19, 6, 118, 30, 18, 31, 47, 28, 34, 34, 24, 30, 20, 61, 15, 30
];
// Galois field log table
var glog = [
0xff, 0x00, 0x01, 0x19, 0x02, 0x32, 0x1a, 0xc6, 0x03, 0xdf, 0x33, 0xee, 0x1b, 0x68, 0xc7, 0x4b,
0x04, 0x64, 0xe0, 0x0e, 0x34, 0x8d, 0xef, 0x81, 0x1c, 0xc1, 0x69, 0xf8, 0xc8, 0x08, 0x4c, 0x71,
0x05, 0x8a, 0x65, 0x2f, 0xe1, 0x24, 0x0f, 0x21, 0x35, 0x93, 0x8e, 0xda, 0xf0, 0x12, 0x82, 0x45,
0x1d, 0xb5, 0xc2, 0x7d, 0x6a, 0x27, 0xf9, 0xb9, 0xc9, 0x9a, 0x09, 0x78, 0x4d, 0xe4, 0x72, 0xa6,
0x06, 0xbf, 0x8b, 0x62, 0x66, 0xdd, 0x30, 0xfd, 0xe2, 0x98, 0x25, 0xb3, 0x10, 0x91, 0x22, 0x88,
0x36, 0xd0, 0x94, 0xce, 0x8f, 0x96, 0xdb, 0xbd, 0xf1, 0xd2, 0x13, 0x5c, 0x83, 0x38, 0x46, 0x40,
0x1e, 0x42, 0xb6, 0xa3, 0xc3, 0x48, 0x7e, 0x6e, 0x6b, 0x3a, 0x28, 0x54, 0xfa, 0x85, 0xba, 0x3d,
0xca, 0x5e, 0x9b, 0x9f, 0x0a, 0x15, 0x79, 0x2b, 0x4e, 0xd4, 0xe5, 0xac, 0x73, 0xf3, 0xa7, 0x57,
0x07, 0x70, 0xc0, 0xf7, 0x8c, 0x80, 0x63, 0x0d, 0x67, 0x4a, 0xde, 0xed, 0x31, 0xc5, 0xfe, 0x18,
0xe3, 0xa5, 0x99, 0x77, 0x26, 0xb8, 0xb4, 0x7c, 0x11, 0x44, 0x92, 0xd9, 0x23, 0x20, 0x89, 0x2e,
0x37, 0x3f, 0xd1, 0x5b, 0x95, 0xbc, 0xcf, 0xcd, 0x90, 0x87, 0x97, 0xb2, 0xdc, 0xfc, 0xbe, 0x61,
0xf2, 0x56, 0xd3, 0xab, 0x14, 0x2a, 0x5d, 0x9e, 0x84, 0x3c, 0x39, 0x53, 0x47, 0x6d, 0x41, 0xa2,
0x1f, 0x2d, 0x43, 0xd8, 0xb7, 0x7b, 0xa4, 0x76, 0xc4, 0x17, 0x49, 0xec, 0x7f, 0x0c, 0x6f, 0xf6,
0x6c, 0xa1, 0x3b, 0x52, 0x29, 0x9d, 0x55, 0xaa, 0xfb, 0x60, 0x86, 0xb1, 0xbb, 0xcc, 0x3e, 0x5a,
0xcb, 0x59, 0x5f, 0xb0, 0x9c, 0xa9, 0xa0, 0x51, 0x0b, 0xf5, 0x16, 0xeb, 0x7a, 0x75, 0x2c, 0xd7,
0x4f, 0xae, 0xd5, 0xe9, 0xe6, 0xe7, 0xad, 0xe8, 0x74, 0xd6, 0xf4, 0xea, 0xa8, 0x50, 0x58, 0xaf
];
// Galios field exponent table
var gexp = [
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1d, 0x3a, 0x74, 0xe8, 0xcd, 0x87, 0x13, 0x26,
0x4c, 0x98, 0x2d, 0x5a, 0xb4, 0x75, 0xea, 0xc9, 0x8f, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0,
0x9d, 0x27, 0x4e, 0x9c, 0x25, 0x4a, 0x94, 0x35, 0x6a, 0xd4, 0xb5, 0x77, 0xee, 0xc1, 0x9f, 0x23,
0x46, 0x8c, 0x05, 0x0a, 0x14, 0x28, 0x50, 0xa0, 0x5d, 0xba, 0x69, 0xd2, 0xb9, 0x6f, 0xde, 0xa1,
0x5f, 0xbe, 0x61, 0xc2, 0x99, 0x2f, 0x5e, 0xbc, 0x65, 0xca, 0x89, 0x0f, 0x1e, 0x3c, 0x78, 0xf0,
0xfd, 0xe7, 0xd3, 0xbb, 0x6b, 0xd6, 0xb1, 0x7f, 0xfe, 0xe1, 0xdf, 0xa3, 0x5b, 0xb6, 0x71, 0xe2,
0xd9, 0xaf, 0x43, 0x86, 0x11, 0x22, 0x44, 0x88, 0x0d, 0x1a, 0x34, 0x68, 0xd0, 0xbd, 0x67, 0xce,
0x81, 0x1f, 0x3e, 0x7c, 0xf8, 0xed, 0xc7, 0x93, 0x3b, 0x76, 0xec, 0xc5, 0x97, 0x33, 0x66, 0xcc,
0x85, 0x17, 0x2e, 0x5c, 0xb8, 0x6d, 0xda, 0xa9, 0x4f, 0x9e, 0x21, 0x42, 0x84, 0x15, 0x2a, 0x54,
0xa8, 0x4d, 0x9a, 0x29, 0x52, 0xa4, 0x55, 0xaa, 0x49, 0x92, 0x39, 0x72, 0xe4, 0xd5, 0xb7, 0x73,
0xe6, 0xd1, 0xbf, 0x63, 0xc6, 0x91, 0x3f, 0x7e, 0xfc, 0xe5, 0xd7, 0xb3, 0x7b, 0xf6, 0xf1, 0xff,
0xe3, 0xdb, 0xab, 0x4b, 0x96, 0x31, 0x62, 0xc4, 0x95, 0x37, 0x6e, 0xdc, 0xa5, 0x57, 0xae, 0x41,
0x82, 0x19, 0x32, 0x64, 0xc8, 0x8d, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xdd, 0xa7, 0x53, 0xa6,
0x51, 0xa2, 0x59, 0xb2, 0x79, 0xf2, 0xf9, 0xef, 0xc3, 0x9b, 0x2b, 0x56, 0xac, 0x45, 0x8a, 0x09,
0x12, 0x24, 0x48, 0x90, 0x3d, 0x7a, 0xf4, 0xf5, 0xf7, 0xf3, 0xfb, 0xeb, 0xcb, 0x8b, 0x0b, 0x16,
0x2c, 0x58, 0xb0, 0x7d, 0xfa, 0xe9, 0xcf, 0x83, 0x1b, 0x36, 0x6c, 0xd8, 0xad, 0x47, 0x8e, 0x00
];
// Working buffers:
// data input and ecc append, image working buffer, fixed part of image, run lengths for badness
var strinbuf = [], eccbuf = [], qrframe = [], framask = [], rlens = [];
// Control values - width is based on version, last 4 are from table.
var version, width, neccblk1, neccblk2, datablkw, eccblkwid;
var ecclevel = 2;
// set bit to indicate cell in qrframe is immutable. symmetric around diagonal
function setmask(x, y) {
var bt;
if (x > y) {
bt = x;
x = y;
y = bt;
}
// y*y = 1+3+5...
bt = y;
bt *= y;
bt += y;
bt >>= 1;
bt += x;
framask[bt] = 1;
}
// enter alignment pattern - black to qrframe, white to mask (later black frame merged to mask)
function putalign(x, y) {
var j;
qrframe[x + width * y] = 1;
for (j = -2; j < 2; j++) {
qrframe[(x + j) + width * (y - 2)] = 1;
qrframe[(x - 2) + width * (y + j + 1)] = 1;
qrframe[(x + 2) + width * (y + j)] = 1;
qrframe[(x + j + 1) + width * (y + 2)] = 1;
}
for (j = 0; j < 2; j++) {
setmask(x - 1, y + j);
setmask(x + 1, y - j);
setmask(x - j, y - 1);
setmask(x + j, y + 1);
}
}
//========================================================================
// Reed Solomon error correction
// exponentiation mod N
function modnn(x) {
while (x >= 255) {
x -= 255;
x = (x >> 8) + (x & 255);
}
return x;
}
var genpoly = [];
// Calculate and append ECC data to data block. Block is in strinbuf, indexes to buffers given.
function appendrs(data, dlen, ecbuf, eclen) {
var i, j, fb;
for (i = 0; i < eclen; i++)
strinbuf[ecbuf + i] = 0;
for (i = 0; i < dlen; i++) {
fb = glog[strinbuf[data + i] ^ strinbuf[ecbuf]];
if (fb != 255) /* fb term is non-zero */
for (j = 1; j < eclen; j++)
strinbuf[ecbuf + j - 1] = strinbuf[ecbuf + j] ^ gexp[modnn(fb + genpoly[eclen - j])];
else
for (j = ecbuf; j < ecbuf + eclen; j++)
strinbuf[j] = strinbuf[j + 1];
strinbuf[ecbuf + eclen - 1] = fb == 255 ? 0 : gexp[modnn(fb + genpoly[0])];
}
}
//========================================================================
// Frame data insert following the path rules
// check mask - since symmetrical use half.
function ismasked(x, y) {
var bt;
if (x > y) {
bt = x;
x = y;
y = bt;
}
bt = y;
bt += y * y;
bt >>= 1;
bt += x;
return framask[bt];
}
//========================================================================
// Apply the selected mask out of the 8.
function applymask(m) {
var x, y, r3x, r3y;
switch (m) {
case 0:
for (y = 0; y < width; y++)
for (x = 0; x < width; x++)
if (!((x + y) & 1) && !ismasked(x, y))
qrframe[x + y * width] ^= 1;
break;
case 1:
for (y = 0; y < width; y++)
for (x = 0; x < width; x++)
if (!(y & 1) && !ismasked(x, y))
qrframe[x + y * width] ^= 1;
break;
case 2:
for (y = 0; y < width; y++)
for (r3x = 0, x = 0; x < width; x++ , r3x++) {
if (r3x == 3)
r3x = 0;
if (!r3x && !ismasked(x, y))
qrframe[x + y * width] ^= 1;
}
break;
case 3:
for (r3y = 0, y = 0; y < width; y++ , r3y++) {
if (r3y == 3)
r3y = 0;
for (r3x = r3y, x = 0; x < width; x++ , r3x++) {
if (r3x == 3)
r3x = 0;
if (!r3x && !ismasked(x, y))
qrframe[x + y * width] ^= 1;
}
}
break;
case 4:
for (y = 0; y < width; y++)
for (r3x = 0, r3y = ((y >> 1) & 1), x = 0; x < width; x++ , r3x++) {
if (r3x == 3) {
r3x = 0;
r3y = !r3y;
}
if (!r3y && !ismasked(x, y))
qrframe[x + y * width] ^= 1;
}
break;
case 5:
for (r3y = 0, y = 0; y < width; y++ , r3y++) {
if (r3y == 3)
r3y = 0;
for (r3x = 0, x = 0; x < width; x++ , r3x++) {
if (r3x == 3)
r3x = 0;
if (!((x & y & 1) + !(!r3x | !r3y)) && !ismasked(x, y))
qrframe[x + y * width] ^= 1;
}
}
break;
case 6:
for (r3y = 0, y = 0; y < width; y++ , r3y++) {
if (r3y == 3)
r3y = 0;
for (r3x = 0, x = 0; x < width; x++ , r3x++) {
if (r3x == 3)
r3x = 0;
if (!(((x & y & 1) + (r3x && (r3x == r3y))) & 1) && !ismasked(x, y))
qrframe[x + y * width] ^= 1;
}
}
break;
case 7:
for (r3y = 0, y = 0; y < width; y++ , r3y++) {
if (r3y == 3)
r3y = 0;
for (r3x = 0, x = 0; x < width; x++ , r3x++) {
if (r3x == 3)
r3x = 0;
if (!(((r3x && (r3x == r3y)) + ((x + y) & 1)) & 1) && !ismasked(x, y))
qrframe[x + y * width] ^= 1;
}
}
break;
}
return;
}
// Badness coefficients.
var N1 = 3, N2 = 3, N3 = 40, N4 = 10;
// Using the table of the length of each run, calculate the amount of bad image
// - long runs or those that look like finders; called twice, once each for X and Y
function badruns(length) {
var i;
var runsbad = 0;
for (i = 0; i <= length; i++)
if (rlens[i] >= 5)
runsbad += N1 + rlens[i] - 5;
// BwBBBwB as in finder
for (i = 3; i < length - 1; i += 2)
if (rlens[i - 2] == rlens[i + 2]
&& rlens[i + 2] == rlens[i - 1]
&& rlens[i - 1] == rlens[i + 1]
&& rlens[i - 1] * 3 == rlens[i]
// white around the black pattern? Not part of spec
&& (rlens[i - 3] == 0 // beginning
|| i + 3 > length // end
|| rlens[i - 3] * 3 >= rlens[i] * 4 || rlens[i + 3] * 3 >= rlens[i] * 4)
)
runsbad += N3;
return runsbad;
}
// Calculate how bad the masked image is - blocks, imbalance, runs, or finders.
function badcheck() {
var x, y, h, b, b1;
var thisbad = 0;
var bw = 0;
// blocks of same color.
for (y = 0; y < width - 1; y++)
for (x = 0; x < width - 1; x++)
if ((qrframe[x + width * y] && qrframe[(x + 1) + width * y]
&& qrframe[x + width * (y + 1)] && qrframe[(x + 1) + width * (y + 1)]) // all black
|| !(qrframe[x + width * y] || qrframe[(x + 1) + width * y]
|| qrframe[x + width * (y + 1)] || qrframe[(x + 1) + width * (y + 1)])) // all white
thisbad += N2;
// X runs
for (y = 0; y < width; y++) {
rlens[0] = 0;
for (h = b = x = 0; x < width; x++) {
if ((b1 = qrframe[x + width * y]) == b)
rlens[h]++;
else
rlens[++h] = 1;
b = b1;
bw += b ? 1 : -1;
}
thisbad += badruns(h);
}
// black/white imbalance
if (bw < 0)
bw = -bw;
var big = bw;
var count = 0;
big += big << 2;
big <<= 1;
while (big > width * width)
big -= width * width, count++;
thisbad += count * N4;
// Y runs
for (x = 0; x < width; x++) {
rlens[0] = 0;
for (h = b = y = 0; y < width; y++) {
if ((b1 = qrframe[x + width * y]) == b)
rlens[h]++;
else
rlens[++h] = 1;
b = b1;
}
thisbad += badruns(h);
}
return thisbad;
}
function genframe(instring) {
var x, y, k, t, v, i, j, m;
// find the smallest version that fits the string
t = instring.length;
version = 0;
do {
version++;
k = (ecclevel - 1) * 4 + (version - 1) * 16;
neccblk1 = eccblocks[k++];
neccblk2 = eccblocks[k++];
datablkw = eccblocks[k++];
eccblkwid = eccblocks[k];
k = datablkw * (neccblk1 + neccblk2) + neccblk2 - 3 + (version <= 9);
if (t <= k)
break;
} while (version < 40);
// FIXME - insure that it fits insted of being truncated
width = 17 + 4 * version;
// allocate, clear and setup data structures
v = datablkw + (datablkw + eccblkwid) * (neccblk1 + neccblk2) + neccblk2;
for (t = 0; t < v; t++)
eccbuf[t] = 0;
strinbuf = instring.slice(0);
for (t = 0; t < width * width; t++)
qrframe[t] = 0;
for (t = 0; t < (width * (width + 1) + 1) / 2; t++)
framask[t] = 0;
// insert finders - black to frame, white to mask
for (t = 0; t < 3; t++) {
k = 0;
y = 0;
if (t == 1)
k = (width - 7);
if (t == 2)
y = (width - 7);
qrframe[(y + 3) + width * (k + 3)] = 1;
for (x = 0; x < 6; x++) {
qrframe[(y + x) + width * k] = 1;
qrframe[y + width * (k + x + 1)] = 1;
qrframe[(y + 6) + width * (k + x)] = 1;
qrframe[(y + x + 1) + width * (k + 6)] = 1;
}
for (x = 1; x < 5; x++) {
setmask(y + x, k + 1);
setmask(y + 1, k + x + 1);
setmask(y + 5, k + x);
setmask(y + x + 1, k + 5);
}
for (x = 2; x < 4; x++) {
qrframe[(y + x) + width * (k + 2)] = 1;
qrframe[(y + 2) + width * (k + x + 1)] = 1;
qrframe[(y + 4) + width * (k + x)] = 1;
qrframe[(y + x + 1) + width * (k + 4)] = 1;
}
}
// alignment blocks
if (version > 1) {
t = adelta[version];
y = width - 7;
for (; ;) {
x = width - 7;
while (x > t - 3) {
putalign(x, y);
if (x < t)
break;
x -= t;
}
if (y <= t + 9)
break;
y -= t;
putalign(6, y);
putalign(y, 6);
}
}
// single black
qrframe[8 + width * (width - 8)] = 1;
// timing gap - mask only
for (y = 0; y < 7; y++) {
setmask(7, y);
setmask(width - 8, y);
setmask(7, y + width - 7);
}
for (x = 0; x < 8; x++) {
setmask(x, 7);
setmask(x + width - 8, 7);
setmask(x, width - 8);
}
// reserve mask-format area
for (x = 0; x < 9; x++)
setmask(x, 8);
for (x = 0; x < 8; x++) {
setmask(x + width - 8, 8);
setmask(8, x);
}
for (y = 0; y < 7; y++)
setmask(8, y + width - 7);
// timing row/col
for (x = 0; x < width - 14; x++)
if (x & 1) {
setmask(8 + x, 6);
setmask(6, 8 + x);
}
else {
qrframe[(8 + x) + width * 6] = 1;
qrframe[6 + width * (8 + x)] = 1;
}
// version block
if (version > 6) {
t = vpat[version - 7];
k = 17;
for (x = 0; x < 6; x++)
for (y = 0; y < 3; y++ , k--)
if (1 & (k > 11 ? version >> (k - 12) : t >> k)) {
qrframe[(5 - x) + width * (2 - y + width - 11)] = 1;
qrframe[(2 - y + width - 11) + width * (5 - x)] = 1;
}
else {
setmask(5 - x, 2 - y + width - 11);
setmask(2 - y + width - 11, 5 - x);
}
}
// sync mask bits - only set above for white spaces, so add in black bits
for (y = 0; y < width; y++)
for (x = 0; x <= y; x++)
if (qrframe[x + width * y])
setmask(x, y);
// convert string to bitstream
// 8 bit data to QR-coded 8 bit data (numeric or alphanum, or kanji not supported)
v = strinbuf.length;
// string to array
for (i = 0; i < v; i++)
eccbuf[i] = strinbuf.charCodeAt(i);
strinbuf = eccbuf.slice(0);
// calculate max string length
x = datablkw * (neccblk1 + neccblk2) + neccblk2;
if (v >= x - 2) {
v = x - 2;
if (version > 9)
v--;
}
// shift and repack to insert length prefix
i = v;
if (version > 9) {
strinbuf[i + 2] = 0;
strinbuf[i + 3] = 0;
while (i--) {
t = strinbuf[i];
strinbuf[i + 3] |= 255 & (t << 4);
strinbuf[i + 2] = t >> 4;
}
strinbuf[2] |= 255 & (v << 4);
strinbuf[1] = v >> 4;
strinbuf[0] = 0x40 | (v >> 12);
}
else {
strinbuf[i + 1] = 0;
strinbuf[i + 2] = 0;
while (i--) {
t = strinbuf[i];
strinbuf[i + 2] |= 255 & (t << 4);
strinbuf[i + 1] = t >> 4;
}
strinbuf[1] |= 255 & (v << 4);
strinbuf[0] = 0x40 | (v >> 4);
}
// fill to end with pad pattern
i = v + 3 - (version < 10);
while (i < x) {
strinbuf[i++] = 0xec;
// buffer has room if (i == x) break;
strinbuf[i++] = 0x11;
}
// calculate and append ECC
// calculate generator polynomial
genpoly[0] = 1;
for (i = 0; i < eccblkwid; i++) {
genpoly[i + 1] = 1;
for (j = i; j > 0; j--)
genpoly[j] = genpoly[j]
? genpoly[j - 1] ^ gexp[modnn(glog[genpoly[j]] + i)] : genpoly[j - 1];
genpoly[0] = gexp[modnn(glog[genpoly[0]] + i)];
}
for (i = 0; i <= eccblkwid; i++)
genpoly[i] = glog[genpoly[i]]; // use logs for genpoly[] to save calc step
// append ecc to data buffer
k = x;
y = 0;
for (i = 0; i < neccblk1; i++) {
appendrs(y, datablkw, k, eccblkwid);
y += datablkw;
k += eccblkwid;
}
for (i = 0; i < neccblk2; i++) {
appendrs(y, datablkw + 1, k, eccblkwid);
y += datablkw + 1;
k += eccblkwid;
}
// interleave blocks
y = 0;
for (i = 0; i < datablkw; i++) {
for (j = 0; j < neccblk1; j++)
eccbuf[y++] = strinbuf[i + j * datablkw];
for (j = 0; j < neccblk2; j++)
eccbuf[y++] = strinbuf[(neccblk1 * datablkw) + i + (j * (datablkw + 1))];
}
for (j = 0; j < neccblk2; j++)
eccbuf[y++] = strinbuf[(neccblk1 * datablkw) + i + (j * (datablkw + 1))];
for (i = 0; i < eccblkwid; i++)
for (j = 0; j < neccblk1 + neccblk2; j++)
eccbuf[y++] = strinbuf[x + i + j * eccblkwid];
strinbuf = eccbuf;
// pack bits into frame avoiding masked area.
x = y = width - 1;
k = v = 1; // up, minus
/* inteleaved data and ecc codes */
m = (datablkw + eccblkwid) * (neccblk1 + neccblk2) + neccblk2;
for (i = 0; i < m; i++) {
t = strinbuf[i];
for (j = 0; j < 8; j++ , t <<= 1) {
if (0x80 & t)
qrframe[x + width * y] = 1;
do { // find next fill position
if (v)
x--;
else {
x++;
if (k) {
if (y != 0)
y--;
else {
x -= 2;
k = !k;
if (x == 6) {
x--;
y = 9;
}
}
}
else {
if (y != width - 1)
y++;
else {
x -= 2;
k = !k;
if (x == 6) {
x--;
y -= 8;
}
}
}
}
v = !v;
} while (ismasked(x, y));
}
}
// save pre-mask copy of frame
strinbuf = qrframe.slice(0);
t = 0; // best
y = 30000; // demerit
// for instead of while since in original arduino code
// if an early mask was "good enough" it wouldn't try for a better one
// since they get more complex and take longer.
for (k = 0; k < 8; k++) {
applymask(k); // returns black-white imbalance
x = badcheck();
if (x < y) { // current mask better than previous best?
y = x;
t = k;
}
if (t == 7)
break; // don't increment i to a void redoing mask
qrframe = strinbuf.slice(0); // reset for next pass
}
if (t != k) // redo best mask - none good enough, last wasn't t
applymask(t);
// add in final mask/ecclevel bytes
y = fmtword[t + ((ecclevel - 1) << 3)];
// low byte
for (k = 0; k < 8; k++ , y >>= 1)
if (y & 1) {
qrframe[(width - 1 - k) + width * 8] = 1;
if (k < 6)
qrframe[8 + width * k] = 1;
else
qrframe[8 + width * (k + 1)] = 1;
}
// high byte
for (k = 0; k < 7; k++ , y >>= 1)
if (y & 1) {
qrframe[8 + width * (width - 7 + k)] = 1;
if (k)
qrframe[(6 - k) + width * 8] = 1;
else
qrframe[7 + width * 8] = 1;
}
return qrframe;
}
var _canvas = null;
export const api = {
get ecclevel() {
return ecclevel;
},
set ecclevel(val) {
ecclevel = val;
},
get size() {
return _size;
},
set size(val) {
_size = val
},
get canvas() {
return _canvas;
},
set canvas(el) {
_canvas = el;
},
getFrame: function (string) {
return genframe(string);
},
//这里的utf16to8(str)是对Text中的字符串进行转码让其支持中文
utf16to8: function (str) {
var out, i, len, c;
out = "";
len = str.length;
for (i = 0; i < len; i++) {
c = str.charCodeAt(i);
if ((c >= 0x0001) && (c <= 0x007F)) {
out += str.charAt(i);
} else if (c > 0x07FF) {
out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
} else {
out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
}
}
return out;
},
/**
* 新增$this参数传入组件的this,兼容在组件中生成
* @param bg 目前只能设置颜色值
*/
draw: function (str, ctx, startX, startY, cavW, cavH, bg, color, $this, ecc) {
var that = this;
ecclevel = ecc || ecclevel;
if (!ctx) {
console.warn('No canvas provided to draw QR code in!')
return;
}
var size = Math.min(cavW, cavH);
str = that.utf16to8(str);//增加中文显示
var frame = that.getFrame(str);
var px = size / width;
if (bg) {
ctx.fillStyle = bg
ctx.fillRect(startX, startY, cavW, cavW);
}
ctx.fillStyle = color || 'black'
for (var i = 0; i < width; i++) {
for (var j = 0; j < width; j++) {
if (frame[j * width + i]) {
ctx.fillRect(startX + px * i, startY + px * j, px, px);
}
}
}
}
}

View File

@@ -0,0 +1,60 @@
const isValidUrl = url => {
return /(ht|f)tp(s?):\/\/([^ \\/]*\.)+[^ \\/]*(:[0-9]+)?\/?/.test(url)
}
/**
* 深度对比两个对象是否一致
* from: https://github.com/epoberezkin/fast-deep-equal
* @param {Object} a 对象a
* @param {Object} b 对象b
* @return {Boolean} 是否相同
*/
/* eslint-disable */
const equal = (a, b) => {
if (a === b) return true
if (a && b && typeof a == 'object' && typeof b == 'object') {
var arrA = Array.isArray(a),
arrB = Array.isArray(b),
i,
length,
key
if (arrA && arrB) {
length = a.length
if (length != b.length) return false
for (i = length; i-- !== 0; ) if (!equal(a[i], b[i])) return false
return true
}
if (arrA != arrB) return false
var dateA = a instanceof Date,
dateB = b instanceof Date
if (dateA != dateB) return false
if (dateA && dateB) return a.getTime() == b.getTime()
var regexpA = a instanceof RegExp,
regexpB = b instanceof RegExp
if (regexpA != regexpB) return false
if (regexpA && regexpB) return a.toString() == b.toString()
var keys = Object.keys(a)
length = keys.length
if (length !== Object.keys(b).length) return false
for (i = length; i-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false
for (i = length; i-- !== 0; ) {
key = keys[i]
if (!equal(a[key], b[key])) return false
}
return true
}
return a !== a && b !== b
}
export { isValidUrl, equal }

View File

@@ -0,0 +1,18 @@
export default function h5Copy(content) {
if (!document.queryCommandSupported('copy')) {
// 不支持
return false
}
let textarea = document.createElement("textarea")
textarea.value = content
textarea.readOnly = "readOnly"
document.body.appendChild(textarea)
textarea.select() // 选择对象
textarea.setSelectionRange(0, content.length) //核心
let result = document.execCommand("copy") // 执行浏览器复制命令
textarea.remove()
return result
}

View File

@@ -13,7 +13,9 @@ import uView from "uview-ui";
Vue.use(uView);
const app = new Vue({
...App
...App
})
Vue.component('no-list',noList)
//v1.3.5起 H5端 你应该去除原有的app.$mount();使用路由自带的渲染方式

View File

@@ -137,5 +137,10 @@
},
"uniStatistics" : {
"enable" : false
},
"h5" : {
"router" : {
"mode" : "hash"
}
}
}

View File

@@ -54,6 +54,23 @@
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#e93340"
}
},
{
"path": "pages/property/coupon/confirmOrder",
"name": "ConfirmOrder",
"style": {
"navigationBarTitleText": "订单确认页面",
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#e93340"
}
},{
"path": "pages/property/coupon/payStatus",
"name": "PayStatus",
"style": {
"navigationBarTitleText": "支付状态",
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#e93340"
}
}, {
"path": "pages/property/order/numberWeight",
"name": "NumberWeight",
@@ -112,6 +129,15 @@
"navigationBarBackgroundColor": "#e93340"
}
},
{
"path": "pages/property/coupon/canUseList",
"name": "CanUseList",
"style": {
"navigationBarTitleText": "可兑换商品列表",
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#039bfe"
}
},
{
"path": "pages/property/coupon/coupon",
"name": "CouponList",
@@ -139,6 +165,70 @@
"navigationBarBackgroundColor": "#e93340",
"navigationBarTitleText": "优惠券详情"
}
},{
"path": "pages/property/collection/collection",
"name": "Collection",
"style": {
"enablePullDownRefresh": true,
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#e93340",
"navigationBarTitleText": "收藏的企业"
}
},{
"path": "pages/property/historyShop/historyShop",
"name": "HistoryShop",
"style": {
"enablePullDownRefresh": true,
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#e93340",
"navigationBarTitleText": "我的足迹"
}
},{
"path": "pages/property/order/servicesOrder",
"name": "ServicesOrder",
"style": {
"enablePullDownRefresh": true,
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#e93340",
"navigationBarTitleText": "已使用服务类订单"
}
},{
"path": "pages/property/order/servicesOrderInfo",
"name": "ServicesOrderInfo",
"style": {
"enablePullDownRefresh": true,
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#e93340",
"navigationBarTitleText": "订单详情"
}
},{
"path": "pages/property/setting/setting",
"name": "Setting",
"style": {
"enablePullDownRefresh": true,
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#e93340",
"navigationBarTitleText": "设置中心"
}
},{
"path": "pages/property/eb",
"name": "Eb",
"style": {
"enablePullDownRefresh": true,
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#f40c50",
"navigationBarTitleText": "我的EB"
}
},
{
"path": "pages/property/record",
"name": "Record",
"style": {
"enablePullDownRefresh": true,
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#f40c50",
"navigationBarTitleText": "我的零钱"
}
},
{
"path": "pages/goods/details",
@@ -191,7 +281,16 @@
"name": "Vip",
"style": {
"navigationBarTitleText": "会员",
"navigationBarBackgroundColor": "#1f1b1c",
"navigationBarBackgroundColor": "#e93340",
"navigationBarTextStyle": "white",
"backgroundColor": "#fefaef"
}
}, {
"path": "pages/vip/agree",
"name": "vipAgree",
"style": {
"navigationBarTitleText": "用户协议",
"navigationBarBackgroundColor": "#e93340",
"navigationBarTextStyle": "white",
"backgroundColor": "#fefaef"
}
@@ -205,7 +304,8 @@
"path": "pages/market/logs",
"name": "marketLogs",
"style": {
"navigationBarTitleText": "成交历史"
"navigationBarTitleText": "成交历史",
"navigationBarBackgroundColor":"#FFFFFF"
}
}, {
"path": "pages/order/buy",
@@ -259,6 +359,13 @@
"navigationBarTitleText": "成交客户",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, {
"path": "pages/store/examine",
"name": "Examine",
"style": {
"navigationBarTitleText": "退货单审核",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, {
"path": "pages/store/basics",
"name": "Basics",
@@ -276,6 +383,55 @@
}
}
}
}, {
"path": "pages/store/Spread",
"name": "Spread",
"style": {
"navigationBarTitleText": "营销推广码",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, {
"path": "pages/store/return",
"name": "Return",
"style": {
"navigationBarTitleText": "退货单处理",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, {
"path": "pages/store/orderDetails",
"name": "storeOrderDetails",
"style": {
"navigationBarTitleText": "订单详情",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, {
"path": "pages/store/deliver",
"name": "Deliver",
"style": {
"navigationBarTitleText": "发货单处理",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, {
"path": "pages/store/deliverForm",
"name": "DeliverForm",
"style": {
"navigationBarTitleText": "我要发货",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, {
"path": "pages/store/logistic",
"name": "Logistic",
"style": {
"navigationBarTitleText": "提货单物流",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, {
"path": "pages/store/journal",
"name": "storeJournal",
"style": {
"navigationBarTitleText": "操作日志",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, {
"path": "pages/employees/list",
"name": "Employees",
@@ -325,6 +481,13 @@
"navigationBarTitleText": "选择权证分类",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, {
"path": "pages/goods/goodsClassify",
"name": "goodsClassify",
"style": {
"navigationBarTitleText": "商品分类",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, {
"path": "pages/goods/add",
"name": "GoodsMagAdd",
@@ -332,6 +495,27 @@
"navigationBarTitleText": "发布权证",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, {
"path": "pages/goods/chain",
"name": "GoodsChain",
"style": {
"navigationBarTitleText": "区块链证书",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, {
"path": "pages/goods/attestation",
"name": "GoodsAttestation",
"style": {
"navigationBarTitleText": "商品认证",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, {
"path": "pages/goods/tracedTo",
"name": "GoodstracedTo",
"style": {
"navigationBarTitleText": "商品溯源",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, {
"path": "pages/coupons/index",
"name": "Coupons",
@@ -339,6 +523,16 @@
"navigationBarTitleText": "优惠券"
}
}, {
"path": "pages/coupons/couponList",
"name": "CouponsList",
"style": {
"enablePullDownRefresh": true,
"navigationBarTextStyle": "white",
"navigationBarTitleText": "优惠券列表",
"navigationBarBackgroundColor": "#e93340"
}
},
{
"path": "pages/coupons/management",
"name": "CouponsMag",
"style": {
@@ -377,13 +571,17 @@
"path": "pages/verification/index",
"name": "Verification",
"style": {
"navigationBarTitleText": "扫码验证"
"navigationBarTitleText": "扫码验证",
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#076cff"
}
}, {
"path": "pages/verification/details",
"name": "VerificationDetails",
"path": "pages/verification/history",
"name": "VerificationHistory",
"style": {
"navigationBarTitleText": "核销券详情"
"navigationBarTitleText": "核销记录",
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#076cff"
}
}, {
"path": "pages/shop/lists",
@@ -407,8 +605,137 @@
"navigationBarTitleText": "创建门店/部门",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, {
"path": "pages/goods/goodsAuth",
"name": "goodsAuth",
"style": {
"navigationBarTitleText": "商品认证信息",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, {
"path" : "pages/market/details",
"name" : "marketDetails",
"style" : {
"navigationBarTitleText": "转让详情"
}
},{
"path" : "pages/market/goods",
"name" : "marketGoods",
"style": {
"navigationBarTitleText": "锚定商品",
"titleNView": {
"backgroundColor": "#FFFFFF",
"type": "transparent"
}
}
},{
"path" : "pages/pay/results",
"name" : "payResults",
"style": {
"navigationBarTitleText": "支付结果",
"backgroundColor": "#FFFFFF"
}
},{
"path" : "pages/market/transfer",
"name" : "marketTransfer",
"style": {
"navigationBarTitleText": "转让权证",
"backgroundColor": "#FFFFFF"
}
},{
"path" : "pages/market/management",
"name" : "marketManag",
"style": {
"navigationBarTitleText": "权证转让管理",
"titleNView": {
"backgroundColor": "#FFFFFF",
"buttons": [{
"text": "转让记录",
"fontSize": "14",
"width": "80",
"color": "#e93340"
}]
}
}
},
{
"path": "pages/wallet/property",
"name": "walletProperty",
"style": {
"navigationBarTitleText": "能量钱包",
"enablePullDownRefresh": false,
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor":"#e93340"
}
}, {
"path": "pages/wallet/redProperty",
"name": "walletRedProperty",
"style": {
"navigationBarTitleText": "现金红包",
"enablePullDownRefresh": false,
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor":"#e93340"
}
},
{
"path": "pages/wallet/extract",
"name": "Extract",
"style": {
"navigationBarTitleText": "原石转零钱",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#e93340",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/wallet/extractRed",
"name": "ExtractRed",
"style": {
"navigationBarTitleText": "我的零钱",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#e93340",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/wallet/fragment",
"name": "Fragment",
"style": {
"navigationBarTitleText": "贡献值记录",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#e93340",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/wallet/addBank",
"style": {
"navigationBarTitleText": "添加银行卡",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#e93340",
"navigationBarTextStyle": "white"
},
"name": "addBank"
}, {
"path": "pages/wallet/bankList",
"style": {
"navigationBarTitleText": "银行卡列表",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#e93340",
"navigationBarTextStyle": "white"
},
"name": "bankList"
}, {
"path": "pages/wallet/withdrawList",
"style": {
"navigationBarTitleText": "零钱提现记录",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#e93340",
"navigationBarTextStyle": "white"
},
"name": "withdrawList"
}
],
],
"tabBar": {
"color": "#bababa",
"selectedColor": "#e93340",
@@ -438,7 +765,7 @@
},
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "易货",
"navigationBarTitleText": "易货-易你所想",
"navigationBarBackgroundColor": "#f5f5f5",
"backgroundColor": "#f5f5f5"
},

View File

@@ -32,6 +32,10 @@
<uni-icons class="picker-icon" type="arrowdown"></uni-icons>
</view>
</view>
<view class="inputs" v-if="is_range">
<label>经营范围</label>
<textarea :auto-height='true' v-model="range" placeholder="输入经营范围" />
</view>
<view class="inputs">
<label>法人姓名</label>
<input type="text" v-model="corporate" placeholder="输入法人姓名" />
@@ -93,7 +97,9 @@
industryIndex: 0,
reason : '',
category : [],
categorys : []
categorys : [],
range : "",
is_range :false,
};
},
created(){
@@ -103,6 +109,7 @@
this.industry = res.industries
this.formType = this.$Route.query.formType
this.name = res.info.name
this.is_range = res.is_range
this.industryIndex = res.industries.findIndex(val => val.industry_id === res.info.industry.industry_id) || 0
if(this.formType === 'put'){
appliesInfo().then(formValue => {
@@ -159,7 +166,8 @@
id_card : this.identity,
code : this.org,
industry_id : this.industry[this.industryIndex].industry_id,
categories : this.categorys
categories : this.categorys,
range : this.range
}, method).then(res => {
uni.showModal({
title : '提示',
@@ -167,7 +175,7 @@
showCancel : false,
confirmText : '确认',
success : resModal => {
this.$Router.back()
this.$Router.pushTab({name: "Store"})
}
})
}).catch(err => {
@@ -252,6 +260,8 @@
padding-left: 200rpx;
line-height: 90rpx;
min-height: 90rpx;
display: flex;
flex-direction: row;
label{
position: absolute;
top: 0;
@@ -259,12 +269,15 @@
width: 200rpx;
font-size: $title-size;
}
input{
input,textarea,picker{
flex: 1;
height: 90rpx;
line-height: 90rpx;
font-size: $title-size;
}
.picker-text{
flex: 1;
font-size: $title-size;
position: relative;
padding-right: 90rpx;
.picker-icon{

View File

@@ -79,7 +79,21 @@
<label class="input-label">{{timeIndex == 0 ? '券有效期': '延期天数'}}</label>
<block v-if="timeIndex === 0">
<view class="input-text" @click="showDatePicker = true">{{datePickerValue.length == 0 ? '选择优惠券有效期区间': datePickerValue[0] + ' ' + datePickerValue[1]}}<uni-icons class="picker-icon" type="arrowdown" size="14" /></view>
<tn-date-picker :show="showDatePicker" :monthNum="12" color="#e93340" :showTips="true" beginText="开始日期" endText="结束日期" @confirm="confirmDatePicker" @cancel="showDatePicker = false"/>
<u-calendar
:safe-area-inset-bottom="true"
v-model="showDatePicker"
mode="range"
active-bg-color="#e93340"
range-bg-color="rgba(0, 0, 0, .05)"
range-color="#e93340"
btn-type="default"
max-date="2099-12-12"
:min-date="minDate"
@change="confirmDatePicker"
>
</u-calendar>
</u-calendar>
<!-- <tn-date-picker :show="showDatePicker" :monthNum="12" color="#e93340" :showTips="true" beginText="开始日期" endText="结束日期" @confirm="confirmDatePicker" @cancel="showDatePicker = false"/> -->
</block>
<block v-if="timeIndex === 1">
<view class="input-number">
@@ -107,6 +121,7 @@
</template>
<script>
import date from '@/public/date'
import TnDatePicker from "@/components/tn-datepicker/tn-datepicker";
import { uploads } from '@/apis/interfaces/uploading'
import { pushCoupons } from '@/apis/interfaces/coupons'
@@ -124,8 +139,8 @@
],
timeIndex : 0,
times : [
{ type: 2, text: '固定时间(区间范围)' },
{ type: 1, text: '延期券(用户领取后有效天数)' }
{ type: 1, text: '固定时间(区间范围)' },
{ type: 2, text: '延期券(用户领取后有效天数)' }
],
showDatePicker : false, // 活动弹出层时间
datePickerValue : [], // 活动时间
@@ -138,12 +153,19 @@
price : '', // 减少金额
description : '', // 使用规则
coupongoods : [], // 关联商品
timeNumber : 1 // 延期券时间
timeNumber : 1 , // 延期券时间
minDate : '' // 优惠券最小期限
};
},
onShow(){
new date().then(res => {
this.minDate = res
})
this.coupongoods = this.$store.getters.getCoupongoods
},
onUnload() {
this.$store.commit('setCoupongoods', [])
},
methods:{
// 发券数量
quantityChange(value){
@@ -163,11 +185,15 @@
},
// 选择
changePicker(e){
if(e.target.dataset.type === 'typeIndex'){
this.$store.commit('setCoupongoods', [])
this.coupongoods = this.$store.getters.getCoupongoods
}
this[e.target.dataset.type] = e.detail.value
},
// 日期
confirmDatePicker(e){
this.datePickerValue = e.value
this.datePickerValue = [e.startDate , e.endDate]
this.showDatePicker = false
},
// 上传优惠券封面
@@ -206,11 +232,17 @@
start_at : this.datePickerValue[0],
end_at : this.datePickerValue[1],
description : this.description,
time_type : this.times[this.typeIndex].type,
time_type : this.times[this.timeIndex].type,
days : this.timeNumber,
goodsable_ids : this.coupongoods
}
if(valuss.description === ''){
uni.showToast({
title:'请添加使用规则',
icon:'none'
})
return;
}
pushCoupons(valuss).then(res => {
uni.showModal({
title : '提示',

File diff suppressed because one or more lines are too long

View File

@@ -188,7 +188,7 @@
.cover{
position: relative;
border-right: dashed 3rpx $border-color;
width: 148rpx;
width: 208rpx;
text-align: center;
.cover-img{
width: 148rpx;
@@ -234,7 +234,7 @@
}
.mian{
justify-content: center;
width: calc(100% - 148rpx - #{$padding*2});
width: calc(100% - 208rpx);
box-sizing: border-box;
@extend .vertical;
.title{

View File

@@ -1,7 +1,7 @@
<template>
<view>
<!-- 商品列表 -->
<view class="lists">
<view class="lists" v-if="goods.length>0">
<view class="goods-item" v-for="(item, index) in goods" :key="index">
<checkbox class="checkbox" :checked="item.isSelect" @click="onSelect(index)"/>
<view class="mian">
@@ -16,6 +16,7 @@
</view>
<view class="ios-bottom"></view>
</view>
<no-list v-if="goods.length === 0" name='no-goods' txt="没有可勾选商品列表~" />
<!-- footer -->
<view class="footer">
<view class="footer-flex">

View File

@@ -18,13 +18,13 @@
<input type="text" v-model="name" placeholder="姓名"/>
</view>
<view class="info-inputs">
<input type="number" v-model="phone" placeholder="手机号码"/>
<input type="number" :disabled="$Route.query.type === 'PUT'?true:false" v-model="phone" placeholder="手机号码为员工唯一登录凭证"/>
</view>
<view class="info-inputs">
<input type="text" v-model="job" placeholder="职业"/>
</view>
<view class="info-inputs">
<picker :range="section" range-key="name" :value="sectionIndex" @change="pickerChange">
<picker :range="section" range-key="name" :value="sectionIndex + ''" @change="pickerChange">
<view class="picker-text">
{{section[sectionIndex].name}}
<uni-icons class="icon" type="arrowdown" color="#555"></uni-icons>
@@ -50,7 +50,7 @@
<label>
<view class="item-title">{{item.title}}</view>
<view class="item-info">{{item.description}}</view>
<checkbox class="item-checkbox" :checked="item.check" color="#e93340" :value="item.permission_id" />
<checkbox class="item-checkbox" :checked="item.check" color="#e93340" :value="item.permission_id+''" />
</label>
</view>
</checkbox-group>
@@ -73,7 +73,7 @@
section : [],
permissions : [],
permissionIds: [],
sectionIndex : 0,
sectionIndex : '0',
cover : {
showpath : '',
path : ''

View File

@@ -12,9 +12,9 @@
<uni-swipe-action-item :rightOptions="options" @click="onEmployees($event, listIndex, index)">
<view class="employees-item">
<view class="cover">
<block v-if="item.user.avatar === ''">{{item.name.slice(0,1)}}</block>
<block v-if="item.cover === ''">{{item.name.slice(0,1)}}</block>
<block v-else>
<image class="cover-img" :src="item.user.avatar" mode="aspectFill"></image>
<image class="cover-img" :src="item.cover" mode="aspectFill"/>
</block>
</view>
<view class="content">

View File

@@ -87,12 +87,22 @@
</view>
</swiper-item>
</swiper>
<!-- 行业分类 -->
<scroll-view class="industry-tabs" scroll-x>
<view class="industry-item" :class="{'show':index === industryIndex}" v-for="(item, index) in industryBus" :key="index" @click="onBusIndustry(index)">{{item.title}}</view>
</scroll-view>
<v-tabs
v-model="industryIndex"
:tabs="industryBus"
color="#555555"
activeColor="#e93340"
fontSize="30rpx"
height="80rpx"
lineHeight="6rpx"
lineColor="#e93340"
bgColor="#f5f5f5"
@change="onBusIndustry"
></v-tabs>
<!-- 商家 -->
<industry-list :list="busList" @on-industry="onOpenWechat"/>
<!-- 分页 -->
<uni-load-more v-if="busList.length > 0" :status="pageStatus" :iconSize="16"></uni-load-more>
</block>
<!-- 易货商城 -->
<block v-if="tabIndex === 0">
@@ -142,7 +152,7 @@
<view class="title">
限时抢购<text>海量商家优惠券</text>
</view>
<navigator class="more" url="#">查看更多</navigator>
<view class="more" @click="onCoupons('more')">查看更多</view>
</view>
<view class="coupons" v-if="coupons.length > 0">
<view class="coupons-item" v-for="(item, index) in coupons" :key="index">
@@ -163,20 +173,23 @@
<view class="logo">
<image class="logo-img" :src="item.cover" mode="aspectFill"></image>
</view>
<view class="btn">立即领取</view>
<button class="btn" :disabled="!item.can.get" @click="onCoupons('get', item.coupon_id, index)">{{item.can.get ? '立即领取' : '已领取'}}</button>
</view>
</view>
<!-- 优选商品 -->
<goods-list :list="goods" priceType="CNY" @on-goods="onGoods" />
<!-- 分页 -->
<uni-load-more :status="pageStatus" :iconSize="16"></uni-load-more>
</block>
</view>
</template>
<script>
import { companies, companiesList } from '@/apis/interfaces/company'
import { mall, list } from '@/apis/interfaces/goods'
import { mall, list, managesCoupons } from '@/apis/interfaces/goods'
import goodsList from '@/components/goods-list/goods-list'
import industryList from '@/components/industry-list/industry-list'
import userAuth from '@/public/userAuth'
export default{
comments:{
goodsList,
@@ -205,14 +218,16 @@
coupons : [],
position : {},
goods : [],
pages : {},
goodsPage : 1,
// 广场部分
industryIndex: 0,
recommendBus : [],
hotBus : [],
industryBus : [],
busList : [],
busPages : {}
busPage : 1,
// 分页
pageStatus : ''
};
},
created() {
@@ -233,10 +248,38 @@
onRightBtn(e){
switch(e.index){
case 0:
this.$Router.push({name: 'Search'})
this.$Router.push({name: 'Search', params: {type: this.tabIndex}})
break
}
},
// 领取,更多优惠券
onCoupons(type, id, index){
let token = this.$store.getters.getToken
if(token == ''){
let userLogin = new userAuth()
userLogin.Login()
return
}
if(type === 'more'){
this.$Router.push({name: 'CouponsList'})
return
}
if(type === 'get'){
managesCoupons(id).then(res=>{
this.$set(this.coupons, index, res)
uni.showToast({
title: '领取成功',
type: 'primary',
duration: 3000
})
}).catch(err => {
uni.showToast({
icon : 'none',
title: err.message
})
})
}
},
// 企业广场
getCompanies(){
companies().then(res=>{
@@ -254,21 +297,26 @@
// 企业广场行业
onBusIndustry(index){
this.industryIndex = index
this.busPage = 1
this.getCompaniesList()
},
// 企业列表
getCompaniesList(){
companiesList({
industry_id: this.industryBus[this.industryIndex].industry_id
industry_id: this.industryBus[this.industryIndex].industry_id,
page : this.busPage
}).then(res => {
this.busList = res.data
this.busPages = res.pages
if(res.page.current === 1){
this.busList = []
}
this.busList = this.busList.concat(res.data)
this.busPage = res.page.current
this.pageStatus = res.page.has_more ? 'more': 'noMore'
})
},
// 易货首页
getMall(){
mall().then(res => {
console.log(res.coupons)
mall().then(res => {
this.classify = res.categories.slice(0, 9)
this.banners = res.banners
this.coupons = res.coupons
@@ -283,9 +331,15 @@
},
// 商品列表
getGoods(){
list().then(res => {
this.goods = res.data
this.pages = res.page
list({
page: this.goodsPage
}).then(res => {
if(res.page.current === 1){
this.goods = []
}
this.goods = this.goods.concat(res.data)
this.goodsPage = res.page.current
this.pageStatus = res.page.has_more ? 'more': 'noMore'
})
},
// 商品详情
@@ -298,7 +352,6 @@
},
// 打开微信小程序
onOpenWechat(e){
console.log(e)
plus.share.getServices(res => {
let sweixin = null;
for(let val of res){
@@ -324,6 +377,22 @@
}
})
}
},
// 下拉加载
onReachBottom() {
if(this.pageStatus == 'more'){
this.pageStatus = 'loading'
switch (this.tabIndex){
case 0:
this.goodsPage += 1
this.getGoods()
break;
case 1:
this.busPage += 1
this.getCompaniesList()
break;
}
}
}
}
</script>
@@ -527,29 +596,17 @@
text-align: center;
line-height: 64rpx;
font-size: 28rpx;
font-weight: 600;
font-weight: 600;
&[disabled]{
background: rgba($color: #faf2dd, $alpha: .8);
color: rgba($color: #fd5f3c, $alpha: .5);
}
&::after{
border: none;
}
}
}
}
// 行业分类
.industry-tabs{
white-space:nowrap;
.industry-item{
margin-left: $margin;
display: inline-block;
line-height: 50rpx;
font-size: $title-size-lg;
color: $text-gray;
&:last-child{
margin-right: $margin;
}
&.show{
color: $text-price;
font-size: $title-size;
font-weight: bold;
}
}
}
// 热易商家
.hot-swiper{
margin: 0 $margin $margin $margin;

View File

@@ -1,22 +1,295 @@
<template>
<view>
搜索
<view class="top">
<view class="search">
<input class="search-input" type="text" focus @input="onInput" :placeholder="nameVal" />
<view class="search-btn" @click="searchClick">搜索</view>
</view>
<view class="tabs">
<view class="tabs-item" @click="onTabs">
{{searchType == 0 ? '价格' : '信用值'}}
<image
class="icon"
mode="widthFix" :src="require(marketType == 'asc' ? '@/static/icons/market_icon_low.png': '@/static/icons/market_icon_high.png')"
/>
</view>
<view class="tabs-item" v-if="searchType == 0" @click="pageUrl">全部分类 <image class="tabs-item-arrow" src="@/static/icons/search_row.png" mode=""></image></view>
<view class="tabs-item" v-if="searchType == 1" @click="companyOpne">{{companyName}} <image class="tabs-item-arrow" src="@/static/icons/search_row.png" mode=""></image></view>
</view>
</view>
<view class="lists">
<!-- 优选商品 -->
<goods-list :list="searchArr" priceType="CNY" v-if="searchType == 0" @on-goods="onGoods" />
<!-- 商家 -->
<industry-list :list="searchArr" v-if="searchType == 1" @on-industry="onOpenWechat"/>
</view>
<!-- 分页 -->
<uni-load-more :status="pageStatus" :iconSize="16" v-if="searchArr.length > 0"></uni-load-more>
<!-- 企业分类弹出 -->
<view class="companyBack" :class="companyShow ? 'active' : ''"></view>
<view class="companyPopup" :class="companyShow ? 'active' : ''">
<view class="nowrap companyPopup-label" :class="{'show': item.industry_id == companyId}" v-for="(item, index) in categoryArr" :key="index" @click="companyList(item.industry_id, index)">
{{item.title}}
</view>
</view>
</view>
</template>
<script>
import { searchUrl, companyCategory, randgoodsUrl } from '@/apis/interfaces/goods'
export default {
data() {
return {
nameVal : '',
searchArr : [],
searchType : '0', // 分类 0位商品 1为企业
marketType : 'asc', // 排序
categoryArr : [], // 分类数组--企业
companyId : '', // 分类数组--企业id
companyName : '选择行业',
companyShow : false,
// 分页
pageStatus : '',
page : 1
}
},
created() {
this.searchType = this.$Route.query.type
// 商品分类默认关键字 type=0为商品列表; type=1为企业列表
let wechaUrl = '' // 定义接口来源名称
if (this.searchType == '0') wechaUrl = 'mall/randgoods' //商品关键字
if (this.searchType == '1') wechaUrl = 'companies/rand' //商品关键字
randgoodsUrl(wechaUrl, {
type: 1
}).then(res => {
this.nameVal = res.name
})
// 企业分类数据
if(this.searchType == '1'){
companyCategory().then(res => {
this.categoryArr = res
})
}
},
methods: {
}
// 商品详情
onGoods(e){
this.$Router.push({name: 'goodsDetails', params: {id: e.goods_id}})
},
// 打开微信小程序
onOpenWechat(e){
plus.share.getServices(res => {
let sweixin = null;
for(let val of res){
if(val.id === 'weixin'){
sweixin = val
}
}
/** 以此为例子 显示跳转引导页
* 'index_4'
* index 跳小程序企业首页
* 4 企业id
**/
if(sweixin != null){
sweixin.launchMiniProgram({
id : e.original_id,
path: 'pages/login/guide?scene=index_' + e.company_id,
})
}else{
uni.showToast({
title: '当前环境不支持打开微信小程序',
icon : 'none'
})
}
})
},
// 列表数据
getList() {
// type=0为商品列表; type=1为企业列表
let wechaUrl = '' // 定义接口来源名称
if (this.searchType == '0') wechaUrl = 'mall/goods'// 商品列表
if (this.searchType == '1') wechaUrl = 'companies/lists' //企业列表
searchUrl(wechaUrl, {
page : this.goodsPage,
order_by : this.marketType,
industry_id : this.companyId,
name : this.nameVal
}).then(res => {
if(res.page.current === 1){
this.searchArr = []
}
this.searchArr = this.searchArr.concat(res.data)
this.goodsPage = res.page.current
this.pageStatus = res.page.has_more ? 'more': 'noMore'
})
},
// 输入关键词
onInput(val) {
this.nameVal = val.detail.value
},
// 搜索
searchClick() {
// 获取列表
this.getList();
},
// 筛选产品
onTabs(e){
this.marketType = this.marketType == 'asc' ? 'desc': 'asc'
this.getList()
},
// 商品分类跳转
pageUrl() {
this.$Router.push({name: 'goodsClassify'})
},
// 查看企业行业
companyOpne(){
this.companyShow = !this.companyShow
},
// 筛选企业列表
companyList(id, index) {
this.companyId = id
this.companyName = this.categoryArr[index].title
this.companyShow = false
// 获取全局列表
this.getList();
}
},
// 下拉加载
onReachBottom() {
if(this.pageStatus == 'more'){
this.pageStatus = 'loading'
this.goodsPage += 1
this.getList()
}
}
}
</script>
<style>
<style lang="scss" scoped>
.top{
position: fixed;
top: 0;
left: 0;
z-index: 9;
width: 100%;
height: 180rpx;
.search {
background: white;
height: 100rpx;
width: 100%;
padding: 20rpx $padding 0;
box-sizing: border-box;
display: flex;
.search-input {
padding: 0 $padding;
box-sizing: border-box;
height: 60rpx;
background-color: #f7f7f7;
font-size: $title-size-m;
border-radius: 80rpx;
flex: 1;
margin-right: $margin;
}
.search-btn {
line-height: 60rpx;
color: #e93340;
}
}
.tabs{
background: white;
display: flex;
justify-content: space-around;
height: 80rpx;
margin-bottom: 20rpx;
box-sizing: border-box;
line-height: 80rpx;
text-align: center;
.tabs-item{
font-size: $title-size-m;
color: $text-gray;
.icon{
width: 32rpx;
height: 32rpx;
vertical-align: middle;
margin-left: $margin / 3;
margin-bottom: 4rpx;
}
&.show{
color: $text-price;
}
.tabs-item-arrow {
width: 24rpx;
height: 24rpx;
margin-left: 10rpx;
}
}
}
}
// 列表
.lists{
padding: 180rpx 0 $padding;
}
// 企业弹出
.companyBack,
.companyPopup {
position: fixed;
top: 200rpx;
left: 0;
width: 100%;
z-index: 99;
}
.companyBack {
height: calc(100% - 200rpx);
background-color: rgba(0,0,0,.2);
display: none;
&.active {
display: block;
}
}
.companyPopup {
height: 45%;
overflow: hidden;
overflow-y: scroll;
border-top: 1rpx solid #f1f1f1;
background-color: #FFFFFF;
padding: $padding - 10 $padding;
display: none;
box-sizing: border-box;
.companyPopup-label {
width: calc(25% - 20rpx);
font-size: $title-size-sm - 2;
display: inline-block;
height: 60rpx;
line-height: 58rpx;
border: 1rpx solid #F8F8F8;
background-color: #FFFFFF;
margin: 10rpx;
text-align: center;
&.show {
color: #e93340;
border-color: #efd3d3;
background-color: #fef9f9;
}
}
&.active {
display: block;
}
}
</style>

View File

@@ -23,7 +23,7 @@
<!-- 商品基本信息 -->
<view class="form-block">
<view class="form-box inputs-flex">
<label class="form-label">品标题</label>
<label class="form-label">品标题</label>
<input type="text" v-model="name" placeholder="输入商品标题"/>
</view>
<view class="form-box inputs-flex">
@@ -32,7 +32,7 @@
</view>
<view class="form-box inputs-flex">
<label class="form-label">规格单位</label>
<input type="digit" :value="skus_unit" placeholder="输入规格单位 如:件"/>
<input type="text" v-model="skus_unit" placeholder="输入规格单位 如:件"/>
</view>
<view class="form-upd">
<view class="form-title">商品详情点击预览长按删除</view>
@@ -72,98 +72,217 @@
</view>
<!-- 商品详情介绍 -->
<view class="form-block">
<!-- is_change query 0 是否支持易货 -->
<view class="form-box inputs-flex">
<label class="form-label">易货起购数量</label>
<input type="number" v-model="skus_number" placeholder="输入易货起购数量"/>
<view class="form-box picker-flex">
<label class="form-label">支持易货</label>
<view class="picker-switch">
<switch :checked="isChange" color="#e93340" @change="pickerChange($event, 'isChange')"/>
</view>
</view>
<view class="form-box inputs-flex" v-if="isChange">
<label class="form-label">最低易货量</label>
<input type="number" v-model="skus_number" placeholder="输入最低易货量"/>
</view>
<view class="form-box inputs-flex">
<label class="form-label">商品库存</label>
<input type="number" v-model="skus_stock" placeholder="输入商品库存"/>
<label class="form-label">发行权证数</label>
<input type="number" v-model="skus_stock" placeholder="输入商品发行权证数"/>
</view>
</view>
<!-- 售后服务 -->
<view class="form-block">
<view class="form-box picker-flex">
<label class="form-label">配送方式</label>
<view class="picker-text">
logistic_type 1.快递2.自提<uni-icons class="picker-icon" type="arrowright" color="#999"></uni-icons>
</view>
<picker :range="logisticArr" range-key="text" :value="logisticType" @change="pickerChange($event, 'logisticType')">
<view class="picker-text">
{{logisticArr[logisticType].text}}
<uni-icons class="picker-icon" type="arrowright" color="#999"></uni-icons>
</view>
</picker>
</view>
<view class="form-box picker-flex">
<view class="form-box picker-flex" v-if="logisticType === 1">
<label class="form-label">关联店铺</label>
<view class="picker-text">
stores 自提必填<uni-icons class="picker-icon" type="arrowright" color="#999"></uni-icons>
<view class="picker-text" @click="opnePopup('storePopup')">
已关联{{stores.length}}家店铺<uni-icons class="picker-icon" type="arrowright" color="#999"></uni-icons>
</view>
</view>
<view class="form-box picker-flex">
<label class="form-label">允许售后</label>
<view class="picker-switch">
<switch :checked="isPostSale" color="#e93340" @change="pickerChange($event, 'isPostSale')"/>
</view>
</view>
<view class="form-box picker-flex">
<label class="form-label">可选服务</label>
<view class="picker-text">
321321<uni-icons class="picker-icon" type="arrowright" color="#999"></uni-icons>
<view class="picker-text" @click="opnePopup('categoryPopup')">
已选{{services.length}}项服务<uni-icons class="picker-icon" type="arrowright" color="#999"></uni-icons>
</view>
</view>
</view>
<!-- 售后服务 -->
<view class="form-block">
<view class="form-block" v-if="type == 2">
<view class="form-box picker-flex">
<label class="form-label">到期时间</label>
<view class="picker-text">
321321<uni-icons class="picker-icon" type="arrowright" color="#999"></uni-icons>
</view>
<picker mode="date" :value="expiriedAt" @change="pickerChange($event, 'expiriedAt')">
<view class="picker-text">
{{expiriedAt || '选择服务到期时间'}}
<uni-icons class="picker-icon" type="arrowright" color="#999"></uni-icons>
</view>
</picker>
</view>
</view>
<!-- 可选服务 -->
<uni-popup ref="categoryPopup">
<view class="category-popup">
<view class="header">
<view class="title">选择商品服务</view>
</view>
<view class="category-flex">
<view class="category-flex-item" :class="{'show' : item.check}" v-for="(item, index) in servicesArr" :key="index" @click="item.check = !item.check">
<view class="category-name">{{item.name}}</view>
<view class="category-content">{{item.content}}</view>
</view>
</view>
<view class="btns">
<button type="default" size="default" @click="affirmCategory('services', 'categoryPopup')">确定</button>
</view>
</view>
</uni-popup>
<!-- 选择店铺 -->
<uni-popup ref="storePopup">
<view class="category-popup">
<view class="header">
<view class="title">选择店铺</view>
</view>
<view class="category-flex">
<view class="category-flex-item" :class="{'show' : item.check}" v-for="(item, index) in storesArr" :key="index" @click="item.check = !item.check">
<view class="category-name">{{item.name}}</view>
<view class="category-content">{{item.address}}</view>
</view>
</view>
<view class="btns">
<button type="default" size="default" @click="affirmCategory('stores', 'storePopup')">确定</button>
</view>
</view>
</uni-popup>
<!-- 安全区 -->
<view class="ios-bottom"></view>
<!-- footer -->
<view class="footer">
<button class="footer-btn" type="default">发布</button>
<button class="footer-btn" type="default" @click="submitAdd">{{type == 2 ? '发布': '发布并认证'}}</button>
<view class="ios-bottom"></view>
</view>
</view>
</template>
<script>
import { managesGoodsCreate, managesCreate } from '@/apis/interfaces/goods'
import { managesGoodsCreate, managesCreate, managesGoodsEdit, managesGoodsPut } from '@/apis/interfaces/goods'
import { uploads } from '@/apis/interfaces/uploading'
export default {
data() {
return {
categoryId : '', // 一级分类
categoryCid : '', // 二级分类
name : '', // 标题
pictures : [], // 轮播图
content : [], // 详情图
description : '', // 商品描述
isPostSale : false, // 是否允许售后
services : [], // 商品服务
skus_cost : '0.00',// 市场价格
skus_price : '0.00',// 销售价格
skus_cost : '', // 市场价格
skus_price : '', // 销售价格
skus_number : 1, // 易货起购数量
skus_unit : '件', // 规格文字
skus_charge : '0.00',// 分销佣金
skus_stock : 0, // 库存
skus_charge : '', // 分销佣金
skus_stock : '', // 库存
isChange : false, // 是否支持易货
logisticType: 0, // 配送方式
stores : [], // 关联店铺
expiriedAt : '', // 活动到期时间
logisticType: 0, // 配送方式
logisticArr : [
{text: '快递', type: 1},
{text: '自提', type: 2}
],
// 配置信息
storesArr : [], // 可选店铺
tags : [], // 可选商品标签
tagsIndex : 0, // 选择标签的下标
servicesArr : [], // 可选服务
type : 1, // 1为商品0为服务
type : 1, // 1为商品2为服务
};
},
created() {
// 编辑状态信息
if(this.$Route.query.type && this.$Route.query.type === 'edit'){
managesGoodsEdit(this.$Route.query.id).then(res => {
let services = [], stores = []
let servicesArr = res.services.map(val => {
let check = (res.data.services.findIndex(obj => obj.service_id === val.service_id)) >= 0
if(check){
services.push(val.service_id)
}
return{
check,
...val
}
})
let storesArr = res.stores.map(val => {
let check = (res.data.stores.findIndex(obj => obj.store_id === val.store_id)) >= 0
if(check){
stores.push(val.store_id)
}
return {
check,
...val
}
})
this.categoryId = res.data.category.category_id
this.categoryCid = res.data.category_sub.category_id
this.name = res.data.name
this.content = res.data.content
this.description = res.data.description
this.pictures = res.data.pictures
this.skus_cost = res.data.skus[0].cost
this.skus_price = res.data.skus[0].price
this.skus_number = res.data.skus[0].number
this.skus_unit = res.data.skus[0].unit
this.skus_charge = res.data.skus[0].charge
this.skus_stock = res.data.skus[0].stock
this.isPostSale = res.data.is_post_sale == 0
this.isChange = res.data.is_change == 0
this.logisticType= this.logisticArr.findIndex(val => val.type === res.data.logistic_type)
this.servicesArr = servicesArr
this.storesArr = storesArr
this.services = services
this.stores = stores
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
return
}
// 添加配置信息
managesCreate({
category_cid: 140
category_cid: this.$Route.query.cid
}).then(res => {
res.services = res.services.map(val => {
return {
check: false,
...val
}
})
res.stores = res.stores.map(val => {
return {
check: false,
...val
}
})
this.storesArr = res.stores
this.tags = res.tags
this.servicesArr= res.services
this.type = res.type
this.categoryId = this.$Route.query.id
this.categoryCid= this.$Route.query.cid
}).catch(err => {
uni.showToast({
title: err.message,
@@ -172,6 +291,25 @@
})
},
methods: {
// 选择商品服务
opnePopup(key){
this.$refs[key].open('bottom')
},
// 确认选择商品服务
affirmCategory(key, popupKey){
let keyArr = key == 'services' ? 'servicesArr' : 'storesArr'
this[key] = []
for(let val of this[keyArr]){
if(val.check){
this[key].push(val.service_id || val.store_id)
}
}
this.$refs[popupKey].close()
},
// picker选择
pickerChange(e, key){
this[key] = e.detail.value
},
// 图片预览
openImg(index, key){
let paths = this[key].map(val => {
@@ -212,6 +350,70 @@
})
}
})
},
// 发布产品
submitAdd(){
let pictures = this.pictures.map(val => {return val.path}),
content = this.content.map(val => {return val.path})
let submitData = {
name : this.name,
cover : this.pictures[0].path,
category_id : this.categoryId,
category_cid : this.categoryCid,
pictures : pictures,
content : content,
description : this.description,
is_post_sale : this.isPostSale ? 0 : 1,
services : this.services,
skus_cost : this.skus_cost,
skus_price : this.skus_price,
skus_number : this.skus_number,
skus_unit : this.skus_unit,
skus_charge : this.skus_charge,
skus_stock : this.skus_stock,
is_change : this.isChange ? 0 : 1,
logistic_type: this.logisticArr[this.logisticType].type,
stores : this.stores,
expiried_at : this.expiriedAt
}
let submitFund = this.$Route.query.type === 'edit' ? managesGoodsPut(this.$Route.query.id, submitData) : managesGoodsCreate(submitData)
submitFund.then(res => {
if(this.type === 2){
uni.showModal({
title : '提示',
content : '商品权证已发布,请耐心等待平台审核',
showCancel : false,
success : res => {
if(res.confirm){
this.$Router.back(this.$Route.query.type === 'edit' ? 1 : 2)
}
}
})
return
}
uni.showModal({
title : '提示',
content : this.$Route.query.type === 'edit' ? '商品权证已更新,是否立即补充产品附加信息认证?' : '商品权证已发布,是否立即补充产品附加信息认证?',
cancelText : '稍后认证',
confirmText : '立即认证',
success : modalRes => {
if(modalRes.cancel){
this.$Router.back(this.$Route.query.type === 'edit' ? 1 : 2)
}
if(modalRes.confirm){
let goodsId = this.$Route.query.type === 'edit' ? this.$Route.query.id : res
this.$Router.replace({name: 'goodsAuth', params: { id: goodsId , type: 'goodsAdd', edit: this.$Route.query.type === 'edit'}})
}
}
})
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
}
}
}
@@ -283,6 +485,15 @@
position: absolute;
}
}
.picker-switch{
line-height: 80rpx;
min-height: 80rpx;
text-align: right;
margin-right: -15rpx;
switch{
transform:scale(0.7)
}
}
}
.form-upd{
.form-title{
@@ -334,7 +545,7 @@
right: 0;
padding: 20rpx $padding;
box-shadow: 0 0 4rpx 4rpx rgba($color: #000000, $alpha: .02);
z-index: 99;
z-index: 9;
.footer-btn{
border: none;
border-radius: 0;
@@ -348,5 +559,69 @@
border: none;
}
}
}
// 可选服务
.category-popup{
background: #F5F5F5;
padding: 0 $padding * 2 $padding * 2 $padding * 2;
.header{
padding: $padding*2 0;
box-sizing: border-box;
@extend .vertical;
.title{
text-align: center;
font-size: $title-size + 14;
font-weight: bold;
line-height: 90rpx;
}
.subtitle{
font-size: $title-size-m;
color: $text-gray;
text-align: center;
}
}
.category-flex{
max-height: 50vh;
overflow-y: scroll;
.category-flex-item{
margin-bottom: $margin;
padding: $padding;
background: white;
border:solid 1rpx white;
box-sizing: border-box;
.category-name{
padding-bottom: $padding/2;
font-weight: bold;
font-size: $title-size-lg;
}
.category-content{
font-size: $title-size-sm;
color: $text-gray;
@extend .ellipsis;
}
&.show{
color: $text-price;
border:solid 1rpx $text-price;
}
&:last-child{
margin-bottom: 0;
}
}
}
.btns{
padding-top: $padding * 2;
button{
background: $text-price;
border-radius: 0;
height: 90rpx;
line-height: 90rpx;
font-size: $title-size;
color: white;
font-weight: bold;
&::after{
border: none;
}
}
}
}
</style>

View File

@@ -32,8 +32,8 @@
},
methods:{
// 选择分类
onCategory(id){
this.$Router.push({name: 'GoodsMagAdd', params: {id}})
onCategory(cid){
this.$Router.push({name: 'GoodsMagAdd', params: {cid, id: this.category[this.stairIndex].category_id}})
}
}
}

185
pages/goods/attestation.vue Normal file
View File

@@ -0,0 +1,185 @@
<template>
<view class="GoodsAuthentication">
<view class="authenticationTop">区块链溯源码{{info.token}}</view>
<!-- 商品认证 商品和服务 -->
<view class="authenticationItem">
<view class="authenticationItemTitle">商品认证</view>
<view class="authenticationItemcontent" v-if="info.goods">
<view class="authenticationItemcontentItem">
<view class="title">{{info.goods.type ===1?'商品名称':'项目名称'}}: </view>
<view class="content">{{info.goods.name || '暂无数据'}}</view>
</view>
<view class="authenticationItemcontentItem" v-if="info.goods.type ===1">
<view class="title">生产批次</view>
<view class="content">{{info.goods.batch || '暂无数据'}}</view>
</view>
<view class="authenticationItemcontentItem" v-if="info.goods.type ===2" >
<view class="title">项目分类</view>
<view class="content">{{info.goods.category || '暂无数据'}}</view>
</view>
<view class="authenticationItemcontentItem" v-if="info.goods.type ===1">
<view class="title">规格</view>
<view class="content">{{info.goods.skus[0].unit || '暂无数据'}}</view>
</view>
<view class="authenticationItemcontentItem">
<view class="title">数量</view>
<view class="content">{{info.goods.skus[0].stock || '暂无数据'}}</view>
</view>
<view class="authenticationItemcontentItem">
<view class="title">售价</view>
<view class="content">{{info.goods.skus[0].price || '暂无数据'}}</view>
</view>
<view class="authenticationItemcontentItem" v-if="info.goods.type ===1">
<view class="title">生产日期</view>
<view class="content">{{info.goods.producted_at || '暂无数据'}}</view>
</view>
<view class="authenticationItemcontentItem" >
<view class="title">{{info.goods.type ===1?'保质期':'有效期'}}</view>
<view class="content">{{info.goods.expiried_at || '暂无数据'}}</view>
</view>
<view class="authenticationItemcontentItem" v-if="info.goods.type ===1">
<view class="title">生产厂家</view>
<view class="content">{{info.goods.product_name || '暂无数据'}}</view>
</view>
<view class="authenticationItemcontentItem" v-if="info.goods.type ===1">
<view class="title">生产地</view>
<view class="content">{{info.goods.product_address || '暂无数据'}}</view>
</view>
<view class="authenticationItemcontentItem" >
<view class="title">供应商</view>
<view class="content">{{info.goods.skus[0].price || '暂无数据'}}</view>
</view>
<view class="authenticationItemcontentItem" >
<view class="title">经营许可证</view>
<view class="content">{{info.goods.lisence || '暂无数据'}}</view>
</view>
<view class="authenticationItemcontentItem" >
<view class="title">实物照片</view>
<image class="img" v-if="info.goods.cover" :src="info.goods.cover" @click="priveImg(info.goods.cover)" mode="aspectFill" />
<view class="content" v-else>暂无数据</view>
</view>
</view>
</view>
<!-- 企业认证 商品和服务通用 -->
<view class="authenticationItem">
<view class="authenticationItemTitle">企业认证</view>
<view class="authenticationItemcontent" v-if="info.certification">
<view class="authenticationItemcontentItem" >
<view class="title">企业名称</view>
<view class="content">{{info.certification.name || '暂无数据'}}</view>
</view>
<view class="authenticationItemcontentItem">
<view class="title">企业地址</view>
<view class="content">{{info.certification.address || '暂无数据'}}</view>
</view>
<view class="authenticationItemcontentItem">
<view class="title">统一信用代码</view>
<view class="content">{{info.certification.certification.code || '暂无数据'}}</view>
</view>
<view class="authenticationItemcontentItem">
<view class="title">行业</view>
<view class="content">{{info.certification.industry.title || '暂无数据'}}</view>
</view>
<view class="authenticationItemcontentItem">
<view class="title">经营范围</view>
<view class="content">{{info.certification.range || '暂无数据'}}</view>
</view>
<view class="authenticationItemcontentItem">
<view class="title">联系电话</view>
<u-icon name="phone-fill" v-if='info.certification.contack' @click="call(info.certification.contact)"
color="#2979ff" label-color="#2979ff" label-size="26" :label='info.certification.contact' />
<view class="content" v-else> 暂无数据 </view>
</view>
<view class="authenticationItemcontentItem">
<view class="title">营业执照</view>
<image class="img" v-if='info.certification.certification.license' :src="info.certification.certification.license" @click="priveImg(info.certification.certification.license)" mode="aspectFill" />
<view class="content" v-else>暂无数据</view>
</view>
</view>
</view>
<!-- 弹窗提示喽 -->
<u-toast ref="uToast" />
</view>
</template>
<script>
import { managesAttestation } from '@/apis/interfaces/goods'
export default {
data() {
return {
info: ''
}
},
created() {
managesAttestation(this.$Route.query.id).then(res=>{
this.info = res
})
},
methods: {}
}
</script>
<style lang="scss" scoped>
page {
background-color: #F7F7F7;
}
.GoodsAuthentication {
padding: 30rpx;
.authenticationTop {
width: 100%;
padding: 20rpx 50rpx;
background-color: #c82626;
font-size: 26rpx;
color: #fff;
border-radius: 60rpx;
word-break: break-all;
text-align: center;
}
// 商品认证
.authenticationItem{
width: 100%;
min-height: 300rpx;
margin-top: 20rpx;
.authenticationItemTitle{
font-size: 30rpx;
color: #333333;
font-weight: 600;
padding: 30rpx 20rpx;
}
.authenticationItemcontent{
width: 100%;
min-height: 500rpx;
background-color: #fff;
border-radius: 20rpx;
border: solid rgba(200,38,0,.05) 6rpx;
box-shadow:2rpx 2rpx 20rpx 0rpx rgba(200,38,0,.051);
padding:10rpx 20rpx;
.authenticationItemcontentItem{
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
box-sizing: border-box;
padding: 20rpx 0;
font-size: 24rpx;
.title{
width: 180rpx;
}
.content{
text-overflow: ellipsis;
width: calc( 100% - 180rpx);
}
.img{
width: 340rpx;
height: 200rpx;
}
}
}
}
}
</style>

115
pages/goods/chain.vue Normal file
View File

@@ -0,0 +1,115 @@
<template>
<view class="GoodsChain">
<image src="https://e-chain.cnskl.com/storage/imageresource/chain-bg.png" class='chainBg' />
<view class="chain-content">
<view class="chain-center">
<image src="/static/icons/e-logo.png" mode="aspectFill" class="logo" />
<view class="name">易品新境区块链溯源证书</view>
<view class="no">区块链溯源证书{{info.token}}</view>
<view class="content">
<view class="con-item">兹证明</view>
<view class="con-item" v-if="info.company">
{{info.company.name}}产品符合溯源规范认证内容如下特授权其产品在易品新境区块链溯源商城出售
</view>
<view class="con-item">交易哈希: {{info.hash}}</view>
<view class="con-item">区块链高度: {{info.height}}</view>
</view>
<view class="date" v-if="info.applied_at">授权时间: {{info.applied_at}}</view>
<view class="date">有效期至: {{info.ended_at}}</view>
<view class="companyInfo">易品新境区块链有限公司</view>
</view>
</view>
<!-- 弹窗提示喽 -->
<u-toast ref="uToast" />
</view>
</template>
<script>
import { managesChain } from '@/apis/interfaces/goods'
export default {
data() {
return {
info: ''
}
},
created() {
managesChain(this.$Route.query.id).then(res=>{
this.info = res
})
},
methods: {}
}
</script>
<style lang="scss" scoped>
page {
background-color: #F7F7F7;
}
.GoodsChain {
background-color:fff;
width: 100%;
position: relative;
z-index: 1;
.chainBg{
position: absolute;
width: 100%;
height: 100%;
z-index: 2;
}
.chain-content{
width: 100%;
min-height: 100%;
z-index: 2;
padding: 18vh 10vw 15vh 10vw ;
box-sizing: border-box;
position: relative;
z-index: 3;
.chain-center{
width: 100%;
min-height: 100%;
.logo{
width: 160rpx;
height: 160rpx;
border-radius: 50%;
position: relative;
margin-left: -80rpx;
left: 50%;
margin-bottom: 20rpx;
border: solid rgba($color: #fff, $alpha: .3) 10rpx;
}
.name{
font-size: 40rpx;
font-weight: bold;
text-align: center;
}
.no{
font-size: 26rpx;
font-weight: bold;
text-align: center;
margin-top: 10rpx;
}
.content{
margin-top: 60rpx;
font-size: 28rpx;
padding: 0 20rpx;
.con-item{
margin-bottom: 30rpx;
word-break: break-all;
}
}
.date{
text-align: right;
margin-bottom: 10rpx;
padding-right: 20rpx;
}
.companyInfo{
text-align: right;
margin-bottom: 40rpx;
padding-right: 20rpx;
}
}
}
}
</style>

View File

@@ -38,22 +38,22 @@
:readonly="true"
color="#ddd"
active-color="#c82626"
:value="2.5"
:value="goodsObj.company.star"
:size="14"
/>
</view>
<view class="openbtn" @click="onOpenWechat">进店<image class="openbtn-img" src="../../static/icons/equity_arrow_right.png" mode="aspectFill"></image></view>
</view>
<view class="tooSee">
<view class="tooSee-label">
<view class="tooSee-label" @click="$Router.push({name: 'GoodsChain', params: {id: goodsObj.goods_id}})">
区块链证书
<image class="tooSee-label-img" src="../../static/icons/equity_arrow_right.png" mode="aspectFill"></image>
</view>
<view class="tooSee-label">
<view class="tooSee-label" @click="$Router.push({name: 'GoodsAttestation', params: {id: goodsObj.goods_id}})">
商品认证
<image class="tooSee-label-img" src="../../static/icons/equity_arrow_right.png" mode="aspectFill"></image>
</view>
<view class="tooSee-label">
<view class="tooSee-label" @click="$Router.push({name: 'GoodstracedTo', params: {id: goodsObj.goods_id}})">
商品溯源
<image class="tooSee-label-img" src="../../static/icons/equity_arrow_right.png" mode="aspectFill"></image>
</view>
@@ -69,7 +69,7 @@
<label class="title">说明</label>
特价商品不可与优惠券叠加使用
</view>
<view class="size-item nowrap">
<view class="size-item nowrap" v-if="goodsObj.services.length > 0">
<label class="title">服务</label>
<view class="goods-serve" @click="serveOpne">
<image class="goods-serve-img" src="../../static/icons/goods_buy.png" mode="aspectFill"></image>
@@ -116,6 +116,9 @@
{{item.full}}可用
</view>
</view>
<view class="coupons-left" v-if="item.type.value == '1' || item.type.value =='3'">
<image :src="item.cover" mode="aspectFill" class="coupon-left-img" />
</view>
<view class="coupons-left" v-else-if="item.type.value == '3'">
<view class="coupons-number coupons-small">
提货券
@@ -129,9 +132,13 @@
{{item.time.interval}}
</view>
</view>
<view class="coupons-right">
<view v-if="item.can.get" class="coupons-right" @click="drawCoupons(item.coupon_id, index)">
领取
</view>
<view v-else class="coupons-right coupons-right-active">
已领取
</view>
</view>
</view>
<view class="coupons-true" @click="couponsClose">
@@ -148,7 +155,7 @@
<image @click="serveClose" class="close" src="../../static/icons/goods_close.png" mode=""></image>
</view>
<view class="serve-cont">
<view class="serve-label" v-for="(item, index) in goodsObj.services">
<view class="serve-label" v-for="(item, index) in goodsObj.services" :key="index">
<view class="serve-label-name">
{{item.name}}
</view>
@@ -166,7 +173,7 @@
</template>
<script>
import { goods } from '@/apis/interfaces/goods'
import { goods, managesCoupons } from '@/apis/interfaces/goods'
import userAuth from '@/public/userAuth'
export default {
data() {
@@ -180,14 +187,13 @@
};
},
created() {
goods(this.$Route.query.id || 16).then(res=>{
console.log(res.coupons)
goods(this.$Route.query.id).then(res=>{
this.loding = false
this.goodsObj = res
this.identity = res.identity.id || ''
this.company = res.company
this.couponSee= res.coupons.slice(0, 3)
this.coupons = res.coupons
this.couponSee= res.coupons.slice(0, 3)
this.coupons = res.coupons
})
},
methods:{
@@ -199,12 +205,15 @@
userLogin.Login()
return
}
this.$Router.push({
name: 'Buy',
params: {
skuId: this.goodsObj.skus[0].sku_id,
qty : this.goodsObj.skus[0].number
}
// this.$Router.push({
// name: 'Buy',
// params: {
// skuId: this.goodsObj.skus[0].sku_id,
// qty : this.goodsObj.skus[0].number
// }
// })
uni.navigateTo({
url: '/pages/property/coupon/confirmOrder?qty=1&type=2&goods_sku_id=' + this.goodsObj.skus[0].sku_id
})
},
// 打开微信小程序
@@ -235,6 +244,28 @@
})
},
// 领取优惠券
drawCoupons(id){
let token = this.$store.getters.getToken
if(token == ''){
let userLogin = new userAuth()
userLogin.Login()
return
}
managesCoupons(id).then(res=>{
uni.showToast({
title: '领取成功',
type: 'primary',
duration: 3000
})
}).catch(err => {
uni.showToast({
icon : 'none',
title: err.message
})
})
},
// 选择优惠券-显示
couponsOpne(){
this.$refs.couponsPopup.open('bottom')
@@ -299,14 +330,14 @@
font-size: $title-size;
font-weight: bold;
line-height: 50rpx;
display: flex;
.title-hot {
display: inline-block;
background-color: #fee195;
font-size: 24rpx;
border-radius: 50rpx;
padding: 0 10rpx;
height: 38rpx;
line-height: 38rpx;
height: 34rpx;
line-height: 36rpx;
margin: 6rpx 10rpx 0 0;
}
}
@@ -342,33 +373,36 @@
background-color: #fef2f2;
color: #e1293f;
border-radius: 8rpx;
border: 2rpx solid #e7e2df;
padding: $padding - 10;
border: 1rpx solid #ffe5e5;
padding: $padding - 15;
box-sizing: border-box;
display: flex;
position: relative;
margin-bottom: $margin - 10;
.coupon-list {
font-size: 24rpx;
font-size: 22rpx;
.coupon-label {
display: inline-block;
border: 2rpx solid #e1293f;
border: 1rpx solid #e998a1;
border-radius: 50rpx;
padding: 4rpx 15rpx;
padding: 0 15rpx;
height: 34rpx;
line-height: 34rpx;
margin-right: $margin - 10;
}
}
.coupon-btn {
position: absolute;
right: $padding - 10;
top: $padding - 10;
font-size: 28rpx;
right: $padding - 20;
top: 0;
line-height: 60rpx;
font-size: 24rpx;
display: flex;
font-weight: 700;
.coupon-btn-img {
width: 30rpx;
height: 30rpx;
margin-top: 6rpx;
width: 22rpx;
height: 22rpx;
margin: 20rpx 0 0 4rpx;
}
}
}
@@ -380,7 +414,7 @@
.goods-serve-img {
width: 36rpx;
height: 36rpx;
margin-top: 24rpx;
margin-top: 26rpx;
}
.goods-serve-name {
margin: 0 30rpx 0 20rpx;
@@ -402,7 +436,7 @@
background: #F8F8F8;
border-radius: $radius/2;
padding: $padding;
min-height: 160rpx;
min-height: 220rpx;
.logo{
position: absolute;
left: $margin;
@@ -609,9 +643,11 @@
overflow: hidden;
position: relative;
margin-top: $margin;
// background-color: red;
.coupons-tips {
background-color: #211e17;
color: #efe8d8;
// background-color: #211e17;
background-image: linear-gradient(to right, #f8e5c0, #d6a46a);
color: #8d4928;
position: absolute;
border-radius: 0 0 20rpx 0;
padding: 0 8rpx;
@@ -619,6 +655,7 @@
line-height: 34rpx;
left: 0;
top: 0;
z-index: 10;
.coupons-tips-text {
font-size: 24rpx;
transform:scale(.85);
@@ -632,6 +669,11 @@
text-align: center;
padding: $padding - 10 0;
border-right: 2rpx dashed #eccdd4;
.coupon-left-img{
width: 180rpx;
height: 100rpx;
border-radius: 20rpx;
}
.coupons-number {
font-size: 40rpx;
font-weight: 600;
@@ -672,6 +714,10 @@
border-radius: 80rpx;
font-size: 24rpx;
line-height: 52rpx;
&.coupons-right-active {
background-color: #adadad;
color: #FFFFFF;
}
}
}
}
@@ -697,4 +743,9 @@
line-height: 44rpx;
}
}
.serve-cont {
height: 40vh;
overflow-y: scroll;
}
</style>

376
pages/goods/goodsAuth.vue Normal file
View File

@@ -0,0 +1,376 @@
<template>
<view class="content">
<view class="form-block">
<view class="form-upd">
<view class="form-title">产品实物图片<text>点击预览长按删除</text></view>
<view class="form-imgs">
<view
class="item"
v-if="extendCover.length > 0"
@click="openImg"
@longpress="extendCover = []"
>
<image class="item-cover" :src="extendCover[0].showpath" mode="aspectFill"></image>
</view>
<view class="item item-add" v-else @click="updCover">
<image class="item-cover" src="@/static/icons/add-icon.png" mode="aspectFill"></image>
</view>
</view>
</view>
</view>
<!-- 商品基本信息 -->
<view class="form-block">
<view class="form-box picker-flex">
<label class="form-label">生产日期</label>
<picker mode="date" :value="productedAt" @change="pickerChange($event, 'productedAt')">
<view class="picker-text">
{{productedAt || '选择商品生产日期'}}
<uni-icons class="picker-icon" type="arrowright" color="#999"></uni-icons>
</view>
</picker>
</view>
<view class="form-box picker-flex">
<label class="form-label">过期时间</label>
<picker mode="date" :value="expiriedAt" @change="pickerChange($event, 'expiriedAt')">
<view class="picker-text">
{{expiriedAt || '选择商品过期时间'}}
<uni-icons class="picker-icon" type="arrowright" color="#999"></uni-icons>
</view>
</picker>
</view>
<view class="form-box inputs-flex">
<label class="form-label">生产商名称</label>
<input type="text" v-model="productName" placeholder="输入商品生产商名称"/>
</view>
<view class="form-box inputs-flex">
<label class="form-label">生产许可证号</label>
<input type="text" v-model="lisence" placeholder="输入商品生产许可证号"/>
</view>
<view class="form-box inputs-flex">
<label class="form-label">生产商地址</label>
<input type="text" v-model="productAddress" placeholder="输入商品生产商地址"/>
</view>
</view>
<!-- 安全区 -->
<view class="ios-bottom"></view>
<!-- footer -->
<view class="footer">
<button class="footer-btn" type="default" @click="submitAdd">提交认证审核</button>
<view class="ios-bottom"></view>
</view>
</view>
</template>
<script>
import { managesGoodsAuth, managesGoodsExtends } from '@/apis/interfaces/goods'
import { uploads } from '@/apis/interfaces/uploading'
export default {
data() {
return {
productedAt : '', // 生产日期
expiriedAt : '', // 过期时间
lisence : '', // 生产许可证号
productName : '', // 生产商名称
productAddress : '', // 生产商地址
extendCover : [] // 实物图片
};
},
created() {
if(this.$Route.query.edit == 'true'){
managesGoodsExtends(this.$Route.query.id).then(res => {
this.productedAt = res.producted_at
this.expiriedAt = res.expiried_at
this.lisence = res.lisence
this.productName = res.product_name
this.productAddress = res.product_address
this.extendCover = [{...res.cover}]
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
}
},
methods: {
// picker选择
pickerChange(e, key){
this[key] = e.detail.value
},
// 图片预览
openImg(){
let paths = this.extendCover.map(val => {
return val.showpath
})
uni.previewImage({
urls : paths,
current : 0,
indicator: 'number'
})
},
// 上传图片
updCover(){
uni.chooseImage({
count : 1,
success : res => {
uploads([{
uri : res.tempFilePaths[0]
}]).then(updRes => {
this.extendCover.push({
path : updRes.path[0],
showpath: updRes.url[0]
})
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
}
})
},
// 发布产品
submitAdd(){
let submitData = {
producted_at : this.productedAt,
expiried_at : this.expiriedAt,
lisence : this.lisence,
product_name : this.productName,
product_address : this.productAddress,
extend_cover : this.extendCover[0].path
}
let submitFund = managesGoodsAuth(this.$Route.query.id, submitData)
submitFund.then(res => {
uni.showModal({
title : '提示',
content : '商品权证认证信息已提交,请耐心等待平台审核',
showCancel : false,
success : res => {
if(res.confirm){
if(this.$Route.query.type == 'goodsAdd'){
this.$Router.back(this.$Route.query.edit == 'true' ? 2 : 2)
}else{
this.$Router.back()
}
}
}
})
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
}
}
}
</script>
<style lang="scss" scoped>
.content{
padding-bottom: 150rpx;
}
// 表单
.form-block{
background: white;
margin-top: $margin - 10;
.form-box{
position: relative;
padding-left: 240rpx;
padding-right: $padding;
font-size: $title-size-lg;
min-height: 80rpx;
&::after{
position: absolute;
bottom: 0;
left: $margin;
right: 0;
height: 1rpx;
content: " ";
background: $border-color;
}
&:last-child::after{
display: none;
}
.form-label{
position: absolute;
left: $margin;
line-height: 80rpx;
top: 0;
width: calc(240rpx - #{$margin});
}
}
.inputs-flex{
input{
height: 80rpx;
line-height: 80rpx;
}
}
.input-unit{
padding-right: 200rpx;
.units{
position: absolute;
right: 0;
top: 0;
line-height: 80rpx;
height: 80rpx;
width: 200rpx;
padding-right: $padding;
text-align: right;
box-sizing: border-box;
}
}
.picker-flex{
.picker-text{
position: relative;
line-height: 80rpx;
min-height: 80rpx;
padding-right: 80rpx;
@extend .nowrap;
.picker-icon{
right: 0;
position: absolute;
}
}
.picker-switch{
line-height: 80rpx;
min-height: 80rpx;
text-align: right;
margin-right: -15rpx;
switch{
transform:scale(0.7)
}
}
}
.form-upd{
.form-title{
font-size: $title-size-lg;
line-height: 80rpx;
padding: 0 $padding;
text{
font-size: 80%;
color: $text-gray;
}
}
.form-imgs{
margin-top: -($margin/3);
padding: 0 20rpx 20rpx;
display: flex;
flex-wrap: wrap;
.item{
width: calc(20% - 14rpx);
padding-top: calc(20% - 14rpx);
margin: 7rpx;
position: relative;
.item-cover{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
.item-add{
border: dashed 2rpx $border-color;
box-sizing: border-box;
.item-cover{
top: calc(15% - 2rpx);
left: calc(15% - 2rpx);
width: 70%;
height: 70%;
}
}
}
}
}
// 发布
.footer{
background: white;
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 20rpx $padding;
box-shadow: 0 0 4rpx 4rpx rgba($color: #000000, $alpha: .02);
z-index: 9;
.footer-btn{
border: none;
border-radius: 0;
background: $text-price;
height: 90rpx;
line-height: 90rpx;
font-weight: bold;
font-size: $title-size;
color: white;
&::after{
border: none;
}
}
}
// 可选服务
.category-popup{
background: #F5F5F5;
padding: 0 $padding * 2 $padding * 2 $padding * 2;
.header{
padding: $padding*2 0;
box-sizing: border-box;
@extend .vertical;
.title{
text-align: center;
font-size: $title-size + 14;
font-weight: bold;
line-height: 90rpx;
}
.subtitle{
font-size: $title-size-m;
color: $text-gray;
text-align: center;
}
}
.category-flex{
max-height: 50vh;
overflow-y: scroll;
.category-flex-item{
margin-bottom: $margin;
padding: $padding;
background: white;
border:solid 1rpx white;
box-sizing: border-box;
.category-name{
padding-bottom: $padding/2;
font-weight: bold;
font-size: $title-size-lg;
}
.category-content{
font-size: $title-size-sm;
color: $text-gray;
@extend .ellipsis;
}
&.show{
color: $text-price;
border:solid 1rpx $text-price;
}
&:last-child{
margin-bottom: 0;
}
}
}
.btns{
padding-top: $padding * 2;
button{
background: $text-price;
border-radius: 0;
height: 90rpx;
line-height: 90rpx;
font-size: $title-size;
color: white;
font-weight: bold;
&::after{
border: none;
}
}
}
}
</style>

View File

@@ -0,0 +1,95 @@
<template>
<view class="content-flex" v-if="!loding">
<scroll-view class="stair" scroll-y>
<view class="stair-item" :class="{'show': stairIndex == index}" v-for="(item, index) in category" :key="index" @click="stairIndex = index">{{item.name}}</view>
<view class="ios-bottom"></view>
</scroll-view>
<scroll-view class="second" scroll-y>
<view class="second-item" v-for="(item, index) in category[stairIndex].children" :key="index" @click="$Router.push({name: 'goodsList', params: {id: item.category_id}})">
{{item.name}}<uni-icons class="arrow-icon" type="arrowright" color="#999" size="14"></uni-icons>
</view>
<view class="ios-bottom"></view>
</scroll-view>
</view>
</template>
<script>
import { goodsCategory } from '@/apis/interfaces/goods'
export default {
data() {
return {
loding : true,
category : [],
stairIndex : 0,
secondIndex : 0
};
},
created() {
goodsCategory().then(res => {
this.loding = false
this.category = res
})
},
methods:{}
}
</script>
<style lang="scss" scoped>
.content-flex{
background-color: white;
height: 100vh;
display: flex;
font-size: $title-size-m;
.stair{
background: #F5F5F5;
width: 240rpx;
.stair-item{
text-align: center;
padding: 0 $padding;
line-height: 90rpx;
color: $text-gray;
@extend .nowrap;
&.show{
position: relative;
background: white;
color: $text-price;
font-weight: bold;
&::before{
position: absolute;
height: 40rpx;
width: 5rpx;
background: $text-price;
content: " ";
left: 0;
top: 20rpx;
}
}
}
}
.second{
width: calc(100% - 240rpx);
.second-item{
position: relative;
padding: 0 ($padding + 80) 0 $padding;
line-height: 90rpx;
color: $text-gray;
.arrow-icon{
position: absolute;
right: $padding;
}
&::after{
position: absolute;
height: 1rpx;
content: ' ';
background: $border-color;
left: $padding;
right: 0;
top: 0;
}
&:first-child::after{
display: none;
}
}
}
}
</style>

View File

@@ -6,7 +6,7 @@
价格
<image
class="icon"
mode="widthFix" :src="require(marketType == 'low' ? '@/static/icons/market_icon_low.png': '@/static/icons/market_icon_high.png')"
mode="widthFix" :src="require(marketType == 'asc' ? '@/static/icons/market_icon_low.png': '@/static/icons/market_icon_high.png')"
/>
</view>
</view>
@@ -23,26 +23,34 @@
data() {
return {
tabIndex : 0,
marketType : 'low',
marketType : 'asc',
goods : []
};
},
created() {
list().then(res=>{
this.goods = res.data
this.pages = res.page
})
this.getList()
},
methods:{
onTabs(e){
let index = e.target.dataset.index
if(index == 0 && index == this.tabIndex) return
if(index == 1 && index == this.tabIndex) this.marketType = this.marketType == 'low' ? 'high': 'low'
if(index == 1 && index == this.tabIndex) this.marketType = this.marketType == 'asc' ? 'desc': 'asc'
this.tabIndex = index
this.getList()
},
onGoods(e){
this.$Router.push({name: 'goodsDetails', params: {id: e.goods_id}})
},
getList(){
list({
category_cid: this.$Route.query.id,
order_by : this.tabIndex == 1 ? this.marketType: ''
}).then(res=>{
this.goods = res.data
this.pages = res.page
})
}
}
}

View File

@@ -2,10 +2,10 @@
<view class="content">
<!-- 分类 -->
<view class="tabs">
<view class="item" :class="{'show': status == '1'}" @click="onTabs('1')">上架</view>
<view class="item" :class="{'show': status == '3'}" @click="onTabs('3')">已下架</view>
<view class="item" :class="{'show': status == '0'}" @click="onTabs('0')">审核中</view>
<view class="item" :class="{'show': status == '2'}" @click="onTabs('2')">已驳回</view>
<view class="item" :class="{'show': status == '0'}" @click="onTabs('0')">发布</view>
<view class="item" :class="{'show': status == '1'}" @click="onTabs('1')">待认证</view>
<view class="item" :class="{'show': status == '2'}" @click="onTabs('2')">审核中</view>
<view class="item" :class="{'show': status == '3'}" @click="onTabs('3')">已驳回</view>
</view>
<!-- 优选商品 -->
<goodsList :list="goods" priceType="CNY" :status='status' toast="暂无产品权证">
@@ -14,16 +14,19 @@
</template>
<template v-slot:footer="goods">
<view class="footer-btns">
<block v-if="status == '1'">
<block v-if="status == '0'">
<button class="button-item" size="mini" @click="openLay(goods.value, 'goodsBurn')">燃烧</button>
<button class="button-item" size="mini" @click="openLay(goods.value, 'goodsMint')">增发</button>
<button class="button-item" size="mini" @click="goodsOffsale(goods.value.goods_id)">下架</button>
</block>
<block v-if="status == '1'">
<button class="button-item" size="mini" @click="goodsAuth(goods.value.goods_id)">认证</button>
<button class="button-item" size="mini" @click="goodsRemove(goods.value.goods_id)">删除</button>
</block>
<block v-if="status == '2'">
<button class="button-item" size="mini" @click="goodsRemove(goods.value.goods_id)">删除</button>
</block>
<block v-if="status == '3'">
<button class="button-item" size="mini" @click="goodsOnsale(goods.value.goods_id)">上架</button>
</block>
<block v-if="status == '0' || status == '2'">
<button class="button-item" size="mini">修改</button>
<button class="button-item" size="mini" @click="goodsPut(goods.value.goods_id, goods.value.reason)">驳回原因</button>
<button class="button-item" size="mini" @click="goodsRemove(goods.value.goods_id)">删除</button>
</block>
</view>
@@ -48,7 +51,7 @@
</template>
<script>
import { managesGoodsIndex, managesGoodsOffsale, managesGoodsOnsale, managesGoodsBurn, managesGoodsMint, managesGoodsCreateBefore } from '@/apis/interfaces/goods'
import { managesGoodsIndex, managesGoodsDelete, managesGoodsBurn, managesGoodsMint, managesGoodsCreateBefore } from '@/apis/interfaces/goods'
import goodsList from '@/components/goods-list/goods-list'
export default {
components: {
@@ -56,7 +59,7 @@
},
data() {
return {
status : 1,
status : 0,
goods : [],
pages : {},
itemGoods : {},
@@ -71,6 +74,7 @@
// tabs
onTabs(value){
if(value == this.status) return
this.goods = []
this.status = value
this.getList()
},
@@ -79,23 +83,29 @@
managesGoodsIndex({
status: this.status
}).then(res => {
console.log(res)
this.goods = res.data
this.pages = res.page
})
},
// 下架
goodsOffsale(id){
let index = this.goods.findIndex(val => val.goods_id == id)
managesGoodsOffsale(id).then(res => {
this.goods.splice(index,1)
if(this.goods.length === 0) this.getList()
}).catch(err => {
uni.showToast({
title: err.message,
icon: 'none'
})
// 修改产品
goodsPut(id, text){
uni.showModal({
title : '驳回原因',
content : text,
confirmText : '编辑',
cancelText : '确定',
success : res => {
if(res.confirm){
this.$Router.push({name: 'GoodsMagAdd', params: {type: 'edit', id}})
}
}
})
},
// 商品认证
goodsAuth(id){
this.$Router.push({name: 'goodsAuth', params: {id, type: 'magList'}})
},
// 燃烧,增发
openLay(item, type){
this.itemGoods = item
@@ -142,12 +152,16 @@
break;
}
},
// 上架
goodsOnsale(id){
// 移出删除商品
goodsRemove(id){
let index = this.goods.findIndex(val => val.goods_id == id)
managesGoodsOnsale(id).then(res => {
this.goods.splice(index,1)
if(this.goods.length === 0) this.getList()
managesGoodsDelete(id).then(res => {
this.goods.splice(index,1)
if(this.goods.length === 0) this.getList()
uni.showToast({
title: '商品权证已删除',
icon : 'none'
})
}).catch(err => {
uni.showToast({
title: err.message,
@@ -157,7 +171,7 @@
}
},
onNavigationBarButtonTap() {
this.$Router.push({name: 'GoodsMagAdd'})
this.$Router.push({name: 'addClassify'})
}
}
</script>

197
pages/goods/tracedTo.vue Normal file
View File

@@ -0,0 +1,197 @@
<template>
<view class="GoodsAuthentication">
<view class="authenticationTop" v-if='list.length>0'>区块链溯源码:{{info.token}}</view>
<!-- 进度条 -->
<view v-if='list.length>0' class='timeAxis'>
<view class="box-top" v-for="(item,index) in list" :key="index">
<view class="left-box-top"><span>商品交易</span>{{item.blockTime}}</view> <!-- 左边 -->
<view class="line" :class="{active:true,none:index==(list.length-1)}"><!-- 中线 -->
<view class="dot" :class="{active:true}"></view><!-- 圆点 -->
</view>
<!-- 右边 -->
<view class="right-box-top">
<view class="authenticationItem">
<view class="authenticationItemcontent">
<view class="authenticationItemcontentItem" v-if="item.goods">
<view class="title">名称:</view>
<view class="content">{{item.goods.name}}</view>
</view>
<view class="authenticationItemcontentItem" v-if="item.goods">
<view class="title">规格:</view>
<view class="content">{{item.goods.skus[0].unit}}</view>
</view>
<view class="authenticationItemcontentItem">
<view class="title">购买数量:</view>
<view class="content">{{item.amount}}</view>
</view>
<view class="authenticationItemcontentItem">
<view class="title">区块链高度:</view>
<view class="content">{{item.height}}</view>
</view>
<view class="authenticationItemcontentItem">
<view class="title">交易哈希:</view>
<view class="content">{{item.hash}}</view>
</view>
<view class="zhushi">注释:{{item.note}}</view>
</view>
</view>
</view>
</view>
</view>
<no-list v-if="list.length === 0" name='no-chain' txt="没有任何数据哦~" />
<!-- 弹窗提示喽 -->
<u-toast ref="uToast" />
</view>
</template>
<script>
import { managesTracedTo } from '@/apis/interfaces/goods'
export default {
data() {
return {
list: '',
info: ''
}
},
created() {
managesTracedTo(this.$Route.query.id).then(res=>{
this.list = res.list
this.info = res
})
},
methods: {}
}
</script>
<style lang="scss" scoped>
page {
background-color: #F7F7F7;
}
.GoodsAuthentication {
padding: 30rpx;
.authenticationTop {
width: 100%;
padding: 20rpx 50rpx;
background-color: #c82626;
font-size: 26rpx;
color: #fff;
border-radius: 60rpx;
word-break: break-all;
text-align: center;
margin-bottom: 40rpx;
}
// 商品认证
.authenticationItem {
width: 100%;
min-height: 300rpx;
.authenticationItemTitle {
font-size: 30rpx;
color: #333333;
font-weight: 600;
padding: 30rpx 20rpx;
}
}
.timeAxis {
margin-top: 60rpx;
}
}
.box-top{
width: 100%;
min-height: 120rpx;
box-sizing: border-box;
display: flex;
flex-direction: row;
.left-box-top{
width: 124rpx;
text-align: center;
color: #cacaca;
font-size: 22rpx;
padding-top: 0;
display: flex;
flex-direction: column;
align-items: flex-end;
justify-content: flex-start;
box-sizing: border-box;
span{
font-size: 28rpx;
// font-weight: bold;
color:#333;
padding-bottom: 10rpx;
padding-right: 4rpx;
}
}
.line{
width: 2rpx;
background-color: rgba(228,231,237,1);
margin: 0 20rpx 0 20rpx;
padding-top: 0;
.dot{
width: 20rpx;
height: 20rpx;
background-color: rgba(228,231,237,1);
border-radius: 50%;
position: relative;
left: -10rpx;
}
}
.right-box-top{
flex: 1;
width: calc( 100% - 170rpx);
padding: 0 0 20rpx 0;
// 商品认证
.authenticationItem{
width: 100%;
.authenticationItemcontent{
width: 100%;
background-color: #fff;
border-radius: 20rpx;
border: solid rgba(200,38,0,.05) 6rpx;
box-shadow:2rpx 2rpx 20rpx 0rpx rgba(200,38,0,.051);
padding:10rpx 20rpx;
.zhushi{
font-size: 24rpx;
color: #999;
padding: 10rpx 0;
word-wrap:break-word;
}
.authenticationItemcontentItem{
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
box-sizing: border-box;
padding: 12rpx 0;
font-size: 26rpx;
.title{
width: 160rpx;
}
.content{
text-overflow: ellipsis;
width: calc( 100% - 180rpx);
word-wrap:break-word;
}
.img{
width: 220rpx;
height: 160rpx;
}
}
}
}
}
}
//激活元素
.active{
background-color: #c82626 !important;
}
// 隐藏元素
.none{
background-color: rgba(0,0,0,0) !important;
}
</style>

353
pages/market/details.vue Normal file
View File

@@ -0,0 +1,353 @@
<template>
<view v-if="!loding">
<!-- 产品信息 -->
<view class="goods">
<image class="cover" :src="info.goods.cover" mode="aspectFill"></image>
<view class="content">
<view class="title nowrap">数字权证</view>
<view class="text nowrap">锚定商品{{info.goods.goods_name}}</view>
<view class="text nowrap">提供企业{{info.company.name}}</view>
<view class="text nav-goods nowrap" @click="onGoods">查看锚定商品信息<uni-icons type="arrowright" size="12" color="#e93340"></uni-icons></view>
</view>
<view class="info">
<view class="info-item">
<label>转让用户</label>
{{info.user.username}}
</view>
<view class="info-item">
<label>转让单价</label>
{{info.price}}
</view>
<view class="info-item">
<label>出售数量</label>
{{info.stock}}
</view>
<view class="info-item">
<label>剩余转让数量</label>
{{info.surplus}}
</view>
<view class="info-item">
<label>区块HASH</label>
{{info.hash}}
</view>
<view class="info-item">
<label>转让时间</label>
{{info.created_at}}
</view>
</view>
</view>
<button class="buy-btn" type="default" @click="openLay">我要购买</button>
<!-- 购买弹窗 -->
<uni-popup ref="buyLay" :safe-area="true" background-color="#ffffff">
<view class="popup">
<view class="title">我要购买</view>
<view class="des">
剩余转让数量
<text>{{info.surplus}}</text>
</view>
<view class="des">
数量
<uni-number-box v-model='stock' :min="1" :max="info.surplus" @change="countPrice"></uni-number-box>
</view>
<view class="des">
订单总价
<text class="price">{{price}}</text>
</view>
<view class="btn" @click="buy">提交订单</view>
</view>
</uni-popup>
<!-- 支付方式 -->
<uni-popup ref="payLay" :safe-area="true" background-color="#ffffff">
<view class="popup">
<view class="title">支付方式</view>
<radio-group class="pay-group" @change="payType">
<view class="item">
<label>
<radio class="pay-radio" value="eb" checked color="#e93340" />
<view class="pay-title">易货额支付</view>
<view class="pay-sub-title">可用{{account.eb}}冻结{{account.frozenEb}}</view>
</label>
</view>
<view class="item">
<label>
<radio class="pay-radio" value="wechat" color="#e93340" />
<view class="pay-title">微信支付</view>
</label>
</view>
</radio-group>
<view class="btn" @click="orderPay">立即支付</view>
</view>
</uni-popup>
</view>
</template>
<script>
import { marketsInfo, marketsBuy, marketsPay } from '@/apis/interfaces/market'
import userAuth from '@/public/userAuth'
export default {
data() {
return {
payValue: 'eb',
orderNo : '',
price : '0.00',
stock : 1,
loding : true,
info : {},
account : {
eb : '0.00',
frozenEb: '0.00'
}
};
},
onShow() {
marketsInfo(this.$Route.query.marketId).then(res =>{
this.info = res
this.price = res.price
this.loding = false
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
methods:{
// 查看锚定产品
onGoods(){
this.$Router.push({name: 'marketGoods', params: { id: this.info.goods.goods_id }})
},
// 选择购买方式
payType(e){
this.payValue = e.detail.value
},
// 购买弹窗
openLay(){
let token = this.$store.getters.getToken
if(token == ''){
let userLogin = new userAuth()
userLogin.Login()
return
}
this.$refs.buyLay.open('bottom')
},
// 计算价格
countPrice(e){
this.price = (e * this.info.price).toFixed(2)
},
// 提交购买单
buy(){
marketsBuy(this.info.market_id, {
qty: this.stock
}).then(res => {
this.account = res.account
this.orderNo = res.market_order_no
this.$refs.buyLay.close()
this.$refs.payLay.open('bottom')
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
// 支付
orderPay(){
let data = {}
marketsPay(this.orderNo, this.payValue).then(res => {
switch (this.payValue){
case 'eb':
this.$refs.payLay.close()
this.$Router.push({
name : 'payResults',
params : {
index: 1,
price: this.price,
type : 'eb',
total: '可在我的资产下我的权证中查看购买的数字权证'
}
})
break
case 'wechat':
this.wxPay(JSON.parse(res))
break
}
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
// 微信支付
wxPay(payConfig){
uni.requestPayment({
provider : 'wxpay',
orderInfo : payConfig,
success : payRes => {
console.log(payRes)
},
fail : payErr => {
uni.showToast({
title: payErr.errMsg,
icon : 'none'
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
// 支付方式
.pay-group{
margin: 0 ($margin * 2);
.item{
position: relative;
border-bottom: solid 1rpx $border-color;
padding: $padding 0;
&:last-child{
border-bottom: none;
}
.pay-radio{
position: absolute;
right: 0;
top: 50%;
margin-top: -25rpx;
}
.pay-sub-title{
font-size: $title-size-sm;
color: $text-gray;
line-height: 40rpx;
}
.pay-title{
font-weight: bold;
line-height: 50rpx;
color: $text-color;
font-size: $title-size-lg;
text-align: left;
}
}
}
// 我要购买按钮
.buy-btn{
margin: 0 $margin;
background: $text-price;
color: white;
height: 90rpx;
line-height: 90rpx;
padding: 0;
border-radius: $radius/2;
font-size: $title-size;
font-weight: bold;
&::after{
border: none;
}
}
// 产品信息
.goods{
min-height: 168rpx;
position: relative;
background: white;
border-radius: $radius/2;
margin: $margin;
padding: $padding;
.cover{
position: absolute;
left: $padding;
top: $padding;
width: 168rpx;
height: 168rpx;
}
.content{
padding-left: calc(168rpx + #{$padding});
.title{
position: relative;
font-size: $title-size-lg;
color: $text-color;
font-weight: bold;
line-height: 52rpx;
padding-right: 60rpx;
text{
position: absolute;
right: 0;
top: 0;
width: 60rpx;
text-align: right;
font-weight: normal;
}
}
.text{
font-size: $title-size-sm;
color: $text-gray;
height: 40rpx;
line-height: 40rpx;
&.nav-goods{
color: $text-price;
}
}
}
.info{
margin-top: $margin;
border-top: solid 1rpx $border-color;
padding-top: $padding;
.info-item{
padding-left: 200rpx;
height: 60rpx;
line-height: 60rpx;
position: relative;
text-align: right;
font-size: $title-size-m;
@extend .nowrap;
label{
position: absolute;
left: 0;
top: 0;
width: 200rpx;
text-align: left;
color: $text-gray;
}
}
}
}
// 购买产品
.popup {
width: 100%;
background-color: #fff;
padding-bottom: $padding;
.title {
font-size: 36rpx;
text-align: center;
padding: 50rpx 30rpx 30rpx 30rpx;
font-weight: bold;
}
.btn {
background-color: $text-price;
height: 90rpx;
line-height: 90rpx;
text-align: center;
color: #fff;
font-weight: bold;
font-size: $title-size;
margin: $padding * 2;
border-radius: $radius/2;
}
.des {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: $padding $padding * 2;
color: $text-gray;
font-size: $title-size-lg;
text{
color: $text-color;
}
.price{
color: $main-color;
font-weight: bold;
}
}
}
</style>

116
pages/market/goods.vue Normal file
View File

@@ -0,0 +1,116 @@
<template>
<view>
<view class="goods-cover">
<swiper class="swiper" circular indicator-dots indicator-active-color="#e93340">
<swiper-item v-for="(item, index) in cover" :key="index">
<view class="swiper-item">
<image class="swiper-cover" :src="item" mode="aspectFill" />
</view>
</swiper-item>
</swiper>
</view>
<view class="info">
<view class="info-item">
<label>锚定商品</label>
{{info.name}}
</view>
<view class="info-item">
<label>商品规格</label>
{{info.skusUnit}}
</view>
<view class="info-item">
<label>提供企业</label>
{{info.companyName}}
</view>
<view class="info-item">
<label>企业诚信</label>
{{info.integrity}}
</view>
<view class="info-item">
<label>权证销量</label>
{{info.sales}}
</view>
<view class="info-item">
<label>发布时间</label>
{{info.createdAt}}
</view>
</view>
</view>
</template>
<script>
import { goods } from '@/apis/interfaces/goods'
export default {
data() {
return {
cover: [],
info : {}
};
},
created() {
goods(this.$Route.query.id).then(res => {
console.log(res)
this.cover = res.pictures
this.info = {
name : res.name,
companyName : res.company.name,
createdAt : res.created_at,
sales : res.sales,
integrity : res.company.integrity,
skusUnit : res.skus[0].unit
}
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
}
}
</script>
<style lang="scss">
// 数权
.goods-cover{
width: 100%;
padding-top: 100%;
position: relative;
background: #f5f5f5;
.swiper{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
.swiper-item{
height: 100%;
width: 100%;
}
.swiper-cover{
@extend .swiper-item;
}
}
}
// 锚定商品详情
.info{
background: white;
padding: $padding;
.info-item{
padding-left: 200rpx;
height: 70rpx;
line-height: 70rpx;
position: relative;
text-align: right;
font-size: $title-size-m;
@extend .nowrap;
label{
position: absolute;
left: 0;
top: 0;
width: 200rpx;
text-align: left;
color: $text-gray;
}
}
}
</style>

View File

@@ -6,40 +6,61 @@
价格
<image
class="icon"
mode="widthFix" :src="require(marketType == 'low' ? '@/static/icons/market_icon_low.png': '@/static/icons/market_icon_high.png')"
mode="widthFix" :src="require(marketType == 'asc' ? '@/static/icons/market_icon_low.png': '@/static/icons/market_icon_high.png')"
/>
</view>
</view>
<view class="lists">
<view class="item" v-for="(item, index) in 10" :key="index">
<image class="cover" src="@/static/dev/good_cover_00.jpg" mode="aspectFill"></image>
<view class="item" v-for="(item, index) in marketArray" :key="index" @click="onDetails(item)">
<image class="cover" :src="item.goods.cover" mode="aspectFill"></image>
<view class="content">
<view class="title nowrap">易品新境权证<text>*1</text></view>
<view class="text nowrap">谷风一木3层软抽面巾纸</view>
<view class="text nowrap">转让方温文尔雅的小阿玉</view>
<view class="text nowrap">Hashdjsakljkljfl3213dsaHKLDJS82231csa</view>
<view class="title nowrap">数字权证<text>{{item.surplus}}/{{item.stock}}</text></view>
<view class="text nowrap">锚定商品{{item.goods.goods_name}}</view>
<view class="text nowrap">提供企业{{item.company.name}}</view>
<view class="text nowrap">转让用户{{item.user.nickname}}</view>
</view>
<view class="price">21000.00/</view>
<view class="price">{{item.price}}/</view>
</view>
</view>
</view>
</template>
<script>
import { markets } from '@/apis/interfaces/market'
export default {
data() {
return {
tabIndex : 0,
marketType : 'low',
marketArray : []
marketType : 'asc',
marketArray : [],
page : {}
};
},
onShow() {
this.getMarkets()
},
methods:{
// 筛选产品
onTabs(e){
let index = e.target.dataset.index
if(index == 0 && index == this.tabIndex) return
if(index == 1 && index == this.tabIndex) this.marketType = this.marketType == 'low' ? 'high': 'low'
if(index == 1 && index == this.tabIndex) this.marketType = this.marketType == 'asc' ? 'desc': 'asc'
this.tabIndex = index
this.getMarkets()
},
// 获取转让市场
getMarkets(){
markets({
sort: this.tabIndex == 1 ? this.marketType : ''
}).then(res => {
this.marketArray = res.data
this.page = res.page
})
},
// 转让商品详情
onDetails(e){
this.$Router.push({name: 'marketDetails', params: {marketId: e.market_id}})
console.log(e)
}
},
onNavigationBarButtonTap(){

View File

@@ -1,19 +1,166 @@
<template>
<view>
成交历史
<view class="tabs" v-if="$Route.query.type === 'my'">
<view class="item" :class="{ 'show' : tab == 'sell'}" @click="onTasb('sell')">我转让的</view>
<view class="item" :class="{ 'show' : tab == 'buys' }" @click="onTasb('buys')">我买到的</view>
</view>
<block v-if="logs.length > 0">
<view :class="{'paddingTop': $Route.query.type === 'my'}">
<view class="logs" v-for="(item, index) in logs" :key="index">
<view class="logs-item">
<label>交易权证</label>
{{item.goods.goods_name}}
</view>
<view class="logs-item">
<label>交易单价</label>
{{item.price}}
</view>
<view class="logs-item">
<label>交易数量</label>
{{item.qty}}
</view>
<view class="logs-item">
<label>转让用户</label>
{{item.sellUser.nickname}}
</view>
<view class="logs-item">
<label>购买用户</label>
{{item.buyUser.nickname}}
</view>
<view class="logs-item">
<label>交易时间</label>
{{item.created_at}}
</view>
</view>
</view>
</block>
<block v-else>
<view class="list-null">
<image class="icon" src="@/static/icons/listnull-icon.png" mode="widthFix" />
<view class="sub-title">暂无数据</view>
</view>
</block>
</view>
</template>
<script>
import { marketsLogs, marketsOrdersLogs } from '@/apis/interfaces/market'
export default {
data() {
return {
logs: [],
page: {},
tab : 'sell'
};
},
created(){
this.getList()
},
methods:{
onTasb(e){
this.tab = e
this.getList()
},
// 获取列表
getList(){
if(this.$Route.query.type === 'my'){
marketsOrdersLogs({}, this.tab).then(res =>{
console.log(res)
this.logs = res.data
this.page = res.page
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
return
}
marketsLogs().then(res => {
this.logs = res.data
this.page = res.page
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
}
}
}
</script>
<style lang="scss">
<style lang="scss" scoped>
.tabs{
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 99;
background-color: white;
height: 90rpx;
line-height: 90rpx;
display: flex;
justify-content: space-around;
.item{
border-bottom: solid 2rpx white;
box-sizing: border-box;
&.show{
border-color: $text-price;
color: $text-price;
}
}
}
.paddingTop{
padding-top: 90rpx;
}
.logs{
background: white;
margin-top: $margin;
padding: ($padding - 10) $padding;
.logs-item{
padding-left: 200rpx;
height: 50rpx;
line-height: 50rpx;
position: relative;
text-align: right;
font-size: $title-size-m;
@extend .nowrap;
label{
position: absolute;
left: 0;
top: 0;
width: 200rpx;
text-align: left;
color: $text-gray;
}
}
}
// 空提示
.list-null{
width: 100vw;
height: 100vh;
box-sizing: border-box;
text-align: center;
background: white;
padding-bottom: 20vh;
@extend .vertical;
.sub-title{
color: $text-gray;
font-size: $title-size-m;
}
.icon{
width: 288rpx;
}
}
.employees-null{
text-align: center;
line-height: 10vh;
padding-bottom: $padding;
font-size: $title-size-m;
color: $text-gray;
}
</style>

169
pages/market/management.vue Normal file
View File

@@ -0,0 +1,169 @@
<template>
<view class="NumberWeight">
<!-- 有订单列表 -->
<view v-if="lists.length > 0">
<block v-for="(item, index) in lists" :key="index">
<view class="order-item">
<view class="order-info">
<image class="order-cover" :src="item.goods.cover" mode="aspectFill"></image>
<view class="title">数字权证<text>{{item.surplus}}/{{item.stock}}</text></view>
<view class="text">锚定商品{{item.goods.goods_name}}</view>
<view class="text">交易哈希{{item.hash}}</view>
<view class="text">发布时间{{item.created_at}}</view>
</view>
<view class="order-tool">
<view class="price">{{item.price}}/</view>
<view class="order-btn" v-if="item.status.value === 1" @click="removeGoods(item.market_id, index)">取消转让</view>
<view class="order-status" v-if="item.status.value === 2">{{item.status.text}}</view>
</view>
</view>
</block>
</view>
<!-- 没有订单列表 -->
<no-list v-if="lists.length === 0" name="no-order" txt="暂无数据~" />
<u-toast ref="uToast" />
</view>
</template>
<script>
import { marketsMag, marketsCancel } from '@/apis/interfaces/market';
export default {
data() {
return {
lists: [],
page: 1,
total: 0
};
},
onLoad() {
this.getList();
},
onReachBottom() {
if (this.total > this.lists.length) {
this.page = this.page + 1;
this.getList();
} else {
this.$refs.uToast.show({
title: '吼吼吼~我是有底的~',
type: 'error',
icon: false,
duration: 3000
});
}
},
methods: {
getList() {
let data = {
perPage: 10,
page: this.page
};
marketsMag(data)
.then(res => {
console.log(res.markets.data);
this.lists = this.lists.concat(res.markets.data);
this.total = res.markets.page.total;
})
.catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'error',
icon: false,
duration: 3000
});
});
},
// 取消转让
removeGoods(id, index) {
marketsCancel(id).then(res => {
uni.showToast({
icon : 'none',
title: res
})
let statusObj = this.lists[index]
statusObj.status = {
value: 2,
text : '已取消',
}
this.$set(this.lists, index, statusObj)
}).catch(err => {
uni.showToast({
icon : 'none',
title: err.message
})
})
}
},
onNavigationBarButtonTap(){
this.$Router.push({name: "marketLogs", params: {type: 'my'}})
}
};
</script>
<style lang="scss" scoped>
.NumberWeight {
box-sizing: border-box;
// 订单列表
.order-item {
background-color: white;
margin: $margin;
border-radius: $radius;
padding: $padding;
.order-info{
position: relative;
padding-left: 188rpx;
min-height: 168rpx;
.order-cover{
position: absolute;
top: 0;
left: 0;
height: 168rpx;
width: 168rpx;
}
.title{
font-weight: bold;
font-size: $title-size-lg;
color: $text-color;
line-height: 48rpx;
height: 48rpx;
display: flex;
justify-content: space-between;
text{
font-size: 80%;
font-weight: normal;
}
}
.text{
line-height: 40rpx;
height: 40rpx;
font-size: $title-size-sm;
color: $text-gray;
@extend .nowrap;
}
}
.order-tool{
margin-top: $margin - 10;
padding-top: $padding - 10;
border-top: solid 1rpx $border-color;
display: flex;
justify-content: space-between;
.price{
color: $text-price;
font-weight: bold;
font-size: $title-size-m;
line-height: 50rpx;
}
.order-btn{
background: $text-price;
color: white;
padding: 0 $padding;
line-height: 50rpx;
border-radius: 25rpx;
font-size: $title-size-m;
}
.order-status{
color: $text-gray-m;
}
}
}
}
</style>

248
pages/market/transfer.vue Normal file
View File

@@ -0,0 +1,248 @@
<template>
<view v-if="!loding">
<!-- 产品信息 -->
<view class="goods">
<image class="cover" :src="info.goods.cover" mode="aspectFill"></image>
<view class="content">
<view class="title nowrap">数字权证</view>
<view class="text nowrap">锚定商品{{info.goods.goods_name}}</view>
<view class="text nowrap">提供企业{{info.goods.company.name}}</view>
<view class="text nav-goods nowrap" @click="onGoods">查看锚定商品信息<uni-icons type="arrowright" size="12" color="#e93340"></uni-icons></view>
</view>
<view class="info">
<view class="info-item">
<label>权证销售单价</label>
{{info.goods.price}}
</view>
<view class="info-item">
<label>拥有数量</label>
{{info.account.balance}}
</view>
<view class="info-item">
<label>转让价格</label>
<input class="info-input" type="digit" v-model="pirce" placeholder="输入转让价格" maxlength="5" @blur="calculatePirce" />
</view>
<view class="info-item info-flex">
<label>转让数量</label>
<uni-number-box class="info-number" v-model='stock' :min="1" :max="info.account.balance" @change="countPrice"></uni-number-box>
</view>
<view class="info-item">
<label>预估转让收益</label>
<view class="price">{{forecast}}</view>
</view>
</view>
</view>
<button class="buy-btn" type="default" @click="onCreate">确认转让</button>
<u-toast ref="uToast" />
</view>
</template>
<script>
import { marketsCreateInfo, marketsCreate } from '@/apis/interfaces/market'
export default {
data() {
return {
loding : true,
pirce : '',
stock : 1,
info : {},
forecast: '0.00'
};
},
onShow() {
marketsCreateInfo(this.$Route.query.symbol).then(res =>{
this.info = res
this.loding = false
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
methods:{
// 查看锚定产品
onGoods(){
this.$Router.push({name: 'marketGoods', params: { id: this.info.goods.goods_id }})
},
// 转让数量
countPrice(e){
this.stock = e
this.calculatePirce()
},
// 计算预估收益
calculatePirce(){
this.forecast = (this.pirce * this.stock).toFixed(2)
},
// 提交转让市场
onCreate(){
if(this.pirce === ''){
this.$refs.uToast.show({
title: '请校验转让价格',
type: 'error',icon:false,
duration: 3000
})
}else{
marketsCreate({
symbol : this.$Route.query.symbol,
qty : this.stock,
price : this.pirce || 0
}).then(res => {
uni.showModal({
title : '提示',
content : res,
showCancel : false,
success : () => {
this.$Router.back()
}
})
}).catch(err => {
console.log(err)
uni.showToast({
title: err.message,
icon : 'none'
})
})
}
}
}
}
</script>
<style lang="scss" scoped>
// 转让权证
.buy-btn{
margin: 0 $margin;
background: $text-price;
color: white;
height: 90rpx;
line-height: 90rpx;
padding: 0;
border-radius: $radius/2;
font-size: $title-size;
font-weight: bold;
&::after{
border: none;
}
}
// 产品信息
.goods{
min-height: 168rpx;
position: relative;
background: white;
border-radius: $radius/2;
margin: $margin;
padding: $padding;
.cover{
position: absolute;
left: $padding;
top: $padding;
width: 168rpx;
height: 168rpx;
}
.content{
padding-left: calc(168rpx + #{$padding});
.title{
position: relative;
font-size: $title-size-lg;
color: $text-color;
font-weight: bold;
line-height: 52rpx;
padding-right: 60rpx;
text{
position: absolute;
right: 0;
top: 0;
width: 60rpx;
text-align: right;
font-weight: normal;
}
}
.text{
font-size: $title-size-sm;
color: $text-gray;
height: 40rpx;
line-height: 40rpx;
&.nav-goods{
color: $text-price;
}
}
}
.info{
margin-top: $margin;
border-top: solid 1rpx $border-color;
padding-top: $padding;
.info-item{
padding-left: 200rpx;
height: 90rpx;
line-height: 90rpx;
position: relative;
text-align: right;
font-size: $title-size-lg;
&.info-flex{
display: flex;
justify-content: flex-end;
align-items: center;
}
@extend .nowrap;
label{
position: absolute;
left: 0;
top: 0;
width: 200rpx;
text-align: left;
color: $text-gray;
}
.info-input{
height: 80rpx;
line-height: 80rpx;
font-size: $title-size-lg;
}
.price{
color: $text-price;
font-weight: bold;
}
}
}
}
// 购买产品
.popup {
width: 100%;
background-color: #fff;
padding-bottom: $padding;
.title {
font-size: 36rpx;
text-align: center;
padding: 50rpx 30rpx 30rpx 30rpx;
font-weight: bold;
}
.btn {
background-color: $text-price;
height: 90rpx;
line-height: 90rpx;
text-align: center;
color: #fff;
font-weight: bold;
font-size: $title-size;
margin: $padding * 2;
border-radius: $radius/2;
}
.des {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: $padding $padding * 2;
color: $text-gray;
font-size: $title-size-lg;
text{
color: $text-color;
}
.price{
color: $main-color;
font-weight: bold;
}
}
}
</style>

View File

@@ -20,12 +20,12 @@
<label>订单金额</label>
<view class="price nowrap">{{amount}}</view>
</view>
<block v-if="coupons.length > 0">
<block v-if="coupons.length >= 1">
<view class="item">
<label>使用优惠券</label>
<picker>
<picker mode="selector" :range="coupons" range-key="title" :value="couponIndex" @change="couponsChange">
<view class="picker-text nowrap">
优惠券
{{couponIndex == 0 ? '选择优惠券' : coupons[couponIndex].title}}
<uni-icons type="arrowright" color="#ddd"></uni-icons>
</view>
</picker>
@@ -35,6 +35,10 @@
<view class="price nowrap">-{{couponPrice}}</view>
</view>
</block>
<view class="item">
<label>实际支付金额</label>
<view class="price nowrap">{{total}}</view>
</view>
</view>
<!-- 支付方式 -->
<radio-group class="pay-group" @change="payType">
@@ -71,6 +75,8 @@
amount : 0,
total : 0,
coupons : [],
couponIndex : 0,
couponId : '',
account : {},
payValue : 'eb',
}
@@ -78,16 +84,15 @@
created(){
buy({
goods_sku_id: this.$Route.query.skuId,
qty : this.$Route.query.qty,
qty : this.qty,
type : 1
}, 'GET').then(res=>{
this.loding = true
this.qty = this.$Route.query.qty,
this.payValue = this.$Route.query.type === 1 ? 'wx' : 'eb'
this.detail = res.detail
this.couponPrice = res.coupon_price
this.amount = res.amount
this.total = res.total
this.couponPrice = res.coupon_price.toFixed(2)
this.amount = res.amount.toFixed(2)
this.total = res.total.toFixed(2)
this.coupons = res.coupons
this.account = res.account
}).catch(err =>{
@@ -98,24 +103,56 @@
})
},
methods: {
// 获取可用优惠券
getCoupons(){
buy({
goods_sku_id : this.$Route.query.skuId,
qty : this.qty,
type : 1,
coupon_grant_id : this.couponId
}, 'GET').then(res=>{
this.couponPrice = res.coupon_price.toFixed(2)
this.amount = res.amount.toFixed(2)
this.total = res.total.toFixed(2)
this.coupons = [{
title : '不使用',
coupon_grant_id : ''
}, ...res.coupons]
}).catch(err =>{
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
// 选择优惠券
couponsChange(e){
this.couponIndex = e.detail.value
this.couponId = this.coupons[e.detail.value].coupon_grant_id
this.getCoupons()
},
// 选择支付类型
payType(e){
console.log(e.detail.value)
this.payValue = e.detail.value
},
//数量变化
numberChange(e){
this.qty = e
this.amount = this.detail[0].items[0].price * e
this.getCoupons()
},
// 提交订单
buyOrder(){
buy({
goods_sku_id: this.$Route.query.skuId || 23,
qty : this.qty,
type : this.payValue == 'eb' ? 1 : 2,
remark : 'app订单'
goods_sku_id : this.$Route.query.skuId,
qty : this.qty,
coupon_grant_id : this.couponId,
type : this.payValue === 'wx'?2:1,
remark : 'app订单易货产品',
channel : 'app'
}, 'POST').then(res=>{
console.log(res)
switch (this.payValue){
case 'eb':
this.ebPay(res.order_no)
@@ -147,14 +184,20 @@
// 易币支付
ebPay(orderNo){
eb(orderNo).then(res => {
uni.showModal({
title: '提示',
content: '支付成功,后续优化支付成功后直接转跳我的权证'
this.$Router.replace({
name : 'payResults',
params : {
index: 1,
price: this.total,
type : 'eb',
total: '可在我的资产下我的权证中查看购买的数字权证'
}
})
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
uni.showModal({
title : '支付提示',
content : err.message,
showCancel : false,
})
})
}

253
pages/order/couponMore.vue Normal file
View File

@@ -0,0 +1,253 @@
<template>
<view class="Coupon">
<!-- 有优惠券列表 -->
<view class="coupon-content">
<couponTemplate v-for="(item,index) in lists" :key='index' :item="{...item}" />
</view>
<!-- 没有优惠券列表 -->
<no-list v-if="lists.length === 0" name='no-counpon' :txt="showTxt" />
<!-- <u-toast ref="uToast" /> -->
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
getCouponsListById
} from '@/apis/interfaces/coupon'
import couponTemplate from '@/components/coupon-template/coupon-template-1'
export default {
data() {
return {
lists:[],
id:'',
page:1,
has_more:true,
showTxt: '没有任何优惠券哦~'
};
},
components: {
couponTemplate
},
onLoad(e) {
console.log(e)
this.id = e.id
this.getMyCoupon()
},
onShow() {
if (wx.getStorageSync('refresh')) {
this.lists = []
this.getMyCoupon()
}
},
onPullDownRefresh() {
this.page = 1
this.lists = []
this.has_more = true
this.getMyCoupon()
},
onReachBottom() {
if (this.has_more) {
this.page = this.page + 1
this.getMyCoupon()
} else {
this.$refs.uToast.show({
title: '吼吼吼~我是有底的~',
duration: 3000
})
}
},
methods: {
getMyCoupon() {
let id = this.id
let data={
page:this.page,
pageSize:4
}
getCouponsListById(id,data).then(res => {
console.log(res)
this.lists = this.lists.concat(res.data)
if (res.page.has_more) {
this.has_more = true
} else {
this.has_more = false
}
uni.stopPullDownRefresh()
wx.setStorageSync('refresh',false)
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
duration: 3000
})
})
},
// 选择顶部菜单
// selectNav(id) {
// console.log(typeof id)
// this.showTxt = (id === 1 ? '没有领取到任何优惠券哦~' : id === 2 ? '没有使用过任何优惠券哦~' : '没有任何过期优惠券哦~')
// if (id !== this.selectNavId) {
// this.selectNavId = id
// this.page = 1
// this.lists = []
// this.has_more = true
// this.getMyCoupon()
// }
// },
// 切换商品分类
selectNav(id) {
console.log(id)
this.selectNavId = id
this.getMyCoupon()
// if (this.selectCategoryId !== id) {
// this.goodsList = []
// this.has_more = true
// this.page = 1
// this.getGoodsByCompanyidCaregoryid()
// }
},
selectCategory(id) {
console.log(id)
this.selectCategoryId = id
this.getMyCoupon()
}
}
}
</script>
<style lang="scss" scoped>
.Coupon {
width: 100%;
min-height: 100vh;
box-sizing: border-box;
background-color: #F7F7F7;
padding-bottom: 20rpx;
.coupon-nav {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-around;
box-sizing: border-box;
background-color: #fff;
padding: 30rpx 60rpx 0 60rpx;
color: #cacaca;
.nav-item {
padding: 20rpx 30rpx 30rpx 30rpx;
border-bottom: solid 4rpx #fff;
font-size: 36rpx;
font-weight: bold;
}
.nav-item-select {
border-bottom: solid 6rpx $main-color;
color: $main-color;
}
}
.scroll-top {
position: sticky;
top: 0;
z-index: 1000;
.scroll-view_H {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
white-space: nowrap;
width: 100%;
padding: 30rpx 30rpx 0 30rpx;
background-color: #fff;
.scroll-view-item_H {
margin-right: 60rpx;
padding: 20rpx 0 40rpx 0;
// height: 100rpx;
display: inline-block;
min-width: 120rpx;
font-size: 28rpx;
border-bottom: #fff;
background-color: #fff;
transition: .1s;
text-align: center;
}
.scroll-view-item_H_selected {
// border-bottom: solid $main-color 4rpx;
color: $main-color;
font-weight: bold;
// font-size: 36rpx;
// transition: .3s;
text-shadow: 6rpx 8rpx 30rpx rgba($color: $main-color, $alpha: .5);
position: relative;
&:after {
// content: '';
// position: absolute;
// bottom: 10rpx;
// left: 0;
// height: 8rpx;
// width: 100%;
// background-color: $main-color;
}
}
}
.scroll-view_H-1 {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
white-space: nowrap;
width: 100%;
padding: 0 30rpx 30rpx 30rpx;
background-color: #fff;
// position: sticky;
// top: 100rpx;
// z-index: 1000;
.scroll-view-item_H-1 {
display: inline-block;
min-width: 120rpx;
font-size: 24rpx;
border-bottom: #fff;
background-color: #f7f7f7;
margin-left: 20rpx;
padding: 10rpx 30rpx;
text-align: center;
border-radius: 40rpx;
}
.scroll-view-item_H_selected-1 {
// border-bottom: solid $main-color 4rpx;
color: #fff;
font-weight: bold;
background-image: linear-gradient(to left, $main-color, $main-color-light);
// font-size: 36rpx;
// transition: .3s;
// text-shadow: 6rpx 8rpx 30rpx rgba($color: $main-color, $alpha: .5);
position: relative;
&:after {
// content: '';
// position: absolute;
// bottom: 10rpx;
// left: 0;
// height: 8rpx;
// width: 100%;
// background-color: $main-color;
}
}
}
}
}
</style>

View File

@@ -5,6 +5,7 @@
</template>
<script>
import { orderJournal } from '@/apis/interfaces/store'
export default {
data() {
return {

76
pages/pay/results.vue Normal file
View File

@@ -0,0 +1,76 @@
<template>
<view class="total vertical">
<uni-icons type="checkbox-filled" size="60" color="#e93340"></uni-icons>
<view class="title">支付成功</view>
<view class="price">支付金额<text>{{type}}{{price}}</text></view>
<view class="text">{{total}}</view>
<button class="btn" type="default" @click="onBack">确定</button>
</view>
</template>
<script>
export default {
data() {
return {
index: 1, // 返回层级
price: 0, // 支付金额
type : '¥', // 支付币种
total: '' // 支付提示语
};
},
created() {
this.index = this.$Route.query.index
this.price = this.$Route.query.price
this.type = this.$Route.query.type === 'eb' ? 'EB': '¥'
this.total = this.$Route.query.total
},
methods:{
onBack(){
this.$Router.back(this.index)
}
}
}
</script>
<style lang="scss" scoped>
.total{
text-align: center;
height: 100vh;
width: 100vw;
padding-left: 10vw;
padding-right: 10vw;
padding-bottom: 20vh;
box-sizing: border-box;
.title{
font-weight: bold;
font-size: $title-size + 10;
padding: 20rpx 0
}
.price{
font-size: $title-size-lg;
color: $text-gray;
text{
color: $text-price;
padding-left: 10rpx;
}
}
.text{
font-size: $title-size-lg;
color: $text-gray;
padding-top: $padding;
}
.btn{
height: 90rpx;
line-height: 90rpx;
border-radius: 0;
background: $text-price;
font-size: $title-size;
color: white;
font-weight: bold;
margin-top: 10vh;
&::after{
border: none;
}
}
}
</style>

View File

@@ -0,0 +1,217 @@
<template>
<view class="Collect-list">
<!--有收藏的店铺 -->
<view class="list-item" v-if="lists.length>0" v-for="(item,index) in lists" :key="index">
<view class="list-top">
<view class="list-top-left">
<image :src="item.cover" mode="aspectFill" class="list-banner"></image>
<view class="shop-info">
<view class="title ellipsis">{{item.name}}</view>
<view class="urate">
<u-rate :current="item.star" size="28rpx" :disabled="true"></u-rate>
</view>
<view class="des">销量:<span>100</span> <span> </span> 库存:<span>2524</span></view>
</view>
</view>
<view class="list-top-right" @click="onOpenWechat(item)">进店逛逛</view>
</view>
<view class="list-bottom">
<view class="list-bottom-item" v-for="(it,idx) in item.goods" :key='idx'>
<image class="goods-img" :src="it.cover" mode="aspectFill" @click="goGoods(it.goods_id)"></image>
<view class="money"> {{it.price.price_min}}</view>
</view>
</view>
</view>
<!-- 没有收藏的店铺 -->
<no-list name='no-shop' v-if="lists.length === 0" txt="您还没有收藏任何企业哦~" />
<!-- <u-toast ref="uToast" /> -->
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
shopSubscribeList
} from '@/apis/interfaces/mine'
export default {
data() {
return {
lists: [],
page: 1,
has_more: true,
};
},
onLoad(e) {
this.getList()
},
onReachBottom() {
if (this.has_more) {
this.page = this.page + 1
this.getGoodsByCompanyidCaregoryid()
} else {
this.$refs.uToast.show({
title: '吼吼吼~我是有底的~',
type: 'primary',
duration: 3000
})
}
},
methods: {
// 获取列表
getList() {
shopSubscribeList(this.page).then(res => {
console.log(res)
this.lists = this.lists.concat(res.data)
if (res.page.has_more) {
this.has_more = true
} else {
this.has_more = false
}
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'primary',
duration: 3000
})
})
},
// 打开微信小程序
onOpenWechat(e){
plus.share.getServices(res => {
let sweixin = null;
for(let val of res){
if(val.id === 'weixin'){
sweixin = val
}
}
/** 以此为例子 显示跳转引导页
* 'index_4'
* index 跳小程序企业首页
* 4 企业id
**/
if(sweixin != null){
sweixin.launchMiniProgram({
id : e.original_id,
path: 'pages/login/guide?scene=index_' + e.company_id,
})
}else{
uni.showToast({
title: '当前环境不支持打开微信小程序',
icon : 'none'
})
}
})
},
// 跳转商城
goShop(company_id) {
uni.setStorageSync('company_id', company_id)
uni.setStorageSync('refresh',true)
this.$Router.pushTab({
name: 'Goods'
})
},
goGoods(id) {
this.$Router.push({name: 'goodsDetails', query: {id: id}})
}
}
}
</script>
<style lang="scss" scoped>
.Collect-list {
.list-item {
border-top: solid 20rpx #F7F7F7;
padding: 0 30rpx 30rpx 30rpx;
.list-top {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 30rpx 0;
font-size: $title-size*0.94;
border-bottom: solid 1rpx #f7f7f7;
.list-top-left {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
.title {
width: 380rpx;
font-size: $title-size*1;
font-weight: 400;
}
.urate {
padding: 10rpx 0;
}
.des {
// padding-top: $padding*0.8;
font-size: $title-size * 0.8;
color: #999;
span {
color: #666;
padding: 0 10rpx;
}
}
.list-banner {
width: 120rpx;
margin-right: $margin*1.5;
height: 120rpx;
border-radius: 4rpx;
}
}
.list-top-right {
border: solid 1rpx $main-color;
color: $main-color;
display: inline-block;
padding: 8rpx 16rpx;
font-size: $title-size *0.8;
border-radius: 4rpx;
}
}
.list-bottom {
margin-top: 20rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
// padding: 0 30rpx;
.list-bottom-item {
width: 160rpx;
height: 160rpx;
position: relative;
.goods-img {
width: 100%;
height: 100%;
}
.money {
position: absolute;
bottom: 0;
right: 0;
background-color: rgba($color: #000000, $alpha: 0.5);
color: #fff;
padding: 2rpx 8rpx;
font-size: $title-size *0.9;
}
}
}
}
}
</style>

View File

@@ -0,0 +1,217 @@
<template>
<view class="can-use-list">
<view v-for="(item,index) in lists" v-if="lists.length>0" :key="index" style="padding: 0 30rpx;">
<view class="goods-item">
<image class="goods-img" hover-class="none" mode="aspectFill" @click="goDetail(item.goods_id)"
:src="item.cover" />
<view class="goods-info">
<view class="goods-title ellipsis-2">{{item.name}}</view>
<view class="flexrow">
<view class="goods-price"><span></span>{{item.price}}/权证</view>
<view :class="['right',selectSkuId===item.goods_sku_id?'selcetRight':'']"
@click="selectSkuId = item.goods_sku_id"> 兑换该商品</view>
</view>
</view>
</view>
</view>
<!-- 没有收藏的店铺 -->
<no-list name='no-goods' v-else txt="没有任何可兑换商品~" />
<view class="nowExchange" ><view class="btn" @click="verifiyCoupon('post')">确认兑换</view></view>
<!-- <u-toast ref="uToast" /> -->
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
scanInfo
} from '@/apis/interfaces/scan'
export default {
data() {
return {
lists: [],
page: 1,
exchangeShow: false, // false不显示立即兑换按钮
has_more: true,
code: '',
selectSkuId: ''
};
},
onLoad(e) {
if (e.code) {
this.code = e.code
}
this.verifiyCoupon('get')
},
methods: {
// 获取列表
verifiyCoupon(method) {
let apiUrl = 'coupons/verify/coupon'
let data = {
code: this.code
}
if(method === 'post'){
data.goods_sku_id = this.selectSkuId
}
scanInfo(apiUrl, data, method).then(res => {
console.log(res)
if(method === 'get'){
this.lists = res.goods
}else{
this.$refs.uToast.show({
title: '优惠券核销成功',
type: 'error',
icon: false,
duration: 3000
})
setTimeout(res=>{
uni.navigateBack({})
},3000)
}
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'error',
icon: false,
duration: 3000
})
})
},
goDetail(id) {
console.log(id)
uni.navigateTo({
url: '/pages/goods/details?id=' + id
})
}
}
}
</script>
<style lang="scss" scoped>
.can-use-list {
padding-bottom: 120rpx;
}
.goods-item {
width: calc(100% - 20rpx);
box-shadow: 0 0 20rpx 4rpx rgba($color: $main-color, $alpha: 0.1);
border-radius: 16rpx;
// margin-left: 20rpx;
margin: 40rpx 0 0 20rpx;
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
box-sizing: border-box;
position: relative;
.exchange {
position: absolute;
bottom: 30rpx;
right: 30rpx;
padding: 6rpx 16rpx;
border-radius: 20rpx 0 20rpx 0;
background-color: $main-color;
color: #fff;
font-size: 20rpx;
z-index: 1;
}
.goods-img {
width: 180rpx;
height: 180rpx;
position: relative;
top: 0;
left: -20rpx;
box-shadow: 0 0 10rpx 4rpx rgba($color: $main-color, $alpha: 0.1);
border-radius: 8rpx;
}
.goods-info {
flex: 1;
height: 180rpx;
padding: 20rpx 20rpx 20rpx 0;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: space-around;
box-sizing: border-box;
.goods-title {
width: 100%;
font-size: 28rpx;
}
.goods-price {
color: #039bfe;
padding-top: 10rpx;
font-weight: bold;
font-size: 32rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
span {
font-size: 26rpx;
// padding-right: 10rpx;
font-weight: normal;
&:nth-child(2) {
padding-left: 30rpx;
}
}
}
}
}
.flexrow {
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
.right {
padding: 20rpx 20rpx;
border-radius: 20rpx;
background-color: #cacaca;
color: #666;
}
.selcetRight {
background-color: #039bfe;
color: #fff;
font-weight: bold;
}
}
.nowExchange {
height: 90rpx;
background-color: #fff;
position: fixed;
bottom: 40rpx;
width: 100%;
padding:20rpx 30rpx;
.btn {
background-color: #039bfe;
font-size: 34rpx;
font-weight: bold;
color: #FFF;
padding: 20rpx 30rpx;
box-sizing: border-box;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
border-radius: 8rpx;
}
}
</style>

View File

@@ -0,0 +1,666 @@
<template>
<view class="ConfirmOrder">
<view class="goods-info1">
<view class="top">
<view class="company">
<image :src="shop.cover" mode="aspectFill" />
<view class="name">{{shop.name}}</view>
</view>
</view>
<view class="goods-info">
<image class="goods-img" :src="info.cover" mode="aspectFill" />
<view class="goods">
<view class="name">
<view class="name1 ellipsis-2">{{info.title}}</view> <span>{{info.price}}</span>
</view>
<!-- <view class="sku">均码规格/<span>x {{info.qty}}</span> </view> -->
<view class="sku">
<span>数量</span>
<span>
<u-number-box v-model="params.qty" :min='1' :max='1000' @change='numberBoxChange' />
</span>
</view>
</view>
</view>
<!-- <view class="goods-type">支付方式<span>在线支付</span></view> -->
<view class="goods-type" @click="showCouponList = true">优惠券
<span>{{coupon_grant_id!==''?'已优惠 - ¥'+coupon_price:'选择优惠券'}}
<u-icon name="arrow-right" color="#666" size="24" />
</span>
</view>
<!-- <view class="goods-type" style="border-top: solid 20rpx #f7f7f7;">创建时间<span>2021-11-20 13:00:15</span></view> -->
<view class="goods-type">商品总价 <span>{{amount}}</span></view>
<view class="goods-type" v-if="coupon_price>0">优惠<span> - {{coupon_price}}</span></view>
<!-- <view class="goods-type">运费 <span>免邮</span></view> -->
<view class="goods-type">
<u-input class="order-content" type="textarea" v-model="remark" :clearable='false' :border="true"
:auto-height="true" placeholder="请填写订单备注" />
</view>
<view class="pay-select">请选择支付方式</view>
<view class="pay-select-item" @click="selectPay('2')">
<view class="pay-left">
<u-icon class="wx-icon" name="weixin-fill" color="#fff" size="40"></u-icon>
<view class="pay-wx-title">
微信支付
<span>推荐微信用户使用</span>
</view>
</view>
<u-icon v-if="selectTypeId!== '2'" name="checkmark-circle" color="#f7f7f7" size="50"></u-icon>
<u-icon v-else name="checkmark-circle-fill" color="#e93340" size="50"></u-icon>
</view>
<view class="pay-select-item" @click="selectPay('1')">
<view class="pay-left">
<u-icon class="wx-icon" name="integral-fill" color="#fff" size="40"></u-icon>
<view class="pay-wx-title">
E币交易
<span>可用Eb总额{{account.getEBBalance}}</span>
</view>
</view>
<u-icon v-if="selectTypeId!== '1'" name="checkmark-circle" color="#f7f7f7" size="50" />
<u-icon v-else name="checkmark-circle-fill" color="#e93340" size="50" />
</view>
</view>
<!-- 订单 -->
<view class="actions">
<view class="title">
实付金额<span class="money">{{total}}</span>
</view>
<view @click="order" class="nowPay">提交订单</view>
</view>
<!-- 优惠券弹窗 -->
<u-popup v-model="showCouponList" mode="bottom" border-radius="14">
<scroll-view scroll-y="true" style="height: 1000rpx;" class="scrollView">
<view class="coupon-title">可用优惠券列表</view>
<view class="coupon-list-item" v-for="(item,index) in list" :key="index" v-if="list.length>0">
<u-icon v-if="coupon_grant_id!== item.coupon_grant_id" name="checkmark-circle" color="#cacaca"
size="50">
</u-icon>
<u-icon v-else name="checkmark-circle-fill" color="#e93340" size="50"></u-icon>
<couponTemplate style="flex: 1;" :item="{...item}" :showUse='false' />
<!-- 遮挡层用户控制点击事件 -->
<view class="coupon-list-item" @click="selectCoupon(item)"></view>
</view>
<!-- 没有优惠券列表 -->
<no-list v-if="list.length === 0" name='no-counpon' txt="没有任何可用券哦" />
</scroll-view>
</u-popup>
<!-- <u-toast ref="uToast" /> -->
<u-toast ref="uToast" />
</view>
</template>
<script>
import couponTemplate from "@/components/coupon-template/coupon-template-2"
import {
mallBuyGoods
} from '@/apis/interfaces/goods'
import {
wxPay,
ebPay
} from '@/apis/interfaces/order'
export default {
name: 'OrderInfo',
components: {
couponTemplate
},
data() {
return {
// box: {
// min: 1,
// max: 100
// },
amount: 0,
account: {},
total: 0,
shop: {}, // 店铺信息
info: {}, // 商品详情
showCouponList: false, // 默认false不显示优惠券弹窗列表
coupon_grant_id: '', // 默认没有选择任何一个优惠券
list: [], // 优惠券列表
params: {}, // 上个页面携带过来的参数
remark: '', // 备注
order_no: '', // 下单成功的id
selectTypeId: '2', // 微信支付2 E币支付1
coupon_price: '' // 代驾券显示金额,提货券显示什么呢
};
},
onLoad(e) {
// 获取确认订单页面参数
this.params = e
this.params.qty = Number(e.qty)
this.mallBuyGoods(e, 'get') // 确认订单商品信息get
},
methods: {
// 确认商品详情页get下单页面post
mallBuyGoods(params, method) {
params.coupon_grant_id = this.coupon_grant_id
mallBuyGoods(params, method).then(res => {
if (method === 'get') {
this.amount = res.amount
this.account = res.account
this.total = res.total
this.list = res.coupons
this.shop = res.detail[0].shop
this.info = res.detail[0].items[0]
this.coupon_price = res.coupon_price
} else {
this.order_no = res.order_no
// this.$refs.uToast.show({
// title: '下单成功',
// duration: 1888,
// type: 'primary',
// })
this.nowPay()
}
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'primary',
duration: 3000
})
})
},
// 提交订单
order() {
let params = this.params
params.coupon_grant_id = this.coupon_grant_id
params.remark = this.remark
params.channel = 'mini'
this.mallBuyGoods(params, 'post')
},
// 触发支付
nowPay() {
this.canPay = false
let apiUrl = ''
let data = {}
if (this.selectTypeId === '2') {
apiUrl = wxPay
data = {
order_no: this.order_no,
type: 'app'
}
} else {
apiUrl = ebPay
data = {
order_no: this.order_no
}
}
apiUrl(data).then(res => {
if (this.selectTypeId === '2') {
console.log(typeof res)
if (typeof res === 'string') {
let payInfo = JSON.parse(res)
// app 支付未完。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
// uni.requestPayment({
// provider: "wxpay",
// orderInfo: JSON.stringify(payInfo),
// success: res => {
// this.$refs.uToast.show({
// title: '支付成功',
// type: 'primary',
// duration: 3000
// })
// setTimeout(() => {
// this.canPay = true
// uni.reLaunch({
// url: '/pages/property/coupon/payStatus?success=true'
// })
// }, 3000);
// },
// fail: (err) => {
// this.canPay = true
// this.$refs.uToast.show({
// title: '支付失败',
// type: 'primary',
// duration: 3000
// })
// setTimeout(() => {
// this.canPay = true
// uni.reLaunch({
// url: '/pages/property/coupon/payStatus?success=false'
// })
// }, 3000);
// }
// })
this.$refs.uToast.show({
title: '支付失败',
type: 'primary',
duration: 3000
})
uni.showModal({
title: '温馨提醒',
content: '微信支付当前暂未开通,无法支付。',
success(res) {
this.canPay = true
setTimeout(() => {
this.canPay = true
uni.reLaunch({
url: '/pages/property/coupon/payStatus?success=false'
})
}, 3000);
}
})
// app 支付未完。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
} else {
this.$refs.uToast.show({
title: '创建订单成功',
type: 'primary',
duration: 3000
})
setTimeout(() => {
this.canPay = true
uni.reLaunch({
url: '/pages/property/coupon/payStatus?success=true'
})
}, 3000);
}
} else {
console.log(res)
this.$refs.uToast.show({
title: res,
type: 'primary',
duration: 3000
})
setTimeout(() => {
this.canPay = true
uni.reLaunch({
url: '/pages/property/coupon/payStatus?success=true'
})
}, 3000);
}
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'primary',
duration: 3000
})
setTimeout(res => {
this.canPay = true
}, 2000)
})
},
// 选择可用优惠券
selectCoupon(item) {
if (this.coupon_grant_id === item.coupon_grant_id) {
this.coupon_grant_id = ''
// this.coupon_price = ''
} else {
this.coupon_grant_id = item.coupon_grant_id
// this.coupon_price = item.price
}
this.mallBuyGoods(this.params, 'get')
this.showCouponList = false
},
// 增加库存时候触发事件
numberBoxChange(e) {
this.params.qty = e.value
this.mallBuyGoods(this.params, 'get')
},
// 选择支付方式
selectPay(id) {
if (id === '1') {
if (this.info.is_change) {
this.selectTypeId = id
} else {
this.$refs.uToast.show({
title: '当前商品不支持EB支付'
})
}
} else if (id === '2') {
this.selectTypeId = id
}
},
}
}
</script>
<style lang="scss" scoped>
page {
width: 100%;
height: 100%;
}
.pay-select {
padding: 20rpx 30rpx;
border-top: 20rpx #f7f7f7 solid;
}
.pay-select-item {
background-color: #fff;
padding: 30rpx;
border-bottom: solid 1rpx #f7f7f7;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
.pay-left {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
.pay-wx-title {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
box-sizing: border-box;
margin-left: 30rpx;
font-size: 28rpx;
span {
font-size: 24rpx;
color: #cacaca;
margin-top: 10rpx;
}
}
}
.wx-icon {
background-color: #e93340;
border-radius: 10rpx;
padding: 10rpx;
}
}
.ConfirmOrder {
width: 100%;
min-height: 100vh;
box-sizing: border-box;
background-color: #F7F7F7;
padding-bottom: 80rpx;
.acceptInfo {
margin: 0 30rpx;
// background-color: #fff;
box-shadow: 0 0 14rpx 4rpx rgba($color: $main-color, $alpha: 0.2);
border-radius: 20rpx;
padding: 30rpx;
position: relative;
top: -30rpx;
.name {
font-size: 36rpx;
font-weight: 600;
span {
padding-left: 20rpx;
font-size: 30rpx;
}
}
.address {
padding: 20rpx 40rpx;
font-size: 28rpx;
span {
margin-left: 10rpx;
}
}
}
.goods-info1 {
background-color: #fff;
border-top: solid 20rpx #f7f7f7;
.goods-type {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 30rpx 40rpx;
color: #666;
border-bottom: solid 1rpx #f7f7f7;
}
.goods-type span {
color: #000;
}
.order-content {
width: 100%;
}
// 顶部信息
.top {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 20rpx 40rpx;
border-bottom: solid 1rpx #f7f7f7;
.company {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
image {
width: 60rpx;
height: 60rpx;
border-radius: 50%;
margin-right: 20rpx;
}
}
.name {
font-size: 30rpx;
color: #484848;
}
.no {
margin-top: 20rpx;
font-size: $title-size*0.9;
color: #999;
}
.status {
color: #999;
font-size: $title-size;
}
}
// 商品信息
.goods-info {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
box-sizing: border-box;
margin-bottom: 20rpx;
padding: 30rpx 40rpx;
.goods-img {
width: 120rpx;
height: 120rpx;
border-radius: 10rpx;
}
.goods {
flex: 1;
margin-left: 20rpx;
.name {
width: 100%;
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: space-between;
box-sizing: border-box;
font-size: 30rpx;
// font-weight: bold;
.name1 {
width: 340rpx;
}
span {
font-size: 34rpx;
font-weight: normal;
}
}
.sku {
flex: 1;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
margin-top: 10rpx;
font-size: 28rpx;
color: #999;
}
}
}
// 合计信息
.total {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
box-sizing: border-box;
font-size: 28rpx;
color: #353535;
flex: 1;
text-align: right;
margin-top: 20rpx;
padding-bottom: 30rpx;
}
.total-btn {
// border: solid 1rpx #f7f7f7;
padding: 10rpx 30rpx;
border-radius: 10rpx;
color: red;
}
}
// 操作信息
.actions {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
box-sizing: border-box;
flex-wrap: wrap;
flex: 1;
font-size: 30rpx;
color: #666;
width: 100%;
background-color: #Fff;
position: fixed;
bottom: 0;
padding: 20rpx 0;
span {
color: $main-color;
margin-right: 30rpx;
font-weight: 600;
font-size: 32rpx;
}
.nowPay {
padding: 20rpx 50rpx;
text-align: center;
box-sizing: border-box;
background-color: $main-color;
color: #fff;
}
}
// 优惠券弹窗
.scrollView {
// padding: 40rpx;
box-sizing: border-box;
position: relative;
// 标题
.coupon-title {
padding: 40rpx;
font-weight: bold;
font-size: 40rpx;
border-bottom: solid 1rpx #f7f7f7;
}
// 优惠券样式
.coupon-list-item {
border-bottom: solid 1rpx #f7f7f7;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
position: relative;
width: 100%;
.coupon-list-item {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background-color: rgba($color: #000, $alpha: 0);
z-index: 10001;
}
}
}
// 选择收货地址
.add-addr {
width: 100%;
background-color: #fff;
border-bottom: solid rgba($color: $main-color, $alpha:0.2) 10rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 0 40rpx;
.selectNew {
flex: 1;
text-align: center;
}
.selectNew2 {
padding: 20rpx 0;
flex: 1;
font-size: 34rpx;
color: #353535;
span {
color: #666;
font-size: 28rpx;
margin-left: 20rpx;
}
.addrs {
font-size: 26rpx;
margin-top: 10rpx;
color: #666;
}
}
}
}
</style>

View File

@@ -73,6 +73,9 @@
}
],
categroyList: [{
id: '',
name: '全部'
}, {
id: '4',
name: '新到'
},
@@ -146,6 +149,7 @@
selectNav(id) {
console.log(id)
this.selectNavId = id
this.selectCategoryId = ''
this.getMyCoupon()
},
selectCategory(id) {

View File

@@ -34,7 +34,7 @@
},
onLoad(e) {
console.log(e)
this.id = this.$route.query.id
this.id = e.id
this.getMyCoupon()
},
onShow() {
@@ -56,6 +56,7 @@
} else {
this.$refs.uToast.show({
title: '吼吼吼~我是有底的~',
type: 'primary',
duration: 3000
})
}
@@ -80,9 +81,9 @@
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'primary',
duration: 3000
})
})
},
// 选择顶部菜单
@@ -124,7 +125,6 @@
min-height: 100vh;
box-sizing: border-box;
background-color: #F7F7F7;
padding-bottom: 20rpx;
.coupon-nav {
display: flex;

View File

@@ -12,9 +12,9 @@
<view class="goods-title" v-if="info.goods.length>0">可用商品 <span
style='font-size: 24rpx;color:gray;'>多选一</span></view>
<view class="goods-item" v-if="info.goods.length>0" v-for="(item,index) in info.goods" :key='index'>
<image :src="item.cover" mode="aspectFill" class="goods-img" @click="$router.push({name:'goodsDetails',query:{id:item.goods_id}})" />
<image :src="item.cover" mode="aspectFill" class="goods-img" @click="goDetail(item.goods_id)" />
<view class="goods-right">
<view class="goods-right-title ellipsis-2" @click="$router.push({name:'goodsDetails',query:{id:item.goods_id}})">{{item.name}}</view>
<view class="goods-right-title ellipsis-2" @click="goDetail(item.goods_id)">{{item.name}}</view>
<view class="goods-right-bottom">
<span class='money'>{{item.price}}</span>
<view class="used" v-if='info.use_way.value=== 1' @click="nowBuy(item)">立即购买</view>
@@ -38,7 +38,7 @@
<view class="showCode " v-if="showCode">
<view class="showCodeBg" @click="showCode = false"></view>
<view :class="['showCodeContent', showCode?'showCodeContentSelect':'showCodeContentSelectNo']">
<view class="showCodeTitle">商品兑换码</view>
<view class="showCodeTitle">优惠券兑换码</view>
<image :src="code" mode="widthFix"></image>
</view>
</view>
@@ -67,16 +67,23 @@
GoodTemplate
},
onLoad(e) {
console.log(this.$route)
this.coupon_grant_id = this.$route.query.id
this.coupon_grant_id = e.id
this.getList()
},
// 监听弹窗页面为false时候重新请求当前页面
watch: {
showCode(newVal, oldVal) {
if(!newVal && oldVal){
uni.setStorageSync('refresh',true)
}
}
},
methods: {
// 获取列表
getList() {
getCouponsInfoById(this.coupon_grant_id).then(res => {
this.info = res
this.contentArr = res.description.replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').split('<br/>')
this.contentArr =res.description? res.description.replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').split('<br/>'):''
this.loaded = true
}).catch(err => {
this.$refs.uToast.show({
@@ -87,16 +94,15 @@
},
// 点击立即购买去商品确认页面
nowBuy(items) {
console.log(items, 'items....')
let data = {
skuId: items.goods_sku_id,
qty: 1
}
this.$router.push({
name: 'Buy',
params: data
uni.navigateTo({
url: '/pages/property/coupon/confirmOrder?qty=1&type=2&goods_sku_id=' + items.goods_sku_id,
})
},
goDetail(id){
uni.navigateTo({
url:'/pages/goods/details?id='+id
})
console.log(data)
},
// 点击二维码特效
clickCode(grantid) {
@@ -152,7 +158,7 @@
// 优惠券
.coupon {
margin: 0 $margin * 2;
margin: 0 $margin;
background-color: #Fff;
position: relative;
z-index: 1;
@@ -182,7 +188,7 @@
// 可用商品
.goods-item {
background-color: #fff;
margin: $margin*1.5 $margin * 2;
margin: $margin*1.5 $margin;
border-radius: 20rpx;
display: flex;
flex-direction: row;
@@ -237,18 +243,18 @@
font-size: 34rpx;
font-weight: bold;
text-align: left;
margin: $margin*2;
margin: $margin $margin;
// text-shadow:10rpx 10rpx linear-gradient(to right, #f39e17, #f85b05);
text-shadow: 2rpx 2rpx 10rpx $main-color;
}
// 描述
.describe {
margin: $margin * 2 0;
margin: $margin 0;
.describe-des {
color: #999;
padding: 10rpx $margin * 2;
padding: 10rpx $margin ;
font-size: 28rpx;
}
}

View File

@@ -4,7 +4,7 @@
<view style="position: relative;z-index: 3;">
<!-- 搜索... -->
<view class="mine-top-contant">
<u-navbar :is-back="false" :background="background" title="企业优惠券中心" title-color="#fff"
<u-navbar :background="background" back-icon-color = '#fff' title="企业优惠券中心" title-color="#fff"
:border-bottom='false'>
</u-navbar>
<!--banner-->

View File

@@ -0,0 +1,101 @@
<template>
<view class="PayStatus">
<image class="payStatusImg" :src="success?'/static/images/paySuccess.png':'/static/images/payFail.png'" mode="widthFix" />
<view class="payTitle">{{success?'支付成功':'支付失败'}}</view>
<view class="payDes">{{success?'您已支付完成,订单稍后配送':'吼吼,您的支付未完成'}}</view>
<view class="payBackCheck">
<!-- <view class="check" v-if='success' @click="check">查看权证</view> -->
<view class="back" @click="back">返回首页</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
success:false,// 支付失败false 支付成功true
};
},
onLoad(e) {
if(e.success === 'true'){
uni.setNavigationBarTitle({
title:'支付成功'
})
this.success=true
}else{
uni.setNavigationBarTitle({
title:'支付失败'
})
this.success=false
}
},
methods: {
check() {
uni.reLaunch({
url:'/pages/property/order/numberWeight'
})
},
back() {
uni.reLaunch({
url:'/pages/equity/index'
})
}
}
}
</script>
<style lang="scss" scoped>
.PayStatus {
width: 100%;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
.payStatusImg {
width: 300rpx;
padding: 50rpx 0;
margin-top: 100rpx;
}
.payTitle {
font-size: 34rpx;
font-weight: bold;
color: #353535;
}
.payDes {
font-size: 26rpx;
color: #666;
padding: 20rpx;
margin-bottom: 30rpx;
}
.payBackCheck {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-around;
box-sizing: border-box;
font-size: 28rpx;
width: 100%;
.check {
border: $main-color solid 1rpx;
color: $main-color;
padding: 14rpx 50rpx;
border-radius: 4rpx;
}
.back {
background-color: $main-color;
color: #fff;
padding: 14rpx 50rpx;
border-radius: 4rpx;
}
}
}
</style>

View File

@@ -1,22 +1,327 @@
<template>
<view>
eb账户
<view class="Record">
<view class="record-top">
<image src="/static/images/record_bg.png" mode="widthFix" class="record-bg" />
<view class="record-top-nav">
<view :class="['record-top-item',type==='year'?'selectTopItem':'']" @click="selectType('year')">年账单</view>
<view :class="['record-top-item',type==='month'?'selectTopItem':'']" @click="selectType('month')">月账单</view>
<view :class="['record-top-item',type==='day'?'selectTopItem':'']" @click="selectType('day')">日账单</view>
</view>
<view class="record-mouth-year">
<view class="record-type-left">
<u-picker mode="time" v-model="show" :params="params" @confirm ='confirm' title ='筛选日期' start-year='2021' :end-year='currentYear'/>
<view @click="show = true">
{{date?date:'选择日期'}}
<uni-icons type="arrowdown" color="#fff" size="12" />
</view>
</view>
<view class="record-type-right">
<view :class="['pay_type_item',cointype==='in'?'pay_type_item_select':'']" @click="selectCoinType('in')">收入</view>
<view :class="['pay_type_item',cointype==='out'?'pay_type_item_select':'']" @click="selectCoinType('out')">支出</view>
</view>
</view>
<view class="record-title">可用额度 ( EB ) </view>
<view class="record-money"><span></span>{{account}} <span></span></view>
<!-- <view class="">待解锁额度</view>
<view class="">授信额度</view> -->
</view>
<!-- 列表 -->
<view class="record-list" v-if="lists.length>0">
<view class="record-list-item" v-for="(item,index) in lists" :key='index'>
<view class="record-list-item-top">
<view class="title">{{item.note}}</view>
<view class="money">{{cointype==='in'?'+':'-'}}{{item.amount}} </view>
</view>
<view class="record-list-item-date">{{item.blockTime}}</view>
</view>
</view>
<!-- 无列表 -->
<no-list v-if="lists.length === 0 && cointype === 'in'" name='no-in' txt="没有任何收入记录" />
<no-list v-if="lists.length === 0 && cointype === 'out'" name='no-out' txt="没有任何支出记录" />
<!-- <u-toast ref="uToast" /> -->
<u-toast ref="uToast" />
</view>
</template>
<script>
import {chaineb} from '@/apis/interfaces/mine';
export default {
data() {
return {
lists:[],
has_next_page:true,
page:1,
type:'year', // 统计类型day日month月year年
cointype:'in',// in 收入 out 支出
date:new Date().toISOString().slice(0,4), // 日Y-m-d月Y-m年Y
params: {
year: true,
month: true,
day: true
},
show: false, // 显示
currentDay:new Date().toISOString().slice(0,10),
currentMonth:new Date().toISOString().slice(0,7),
currentYear:new Date().toISOString().slice(0,4),
account:''
}
},
onLoad(){
this.getList()
},
onReachBottom(){
if (this.has_next_page) {
this.page = this.page + 1
this.getList()
} else {
this.$refs.uToast.show({
title: '吼吼吼~我是有底的~',
type: 'error',
icon:false,
duration: 3000
})
}
},
methods: {
// 获取列表
getList(){
let data = {
page:this.page,
type:this.type,
date:this.date,
cointype:this.cointype
}
chaineb(data).then(res => {
console.log(res)
this.account = res.account
this.lists = this.lists.concat(res.lists)
this.has_next_page = res.has_next_page
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'error',
icon:false,
duration: 3000
})
})
},
selectCoinType(type){
if(this.cointype !== type){
this.cointype = type
this.reset()
}
},
// 重置
reset(){
this.page = 1
this.lists = []
this.has_next_page = true
this.getList()
},
// 选择 年 月 日 切换要重置数据
selectType(type){
console.log(type,typeof type)
if(this.type !== type){
switch(type){
case 'year':
this.type = type
this.params= {
year: true,
month: false,
day: false
}
this.date = this.currentYear
this.reset()
break;
case 'month':
this.type = type
this.params= {
year: true,
month: true,
day: false
}
this.date = this.currentMonth
this.reset()
break;
case 'day':
this.type = type
this.params= {
year: true,
month: false,
day: false
}
this.date = this.currentDay
this.reset()
break;
}
}
},
// 点击确认按钮
confirm(e){
let type = this.type
switch(type){
case 'year':
this.date = e.year
this.reset()
break;
case 'month':
this.date = e.year + '-' + e.month
this.reset()
break;
case 'day':
this.date = e.year + '-' + e.month + '-' + e.day
this.reset()
break;
}
}
}
}
</script>
<style>
<style lang="scss" scoped>
page {
background-color: #f7f7f7;
}
.Record {
width: 100%;
min-height: 100vh;
padding-top: 30rpx;
background-color: #fff;
}
.record-top {
width: calc(100% - 60rpx);
height: 360rpx;
background-image: linear-gradient(to left, #f40c50 , #f40c50);
box-shadow: 0 10rpx 20rpx 0rpx rgba($color: $main-color, $alpha: 0.4);
margin: 0 30rpx;
border-radius: 20rpx;
box-sizing: border-box;
position: relative;
padding: 10rpx 50rpx 20rpx 50rpx;
z-index: 1;
.record-bg {
position: absolute;
width: 230rpx;
bottom: 0;
right: 30rpx;
z-index: 1;
}
.record-top-nav {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
.record-top-item {
margin: 40rpx 20rpx;
font-size: 30rpx;
font-weight: 500;
color: #fff;
}
.selectTopItem{
border-bottom: solid 4rpx #fff;
}
}
.record-mouth-year {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
position: relative;
z-index: 2;
color: #fff;
font-size: 30rpx;
.record-type-left {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
uni-icons {
margin-left: 4rpx;
}
}
.record-type-right {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
font-size: 24rpx;
.pay_type_item {
margin: 0 10rpx;
padding: 2rpx 20rpx;
border-radius: 30rpx;
border: solid 1rpx rgba($color: #000000, $alpha: 0);
}
.pay_type_item_select{
border: solid 1rpx #f7f7f7;
}
}
}
.record-title {
font-size: 28rpx;
color: #fff;
padding: 20rpx 0;
}
.record-money {
color: #fff;
font-size: 50rpx;
font-weight: bold;
span {
font-size: 30rpx;
font-weight: 400;
margin-right: 4rpx;
}
}
}
.record-list {
padding: 20rpx 30rpx;
.record-list-item {
padding: 20rpx 0;
border-bottom: solid 1rpx #f7f7f7;
.record-list-item-top {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
.title {
font-size: 30rpx;
width: 400rpx;
}
.money {
color: #f40c50;
font-size: 34rpx;
font-weight: bold;
}
}
.record-list-item-date {
font-size: 24rpx;
color: #a6a6a6;
margin-top: 10rpx;
}
}
}
</style>

View File

@@ -0,0 +1,139 @@
<template>
<view class="HistoryList">
<!-- 有足迹 -->
<view class="goodsList" v-if="lists.length>0">
<view class="date">以往足迹</view>
<view class="lists">
<view class="lists-item" v-for="(item,index) in lists" :key="index" @click="goGoods(item.goods_id)">
<image class="goods-img" :src="item.cover" mode="aspectFill" />
<view class="money"><span class="tags" v-if='item.tags.length>0'>{{item.tags[0].name}}</span><span>¥</span>{{item.price}}</view>
</view>
</view>
</view>
<!-- 没有任何足迹 -->
<no-list v-if="lists.length === 0" name='no-foot' txt="您还没有产生任何足迹哦~" />
<!-- <u-toast ref="uToast" /> -->
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
browsers
} from '@/apis/interfaces/mine'
export default {
data() {
return {
lists: [],
page: 1,
has_more: true
}
},
onLoad() {
this.getLists()
},
onReachBottom() {
console.log('this.has_more',this.has_more)
if (this.has_more) {
this.page = this.page + 1
this.getLists()
} else {
this.$refs.uToast.show({
title: '吼吼吼~我是有底的~',
duration: 3000
})
}
},
methods: {
getLists() {
browsers(this.page).then(res => {
console.log(res)
this.lists = this.lists.concat(res.data)
this.has_more = res.page.has_more
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'primary',
duration: 3000
})
})
},
// 跳转到商品详情
goGoods(id) {
console.log(id)
uni.navigateTo({
url: '/pages/goods/details?id=' + id
})
}
}
}
</script>
<style lang="scss" scoped>
.HistoryList {
background-color: #fff;
width: 100%;
min-height: 100vh;
.goodsList {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
box-sizing: border-box;
padding: 20rpx 10rpx 20rpx 15rpx;
border-bottom: solid 1rpx #f7f7f7;
.date {
margin-left: 10rpx;
font-size: $title-size * 1.12;
font-weight: bold;
}
.lists {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
flex-wrap: wrap;
width: 100%;
.lists-item {
margin: 20rpx 10rpx 10rpx 10rpx;
width: 220rpx;
.goods-img {
width: 220rpx;
height: 220rpx;
border-radius: 10rpx;
}
.money {
color: #FA3534;
font-size: $title-size*0.9;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
.tags {
background-color: #FA3534;
color: #fff;
padding: 2rpx 12rpx;
border-radius: 6rpx;
font-size: $title-size * 0.7 !important;
margin-right: 10rpx;
}
span {
font-size: $title-size * 0.8;
}
}
}
}
}
}
</style>

View File

@@ -1,188 +1,286 @@
<template>
<view>
<!-- 用户信息 -->
<view class="user">
<view class="user-tool">
<image src="@/static/icons/user_icon_00.png" mode="widthFix" />
</view>
<view class="user-content">
<image class="info-cover" src="../../static/dev/good_cover_00.jpg" mode="aspectFill" />
<view class="info-nickname">唐明明</view>
<view class="info-signa">潮流就是我的态度</view>
<view class="info-tags">
<text class="info-tags-item identity">普通用户</text>
<text class="info-tags-item vip">PULS企业</text>
<view v-if='loding'>
<block v-if="this.$store.state.token != ''">
<!-- 用户信息 -->
<view class="user">
<view class="user-tool" @click="$Router.push({name:'Setting'})">
<image src="@/static/icons/user_icon_00.png" mode="widthFix" />
</view>
<view class="user-content">
<image class="info-cover" :src="base.avatar || require('@/static/images/boss.png')" mode="aspectFill" />
<view class="info-nickname">{{base.nickname}}</view>
<view class="info-signa">潮流就是我的态度</view>
<view class="info-tags" v-if="this.$store.state.token != ''">
<text class="info-tags-item identity" v-if="base.identity">{{base.identity.name}}</text>
<text class="info-tags-item vip" v-if="base.company_level.name">{{base.company_level.name }}</text>
</view>
</view>
<view class="user-tabs">
<view class="user-tabs-item" :class="{'show': tabsIndex === 0}" @click="tabsIndex = 0">管理中心</view>
<view class="user-tabs-item" :class="{'show': tabsIndex === 1}" @click="tabsIndex = 1">我的推广</view>
</view>
</view>
<view class="user-tabs">
<view class="user-tabs-item" :class="{'show': tabsIndex === 0}" @click="tabsIndex = 0">管理中心</view>
<view class="user-tabs-item" :class="{'show': tabsIndex === 1}" @click="tabsIndex = 1">我的推广</view>
<!-- 消息 -->
<view class="user-ad" v-if="message.length > 0">
<uni-icons class="user-ad-icon" type="sound-filled" color="#e93340"></uni-icons>
<swiper class="user-ad-swiper" :interval="3000" autoplay vertical circular>
<swiper-item v-for="(item,index) in message" :key='index'>
<view class="user-ad-item">{{item}}</view>
</swiper-item>
</swiper>
</view>
</view>
<!-- 消息 -->
<view class="user-ad">
<uni-icons class="user-ad-icon" type="sound-filled" color="#e93340"></uni-icons>
<swiper class="user-ad-swiper" :interval="3000" autoplay vertical circular>
<swiper-item>
<view class="user-ad-item">恭喜用户0101成功开通PLUS企业会员</view>
</swiper-item>
<swiper-item>
<view class="user-ad-item">恭喜用户0101成功开通PLUS企业会员</view>
</swiper-item>
</swiper>
</view>
<block v-if="tabsIndex === 0">
<!-- 我的资产 -->
<view class="user-group">
<view class="title">
<view class="title-text">我的资产</view>
</view>
<view class="group-flex group-flex-4">
<view class="item">
<view class="item-num">0</view>
<view class="item-title">原石</view>
<block v-if="tabsIndex === 0">
<!-- 我的资产 -->
<view class="user-group">
<view class="title">
<view class="title-text">我的资产</view>
</view>
<view class="item">
<view class="item-num">0</view>
<view class="item-title">贡献值</view>
</view>
<view class="item">
<view class="item-num">0</view>
<view class="item-title">易币</view>
</view>
<view class="item">
<view class="item-num">0</view>
<view class="item-title">零钱</view>
<view class="group-flex group-flex-4">
<view class="item" @click="$Router.push({name:'Extract'})">
<view class="item-num">{{base.account.coins}}</view>
<view class="item-title">原石</view>
</view>
<view class="item" @click="$Router.push({name:'Fragment'})">
<view class="item-num">{{base.account.contribution}}</view>
<view class="item-title">当前贡献值</view>
</view>
<view class="item" @click="$Router.push({name:'Eb'})">
<view class="item-num">{{base.account.eb}}</view>
<view class="item-title">当前易币</view>
</view>
<view class="item" @click="$Router.push({name:'ExtractRed'})">
<view class="item-num">{{base.account.money}}</view>
<view class="item-title">零钱</view>
</view>
</view>
</view>
<!-- 我的权证 -->
<view class="user-group">
<view class="title" >
<view class="title-text">我的权证</view>
</view>
<view class="group-flex group-flex-4">
<view class="item" @click="$Router.push({name:'NumberWeight'})">
<view class="item-num">{{count.warrnats}}</view>
<view class="item-title">权证持有</view>
</view>
<view class="item" @click="$Router.push({name: 'marketManag'})">
<view class="item-num">{{count.warrnat_transfer}}</view>
<view class="item-title">权证转让</view>
</view>
<view class="item" @click="$Router.push({name:'ServicesOrder'})">
<view class="item-num">{{count.shipment_fuwu_count}}</view>
<view class="item-title">已使用</view>
</view>
<view class="item" @click="$Router.push({name:'MallShipments'})">
<view class="item-num">{{count.shipment_goods_count}}</view>
<view class="item-title">已提货</view>
</view>
</view>
</view>
<!-- 我的权证 -->
<view class="user-group">
<view class="group-flex group-flex-4">
<view class="item" @click="$Router.push({name:'Collection'})">
<image class="item-cover" src="@/static/icons/user_icon_02.png" mode="aspectFill" />
<view class="item-title">收藏的企业</view>
</view>
<view class="item" @click="$Router.push({name:'CouponList'})">
<image class="item-cover" src="@/static/icons/user_icon_03.png" mode="aspectFill" />
<view class="item-title">我的优惠券</view>
</view>
<view class="item" @click="$Router.push({name:'HistoryShop'})">
<image class="item-cover" src="@/static/icons/user_icon_01.png" mode="aspectFill" />
<view class="item-title">我的足迹</view>
</view>
<view class="item" @click="$Router.push({name:'AddressList'})">
<image class="item-cover" src="@/static/icons/user_icon_04.png" mode="aspectFill" />
<view class="item-title">地址管理</view>
</view>
</view>
</view>
</block>
<block v-else-if="tabsIndex === 1">
<!-- 我的权证 -->
<view class="user-group">
<view class="title">
<view class="title-text">推广数据</view>
</view>
<view class="group-flex group-flex-2">
<view class="item">
<view class="item-num">{{relations.children}}</view>
<view class="item-title">推广人数</view>
</view>
<view class="item">
<view class="item-num">{{relations.company}}</view>
<view class="item-title">推广企业</view>
</view>
</view>
</view>
<!-- 排名信息 -->
<view class="user-group">
<view class="title">
<view class="title-text">推广排名</view>
</view>
<view class="ranking ranking-after">
<view class="ranking-title">
<view class="ranking-text">全站推广人数</view>
<view class="ranking-number">{{relations.childrenRank}}</view>
</view>
<image class="tips" src="../../static/icons/property_icon_00.png" mode="aspectFill" />
</view>
<view class="ranking">
<view class="ranking-title">
<view class="ranking-text">推广企业</view>
<view class="ranking-number">{{relations.companyRank}}</view>
</view>
<image class="tips" src="../../static/icons/property_icon_01.png" mode="aspectFill" />
</view>
</view>
<!-- 推广海报 -->
<view class="poster-text">推广海报</view>
<view class="code">
<image class="code-img-bg" src="/static/images/share_bg_3.png" mode="aspectFill" />
<image class='code-img' :src="shareCode" mode="widthFix" />
</view>
</block>
<!-- 版权信息 -->
<view class="copyright">易品新境 beta 1.0.0</view>
</block>
<block v-else>
<view class="statusBar">
<view class="statusBar-title">我的资产</view>
</view>
<!-- 我的权证 -->
<view class="user-group">
<view class="title" >
<view class="title-text">我的权证</view>
</view>
<view class="group-flex group-flex-4">
<view class="item" @click="$Router.push({name:'NumberWeight'})">
<view class="item-num">0</view>
<view class="item-title">权证持有</view>
</view>
<view class="item" @click="$Router.push({name:'33'})">
<view class="item-num">0</view>
<view class="item-title">权证转让</view>
</view>
<view class="item" @click="$Router.push({name:'334'})">
<view class="item-num">0</view>
<view class="item-title">已使用</view>
</view>
<view class="item" @click="$Router.push({name:'MallShipments'})">
<view class="item-num">0</view>
<view class="item-title">已提货</view>
</view>
</view>
</view>
<!-- 我的权证 -->
<view class="user-group">
<view class="group-flex group-flex-4">
<view class="item">
<image class="item-cover" src="@/static/icons/user_icon_01.png" mode="aspectFill" />
<view class="item-title">商品收藏</view>
</view>
<view class="item">
<image class="item-cover" src="@/static/icons/user_icon_02.png" mode="aspectFill" />
<view class="item-title">关注企业</view>
</view>
<view class="item" @click="$Router.push({name:'CouponList'})">
<image class="item-cover" src="@/static/icons/user_icon_03.png" mode="aspectFill" />
<view class="item-title">我的优惠券</view>
</view>
<view class="item" @click="$Router.push({name:'AddressList'})">
<image class="item-cover" src="@/static/icons/user_icon_04.png" mode="aspectFill" />
<view class="item-title">地址管理</view>
</view>
</view>
<view class="store-login">
<image class="icon" src="@/static/icons/login-icon.png" mode="widthFix"></image>
<view class="sub-title">一键开启您的易货之旅</view>
<button type="default" @click="login">登录</button>
</view>
</block>
<block v-else-if="tabsIndex === 1">
<!-- 我的权证 -->
<view class="user-group">
<view class="title">
<view class="title-text">推广数据</view>
</view>
<view class="group-flex group-flex-2">
<view class="item">
<view class="item-num">0</view>
<view class="item-title">推广人数</view>
</view>
<view class="item">
<view class="item-num">0</view>
<view class="item-title">推广企业</view>
</view>
</view>
</view>
<!-- 排名信息 -->
<view class="user-group">
<view class="title">
<view class="title-text">推广排名</view>
</view>
<view class="ranking ranking-after">
<view class="ranking-title">
<view class="ranking-text">全站推广人数</view>
<view class="ranking-number">5</view>
</view>
<image class="tips" src="../../static/icons/property_icon_00.png" mode="aspectFill" />
</view>
<view class="ranking">
<view class="ranking-title">
<view class="ranking-text">推广企业</view>
<view class="ranking-number">5</view>
</view>
<image class="tips" src="../../static/icons/property_icon_01.png" mode="aspectFill" />
</view>
</view>
<!-- 推广海报 -->
<view class="poster-text">推广海报</view>
<carousel :img-list="imgList" url-key="url" @selected="selectedBanner"/>
</block>
<!-- 版权信息 -->
<view class="copyright">易品新境 beta 1.0.0</view>
</view>
</template>
<script>
import carousel from '@/components/vear-carousel/vear-carousel'
import { getUserInfo , appcode } from '@/apis/interfaces/mine'
import userAuth from '@/public/userAuth'
export default {
components: {
carousel
},
data() {
return {
tabsIndex: 1,
imgList: [{
url: 'https://img9.51tietu.net/pic/2019-091200/vgkpidei2tjvgkpidei2tj.jpg',
id: 1
},{
url: 'https://img9.51tietu.net/pic/2019-091200/euzekmi5m23euzekmi5m23.jpg',
id: 2
},{
url: 'https://img9.51tietu.net/pic/2019-091200/143tt0ta4sr143tt0ta4sr.jpg',
id: 3
}]
tabsIndex : 0,
base : {
avatar : '',
nickname: '',
account : {
token : 0,
contribution: 0,
eb : 0,
money : 0
}
},
count : {
warrnats : 0,
warrnat_transfer : 0,
shipment_fuwu_count : 0,
shipment_goods_count: 0
},
relations : '',
message : [],
shareCode : '',
loding : false
}
},
onShow(){
if(this.$store.state.token != '') this.userInfo()
else this.loding = true
},
methods: {
outLogin(){
this.$store.commit('setToken', '')
// 获取用户的基本信息
userInfo(){
Promise.all([getUserInfo(), appcode()]).then(res => {
let userInfoData = res[0],
appcodeData = res[1]
this.base = userInfoData.base
this.count = userInfoData.count
this.message = userInfoData.message
this.relations = userInfoData.relations
this.shareCode = appcodeData.code
this.loding = true
}).catch(err => {
console.log(err)
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
selectedBanner(item, index) {
console.log('🥒', item, index)
}
// 努力开发中,,,
showToast(){
uni.showToast({
title: '努力开发中',
icon : 'none'
})
},
// 登录
login(){
let auth = new userAuth()
auth.Login().then(res => {
if(res.auth){
this.loding = false
this.userInfo()
}
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
}
}
}
</script>
<style lang="scss" scoped>
// 登录提示
.store-login{
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
z-index: 9;
background: white;
text-align: center;
@extend .vertical;
button{
margin-top: $margin*3;
display: inline-block;
width: 50%;
height: 90rpx;
line-height: 90rpx;
border-radius: $radius/2;
background: $text-price;
color: white;
font-weight: bold;
font-size: $title-size;
}
.sub-title{
color: $text-gray;
font-size: $title-size-m;
}
.icon{
width: 288rpx;
}
}
// 退出按钮
.out-login{
padding: 0 $padding;
@@ -278,6 +376,7 @@
&.vip{
background-image: linear-gradient(to right, #f8e5c0, #d6a46a);
color: #8d4928;
text-transform: uppercase;
}
}
}
@@ -406,13 +505,31 @@
margin: $margin + 10 0 0;
text-align: center;
}
.code{
width: 700rpx;
height: 400rpx;
background-color: red;
margin: 25rpx;
position: relative;
.code-img-bg{
width: 100%;
height: 100%;
}
.code-img{
width: 220rpx;
position: absolute;
left: 30rpx;
top: 50%;
margin-top: -90rpx;
}
}
// 易货订单
.order-flex{
.item{
width: calc(20% - #{$padding - 10});
width: calc(25% - #{$padding - 10});
.item-num{
font-weight: bold;
font-size: $title-size + 4;
font-size: $title-size;
}
.item-cover{
width: 72rpx;
@@ -454,4 +571,95 @@
font-size: $title-size-sm;
color: $text-gray-m;
}
// Bar
.statusBar{
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 99;
background: $text-price;
@extend .ios-top;
.statusBar-box{
min-height: 90rpx;
position: relative;
padding: $padding $padding $padding ($padding + 88);
color: white;
.logo{
position: absolute;
left: $padding;
width: 94rpx;
height: 94rpx;
border-radius: 50%;
border: 4rpx solid #ed8483;
box-sizing: border-box;
box-shadow: 0 4rpx 15rpx rgba(109,1,0,.8);
}
.company{
width: calc(100% - 94rpx);
padding-left: 30rpx;
box-sizing: border-box;
.name{
line-height: 40rpx;
@extend .nowrap;
font-size: $title-size;
.name-img {
width: 30rpx;
height: 30rpx;
margin: 7rpx 0 0 15rpx;
}
}
.tool {
display: flex;
margin-top: 13rpx;
.faith{
line-height: 40rpx;
height: 38rpx;
@extend .nowrap;
font-size: 24rpx;
background-color: rgba(0,0,0,.15);
padding: 0 15rpx;
border-radius: 60rpx;
margin-right: 30rpx;
display: flex;
.faith-img {
width: 28rpx;
height: 28rpx;
margin: 5rpx 4rpx 0 0;
}
}
.btn{
line-height: 40rpx;
height: 38rpx;
font-size: 24rpx;
padding: 0 15rpx 0 30rpx;
background-color: #913335;
display: inline-block;
border-radius: 0 60rpx 60rpx 0;
position: relative;
text-transform: uppercase;
.btn-img {
position: absolute;
width: 38rpx;
height: 38rpx;
left: -20rpx;
top: 0;
}
}
}
}
}
.statusBar-title{
line-height: 88rpx;
min-height: 88rpx;
color: white;
text-align: center;
font-weight: bold;
}
}
.content{
padding-top: calc(var(--status-bar-height) + #{$padding * 2} + 65rpx);
padding-bottom: $padding;
}
</style>

View File

@@ -1,5 +1,5 @@
<template>
<view class="LogisticsIndex">
<view class="LogisticsIndex" v-if="loaded">
<block v-if="list.length>0">
<view class="logistics-top">
<view>{{express.express_name}} <span class="copy" @click='copy(express.express_no)'>复制单号</span></view>
@@ -34,12 +34,15 @@
data() {
return {
list: [],
loaded:false,
no: '', // 快递单号
express:{},// 地址信息
}
},
onLoad(e) {
this.no = this.$route.params.no
// this.no = this.$route.params.no
// this.getLogistic(this.no)
this.no = e.no
this.getLogistic(this.no)
},
methods: {
@@ -48,6 +51,7 @@
console.log(res)
this.list = res.logistics
this.express = res.express
this.loaded = true
}).catch(err => {
this.$refs.uToast.show({
title: err.message,

View File

@@ -60,7 +60,7 @@
id: 'signed'
},
{
name: '待退权',
name: '待退权',
id: 'process'
},
{
@@ -136,7 +136,7 @@
console.log(index,no)
uni.showModal({
title: '哎呦,提醒你',
content: '是否确认要取消订单啊,取消后请去我的权中查看',
content: '是否确认要取消订单啊,取消后请去我的权中查看',
success: (res) =>{
if (res.confirm) {
mallShipmentsCancel(no).then(res=>{

View File

@@ -1,23 +1,13 @@
<template>
<view class="OrderInfo">
<view class="OrderInfo" v-if="loaded">
<!-- 订单状态 -->
<view class="order-status">
<view class="info">
{{info.state.text}}
<span>{{info.state.remark}}</span>
{{state.text}}
<span>{{state.remark}}</span>
</view>
<image src="/static/imgs/fire.png" mode="widthFix"></image>
</view>
<!-- 收货人 -->
<view class="acceptInfo" v-if="type === '2'">
<block>
<view class="name">{{address.name}} <span>{{address.mobile}}</span> </view>
<view class="address">
<u-icon name="map" color="red"></u-icon>
<span>{{address.full_address}}</span>
</view>
</block>
</view>
<view class="goods-info1">
<view class="top">
@@ -38,10 +28,10 @@
<view class="name1 ellipsis-2">{{info.goods_sku.goods_name}}</view>
<!-- <span>16.80</span> -->
</view>
<view class="sku">权个数 <span>x {{info.qty}}</span> </view>
<view class="sku">个数 <span>x {{info.qty}}</span> </view>
</view>
</view>
<navigator class="total" hover-class="none" :url='"/pages/goods/detail?id="+info.goods_sku.goods_id'>
<navigator class="total" hover-class="none" :url='"/pages/goods/details?id="+info.goods_sku.goods_id'>
<view class="total-btn">再次购买</view>
</navigator>
<view class="goods-type">创建退货时间 <span>{{info.created_at}}</span></view>
@@ -73,7 +63,7 @@
<view :class="['dian',index === 0 ?'dian-active':'']"></view>
<view :class="['content',index === 0?'content-active':'']">
<view class="title">{{item.state_text?item.state_text:'当前状态不明确,需后台返回'}}</view>
<view class="des">退货原因{{item.title || '无理由'}} 退货备注{{item.remark || '无备注'}}</view>
<view class="des">原因{{item.title || '无理由'}} 备注{{item.remark || '无备注'}}</view>
<view class="pictures">
<image @click="priveImg(index,idx)" v-for="(it,idx) in item.pictures" :key='idx' :src="it" mode="aspectFill" />
</view>
@@ -101,16 +91,20 @@
return {
info: {},
qty: 1,
state:{},
refund_id: '', // 退货单no
company: '',
number: '',
logs: [],
loaded:false,
showLogs: false // 默认不显示记录信息
};
},
onLoad(e) {
this.refund_id = this.$route.params.no
this.getInfo(this.refund_id)
// this.refund_id = this.$route.params.no
// this.getInfo(this.refund_id)
this.refund_id = e.no
this.getInfo(e.no)
},
onShow() {
if (uni.getStorageSync('refresh')) {
@@ -123,6 +117,8 @@
mallRefundsInfo(refund_id).then(res => {
this.info = res
this.logs = res.log
this.state = res.state
this.loaded = true
}).catch(err => {
this.$refs.uToast.show({
title: err.message,

View File

@@ -1,5 +1,5 @@
<template>
<view class="NumberWeight">
<view class="mallShipments">
<!-- 订单分类 -->
<view class="nav">
<view :class="['nav-item' ,selectTypeId === item.id?'nav-item-selected':'']"
@@ -139,7 +139,7 @@
id: 'signed'
},
{
name: '待退数权',
name: '待确认退货',
id: 'process'
},
{
@@ -216,6 +216,7 @@
apiUrl = 'mall/shipments/post'
} else if(this.selectTypeId === 'take') {
apiUrl = 'mall/shipments/shop'
data.channel = 'app'
} else if(this.selectTypeId === 'refund') {
apiUrl = 'mall/refunds'
}
@@ -238,7 +239,7 @@
console.log(index, no)
uni.showModal({
title: '哎呦,提醒你',
content: '是否确认要取消订单啊,取消后请去我的权中查看',
content: '是否确认要取消订单啊,取消后请去我的权中查看',
success: (res) => {
if (res.confirm) {
mallShipmentsCancel(no).then(res => {
@@ -313,39 +314,51 @@
// 申请退货
nowRefund(no) {
this.$router.push({
name: 'MallShipmentsRefund',
params: {
no: no
}
// this.$Router.push({
// name: 'MallShipmentsRefund',
// params: {
// no: no
// }
// })
uni.navigateTo({
url:'/pages/property/order/mallShipmentsRefund?no='+no
})
},
// 查看物流
nowLogistics(no) {
this.$router.push({
name: 'Orderlogistics',
params: {
no: no
}
// this.$Router.push({
// name: 'Orderlogistics',
// params: {
// no: no
// }
// })
uni.navigateTo({
url:'/pages/property/order/logistics?no='+no
})
},
// 查看详情
goDetail(no) {
this.$router.push({
name: 'MallShipmentsInfo',
params: {
no: no
}
// this.$Router.push({
// name: 'MallShipmentsInfo',
// query:{
// no:no
// }
// })
uni.navigateTo({
url:'/pages/property/order/mallShipmentsInfo?no='+no
})
},
// 查看退货单详情
// 查看详情
goDetail1(no){
this.$router.push({
name: 'MallRefundsInfo',
params:{
no:no
}
// this.$Router.push({
// name: 'MallRefundsInfo',
// params:{
// no:no
// }
// })
uni.navigateTo({
url:'/pages/property/order/mallRefundsInfo?no='+no
})
}
@@ -359,7 +372,7 @@
height: 100%;
}
.NumberWeight {
.mallShipments {
width: 100%;
min-height: 100vh;
box-sizing: border-box;

View File

@@ -1,5 +1,5 @@
<template>
<view class="OrderInfo">
<view class="OrderInfo" v-if="loaded">
<!-- 订单状态 -->
<view class="order-status">
<view class="info">
@@ -38,10 +38,10 @@
<view class="name1 ellipsis-2">{{info.goods_sku.goods_name}}</view>
<!-- <span>16.80</span> -->
</view>
<view class="sku">权个数 <span>x {{info.qty}}</span> </view>
<view class="sku">个数 <span>x {{info.qty}}</span> </view>
</view>
</view>
<navigator class="total" hover-class="none" :url='"/pages/goods/detail?id="+info.goods_sku.goods_id'>
<navigator class="total" hover-class="none" :url='"/pages/goods/details?id="+info.goods_sku.goods_id'>
<view class="total-btn">再次购买</view>
</navigator>
<view class="goods-type">创建提货单时间 <span>{{info.created_at}}</span></view>
@@ -106,11 +106,12 @@
store_Name:'',// 门店名称
qty :1,
shipment_no:'', // 提货单no
loaded:false
};
},
onLoad(e) {
this.shipment_no = this.$route.params.no
this.getInfo(this.$route.params.no)
this.shipment_no = e.no
this.getInfo(e.no)
},
onShow() {
if(uni.getStorageSync('refresh')){
@@ -123,6 +124,7 @@
this.info = res
this.address = res.express
this.type = res.type+''
this.loaded = true
}).catch(err=>{
this.$refs.uToast.show({
title: err.message,
@@ -135,7 +137,7 @@
nowCancel(no){
uni.showModal({
title: '哎呦,提醒你',
content: '是否确认要取消订单啊,取消后请去我的权中查看',
content: '是否确认要取消订单啊,取消后请去我的权中查看',
success: (res) =>{
if (res.confirm) {
mallShipmentsCancel(no).then(res=>{

View File

@@ -78,8 +78,11 @@
};
},
onLoad(e) {
this.shipment_no = this.$route.params.no
this.getInfo(this.shipment_no)
// this.shipment_no = this.$route.params.no
// this.getInfo(this.shipment_no)
this.shipment_no = e.no
this.getInfo(e.no)
},
methods: {
// 预览上传图片
@@ -154,7 +157,7 @@
title: this.title,
shipment_no: this.shipment_no,
remark: this.remark,
pictures: JSON.stringify(this.pictures.path)
pictures:this.pictures.path
}
if (data.title === '') {
this.$refs.uToast.show({

View File

@@ -6,6 +6,7 @@
<view class="order-list" v-for="(item,index) in lists" :key="index">
<NumberWeightTemplate :item="item" />
<view class="actions">
<view @click="navMarkets(item.symbol)" class="nowPay">权证转让</view>
<view @click="nowTake(item.symbol)" class="nowPay">去提货</view>
</view>
</view>
@@ -64,6 +65,7 @@
page:this.page
}
mallWarrants(data).then(res=>{
console.log(res)
this.lists = this.lists.concat(res.data)
this.total = res.total
}).catch(err=>{
@@ -79,6 +81,10 @@
uni.navigateTo({
url:'./numberWeightInfo?symbol='+symbol
})
},
// 转让权证
navMarkets(symbol){
this.$Router.push({name: 'marketTransfer', params:{symbol}})
}
}
}

View File

@@ -1,5 +1,5 @@
<template>
<view class="OrderInfo">
<view class="OrderInfo" v-if="loaded">
<!-- 订单状态 -->
<view class="order-status">
<view class="info">
@@ -45,7 +45,7 @@
<view class="sku">可提个数 <span>x {{account.balance}}</span> </view>
</view>
</view>
<navigator class="total" hover-class="none" :url='"/pages/goods/detail?id="+goods.goods_id'>
<navigator class="total" hover-class="none" :url='"/pages/goods/details?id="+goods.goods_id'>
<view class="total-btn">再次购买</view>
</navigator>
<view class="goods-type" v-if="type === '1'">运费 <span>免邮</span></view>
@@ -147,7 +147,8 @@
store_Name: '', // 门店名称
qty: 1,
showCode:false,
showCodeImg:''
showCodeImg:'',
loaded:false
};
},
onLoad(e) {
@@ -155,6 +156,15 @@
this.getInfo(e.symbol)
// this.getInfo('G22S20')
},
// 监听弹窗页面为false时候重新请求当前页面
watch: {
showCode(newVal, oldVal) {
if(!newVal && oldVal){
this.getInfo(this.symbol)
uni.setStorageSync('refresh',true)
}
}
},
methods: {
getInfo(symbol) {
mallWarrantsList(symbol).then(res => {
@@ -167,6 +177,7 @@
this.stores = res.stores
this.qty = res.account.balance
this.type = res.logistic_type + ''
this.loaded = true
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
@@ -174,6 +185,7 @@
duration: 3000
})
setTimeout(res => {
uni.setStorageSync('refresh',true)
uni.navigateBack({})
}, 2000)
})

View File

@@ -0,0 +1,237 @@
<template>
<view class="NumberWeight">
<!-- 订单分类 -->
<view class="nav" >
<view :class="['nav-item' ,selectNavId === item.id?'nav-item-selected':'']" v-for="(item,index) in navList"
:key="index" @click="selectNav(item.id)">
{{item.name}}
{{item.id ==='signed' && count.signed >0 ? '('+count.signed + ')':''}}
{{item.id ==='completed' && count.completed >0 ?'('+count.completed + ')':''}}
{{item.id ==='init' && count.init >0 ?'('+count.init + ')':''}}
{{item.id ==='delivered' && count.delivered >0 ?'('+count.delivered + ')':''}}
</view>
</view>
<!-- 有订单列表 -->
<block v-if="lists.length > 0">
<!-- 订单列表 -->
<view class="order-list" v-for="(item,index) in lists" :key="index">
<MallShipmentsTemplate :item="item" />
<view class="actions">
<view class="nowPay" @click="goDetail(item.shipment_no)" >查看详情</view>
</view>
</view>
</block>
<!-- 没有订单列表 -->
<no-list v-if="lists.length === 0" name='no-order' txt="暂无数据~" />
<!-- <u-toast ref="uToast" /> -->
<u-toast ref="uToast" />
</view>
</template>
<script>
import MallShipmentsTemplate from '@/components/mall-shipments-template/mall-shipments-template'
import { mallShipmentsPostShop , mallShipmentsSign , mallShipmentsCancel } from '@/apis/interfaces/numberWeight'
export default {
components: {
MallShipmentsTemplate
},
data() {
return {
lists: [],
page:1,
total:0,
navList: [],
type:'',// post 快递单 空为自提单
selectNavId: 'signed',
count:{},// 订单数量
};
},
onLoad(e) {
this.navList = [
{
name: '已使用',
id: 'signed'
},
{
name: '已完成',
id: 'completed'
}
]
this.selectNavId = 'signed'
this.getList()
},
onShow(){
console.log(uni.getStorageSync('refresh'),'getStorageSync')
if(uni.getStorageSync('refresh')){
this.reset()
}
},
onUnload() {
uni.setStorageSync('refresh',false)
},
onReachBottom() {
if(this.total>this.lists.length){
this.page = this.page + 1
this.getList()
}else{
this.$refs.uToast.show({
title: '吼吼吼~我是有底的~',
duration: 3000
})
}
},
methods: {
reset(){
this.page =1
this.total = 0
this.lists = []
this.getList()
uni.setStorageSync('refresh',false)
},
// 选择订单
selectNav(id) {
if (this.selectNavId !== id) {
this.selectNavId = id
this.reset()
}
},
// 获取订单列表
getList(){
let data = {
pageSize:4,
page:this.page,
state:this.selectNavId
}
let apiUrl = ''
apiUrl = 'mall/shipments/service'
data.channel = 'app'
mallShipmentsPostShop(apiUrl,data).then(res=>{
console.log(res.count)
this.count = res.count
this.lists = this.lists.concat(res.lists.data)
this.total = res.lists.page.total
}).catch(err=>{
this.$refs.uToast.show({
title: err.message,
duration: 3000
})
})
},
// 查看详情
goDetail(no){
uni.navigateTo({
url:'/pages/property/order/servicesOrderInfo?no='+no
})
}
}
}
</script>
<style lang="scss" scoped>
page {
width: 100%;
height: 100%;
}
.NumberWeight {
width: 100%;
min-height: 100vh;
box-sizing: border-box;
background-color: #F7F7F7;
// 订单nav
.nav {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-around;
box-sizing: border-box;
font-size: $title-size*0.95;
padding: 0 30rpx;
background-color: #fff;
color: #666;
border-top: solid 20rpx #f7f7f7;
position: sticky;
top: 0rpx;
z-index: 10000;
.nav-item {
border-bottom: solid 4rpx #fff;
padding: 30rpx 10rpx;
}
.nav-item-selected {
border-bottom: solid 4rpx $main-color;
color: $main-color;
}
}
// 订单列表
.order-list {
background-color: #fff;
border-radius: 20rpx;
min-height: 300rpx;
margin: 30rpx 20rpx 0 20rpx;
padding:30rpx 30rpx 20rpx 30rpx ;
// border-top: solid 4rpx #cacaca;
// 操作信息
.actions {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
box-sizing: border-box;
flex-wrap: wrap;
flex: 1;
font-size: 28rpx;
color: #fff;
border-top: solid 1rpx #EFF4F2;
.nowPay {
padding: 4rpx 20rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
// background-color: $main-color;
color: #999;
border:solid 1rpx #cacaca;
}
.cancelOrder {
padding: 10rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
background-color: #DD524D;
}
.logistics {
background-color: $main-color;
padding: 10rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
}
.sign {
background-color: #DD524D;
padding: 10rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
}
.evaluate {
background-color: $main-color;
padding: 10rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
}
}
}
}
</style>

View File

@@ -0,0 +1,594 @@
<template>
<view class="OrderInfo" v-if="loaded">
<!-- 订单状态 -->
<view class="order-status">
<view class="info">
{{info.state_text}}
<span>您的快递正在坐着火箭朝您飞来</span>
</view>
<image src="/static/imgs/fire.png" mode="widthFix"></image>
</view>
<!-- 收货人 -->
<view class="acceptInfo" v-if="type === '1'">
<block>
<view class="name">{{address.name}} <span>{{address.mobile}}</span> </view>
<view class="address">
<u-icon name="map" color="red"></u-icon>
<span>{{address.full_address}}</span>
</view>
</block>
</view>
<view class="goods-info1">
<view class="top">
<view class="company">
<view class="company-logo">
<image :src="info.shop.cover" mode="aspectFill" />
<view class="name ellipsis">{{info.shop.name}}</view>
</view>
<view class="flexrow">
<view class="no ellipsis">发货单号 {{info.shipment_no}}</view>
</view>
</view>
</view>
<view class="goods-info">
<image class="goods-img" :src="info.goods_sku.cover" mode="aspectFill" />
<view class="goods">
<view class="name">
<view class="name1 ellipsis-2">{{info.goods_sku.goods_name}}</view>
<!-- <span>16.80</span> -->
</view>
<view class="sku">权证个数 <span>x {{info.qty}}</span> </view>
</view>
</view>
<navigator class="total" hover-class="none" :url='"/pages/goods/details?id="+info.goods_sku.goods_id'>
<view class="total-btn">再次购买</view>
</navigator>
<view class="goods-type">使用时间 <span>{{info.created_at}}</span></view>
<view class="goods-type">使用数量 <span> x {{info.qty}}</span></view>
<view class="goods-type">使用方式<span>门店使用</span>
</view>
<view class="goods-type-1" v-if="type === '2'">
提货门店
<view class="goods-type-address">
<view class="list-top1">
<image :src="info.store.cover.showpath" @click="map(info.store)" mode="aspectFill"
class="list-top1-img" />
<view class="shop-info shop-info1">
<view class="title ellipsis">{{info.store.name}}</view>
<view class="des" style="padding-top: 16rpx;">营业时间{{info.store.start_time}}</view>
<view class="des" style="padding-top: 4rpx;" @click="call(info.store.mobile)">
联系电话{{info.store.mobile}}</view>
<view class="des" style="padding-top: 4rpx;" @click="map(info.store)">
门店地址{{info.store.address}}</view>
</view>
</view>
</view>
</view>
</view>
<!-- <u-toast ref="uToast" /> -->
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
mallShipmentsInfo
} from '@/apis/interfaces/numberWeight'
export default {
name: 'OrderInfo',
data() {
return {
info: {},
list: [{
name: '快递',
disabled: true,
id: '1'
},
{
name: '自提',
disabled: false,
id: '2'
}
],
address: {},
type: '1', //提货类型2 自提 1 邮寄
showStoreList: false, // 默认false不显示优惠券弹窗列表
store_id: '', // 默认没有选择任何一个优惠券
store_Name: '', // 门店名称
qty: 1,
loaded: false,
shipment_no: '', // 提货单no
};
},
onLoad(e) {
console.log(e)
this.shipment_no = e.no
this.getInfo(e.no)
console.log(this.shipment_no)
// this.getInfo('2021081817410747800300000004')
},
onShow() {
if (uni.getStorageSync('refresh')) {
this.getInfo(this.shipment_no)
}
},
methods: {
getInfo(shipment_no) {
mallShipmentsInfo(shipment_no).then(res => {
this.info = res
this.address = res.express
this.type = res.type + ''
this.loaded = true
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'primary',
duration: 3000
})
})
},
call(e) {
uni.makePhoneCall({
phoneNumber: e
})
},
map(info) {
console.log(info.latitude, info.longitude)
uni.openLocation({
latitude: Number(info.latitude),
longitude: Number(info.longitude),
success: function() {
console.log('success');
}
});
}
}
}
</script>
<style lang="scss" scoped>
page {
width: 100%;
height: 100%;
}
.OrderInfo {
width: 100%;
min-height: 100vh;
box-sizing: border-box;
background-color: #F7F7F7;
padding-bottom: 80rpx;
.order-status {
width: 100%;
height: 300rpx;
background-image: linear-gradient(to bottom, $main-color, $main-color-light);
color: #Fff;
font-size: 36rpx;
padding: 30rpx 50rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
.info {
font-size: 36rpx;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
box-sizing: border-box;
span {
font-size: 28rpx;
padding-top: 30rpx;
}
}
image {
width: 200rpx;
}
}
.acceptInfo {
margin: 0 30rpx;
background-color: #fff;
box-shadow: 0 0 14rpx 4rpx rgba($color: $main-color, $alpha: 0.2);
border-radius: 20rpx;
padding: 30rpx;
position: relative;
top: -30rpx;
.name {
font-size: 36rpx;
font-weight: 600;
span {
padding-left: 20rpx;
font-size: 30rpx;
}
}
.address {
padding-top: 20rpx;
font-size: 28rpx;
span {
margin-left: 10rpx;
}
}
}
.goods-info1 {
padding: 20rpx 40rpx;
background-color: #fff;
.goods-type {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 30rpx 0;
border-bottom: solid 1rpx #f7f7f7;
}
.goods-type-1 {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
box-sizing: border-box;
padding: 30rpx 0;
border-bottom: solid 1rpx #f7f7f7;
}
.goods-type-address {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
u-icon {
padding-left: 20rpx;
}
}
// 顶部信息
.top {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 30rpx 0;
border-bottom: solid 1rpx #EFF4F2;
.company-logo {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
image {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
margin-right: 20rpx;
}
.name {
width: 600rpx;
font-size: 30rpx;
color: #484848;
font-weight: bold;
}
}
.no {
margin-top: 16rpx;
font-size: $title-size*0.8;
color: #999;
// width: 500rpx;
}
.status {
color: #999;
font-size: $title-size;
}
}
// 商品信息
.goods-info {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
box-sizing: border-box;
margin-top: 40rpx;
.goods-img {
width: 120rpx;
height: 120rpx;
border-radius: 10rpx;
}
.goods {
flex: 1;
margin-left: 20rpx;
.name {
width: 100%;
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: space-between;
box-sizing: border-box;
font-size: 30rpx;
// font-weight: bold;
.name1 {
width: 500rpx;
}
span {
font-size: 34rpx;
font-weight: normal;
}
}
.sku {
flex: 1;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
margin-top: 10rpx;
font-size: 28rpx;
color: #999;
}
}
}
// 合计信息
.total {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
box-sizing: border-box;
font-size: 26rpx;
color: $main-color;
flex: 1;
text-align: right;
margin-top: 20rpx;
padding-bottom: 30rpx;
}
.total-btn {
border: solid 1rpx $main-color;
padding: 6rpx 20rpx;
border-radius: 10rpx;
}
}
// 操作信息
.actions {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
box-sizing: border-box;
flex-wrap: wrap;
background-color: #fff;
flex: 1;
font-size: 28rpx;
padding: 20rpx 50rpx 30rpx 50rpx;
color: #fff;
.nowPay {
padding: 4rpx 20rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
// background-color: $main-color;
color: #999;
border: solid 1rpx #cacaca;
}
.cancelOrder {
padding: 10rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
background-color: #DD524D;
}
.logistics {
background-color: $main-color;
padding: 10rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
}
.sign {
background-color: #DD524D;
padding: 10rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
}
.evaluate {
background-color: $main-color;
padding: 10rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
}
}
}
.flexrow {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
width: 100%;
.copy {
color: $main-color;
font-size: $title-size*0.8;
font-weight: 400;
padding: 0 30rpx;
}
}
.no-address {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
}
// 优惠券弹窗
.scrollView {
// padding: 40rpx;
box-sizing: border-box;
position: relative;
// 标题
.coupon-title {
padding: 40rpx;
font-weight: bold;
font-size: 40rpx;
border-bottom: solid 1rpx #f7f7f7;
}
// 优惠券样式
.coupon-list-item {
border-bottom: solid 1rpx #f7f7f7;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
position: relative;
width: 100%;
.coupon-list-item {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background-color: rgba($color: #000, $alpha: 0);
z-index: 10001;
}
}
}
.list-top1 {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: space-between;
box-sizing: border-box;
font-size: $title-size*0.94;
width: 100%;
margin-left: 0 !important;
margin-top: 30rpx;
.shop-info {
margin-left: 20rpx;
}
.list-top1-img {
width: 170rpx;
height: 170rpx;
border-radius: 10rpx;
}
.des {
font-size: 28rpx;
}
.title {
font-size: 32rpx;
}
}
.list-top {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 30rpx 0;
font-size: $title-size*0.94;
border-bottom: solid 1rpx #f7f7f7;
width: 600rpx;
margin-left: 30rpx;
.list-top-left {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
.shop-info {
flex: 1;
}
.title {
width: 380rpx;
font-size: $title-size*1;
font-weight: 400;
}
.urate {
padding: 10rpx 0;
}
.des {
// padding-top: $padding*0.8;
font-size: $title-size * 0.8;
color: #999;
span {
color: #666;
padding: 0 10rpx;
}
}
.list-banner {
width: 120rpx;
margin-right: $margin*1.5;
height: 120rpx;
border-radius: 4rpx;
}
}
.list-top-right {
border: solid 1rpx $main-color;
color: $main-color;
display: inline-block;
padding: 8rpx 16rpx;
font-size: $title-size *0.8;
border-radius: 4rpx;
}
}
</style>

326
pages/property/record.vue Normal file
View File

@@ -0,0 +1,326 @@
<template>
<view class="Record">
<view class="record-top">
<image src="/static/images/record_bg.png" mode="widthFix" class="record-bg" />
<view class="record-top-nav">
<view :class="['record-top-item',type==='year'?'selectTopItem':'']" @click="selectType('year')">年账单</view>
<view :class="['record-top-item',type==='month'?'selectTopItem':'']" @click="selectType('month')">月账单</view>
<view :class="['record-top-item',type==='day'?'selectTopItem':'']" @click="selectType('day')">日账单</view>
</view>
<view class="record-mouth-year">
<view class="record-type-left">
<u-picker mode="time" v-model="show" :params="params" @confirm ='confirm' title ='筛选日期' start-year='2021' :end-year='currentYear'/>
<view @click="show = true">
{{date?date:'选择日期'}}
<uni-icons type="arrowdown" color="#fff" size="12" />
</view>
</view>
<view class="record-type-right">
<view :class="['pay_type_item',cointype==='in'?'pay_type_item_select':'']" @click="selectCoinType('in')">收入</view>
<view :class="['pay_type_item',cointype==='out'?'pay_type_item_select':'']" @click="selectCoinType('out')">支出</view>
</view>
</view>
<view class="record-title">可用额度</view>
<view class="record-money"><span></span>{{account}}</view>
<!-- <view class="">待解锁额度</view>
<view class="">授信额度</view> -->
</view>
<!-- 列表 -->
<view class="record-list" v-if="lists.length>0">
<view class="record-list-item" v-for="(item,index) in lists" :key='index'>
<view class="record-list-item-top">
<view class="title">{{item.note}}</view>
<view class="money">{{cointype==='in'?'+':'-'}}{{item.amount}}</view>
</view>
<view class="record-list-item-date">{{item.blockTime}}</view>
</view>
</view>
<!-- 无列表 -->
<no-list v-if="lists.length === 0 && cointype === 'in'" name='no-in' txt="没有任何收入记录" />
<no-list v-if="lists.length === 0 && cointype === 'out'" name='no-out' txt="没有任何支出记录" />
<!-- <u-toast ref="uToast" /> -->
<u-toast ref="uToast" />
</view>
</template>
<script>
import {chaineb} from '@/apis/interfaces/mine';
export default {
data() {
return {
lists:[],
has_next_page:true,
page:1,
type:'year', // 统计类型day日month月year年
cointype:'in',// in 收入 out 支出
date:new Date().toISOString().slice(0,4), // 日Y-m-d月Y-m年Y
params: {
year: true,
month: true,
day: true
},
show: false, // 显示
currentDay:new Date().toISOString().slice(0,10),
currentMonth:new Date().toISOString().slice(0,7),
currentYear:new Date().toISOString().slice(0,4),
account:''
}
},
onLoad(){
this.getList()
},
onReachBottom(){
if (this.has_next_page) {
this.page = this.page + 1
this.getList()
} else {
this.$refs.uToast.show({
title: '吼吼吼~我是有底的~',
type: 'error',
icon:false,
duration: 3000
})
}
},
methods: {
// 获取列表
getList(){
let data = {
page:this.page,
type:this.type,
date:this.date,
cointype:this.cointype
}
chaineb(data).then(res => {
console.log(res)
this.account = res.account
this.lists = this.lists.concat(res.lists)
this.has_next_page = res.has_next_page
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'error',
icon:false,
duration: 3000
})
})
},
selectCoinType(type){
if(this.cointype !== type){
this.cointype = type
this.reset()
}
},
// 重置
reset(){
this.page = 1
this.lists = []
this.has_next_page = true
this.getList()
},
// 选择 年 月 日 切换要重置数据
selectType(type){
console.log(type,typeof type)
if(this.type !== type){
switch(type){
case 'year':
this.type = type
this.params= {
year: true,
month: false,
day: false
}
this.date = this.currentYear
this.reset()
break;
case 'month':
this.type = type
this.params= {
year: true,
month: true,
day: false
}
this.date = this.currentMonth
this.reset()
break;
case 'day':
this.type = type
this.params= {
year: true,
month: false,
day: false
}
this.date = this.currentDay
this.reset()
break;
}
}
},
// 点击确认按钮
confirm(e){
let type = this.type
switch(type){
case 'year':
this.date = e.year
this.reset()
break;
case 'month':
this.date = e.year + '-' + e.month
this.reset()
break;
case 'day':
this.date = e.year + '-' + e.month + '-' + e.day
this.reset()
break;
}
}
}
}
</script>
<style lang="scss" scoped>
page {
background-color: #f7f7f7;
}
.Record {
width: 100%;
height: 100vh;
padding-top: 30rpx;
}
.record-top {
width: calc(100% - 60rpx);
height: 360rpx;
background-image: linear-gradient(to left, #f40c50 , #f40c50);
box-shadow: 0 10rpx 20rpx 0rpx rgba($color: $main-color, $alpha: 0.4);
margin: 0 30rpx;
border-radius: 20rpx;
box-sizing: border-box;
position: relative;
padding: 10rpx 50rpx 20rpx 50rpx;
z-index: 1;
.record-bg {
position: absolute;
width: 230rpx;
bottom: 0;
right: 30rpx;
z-index: 1;
}
.record-top-nav {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
.record-top-item {
margin: 40rpx 20rpx;
font-size: 30rpx;
font-weight: 500;
color: #fff;
}
.selectTopItem{
border-bottom: solid 4rpx #fff;
}
}
.record-mouth-year {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
position: relative;
z-index: 2;
color: #fff;
font-size: 30rpx;
.record-type-left {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
uni-icons {
margin-left: 4rpx;
}
}
.record-type-right {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
font-size: 24rpx;
.pay_type_item {
margin: 0 10rpx;
padding: 2rpx 20rpx;
border-radius: 30rpx;
border: solid 1rpx rgba($color: #000000, $alpha: 0);
}
.pay_type_item_select{
border: solid 1rpx #f7f7f7;
}
}
}
.record-title {
font-size: 28rpx;
color: #fff;
padding: 20rpx 0;
}
.record-money {
color: #fff;
font-size: 50rpx;
font-weight: bold;
span {
font-size: 30rpx;
font-weight: 400;
margin-right: 4rpx;
}
}
}
.record-list {
padding: 20rpx 30rpx;
.record-list-item {
padding: 20rpx 0;
border-bottom: solid 1rpx #f7f7f7;
.record-list-item-top {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
.title {
font-size: 30rpx;
width: 500rpx;
}
.money {
color: #f40c50;
font-size: 34rpx;
font-weight: bold;
}
}
.record-list-item-date {
font-size: 24rpx;
color: #a6a6a6;
margin-top: 10rpx;
}
}
}
</style>

View File

@@ -0,0 +1,269 @@
<template>
<view class="Mine">
<!-- 更多管理 -->
<view class="list">
<view class="list-item" @click="updImgs">
<view class="list-item-left">
<image src="/static/images/user-avatar.png" mode="widthFix" />
<span>修改头像</span>
</view>
<view class="avatar" >
<image :src="avatar.showPath || require('@/static/images/boss.png')" mode="aspectFill" />
<u-icon name="arrow-right" color="#f1f1f1" size="28"></u-icon>
</view>
</view>
<view class="list-item">
<view class="list-item-left">
<image src="/static/images/mine-self-name.png" mode="widthFix" />
<span>修改昵称</span>
</view>
<view class="input">
<input type="text" :value="nickname" @blur='blur' placeholder="请输入用户的昵称" maxlength="12" />
<u-icon name="arrow-right" color="#f1f1f1" size="28"></u-icon>
</view>
</view>
<view @click="loginOut" class="list-item">
<view class="list-item-left">
<image src="/static/images/reset-info.png" mode="widthFix" />
<span>退出登录</span>
</view>
<u-icon name="arrow-right" color="#f1f1f1" size="28"></u-icon>
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
getUserSettingInfo,
resetUserInfo
} from '@/apis/interfaces/mine'
import {
uploads
} from '@/apis/interfaces/uploading'
export default {
data() {
return {
canLogin: true,
nickname: '',
avatar: {
path: '',
showPath: ''
},
is_bind: true
}
},
onShow() {
this.getUserInfo()
},
onPullDownRefresh() {
this.getUserInfo()
},
methods: {
// 获取当前用户得基本信息
getUserInfo() {
getUserSettingInfo().then(res => {
this.avatar.showPath = res.avatar
this.nickname = res.nickname
this.is_bind = res.is_bind
uni.stopPullDownRefresh()
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'primary',
duration: 3000
})
})
},
loginOut() {
this.$store.commit('setToken', '')
this.$Router.replaceAll({name: 'Equity'})
},
// 上传头像
updImgs(type) {
uni.chooseImage({
crop: {
width: 80,
height: 80
},
success: res => {
let path = res.tempFiles.map((val, index) => {
return {
name: 'uploads' + index,
uri: val.path
}
})
uploads(path).then(pathRes => {
console.log(pathRes)
this.avatar.path = pathRes.path[0]
this.avatar.showPath = pathRes.url[0]
this.resetUserInfo('avatar',pathRes.url[0])
}).catch(err => {
uni.showToast({
title: err.message,
icon: 'none'
})
})
}
})
},
// 修改姓名
blur(e){
let value = e.detail.value
console.log(value)
console.log(this.nickname)
if(value !== this.nickname){
this.resetUserInfo('nickname',value)
}
},
// 修改头像或昵称
resetUserInfo(key, value) {
let data ={
key:key,
value:value
}
resetUserInfo(data).then(res=>{
uni.showToast({
title: res,
icon: 'none'
})
this.getUserInfo()
}).catch(err => {
uni.showToast({
title: err.message,
icon: 'none'
})
})
}
}
}
</script>
<style lang="scss" scoped>
page {
background-color: #F8F8F8;
}
.Mine {
width: 100%;
height: 100%;
position: relative;
background-color: #fff;
// 更多管理
.list {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
box-sizing: border-box;
position: relative;
top: -10rpx;
border-radius: 20rpx;
margin: 0 40rpx;
padding: 30rpx 0;
width: calc(100% - 80rpx);
button::after {
border: none;
background-color: none;
}
button {
position: relative;
display: block;
margin-left: auto;
margin-right: auto;
padding-left: 0;
padding-right: 0;
box-sizing: border-box;
font-size: $title-size *0.9;
text-align: center;
text-decoration: none;
line-height: 1;
border-radius: 5px;
-webkit-tap-highlight-color: transparent;
overflow: hidden;
color: #333;
background-color: #fff;
}
.list-item {
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 40rpx 0;
border-bottom: solid 1rpx #f7f7f7;
box-sizing: border-box;
.avatar {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
image {
width: 100rpx;
height: 100rpx;
border-radius: 50%;
margin-right: 20rpx;
}
}
.input {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
text-align: right;
flex: 1;
input {
padding-right: 30rpx;
width: 100%;
}
}
.list-item-left {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
image {
width: 40rpx;
}
span {
margin-left: 20rpx;
}
}
}
}
// 底部轮播图跳转到其他app
.mine-banner {
position: relative;
width: calc(100% - 80rpx);
top: -20rpx;
margin: 0 40rpx;
box-sizing: border-box;
margin-top: $margin*2;
}
}
.loginOut {
margin: 30rpx 50rpx;
background-color: #fff;
box-shadow: 0 0 20rpx 4rpx rgba($color: $main-color, $alpha: 0.1);
text-align: center;
padding: 20rpx;
border-radius: 10rpx;
color: #353535;
}
</style>

View File

@@ -1,6 +1,6 @@
<template>
<view>
权账户
账户
</view>
</template>

249
pages/store/Spread.vue Normal file
View File

@@ -0,0 +1,249 @@
<template>
<view class="content">
<view class="codeContent">
<image class="codeContent-back" src="../../static/icons/store_codeBack.png" mode="widthFix"></image>
<image class="codeContent-cont" src="../../static/icons/store_contBack.png" mode="widthFix"></image>
<view class="textContent">
<view class="company">
<image class="company-logo" :src="companyInfo.cover" mode="aspectFill"></image>
<view class="company-cont">
<view class="nowrap company-name">{{companyInfo.name}}</view>
<view class="company-tips">易货平台</view>
</view>
</view>
<view class="code">
<image class="code-img" :src="companyInfo.code" mode="aspectFit"></image>
<!-- <view class="code-text">简单扫一扫即可进入平台</view> -->
</view>
<!-- @click="shareCanvas" -->
<view class="codeBnt">
扫码推广
</view>
</view>
</view>
<canvas class="codeImg" canvas-id="qrcodeCard"></canvas>
</view>
</template>
<script>
import { companiesCode } from '@/apis/interfaces/store'
export default {
data() {
return {
companyInfo : ''
}
},
created() {
companiesCode().then(res=>{
this.companyInfo = res
})
},
methods: {
// 绘制图片
shareCanvas(e){
uni.showLoading({
title: '加载中',
})
// 下载头像
let avatarImg = new Promise(success=>{
uni.getImageInfo({
src : this.companyInfo.cover,
success : res => {
success(res.path)
}
})
})
// 下载二维码
let codeImg = new Promise(success => {
uni.getImageInfo({
src : this.companyInfo.code,
success : res => {
success(res.path)
}
})
})
Promise.all([avatarImg, codeImg]).then(res => {
console.log(res[0],'0')
console.log(res[1],'1')
// 绘制海报
const ctx = uni.createCanvasContext('qrcodeCard')
ctx.save()
// 绘制背景图片
ctx.drawImage('../../static/icons/store_downBack', 0, 0, 375, 603)
// 绘制头像
ctx.drawImage(res[0], 0, 0, 60, 60)
// 绘制二维码
ctx.drawImage(res[1], 140, 250, 110, 110)
// 文字
ctx.setFontSize(16)
ctx.fillText(this.companyInfo.name, 194, 180 , 270)
ctx.setFontSize(16)
ctx.fillText('邀请你加入易货平台', 194, 180 , 270)
ctx.save();
ctx.beginPath(); //开始绘制
ctx.arc(50 / 2 + 170, 50 / 2 + 110, 50 / 2, 0, Math.PI * 2, false);
ctx.clip();
// 保存图片
ctx.draw(true, () => {
uni.hideLoading()
uni.canvasToTempFilePath({
canvasId: 'qrcodeCard',
x: 0,
y: 0,
success: res => {
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success : res=>{
if (res.errMsg == "saveImageToPhotosAlbum:ok"){
uni.showToast({
title: '分享海报已保存至相册',
icon : 'none'
})
}else{
uni.hideLoading()
}
},
fail : err=>{
if (err.errMsg == "saveImageToPhotosAlbum:fail auth deny"){
uni.showModal({
title : '提示',
content : '暂未授权小程序写入您的相册,无法存储二维码海报',
confirmColor: '#d82526',
confirmText : '去设置',
success : res=>{
if (res.confirm){
uni.openSetting()
}
}
})
}
}
})
}
})
})
}).catch(err=>{
uni.showToast({
title: '海报下载,请检查网络',
icon : 'none'
})
})
}
}
}
</script>
<style lang="scss" scoped>
.content {
background-color: #e93340;
height: 100vh;
width: 100vw;
}
.codeContent {
position: relative;
width: 100%;
height: 100vh;
.codeContent-back {
width: 100%;
height: 100%;
z-index: 1;
position: absolute;
}
.codeContent-cont {
left: 5%;
width: 90%;
top: 100px;
z-index: 2;
position: absolute;
}
.codeContent-tips {
position: absolute;
top: 0;
right: 20rpx;
width: 200rpx;
z-index: 2;
}
.textContent {
position: absolute;
padding: 20rpx 20rpx 0 40rpx;
box-sizing: border-box;
width: 70%;
z-index: 3;
left: 15%;
right: 15%;
top: 140px;
}
.company {
width: 100%;
.company-logo {
width: 120rpx;
height: 120rpx;
border-radius: 50%;
}
.company-cont {
position: absolute;
width: 100%;
height: 230rpx;
left: 0;
top: 0;
padding: 20rpx 20rpx 30rpx 210rpx;
font-size: $title-size;
.company-name {
font-weight: 600;
margin: 10rpx 0;
}
.company-tips {
font-size: 26rpx;
color: #787878;
}
}
}
.code {
text-align: center;
width: 100%;
box-sizing: border-box;
margin-bottom: $margin;
.code-img {
width: 90%;
}
.code-text {
color: #787878;
margin-top: $margin - 10;
font-size: $title-size;
}
}
}
.codeBnt {
background-color: #e1293f;
text-align: center;
border-radius: 10rpx;
line-height: 90rpx;
font-weight: 600;
font-size: $title-size;
color: #FFFFFF;
box-shadow: 4rpx 0 10rpx rgba(155,0,19,.5);
position: relative;
}
/* canvas */
.codeImg {
position: absolute;
left: -1000%;
height: 603px;
width: 375px;
background: white;
}
</style>

Some files were not shown because too many files have changed in this diff Show More