Compare commits

...

56 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
249 changed files with 57322 additions and 20193 deletions

48
App.vue
View File

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

View File

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

View File

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

View File

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

View File

@@ -3,7 +3,7 @@
* moduleName: 优惠券相关 * moduleName: 优惠券相关
*/ */
import request from '../request.js' import { request } from '../index'
// 我的优惠券 // 我的优惠券
const myCoupon = (data) => { const myCoupon = (data) => {

View File

@@ -18,7 +18,8 @@ const mall = data => {
// 商品列表 // 商品列表
const list = data => { const list = data => {
return request({ return request({
url: "mall/goods" url: "mall/goods",
data
}) })
} }
@@ -171,6 +172,44 @@ const managesGoodsExtends = id => {
}) })
} }
// 通证权益 搜索页面
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 { export {
mall, mall,
list, list,
@@ -192,5 +231,10 @@ export {
managesTracedTo, managesTracedTo,
managesCoupons, managesCoupons,
managesGoodsPut, managesGoodsPut,
managesGoodsExtends managesGoodsExtends,
searchUrl,
goodsCategory,
companyCategory,
randgoodsUrl,
mallBuyGoods
} }

View File

@@ -47,12 +47,56 @@ const marketsPay = (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 { export {
markets, markets,
marketsLogs, marketsLogs,
marketsInfo, marketsInfo,
marketsBuy, marketsBuy,
marketsPay marketsPay,
marketsCreateInfo,
marketsCreate,
marketsMag,
marketsCancel,
marketsOrdersLogs
} }

View File

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

View File

@@ -3,7 +3,7 @@
* moduleName: 我的数权 * moduleName: 我的数权
*/ */
import request from '../request.js' import { request } from '../index'
// 我的数权 // 我的数权
const mallWarrants = (data) => { const mallWarrants = (data) => {

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 { export {
buy, buy,
eb eb,
wxPay,
ebPay
} }

View File

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

View File

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

View File

@@ -15,7 +15,7 @@ const index = () => {
}) })
} }
// 成交客户 // 成交客户 *********已废弃
const customer = data => { const customer = data => {
return request({ return request({
url: 'mall/statistics', url: 'mall/statistics',
@@ -23,6 +23,14 @@ const customer = data => {
}) })
} }
// 成交客户
const orderUsers = data => {
return request({
url: 'manages/order_users',
data
})
}
// 访客记录 // 访客记录
const visitors = data => { const visitors = data => {
return request({ 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 { export {
index, index,
customer, customer,
orderUsers,
visitors, visitors,
basicsConfig, 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({ return request({
url : 'user/identities/create/' + id, 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 { export {
identities, identities,
vipOrder, 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,7 +21,7 @@
<view class="coupon-right-des" v-if='item.type.value === 2'>{{item.price_text}}</view> <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 class="coupon-right-day">剩余{{item.time.expire}}</view>
</view> </view>
<view class="coupon-to-used" @click="couponDetailGo(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> </view>
<view class="check-all" v-if="item.coupon_count>2" @click="couponMoreListGo(item.coupon_id)"> <view class="check-all" v-if="item.coupon_count>2" @click="couponMoreListGo(item.coupon_id)">
@@ -152,7 +152,7 @@
box-sizing: border-box; box-sizing: border-box;
.money { .money {
font-size: 70rpx; font-size: 50rpx;
font-weight: bold; font-weight: bold;
} }
} }

File diff suppressed because one or more lines are too long

View File

@@ -39,7 +39,7 @@
// 跳转到商品详情页面 // 跳转到商品详情页面
goDetail(id) { goDetail(id) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/goods/detail?id=' + id url: '/pages/goods/details?id=' + id
}) })
} }
} }

View File

@@ -41,7 +41,7 @@
// 跳转到商品详情页面 // 跳转到商品详情页面
goDetail(id) { goDetail(id) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/goods/detail?id='+id url: '/pages/goods/details?id='+id
}) })
} }
} }

View File

@@ -1,6 +1,6 @@
<template> <template>
<view class="OrderTemplate" > <view class="OrderTemplate" >
<view class="top" > <view class="top" v-if="isTop">
<view class="company"> <view class="company">
<view class="company-logo"> <view class="company-logo">
<image :src="item.shop.cover" mode="aspectFill" /> <image :src="item.shop.cover" mode="aspectFill" />
@@ -33,7 +33,11 @@
}; };
}, },
props:{ props:{
item:Object item : Object,
isTop : {
type: Boolean,
default: true
}
}, },
onShow() { onShow() {
console.log(this.item,'onshow,numtempa') console.log(this.item,'onshow,numtempa')
@@ -42,7 +46,7 @@
// 跳转到商品详情页面 // 跳转到商品详情页面
goDetail(id) { goDetail(id) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/goods/detail?id='+id url: '/pages/goods/details?id='+id
}) })
}, },
// 复制 // 复制
@@ -113,13 +117,11 @@
justify-content: flex-start; justify-content: flex-start;
box-sizing: border-box; box-sizing: border-box;
margin-top: 36rpx; margin-top: 36rpx;
.goods-img { .goods-img {
width: 120rpx; width: 120rpx;
height: 120rpx; height: 120rpx;
border-radius: 10rpx; border-radius: 10rpx;
} }
.goods { .goods {
flex: 1; flex: 1;
margin-left: 20rpx; 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>
<view class="member-cont"> <view class="member-cont">
<view class="member-tips"> <view class="member-tips">
<view class="member-tips-title">会员升级/续费</view> <view class="member-tips-title" v-if="wordData.grade == 1">会员升级/续费</view>
<view class="member-tips-time">有效期2022年10月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>
<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> <image class="member-btn-icon" src="../../static/icons/store_icon_vip.png" mode="aspectFill"></image>
<view class="member-btn-name">去升级</view> <view class="member-btn-name">去升级</view>
</view> </view>
@@ -58,19 +64,19 @@
<view class="text">转让权证</view> <view class="text">转让权证</view>
</view> --> </view> -->
<view class="general-item"> <view class="general-item">
<view class="number">{{wordData.top.barter_total || 0}}</view> <view class="number">{{wordData.top.order_total.toFixed(2) || 0}}</view>
<view class="text">收益</view> <view class="text">交易</view>
</view> </view>
<view class="general-item" @click="$Router.push({name: 'GoodsMag'})"> <view class="general-item" @click="$Router.push({name: 'GoodsMag'})">
<view class="number">{{wordData.middle.sale || 0}}</view> <view class="number">{{wordData.middle.sale || 0}}</view>
<view class="text">在售权证</view> <view class="text">在售权证</view>
</view> </view>
<view class="general-item"> <view class="general-item" @click="$Router.push({name: 'Return'})">
<view class="number">{{wordData.top.barter_total || 0}}</view> <view class="number">{{wordData.order.refund || 0}}</view>
<view class="text">退货单处理</view> <view class="text">退货单处理</view>
</view> </view>
<view class="general-item"> <view class="general-item" @click="$Router.push({name: 'Deliver'})">
<view class="number">{{wordData.top.barter_total || 0}}</view> <view class="number">{{wordData.order.deliver|| 0}}</view>
<view class="text">发货单处理</view> <view class="text">发货单处理</view>
</view> </view>
</view> </view>
@@ -117,7 +123,7 @@
<image class="icon" src="@/static/icons/tool_icon_02.png" mode="aspectFill"></image> <image class="icon" src="@/static/icons/tool_icon_02.png" mode="aspectFill"></image>
<view class="title">优惠券管理</view> <view class="title">优惠券管理</view>
</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> <image class="icon" src="@/static/icons/tool_icon_03.png" mode="aspectFill"></image>
<view class="title">收款管理</view> <view class="title">收款管理</view>
</view> </view>
@@ -132,7 +138,7 @@
<image class="icon" src="@/static/icons/tool_icon_05.png" mode="aspectFill"></image> <image class="icon" src="@/static/icons/tool_icon_05.png" mode="aspectFill"></image>
<view class="title">智能名片</view> <view class="title">智能名片</view>
</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> <image class="icon" src="@/static/icons/tool_icon_06.png" mode="aspectFill"></image>
<view class="title">营销推广码</view> <view class="title">营销推广码</view>
</view> </view>
@@ -162,7 +168,16 @@
order : {} order : {}
} }
} }
} },
identityData:{
type: Object,
default: () => {
return {
time : {},
grade : {}
}
}
}
} }
} }
</script> </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

@@ -23,17 +23,17 @@
<image class="arrow" src="@/static/icons/equity_arrow_right.png" mode="aspectFill"></image> <image class="arrow" src="@/static/icons/equity_arrow_right.png" mode="aspectFill"></image>
</view> </view>
<!-- order-shipment --> <!-- order-refund -->
<view class="store-item" @click="$Router.push({name: ''})" v-if="toolList.orderShipment"> <view class="store-item" @click="$Router.push({name: 'Return'})" v-if="toolList.orderRefund">
<image class="icon" src="@/static/icons/tool_icon_04.png" mode="aspectFill"></image> <image class="icon" src="@/static/icons/tool_icon_07.png" mode="aspectFill"></image>
<view class="title">发货单管理</view> <view class="title">退换货管理</view>
<image class="arrow" src="@/static/icons/equity_arrow_right.png" mode="aspectFill"></image> <image class="arrow" src="@/static/icons/equity_arrow_right.png" mode="aspectFill"></image>
</view> </view>
<!-- order-refund --> <!-- order-shipment -->
<view class="store-item" @click="$Router.push({name: ''})" v-if="toolList.orderRefund"> <view class="store-item" @click="$Router.push({name: 'Deliver'})" v-if="toolList.orderShipment">
<image class="icon" src="@/static/icons/tool_icon_07.png" mode="aspectFill"></image> <image class="icon" src="@/static/icons/tool_icon_04.png" mode="aspectFill"></image>
<view class="title">退换货管理</view> <view class="title">发货单管理</view>
<image class="arrow" src="@/static/icons/equity_arrow_right.png" mode="aspectFill"></image> <image class="arrow" src="@/static/icons/equity_arrow_right.png" mode="aspectFill"></image>
</view> </view>
@@ -51,9 +51,10 @@
<image class="arrow" src="@/static/icons/equity_arrow_right.png" mode="aspectFill"></image> <image class="arrow" src="@/static/icons/equity_arrow_right.png" mode="aspectFill"></image>
</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> <image class="icon" src="@/static/icons/tool_icon_06.png" mode="aspectFill"></image>
<view class="title">营销推广码</view> <view class="title">营销推广码</view>
<image class="arrow" src="@/static/icons/equity_arrow_right.png" mode="aspectFill"></image>
</view> </view>
</view> </view>
</view> </view>

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

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

View File

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

View File

@@ -54,6 +54,23 @@
"navigationBarTextStyle": "white", "navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#e93340" "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", "path": "pages/property/order/numberWeight",
"name": "NumberWeight", "name": "NumberWeight",
@@ -173,7 +190,7 @@
"enablePullDownRefresh": true, "enablePullDownRefresh": true,
"navigationBarTextStyle": "white", "navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#e93340", "navigationBarBackgroundColor": "#e93340",
"navigationBarTitleText": "已使用订单" "navigationBarTitleText": "已使用服务类订单"
} }
},{ },{
"path": "pages/property/order/servicesOrderInfo", "path": "pages/property/order/servicesOrderInfo",
@@ -264,7 +281,16 @@
"name": "Vip", "name": "Vip",
"style": { "style": {
"navigationBarTitleText": "会员", "navigationBarTitleText": "会员",
"navigationBarBackgroundColor": "#1f1b1c", "navigationBarBackgroundColor": "#e93340",
"navigationBarTextStyle": "white",
"backgroundColor": "#fefaef"
}
}, {
"path": "pages/vip/agree",
"name": "vipAgree",
"style": {
"navigationBarTitleText": "用户协议",
"navigationBarBackgroundColor": "#e93340",
"navigationBarTextStyle": "white", "navigationBarTextStyle": "white",
"backgroundColor": "#fefaef" "backgroundColor": "#fefaef"
} }
@@ -333,6 +359,13 @@
"navigationBarTitleText": "成交客户", "navigationBarTitleText": "成交客户",
"navigationBarBackgroundColor": "#FFFFFF" "navigationBarBackgroundColor": "#FFFFFF"
} }
}, {
"path": "pages/store/examine",
"name": "Examine",
"style": {
"navigationBarTitleText": "退货单审核",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, { }, {
"path": "pages/store/basics", "path": "pages/store/basics",
"name": "Basics", "name": "Basics",
@@ -350,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", "path": "pages/employees/list",
"name": "Employees", "name": "Employees",
@@ -399,6 +481,13 @@
"navigationBarTitleText": "选择权证分类", "navigationBarTitleText": "选择权证分类",
"navigationBarBackgroundColor": "#FFFFFF" "navigationBarBackgroundColor": "#FFFFFF"
} }
}, {
"path": "pages/goods/goodsClassify",
"name": "goodsClassify",
"style": {
"navigationBarTitleText": "商品分类",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, { }, {
"path": "pages/goods/add", "path": "pages/goods/add",
"name": "GoodsMagAdd", "name": "GoodsMagAdd",
@@ -406,6 +495,27 @@
"navigationBarTitleText": "发布权证", "navigationBarTitleText": "发布权证",
"navigationBarBackgroundColor": "#FFFFFF" "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", "path": "pages/coupons/index",
"name": "Coupons", "name": "Coupons",
@@ -414,12 +524,12 @@
} }
}, { }, {
"path": "pages/coupons/couponList", "path": "pages/coupons/couponList",
"name": "Coupons", "name": "CouponsList",
"style": { "style": {
"enablePullDownRefresh": true, "enablePullDownRefresh": true,
"navigationBarTextStyle": "white", "navigationBarTextStyle": "white",
"navigationStyle": "custom", "navigationBarTitleText": "优惠券列表",
"backgroundColor": "#e93340" "navigationBarBackgroundColor": "#e93340"
} }
}, },
{ {
@@ -463,15 +573,15 @@
"style": { "style": {
"navigationBarTitleText": "扫码验证", "navigationBarTitleText": "扫码验证",
"navigationBarTextStyle": "white", "navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#039bfe" "navigationBarBackgroundColor": "#076cff"
} }
}, { }, {
"path": "pages/verification/details", "path": "pages/verification/history",
"name": "VerificationDetails", "name": "VerificationHistory",
"style": { "style": {
"navigationBarTitleText": "核销券详情", "navigationBarTitleText": "核销记录",
"navigationBarTextStyle": "white", "navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#f40c50" "navigationBarBackgroundColor": "#076cff"
} }
}, { }, {
"path": "pages/shop/lists", "path": "pages/shop/lists",
@@ -518,7 +628,113 @@
"type": "transparent" "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": { "tabBar": {
"color": "#bababa", "color": "#bababa",
@@ -549,7 +765,7 @@
}, },
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "易货", "navigationBarTitleText": "易货-易你所想",
"navigationBarBackgroundColor": "#f5f5f5", "navigationBarBackgroundColor": "#f5f5f5",
"backgroundColor": "#f5f5f5" "backgroundColor": "#f5f5f5"
}, },

View File

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

View File

@@ -79,7 +79,21 @@
<label class="input-label">{{timeIndex == 0 ? '券有效期': '延期天数'}}</label> <label class="input-label">{{timeIndex == 0 ? '券有效期': '延期天数'}}</label>
<block v-if="timeIndex === 0"> <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> <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>
<block v-if="timeIndex === 1"> <block v-if="timeIndex === 1">
<view class="input-number"> <view class="input-number">
@@ -107,6 +121,7 @@
</template> </template>
<script> <script>
import date from '@/public/date'
import TnDatePicker from "@/components/tn-datepicker/tn-datepicker"; import TnDatePicker from "@/components/tn-datepicker/tn-datepicker";
import { uploads } from '@/apis/interfaces/uploading' import { uploads } from '@/apis/interfaces/uploading'
import { pushCoupons } from '@/apis/interfaces/coupons' import { pushCoupons } from '@/apis/interfaces/coupons'
@@ -124,8 +139,8 @@
], ],
timeIndex : 0, timeIndex : 0,
times : [ times : [
{ type: 2, text: '固定时间(区间范围)' }, { type: 1, text: '固定时间(区间范围)' },
{ type: 1, text: '延期券(用户领取后有效天数)' } { type: 2, text: '延期券(用户领取后有效天数)' }
], ],
showDatePicker : false, // 活动弹出层时间 showDatePicker : false, // 活动弹出层时间
datePickerValue : [], // 活动时间 datePickerValue : [], // 活动时间
@@ -138,12 +153,19 @@
price : '', // 减少金额 price : '', // 减少金额
description : '', // 使用规则 description : '', // 使用规则
coupongoods : [], // 关联商品 coupongoods : [], // 关联商品
timeNumber : 1 // 延期券时间 timeNumber : 1 , // 延期券时间
minDate : '' // 优惠券最小期限
}; };
}, },
onShow(){ onShow(){
new date().then(res => {
this.minDate = res
})
this.coupongoods = this.$store.getters.getCoupongoods this.coupongoods = this.$store.getters.getCoupongoods
}, },
onUnload() {
this.$store.commit('setCoupongoods', [])
},
methods:{ methods:{
// 发券数量 // 发券数量
quantityChange(value){ quantityChange(value){
@@ -163,11 +185,15 @@
}, },
// 选择 // 选择
changePicker(e){ 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 this[e.target.dataset.type] = e.detail.value
}, },
// 日期 // 日期
confirmDatePicker(e){ confirmDatePicker(e){
this.datePickerValue = e.value this.datePickerValue = [e.startDate , e.endDate]
this.showDatePicker = false this.showDatePicker = false
}, },
// 上传优惠券封面 // 上传优惠券封面
@@ -206,11 +232,17 @@
start_at : this.datePickerValue[0], start_at : this.datePickerValue[0],
end_at : this.datePickerValue[1], end_at : this.datePickerValue[1],
description : this.description, description : this.description,
time_type : this.times[this.typeIndex].type, time_type : this.times[this.timeIndex].type,
days : this.timeNumber, days : this.timeNumber,
goodsable_ids : this.coupongoods goodsable_ids : this.coupongoods
} }
if(valuss.description === ''){
uni.showToast({
title:'请添加使用规则',
icon:'none'
})
return;
}
pushCoupons(valuss).then(res => { pushCoupons(valuss).then(res => {
uni.showModal({ uni.showModal({
title : '提示', title : '提示',

View File

@@ -4,9 +4,7 @@
<view style="position: relative;z-index: 3;"> <view style="position: relative;z-index: 3;">
<!-- 搜索... --> <!-- 搜索... -->
<view class="mine-top-contant"> <view class="mine-top-contant">
<u-navbar :is-back="false" :background="background" title="企业优惠券中心" title-color="#fff" <!-- <u-navbar :is-back="true" :background="background" title="企业优惠券中心" title-color="#fff" :border-bottom='false'></u-navbar> -->
:border-bottom='false'>
</u-navbar>
<!--banner--> <!--banner-->
<swiper class="swiper" :indicator-dots="true" :autoplay="false" indicator-active-color='#fff' <swiper class="swiper" :indicator-dots="true" :autoplay="false" indicator-active-color='#fff'
indicator-color='rgba(0,0,0,.1)'> indicator-color='rgba(0,0,0,.1)'>
@@ -142,8 +140,7 @@
</view> </view>
</u-circle-progress> </u-circle-progress>
<view class="now-get" v-if='item.can.get' <view class="now-get" v-if='item.can.get'
@click="toReceiveCoupon('services',index,item.coupon_id)"> @click="toReceiveCoupon('services',index,item.coupon_id)">立即领取</view>
立即领取</view>
<view class="now-get now-got" v-if="!item.can.get && item.can.is_get" <view class="now-get now-got" v-if="!item.can.get && item.can.is_get"
@click="toUse(item.coupon_id)">去使用</view> @click="toUse(item.coupon_id)">去使用</view>
</view> </view>
@@ -263,7 +260,6 @@
// 获取首页列表 // 获取首页列表
getCoupons() { getCoupons() {
couponsByCompanyId({}).then(res => { couponsByCompanyId({}).then(res => {
console.log(res)
this.activities = res.activities // 顶部活动 this.activities = res.activities // 顶部活动
this.notices = res.notices // 通知消息 this.notices = res.notices // 通知消息
let notices = res.notices let notices = res.notices

View File

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

View File

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

View File

@@ -18,13 +18,13 @@
<input type="text" v-model="name" placeholder="姓名"/> <input type="text" v-model="name" placeholder="姓名"/>
</view> </view>
<view class="info-inputs"> <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>
<view class="info-inputs"> <view class="info-inputs">
<input type="text" v-model="job" placeholder="职业"/> <input type="text" v-model="job" placeholder="职业"/>
</view> </view>
<view class="info-inputs"> <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"> <view class="picker-text">
{{section[sectionIndex].name}} {{section[sectionIndex].name}}
<uni-icons class="icon" type="arrowdown" color="#555"></uni-icons> <uni-icons class="icon" type="arrowdown" color="#555"></uni-icons>
@@ -50,7 +50,7 @@
<label> <label>
<view class="item-title">{{item.title}}</view> <view class="item-title">{{item.title}}</view>
<view class="item-info">{{item.description}}</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> </label>
</view> </view>
</checkbox-group> </checkbox-group>
@@ -73,7 +73,7 @@
section : [], section : [],
permissions : [], permissions : [],
permissionIds: [], permissionIds: [],
sectionIndex : 0, sectionIndex : '0',
cover : { cover : {
showpath : '', showpath : '',
path : '' path : ''

View File

@@ -12,9 +12,9 @@
<uni-swipe-action-item :rightOptions="options" @click="onEmployees($event, listIndex, index)"> <uni-swipe-action-item :rightOptions="options" @click="onEmployees($event, listIndex, index)">
<view class="employees-item"> <view class="employees-item">
<view class="cover"> <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> <block v-else>
<image class="cover-img" :src="item.user.avatar" mode="aspectFill"></image> <image class="cover-img" :src="item.cover" mode="aspectFill"/>
</block> </block>
</view> </view>
<view class="content"> <view class="content">

View File

@@ -87,12 +87,22 @@
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
<!-- 行业分类 --> <v-tabs
<scroll-view class="industry-tabs" scroll-x> v-model="industryIndex"
<view class="industry-item" :class="{'show':index === industryIndex}" v-for="(item, index) in industryBus" :key="index" @click="onBusIndustry(index)">{{item.title}}</view> :tabs="industryBus"
</scroll-view> 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"/> <industry-list :list="busList" @on-industry="onOpenWechat"/>
<!-- 分页 -->
<uni-load-more v-if="busList.length > 0" :status="pageStatus" :iconSize="16"></uni-load-more>
</block> </block>
<!-- 易货商城 --> <!-- 易货商城 -->
<block v-if="tabIndex === 0"> <block v-if="tabIndex === 0">
@@ -142,7 +152,7 @@
<view class="title"> <view class="title">
限时抢购<text>海量商家优惠券</text> 限时抢购<text>海量商家优惠券</text>
</view> </view>
<navigator class="more" url="/pages/coupons/couponList">查看更多</navigator> <view class="more" @click="onCoupons('more')">查看更多</view>
</view> </view>
<view class="coupons" v-if="coupons.length > 0"> <view class="coupons" v-if="coupons.length > 0">
<view class="coupons-item" v-for="(item, index) in coupons" :key="index"> <view class="coupons-item" v-for="(item, index) in coupons" :key="index">
@@ -163,20 +173,23 @@
<view class="logo"> <view class="logo">
<image class="logo-img" :src="item.cover" mode="aspectFill"></image> <image class="logo-img" :src="item.cover" mode="aspectFill"></image>
</view> </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>
</view> </view>
<!-- 优选商品 --> <!-- 优选商品 -->
<goods-list :list="goods" priceType="CNY" @on-goods="onGoods" /> <goods-list :list="goods" priceType="CNY" @on-goods="onGoods" />
<!-- 分页 -->
<uni-load-more :status="pageStatus" :iconSize="16"></uni-load-more>
</block> </block>
</view> </view>
</template> </template>
<script> <script>
import { companies, companiesList } from '@/apis/interfaces/company' 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 goodsList from '@/components/goods-list/goods-list'
import industryList from '@/components/industry-list/industry-list' import industryList from '@/components/industry-list/industry-list'
import userAuth from '@/public/userAuth'
export default{ export default{
comments:{ comments:{
goodsList, goodsList,
@@ -205,14 +218,16 @@
coupons : [], coupons : [],
position : {}, position : {},
goods : [], goods : [],
pages : {}, goodsPage : 1,
// 广场部分 // 广场部分
industryIndex: 0, industryIndex: 0,
recommendBus : [], recommendBus : [],
hotBus : [], hotBus : [],
industryBus : [], industryBus : [],
busList : [], busList : [],
busPages : {} busPage : 1,
// 分页
pageStatus : ''
}; };
}, },
created() { created() {
@@ -233,10 +248,38 @@
onRightBtn(e){ onRightBtn(e){
switch(e.index){ switch(e.index){
case 0: case 0:
this.$Router.push({name: 'Search'}) this.$Router.push({name: 'Search', params: {type: this.tabIndex}})
break 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(){ getCompanies(){
companies().then(res=>{ companies().then(res=>{
@@ -254,21 +297,26 @@
// 企业广场行业 // 企业广场行业
onBusIndustry(index){ onBusIndustry(index){
this.industryIndex = index this.industryIndex = index
this.busPage = 1
this.getCompaniesList() this.getCompaniesList()
}, },
// 企业列表 // 企业列表
getCompaniesList(){ getCompaniesList(){
companiesList({ companiesList({
industry_id: this.industryBus[this.industryIndex].industry_id industry_id: this.industryBus[this.industryIndex].industry_id,
page : this.busPage
}).then(res => { }).then(res => {
this.busList = res.data if(res.page.current === 1){
this.busPages = res.pages this.busList = []
}
this.busList = this.busList.concat(res.data)
this.busPage = res.page.current
this.pageStatus = res.page.has_more ? 'more': 'noMore'
}) })
}, },
// 易货首页 // 易货首页
getMall(){ getMall(){
mall().then(res => { mall().then(res => {
console.log(res.coupons)
this.classify = res.categories.slice(0, 9) this.classify = res.categories.slice(0, 9)
this.banners = res.banners this.banners = res.banners
this.coupons = res.coupons this.coupons = res.coupons
@@ -283,9 +331,15 @@
}, },
// 商品列表 // 商品列表
getGoods(){ getGoods(){
list().then(res => { list({
this.goods = res.data page: this.goodsPage
this.pages = res.page }).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){ onOpenWechat(e){
console.log(e)
plus.share.getServices(res => { plus.share.getServices(res => {
let sweixin = null; let sweixin = null;
for(let val of res){ 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> </script>
@@ -528,28 +597,16 @@
line-height: 64rpx; line-height: 64rpx;
font-size: 28rpx; 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{ .hot-swiper{
margin: 0 $margin $margin $margin; margin: 0 $margin $margin $margin;

View File

@@ -1,22 +1,295 @@
<template> <template>
<view> <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> </view>
</template> </template>
<script> <script>
import { searchUrl, companyCategory, randgoodsUrl } from '@/apis/interfaces/goods'
export default { export default {
data() { data() {
return { return {
nameVal : '',
searchArr : [],
searchType : '0', // 分类 0位商品 1为企业
marketType : 'asc', // 排序
categoryArr : [], // 分类数组--企业
companyId : '', // 分类数组--企业id
companyName : '选择行业',
companyShow : false,
// 分页
pageStatus : '',
page : 1
} }
}, },
methods: { 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> </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> </style>

View File

@@ -398,13 +398,13 @@
content : this.$Route.query.type === 'edit' ? '商品权证已更新,是否立即补充产品附加信息认证?' : '商品权证已发布,是否立即补充产品附加信息认证?', content : this.$Route.query.type === 'edit' ? '商品权证已更新,是否立即补充产品附加信息认证?' : '商品权证已发布,是否立即补充产品附加信息认证?',
cancelText : '稍后认证', cancelText : '稍后认证',
confirmText : '立即认证', confirmText : '立即认证',
success : res => { success : modalRes => {
if(res.cancel){ if(modalRes.cancel){
this.$Router.back(this.$Route.query.type === 'edit' ? 1 : 2) this.$Router.back(this.$Route.query.type === 'edit' ? 1 : 2)
} }
if(res.confirm){ if(modalRes.confirm){
let goodsId = this.$Route.query.type === 'edit' ? this.$Route.query.id : res let goodsId = this.$Route.query.type === 'edit' ? this.$Route.query.id : res
this.$Router.push({name: 'goodsAuth', params: { id: goodsId , type: 'goodsAdd', edit: this.$Route.query.type === 'edit'}}) this.$Router.replace({name: 'goodsAuth', params: { id: goodsId , type: 'goodsAdd', edit: this.$Route.query.type === 'edit'}})
} }
} }
}) })

View File

@@ -26,7 +26,6 @@
}, },
created() { created() {
managesCategory().then(res => { managesCategory().then(res => {
console.log(res)
this.loding = false this.loding = false
this.category = res this.category = res
}) })

View File

@@ -115,7 +115,6 @@
}, },
created() { created() {
managesAttestation(this.$Route.query.id).then(res=>{ managesAttestation(this.$Route.query.id).then(res=>{
console.log(res)
this.info = res this.info = res
}) })
}, },

View File

@@ -3,7 +3,7 @@
<image src="https://e-chain.cnskl.com/storage/imageresource/chain-bg.png" class='chainBg' /> <image src="https://e-chain.cnskl.com/storage/imageresource/chain-bg.png" class='chainBg' />
<view class="chain-content"> <view class="chain-content">
<view class="chain-center"> <view class="chain-center">
<image src="/static/images/service-logi.png" mode="aspectFill" class="logo" /> <image src="/static/icons/e-logo.png" mode="aspectFill" class="logo" />
<view class="name">易品新境区块链溯源证书</view> <view class="name">易品新境区块链溯源证书</view>
<view class="no">区块链溯源证书{{info.token}}</view> <view class="no">区块链溯源证书{{info.token}}</view>
<view class="content"> <view class="content">
@@ -19,7 +19,6 @@
<view class="companyInfo">易品新境区块链有限公司</view> <view class="companyInfo">易品新境区块链有限公司</view>
</view> </view>
</view> </view>
<!-- 弹窗提示喽 --> <!-- 弹窗提示喽 -->
<u-toast ref="uToast" /> <u-toast ref="uToast" />
</view> </view>
@@ -50,7 +49,6 @@
.GoodsChain { .GoodsChain {
background-color:fff; background-color:fff;
width: 100%; width: 100%;
min-height: 100vh;
position: relative; position: relative;
z-index: 1; z-index: 1;
.chainBg{ .chainBg{
@@ -61,7 +59,7 @@
} }
.chain-content{ .chain-content{
width: 100%; width: 100%;
height: 100vh; min-height: 100%;
z-index: 2; z-index: 2;
padding: 18vh 10vw 15vh 10vw ; padding: 18vh 10vw 15vh 10vw ;
box-sizing: border-box; box-sizing: border-box;
@@ -69,7 +67,7 @@
z-index: 3; z-index: 3;
.chain-center{ .chain-center{
width: 100%; width: 100%;
height: 100%; min-height: 100%;
.logo{ .logo{
width: 160rpx; width: 160rpx;
height: 160rpx; height: 160rpx;

View File

@@ -38,7 +38,7 @@
:readonly="true" :readonly="true"
color="#ddd" color="#ddd"
active-color="#c82626" active-color="#c82626"
:value="2.5" :value="goodsObj.company.star"
:size="14" :size="14"
/> />
</view> </view>
@@ -69,7 +69,7 @@
<label class="title">说明</label> <label class="title">说明</label>
特价商品不可与优惠券叠加使用 特价商品不可与优惠券叠加使用
</view> </view>
<view class="size-item nowrap"> <view class="size-item nowrap" v-if="goodsObj.services.length > 0">
<label class="title">服务</label> <label class="title">服务</label>
<view class="goods-serve" @click="serveOpne"> <view class="goods-serve" @click="serveOpne">
<image class="goods-serve-img" src="../../static/icons/goods_buy.png" mode="aspectFill"></image> <image class="goods-serve-img" src="../../static/icons/goods_buy.png" mode="aspectFill"></image>
@@ -116,6 +116,9 @@
{{item.full}}可用 {{item.full}}可用
</view> </view>
</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-left" v-else-if="item.type.value == '3'">
<view class="coupons-number coupons-small"> <view class="coupons-number coupons-small">
提货券 提货券
@@ -129,9 +132,13 @@
{{item.time.interval}} {{item.time.interval}}
</view> </view>
</view> </view>
<view class="coupons-right" @click="drawCoupons(item.coupon_id)">
<view v-if="item.can.get" class="coupons-right" @click="drawCoupons(item.coupon_id, index)">
领取 领取
</view> </view>
<view v-else class="coupons-right coupons-right-active">
已领取
</view>
</view> </view>
</view> </view>
<view class="coupons-true" @click="couponsClose"> <view class="coupons-true" @click="couponsClose">
@@ -148,7 +155,7 @@
<image @click="serveClose" class="close" src="../../static/icons/goods_close.png" mode=""></image> <image @click="serveClose" class="close" src="../../static/icons/goods_close.png" mode=""></image>
</view> </view>
<view class="serve-cont"> <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"> <view class="serve-label-name">
{{item.name}} {{item.name}}
</view> </view>
@@ -180,13 +187,13 @@
}; };
}, },
created() { created() {
goods(this.$Route.query.id || 16).then(res=>{ goods(this.$Route.query.id).then(res=>{
this.loding = false this.loding = false
this.goodsObj = res this.goodsObj = res
this.identity = res.identity.id || '' this.identity = res.identity.id || ''
this.company = res.company this.company = res.company
this.couponSee= res.coupons.slice(0, 3) this.couponSee= res.coupons.slice(0, 3)
this.coupons = res.coupons this.coupons = res.coupons
}) })
}, },
methods:{ methods:{
@@ -198,12 +205,15 @@
userLogin.Login() userLogin.Login()
return return
} }
this.$Router.push({ // this.$Router.push({
name: 'Buy', // name: 'Buy',
params: { // params: {
skuId: this.goodsObj.skus[0].sku_id, // skuId: this.goodsObj.skus[0].sku_id,
qty : this.goodsObj.skus[0].number // 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
}) })
}, },
// 打开微信小程序 // 打开微信小程序
@@ -236,10 +246,24 @@
// 领取优惠券 // 领取优惠券
drawCoupons(id){ drawCoupons(id){
console.log(id) let token = this.$store.getters.getToken
if(token == ''){
let userLogin = new userAuth()
userLogin.Login()
return
}
managesCoupons(id).then(res=>{ managesCoupons(id).then(res=>{
console.log(res) uni.showToast({
}) title: '领取成功',
type: 'primary',
duration: 3000
})
}).catch(err => {
uni.showToast({
icon : 'none',
title: err.message
})
})
}, },
// 选择优惠券-显示 // 选择优惠券-显示
@@ -306,8 +330,8 @@
font-size: $title-size; font-size: $title-size;
font-weight: bold; font-weight: bold;
line-height: 50rpx; line-height: 50rpx;
display: flex;
.title-hot { .title-hot {
display: inline-block;
background-color: #fee195; background-color: #fee195;
font-size: 24rpx; font-size: 24rpx;
border-radius: 50rpx; border-radius: 50rpx;
@@ -390,7 +414,7 @@
.goods-serve-img { .goods-serve-img {
width: 36rpx; width: 36rpx;
height: 36rpx; height: 36rpx;
margin-top: 24rpx; margin-top: 26rpx;
} }
.goods-serve-name { .goods-serve-name {
margin: 0 30rpx 0 20rpx; margin: 0 30rpx 0 20rpx;
@@ -619,9 +643,11 @@
overflow: hidden; overflow: hidden;
position: relative; position: relative;
margin-top: $margin; margin-top: $margin;
// background-color: red;
.coupons-tips { .coupons-tips {
background-color: #211e17; // background-color: #211e17;
color: #efe8d8; background-image: linear-gradient(to right, #f8e5c0, #d6a46a);
color: #8d4928;
position: absolute; position: absolute;
border-radius: 0 0 20rpx 0; border-radius: 0 0 20rpx 0;
padding: 0 8rpx; padding: 0 8rpx;
@@ -629,6 +655,7 @@
line-height: 34rpx; line-height: 34rpx;
left: 0; left: 0;
top: 0; top: 0;
z-index: 10;
.coupons-tips-text { .coupons-tips-text {
font-size: 24rpx; font-size: 24rpx;
transform:scale(.85); transform:scale(.85);
@@ -642,6 +669,11 @@
text-align: center; text-align: center;
padding: $padding - 10 0; padding: $padding - 10 0;
border-right: 2rpx dashed #eccdd4; border-right: 2rpx dashed #eccdd4;
.coupon-left-img{
width: 180rpx;
height: 100rpx;
border-radius: 20rpx;
}
.coupons-number { .coupons-number {
font-size: 40rpx; font-size: 40rpx;
font-weight: 600; font-weight: 600;
@@ -682,6 +714,10 @@
border-radius: 80rpx; border-radius: 80rpx;
font-size: 24rpx; font-size: 24rpx;
line-height: 52rpx; line-height: 52rpx;
&.coupons-right-active {
background-color: #adadad;
color: #FFFFFF;
}
} }
} }
} }

View File

@@ -140,6 +140,7 @@
product_address : this.productAddress, product_address : this.productAddress,
extend_cover : this.extendCover[0].path extend_cover : this.extendCover[0].path
} }
let submitFund = managesGoodsAuth(this.$Route.query.id, submitData) let submitFund = managesGoodsAuth(this.$Route.query.id, submitData)
submitFund.then(res => { submitFund.then(res => {
uni.showModal({ uni.showModal({
@@ -149,7 +150,7 @@
success : res => { success : res => {
if(res.confirm){ if(res.confirm){
if(this.$Route.query.type == 'goodsAdd'){ if(this.$Route.query.type == 'goodsAdd'){
this.$Router.back(this.$Route.query.edit == 'true' ? 2 : 3) this.$Router.back(this.$Route.query.edit == 'true' ? 2 : 2)
}else{ }else{
this.$Router.back() this.$Router.back()
} }

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 <image
class="icon" 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> </view>
@@ -23,26 +23,34 @@
data() { data() {
return { return {
tabIndex : 0, tabIndex : 0,
marketType : 'low', marketType : 'asc',
goods : [] goods : []
}; };
}, },
created() { created() {
list().then(res=>{ this.getList()
this.goods = res.data
this.pages = res.page
})
}, },
methods:{ methods:{
onTabs(e){ onTabs(e){
let index = e.target.dataset.index let index = e.target.dataset.index
if(index == 0 && index == this.tabIndex) return 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.tabIndex = index
this.getList()
}, },
onGoods(e){ onGoods(e){
this.$Router.push({name: 'goodsDetails', params: {id: e.goods_id}}) 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

@@ -56,9 +56,7 @@
} }
}, },
created() { created() {
console.log(this.$Route.query.id)
managesTracedTo(this.$Route.query.id).then(res=>{ managesTracedTo(this.$Route.query.id).then(res=>{
console.log(res)
this.list = res.list this.list = res.list
this.info = res this.info = res
}) })

View File

@@ -83,6 +83,7 @@
<script> <script>
import { marketsInfo, marketsBuy, marketsPay } from '@/apis/interfaces/market' import { marketsInfo, marketsBuy, marketsPay } from '@/apis/interfaces/market'
import userAuth from '@/public/userAuth'
export default { export default {
data() { data() {
return { return {
@@ -98,8 +99,8 @@
} }
}; };
}, },
created() { onShow() {
marketsInfo(this.$Route.query.marketId || 5).then(res =>{ marketsInfo(this.$Route.query.marketId).then(res =>{
this.info = res this.info = res
this.price = res.price this.price = res.price
this.loding = false this.loding = false
@@ -121,6 +122,12 @@
}, },
// 购买弹窗 // 购买弹窗
openLay(){ openLay(){
let token = this.$store.getters.getToken
if(token == ''){
let userLogin = new userAuth()
userLogin.Login()
return
}
this.$refs.buyLay.open('bottom') this.$refs.buyLay.open('bottom')
}, },
// 计算价格 // 计算价格
@@ -149,8 +156,16 @@
marketsPay(this.orderNo, this.payValue).then(res => { marketsPay(this.orderNo, this.payValue).then(res => {
switch (this.payValue){ switch (this.payValue){
case 'eb': case 'eb':
console.log(res) this.$refs.payLay.close()
console.log('支付结果') this.$Router.push({
name : 'payResults',
params : {
index: 1,
price: this.price,
type : 'eb',
total: '可在我的资产下我的权证中查看购买的数字权证'
}
})
break break
case 'wechat': case 'wechat':
this.wxPay(JSON.parse(res)) this.wxPay(JSON.parse(res))

View File

@@ -11,7 +11,7 @@
</view> </view>
</view> </view>
<view class="lists"> <view class="lists">
<view class="item" v-for="(item, index) in marketArray" :key="index"> <view class="item" v-for="(item, index) in marketArray" :key="index" @click="onDetails(item)">
<image class="cover" :src="item.goods.cover" mode="aspectFill"></image> <image class="cover" :src="item.goods.cover" mode="aspectFill"></image>
<view class="content"> <view class="content">
<view class="title nowrap">数字权证<text>{{item.surplus}}/{{item.stock}}</text></view> <view class="title nowrap">数字权证<text>{{item.surplus}}/{{item.stock}}</text></view>
@@ -36,7 +36,7 @@
page : {} page : {}
}; };
}, },
created() { onShow() {
this.getMarkets() this.getMarkets()
}, },
methods:{ methods:{
@@ -53,10 +53,14 @@
markets({ markets({
sort: this.tabIndex == 1 ? this.marketType : '' sort: this.tabIndex == 1 ? this.marketType : ''
}).then(res => { }).then(res => {
console.log(res.data)
this.marketArray = res.data this.marketArray = res.data
this.page = res.page this.page = res.page
}) })
},
// 转让商品详情
onDetails(e){
this.$Router.push({name: 'marketDetails', params: {marketId: e.market_id}})
console.log(e)
} }
}, },
onNavigationBarButtonTap(){ onNavigationBarButtonTap(){

View File

@@ -1,61 +1,121 @@
<template> <template>
<view> <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"> <block v-if="logs.length > 0">
<view class="logs" v-for="(item, index) in logs" :key="index"> <view :class="{'paddingTop': $Route.query.type === 'my'}">
<view class="logs-item"> <view class="logs" v-for="(item, index) in logs" :key="index">
<label>交易权证</label> <view class="logs-item">
{{item.goods.goods_name}} <label>交易权证</label>
</view> {{item.goods.goods_name}}
<view class="logs-item"> </view>
<label>交易单价</label> <view class="logs-item">
{{item.price}} <label>交易单价</label>
</view> {{item.price}}
<view class="logs-item"> </view>
<label>交易数量</label> <view class="logs-item">
{{item.qty}} <label>交易数量</label>
</view> {{item.qty}}
<view class="logs-item"> </view>
<label>转让用户</label> <view class="logs-item">
{{item.sellUser.nickname}} <label>转让用户</label>
</view> {{item.sellUser.nickname}}
<view class="logs-item"> </view>
<label>购买用户</label> <view class="logs-item">
{{item.buyUser.nickname}} <label>购买用户</label>
</view> {{item.buyUser.nickname}}
<view class="logs-item"> </view>
<label>交易时间</label> <view class="logs-item">
{{item.created_at}} <label>交易时间</label>
{{item.created_at}}
</view>
</view> </view>
</view> </view>
</block> </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> </view>
</template> </template>
<script> <script>
import { marketsLogs } from '@/apis/interfaces/market' import { marketsLogs, marketsOrdersLogs } from '@/apis/interfaces/market'
export default { export default {
data() { data() {
return { return {
logs: [], logs: [],
page: {} page: {},
tab : 'sell'
}; };
}, },
created(){ created(){
marketsLogs().then(res => { this.getList()
console.log(res.data) },
this.logs = res.data methods:{
this.page = res.page onTasb(e){
}).catch(err => { this.tab = e
uni.showToast({ this.getList()
title: err.message, },
icon : 'none' // 获取列表
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> </script>
<style lang="scss" scoped> <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{ .logs{
background: white; background: white;
margin-top: $margin; margin-top: $margin;
@@ -78,4 +138,29 @@
} }
} }
} }
// 空提示
.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> </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> <label>订单金额</label>
<view class="price nowrap">{{amount}}</view> <view class="price nowrap">{{amount}}</view>
</view> </view>
<block v-if="coupons.length > 0"> <block v-if="coupons.length >= 1">
<view class="item"> <view class="item">
<label>使用优惠券</label> <label>使用优惠券</label>
<picker> <picker mode="selector" :range="coupons" range-key="title" :value="couponIndex" @change="couponsChange">
<view class="picker-text nowrap"> <view class="picker-text nowrap">
优惠券 {{couponIndex == 0 ? '选择优惠券' : coupons[couponIndex].title}}
<uni-icons type="arrowright" color="#ddd"></uni-icons> <uni-icons type="arrowright" color="#ddd"></uni-icons>
</view> </view>
</picker> </picker>
@@ -35,6 +35,10 @@
<view class="price nowrap">-{{couponPrice}}</view> <view class="price nowrap">-{{couponPrice}}</view>
</view> </view>
</block> </block>
<view class="item">
<label>实际支付金额</label>
<view class="price nowrap">{{total}}</view>
</view>
</view> </view>
<!-- 支付方式 --> <!-- 支付方式 -->
<radio-group class="pay-group" @change="payType"> <radio-group class="pay-group" @change="payType">
@@ -71,6 +75,8 @@
amount : 0, amount : 0,
total : 0, total : 0,
coupons : [], coupons : [],
couponIndex : 0,
couponId : '',
account : {}, account : {},
payValue : 'eb', payValue : 'eb',
} }
@@ -78,16 +84,15 @@
created(){ created(){
buy({ buy({
goods_sku_id: this.$Route.query.skuId, goods_sku_id: this.$Route.query.skuId,
qty : this.$Route.query.qty, qty : this.qty,
type : 1 type : 1
}, 'GET').then(res=>{ }, 'GET').then(res=>{
this.loding = true this.loding = true
this.qty = this.$Route.query.qty,
this.payValue = this.$Route.query.type === 1 ? 'wx' : 'eb' this.payValue = this.$Route.query.type === 1 ? 'wx' : 'eb'
this.detail = res.detail this.detail = res.detail
this.couponPrice = res.coupon_price this.couponPrice = res.coupon_price.toFixed(2)
this.amount = res.amount this.amount = res.amount.toFixed(2)
this.total = res.total this.total = res.total.toFixed(2)
this.coupons = res.coupons this.coupons = res.coupons
this.account = res.account this.account = res.account
}).catch(err =>{ }).catch(err =>{
@@ -98,24 +103,56 @@
}) })
}, },
methods: { 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){ payType(e){
console.log(e.detail.value)
this.payValue = e.detail.value this.payValue = e.detail.value
}, },
//数量变化 //数量变化
numberChange(e){ numberChange(e){
this.qty = e this.qty = e
this.amount = this.detail[0].items[0].price * e this.getCoupons()
}, },
// 提交订单 // 提交订单
buyOrder(){ buyOrder(){
buy({ buy({
goods_sku_id: this.$Route.query.skuId || 23, goods_sku_id : this.$Route.query.skuId,
qty : this.qty, qty : this.qty,
type : this.payValue == 'eb' ? 1 : 2, coupon_grant_id : this.couponId,
remark : 'app订单' type : this.payValue === 'wx'?2:1,
remark : 'app订单易货产品',
channel : 'app'
}, 'POST').then(res=>{ }, 'POST').then(res=>{
console.log(res)
switch (this.payValue){ switch (this.payValue){
case 'eb': case 'eb':
this.ebPay(res.order_no) this.ebPay(res.order_no)
@@ -147,14 +184,20 @@
// 易币支付 // 易币支付
ebPay(orderNo){ ebPay(orderNo){
eb(orderNo).then(res => { eb(orderNo).then(res => {
uni.showModal({ this.$Router.replace({
title: '提示', name : 'payResults',
content: '支付成功,后续优化支付成功后直接转跳我的权证' params : {
index: 1,
price: this.total,
type : 'eb',
total: '可在我的资产下我的权证中查看购买的数字权证'
}
}) })
}).catch(err => { }).catch(err => {
uni.showToast({ uni.showModal({
title: err.message, title : '支付提示',
icon : 'none' content : err.message,
showCancel : false,
}) })
}) })
} }

View File

@@ -5,6 +5,7 @@
</template> </template>
<script> <script>
import { orderJournal } from '@/apis/interfaces/store'
export default { export default {
data() { data() {
return { 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,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: [{ categroyList: [{
id: '',
name: '全部'
}, {
id: '4', id: '4',
name: '新到' name: '新到'
}, },
@@ -146,6 +149,7 @@
selectNav(id) { selectNav(id) {
console.log(id) console.log(id)
this.selectNavId = id this.selectNavId = id
this.selectCategoryId = ''
this.getMyCoupon() this.getMyCoupon()
}, },
selectCategory(id) { selectCategory(id) {

View File

@@ -2,7 +2,7 @@
<view class="Coupon"> <view class="Coupon">
<!-- 有优惠券列表 --> <!-- 有优惠券列表 -->
<view class="coupon-content"> <view class="coupon-content">
<couponTemplate v-for="(item,index) in lists" :key='index' :item="{...item}" :action="actions" /> <couponTemplate v-for="(item,index) in lists" :key='index' :item="{...item}" />
</view> </view>
<!-- 没有优惠券列表 --> <!-- 没有优惠券列表 -->

View File

@@ -83,7 +83,7 @@
getList() { getList() {
getCouponsInfoById(this.coupon_grant_id).then(res => { getCouponsInfoById(this.coupon_grant_id).then(res => {
this.info = 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 this.loaded = true
}).catch(err => { }).catch(err => {
this.$refs.uToast.show({ this.$refs.uToast.show({
@@ -95,7 +95,8 @@
// 点击立即购买去商品确认页面 // 点击立即购买去商品确认页面
nowBuy(items) { nowBuy(items) {
uni.navigateTo({ uni.navigateTo({
url:'/pages/order/buy?qty=1&skuId='+items.goods_sku_id, url: '/pages/property/coupon/confirmOrder?qty=1&type=2&goods_sku_id=' + items.goods_sku_id,
}) })
}, },
goDetail(id){ goDetail(id){

View File

@@ -4,7 +4,7 @@
<view style="position: relative;z-index: 3;"> <view style="position: relative;z-index: 3;">
<!-- 搜索... --> <!-- 搜索... -->
<view class="mine-top-contant"> <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'> :border-bottom='false'>
</u-navbar> </u-navbar>
<!--banner--> <!--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

@@ -187,7 +187,7 @@
.Record { .Record {
width: 100%; width: 100%;
height: 100vh; min-height: 100vh;
padding-top: 30rpx; padding-top: 30rpx;
background-color: #fff; background-color: #fff;
} }

View File

@@ -1,239 +1,286 @@
<template> <template>
<view v-if='loaded'> <view v-if='loding'>
<!-- 用户信息 --> <block v-if="this.$store.state.token != ''">
<view class="user"> <!-- 用户信息 -->
<view class="user-tool" @click="$Router.push({name:'Setting'})"> <view class="user">
<image src="@/static/icons/user_icon_00.png" mode="widthFix" /> <view class="user-tool" @click="$Router.push({name:'Setting'})">
</view> <image src="@/static/icons/user_icon_00.png" mode="widthFix" />
<view class="user-content"> </view>
<image class="info-cover" :src="base.avatar" mode="aspectFill" /> <view class="user-content">
<view class="info-nickname">{{base.nickname}}</view> <image class="info-cover" :src="base.avatar || require('@/static/images/boss.png')" mode="aspectFill" />
<view class="info-signa">潮流就是我的态度</view> <view class="info-nickname">{{base.nickname}}</view>
<view class="info-tags"> <view class="info-signa">潮流就是我的态度</view>
<text class="info-tags-item identity">{{base.identity.name}}</text> <view class="info-tags" v-if="this.$store.state.token != ''">
<text class="info-tags-item vip" v-if="base.company_level.name">{{base.company_level.name }}</text> <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> </view>
<view class="user-tabs"> <!-- 消息 -->
<view class="user-tabs-item" :class="{'show': tabsIndex === 0}" @click="tabsIndex = 0">管理中心</view> <view class="user-ad" v-if="message.length > 0">
<view class="user-tabs-item" :class="{'show': tabsIndex === 1}" @click="tabsIndex = 1">我的推广</view> <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> <block v-if="tabsIndex === 0">
<!-- 消息 --> <!-- 我的资产 -->
<view class="user-ad"> <view class="user-group">
<uni-icons class="user-ad-icon" type="sound-filled" color="#e93340"></uni-icons> <view class="title">
<swiper class="user-ad-swiper" :interval="3000" autoplay vertical circular> <view class="title-text">我的资产</view>
<swiper-item v-for="(item,index) in message" :key='index'>
<view class="user-ad-item">{{item}}</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" @click="showToast">
<view class="item-num">{{base.account.token}}</view>
<view class="item-title">原石</view>
</view> </view>
<view class="item" @click="showToast"> <view class="group-flex group-flex-4">
<view class="item-num">{{base.account.contribution}}</view> <view class="item" @click="$Router.push({name:'Extract'})">
<view class="item-title">贡献值</view> <view class="item-num">{{base.account.coins}}</view>
</view> <view class="item-title">原石</view>
<view class="item" @click="$Router.push({name:'Eb'})"> </view>
<view class="item-num">{{base.account.eb}}</view> <view class="item" @click="$Router.push({name:'Fragment'})">
<view class="item-title">易币</view> <view class="item-num">{{base.account.contribution}}</view>
</view> <view class="item-title">当前贡献值</view>
<view class="item" @click="showToast"> </view>
<view class="item-num">{{base.account.money}}</view> <view class="item" @click="$Router.push({name:'Eb'})">
<view class="item-title">零钱</view> <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> </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>
<!-- 我的权证 --> <view class="store-login">
<view class="user-group"> <image class="icon" src="@/static/icons/login-icon.png" mode="widthFix"></image>
<view class="title" > <view class="sub-title">一键开启您的易货之旅</view>
<view class="title-text">我的权证</view> <button type="default" @click="login">登录</button>
</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="showToast">
<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> </view>
</block> </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>
<!-- <carousel :img-list="imgList" url-key="url" @selected="selectedBanner"/> -->
<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>
<!-- 弹窗 -->
<u-toast ref="uToast" />
<!-- 版权信息 -->
<view class="copyright">易品新境 beta 1.0.0</view>
</view> </view>
</template> </template>
<script> <script>
import carousel from '@/components/vear-carousel/vear-carousel' import carousel from '@/components/vear-carousel/vear-carousel'
import {getUserInfo , appcode} from '@/apis/interfaces/mine' import { getUserInfo , appcode } from '@/apis/interfaces/mine'
import userAuth from '@/public/userAuth'
export default { export default {
components: { components: {
carousel carousel
}, },
data() { data() {
return { return {
tabsIndex: 0, tabsIndex : 0,
imgList: [{ base : {
url: 'https://img9.51tietu.net/pic/2019-091200/vgkpidei2tjvgkpidei2tj.jpg', avatar : '',
id: 1 nickname: '',
},{ account : {
url: 'https://img9.51tietu.net/pic/2019-091200/euzekmi5m23euzekmi5m23.jpg', token : 0,
id: 2 contribution: 0,
},{ eb : 0,
url: 'https://img9.51tietu.net/pic/2019-091200/143tt0ta4sr143tt0ta4sr.jpg', money : 0
id: 3 }
}], },
base:'', count : {
count:'', warrnats : 0,
relations:'', warrnat_transfer : 0,
message:'', shipment_fuwu_count : 0,
loaded:false, shipment_goods_count: 0
shareCode:'' },
relations : '',
message : [],
shareCode : '',
loding : false
} }
}, },
onShow(){ onShow(){
this.getUserInfo() if(this.$store.state.token != '') this.userInfo()
else this.loding = true
}, },
methods: { methods: {
// 获取用户的基本信息 // 获取用户的基本信息
getUserInfo(){ userInfo(){
getUserInfo().then(res => { Promise.all([getUserInfo(), appcode()]).then(res => {
this.base = res.base let userInfoData = res[0],
this.count = res.count appcodeData = res[1]
this.message = res.message
this.relations = res.relations this.base = userInfoData.base
this.loaded = true this.count = userInfoData.count
this.message = userInfoData.message
this.relations = userInfoData.relations
this.shareCode = appcodeData.code
this.loding = true
}).catch(err => { }).catch(err => {
this.$refs.uToast.show({ console.log(err)
uni.showToast({
title: err.message, title: err.message,
type: 'error', icon : 'none'
icon:false,
duration: 3000
})
})
appcode().then(res => {
this.shareCode = res.code
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'error',
icon:false,
duration: 3000
}) })
}) })
}, },
outLogin(){
this.$store.commit('setToken', '')
},
selectedBanner(item, index) {
console.log('🥒', item, index)
},
// 努力开发中,,, // 努力开发中,,,
showToast(){ showToast(){
this.$refs.uToast.show({ uni.showToast({
title: '努力开发中', title: '努力开发中',
type:'error', icon : 'none'
duration: 3000
}) })
} },
// 登录
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> </script>
<style lang="scss" scoped> <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{ .out-login{
padding: 0 $padding; padding: 0 $padding;
@@ -329,6 +376,7 @@
&.vip{ &.vip{
background-image: linear-gradient(to right, #f8e5c0, #d6a46a); background-image: linear-gradient(to right, #f8e5c0, #d6a46a);
color: #8d4928; color: #8d4928;
text-transform: uppercase;
} }
} }
} }
@@ -523,4 +571,95 @@
font-size: $title-size-sm; font-size: $title-size-sm;
color: $text-gray-m; 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> </style>

View File

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

View File

@@ -1,23 +1,13 @@
<template> <template>
<view class="OrderInfo"> <view class="OrderInfo" v-if="loaded">
<!-- 订单状态 --> <!-- 订单状态 -->
<view class="order-status"> <view class="order-status">
<view class="info"> <view class="info">
{{info.state.text}} {{state.text}}
<span>{{info.state.remark}}</span> <span>{{state.remark}}</span>
</view> </view>
<image src="/static/imgs/fire.png" mode="widthFix"></image> <image src="/static/imgs/fire.png" mode="widthFix"></image>
</view> </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="goods-info1">
<view class="top"> <view class="top">
@@ -41,7 +31,7 @@
<view class="sku">权证个数 <span>x {{info.qty}}</span> </view> <view class="sku">权证个数 <span>x {{info.qty}}</span> </view>
</view> </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> <view class="total-btn">再次购买</view>
</navigator> </navigator>
<view class="goods-type">创建退货时间 <span>{{info.created_at}}</span></view> <view class="goods-type">创建退货时间 <span>{{info.created_at}}</span></view>
@@ -73,7 +63,7 @@
<view :class="['dian',index === 0 ?'dian-active':'']"></view> <view :class="['dian',index === 0 ?'dian-active':'']"></view>
<view :class="['content',index === 0?'content-active':'']"> <view :class="['content',index === 0?'content-active':'']">
<view class="title">{{item.state_text?item.state_text:'当前状态不明确,需后台返回'}}</view> <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"> <view class="pictures">
<image @click="priveImg(index,idx)" v-for="(it,idx) in item.pictures" :key='idx' :src="it" mode="aspectFill" /> <image @click="priveImg(index,idx)" v-for="(it,idx) in item.pictures" :key='idx' :src="it" mode="aspectFill" />
</view> </view>
@@ -101,16 +91,20 @@
return { return {
info: {}, info: {},
qty: 1, qty: 1,
state:{},
refund_id: '', // 退货单no refund_id: '', // 退货单no
company: '', company: '',
number: '', number: '',
logs: [], logs: [],
loaded:false,
showLogs: false // 默认不显示记录信息 showLogs: false // 默认不显示记录信息
}; };
}, },
onLoad(e) { onLoad(e) {
this.refund_id = this.$route.params.no // this.refund_id = this.$route.params.no
this.getInfo(this.refund_id) // this.getInfo(this.refund_id)
this.refund_id = e.no
this.getInfo(e.no)
}, },
onShow() { onShow() {
if (uni.getStorageSync('refresh')) { if (uni.getStorageSync('refresh')) {
@@ -123,6 +117,8 @@
mallRefundsInfo(refund_id).then(res => { mallRefundsInfo(refund_id).then(res => {
this.info = res this.info = res
this.logs = res.log this.logs = res.log
this.state = res.state
this.loaded = true
}).catch(err => { }).catch(err => {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: err.message, title: err.message,

View File

@@ -1,5 +1,5 @@
<template> <template>
<view class="NumberWeight"> <view class="mallShipments">
<!-- 订单分类 --> <!-- 订单分类 -->
<view class="nav"> <view class="nav">
<view :class="['nav-item' ,selectTypeId === item.id?'nav-item-selected':'']" <view :class="['nav-item' ,selectTypeId === item.id?'nav-item-selected':'']"
@@ -314,39 +314,51 @@
// 申请退货 // 申请退货
nowRefund(no) { nowRefund(no) {
this.$router.push({ // this.$Router.push({
name: 'MallShipmentsRefund', // name: 'MallShipmentsRefund',
params: { // params: {
no: no // no: no
} // }
// })
uni.navigateTo({
url:'/pages/property/order/mallShipmentsRefund?no='+no
}) })
}, },
// 查看物流 // 查看物流
nowLogistics(no) { nowLogistics(no) {
this.$router.push({ // this.$Router.push({
name: 'Orderlogistics', // name: 'Orderlogistics',
params: { // params: {
no: no // no: no
} // }
// })
uni.navigateTo({
url:'/pages/property/order/logistics?no='+no
}) })
}, },
// 查看详情 // 查看详情
goDetail(no) { goDetail(no) {
this.$router.push({ // this.$Router.push({
name: 'MallShipmentsInfo', // name: 'MallShipmentsInfo',
params: { // query:{
no: no // no:no
} // }
// })
uni.navigateTo({
url:'/pages/property/order/mallShipmentsInfo?no='+no
}) })
}, },
// 查看退货单详情 // 查看退货单详情
// 查看详情 // 查看详情
goDetail1(no){ goDetail1(no){
this.$router.push({ // this.$Router.push({
name: 'MallRefundsInfo', // name: 'MallRefundsInfo',
params:{ // params:{
no:no // no:no
} // }
// })
uni.navigateTo({
url:'/pages/property/order/mallRefundsInfo?no='+no
}) })
} }
@@ -360,7 +372,7 @@
height: 100%; height: 100%;
} }
.NumberWeight { .mallShipments {
width: 100%; width: 100%;
min-height: 100vh; min-height: 100vh;
box-sizing: border-box; box-sizing: border-box;

View File

@@ -1,5 +1,5 @@
<template> <template>
<view class="OrderInfo"> <view class="OrderInfo" v-if="loaded">
<!-- 订单状态 --> <!-- 订单状态 -->
<view class="order-status"> <view class="order-status">
<view class="info"> <view class="info">
@@ -41,7 +41,7 @@
<view class="sku">权证个数 <span>x {{info.qty}}</span> </view> <view class="sku">权证个数 <span>x {{info.qty}}</span> </view>
</view> </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> <view class="total-btn">再次购买</view>
</navigator> </navigator>
<view class="goods-type">创建提货单时间 <span>{{info.created_at}}</span></view> <view class="goods-type">创建提货单时间 <span>{{info.created_at}}</span></view>
@@ -106,11 +106,12 @@
store_Name:'',// 门店名称 store_Name:'',// 门店名称
qty :1, qty :1,
shipment_no:'', // 提货单no shipment_no:'', // 提货单no
loaded:false
}; };
}, },
onLoad(e) { onLoad(e) {
this.shipment_no = this.$route.params.no this.shipment_no = e.no
this.getInfo(this.$route.params.no) this.getInfo(e.no)
}, },
onShow() { onShow() {
if(uni.getStorageSync('refresh')){ if(uni.getStorageSync('refresh')){
@@ -123,6 +124,7 @@
this.info = res this.info = res
this.address = res.express this.address = res.express
this.type = res.type+'' this.type = res.type+''
this.loaded = true
}).catch(err=>{ }).catch(err=>{
this.$refs.uToast.show({ this.$refs.uToast.show({
title: err.message, title: err.message,

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
<template> <template>
<view class="OrderInfo"> <view class="OrderInfo" v-if="loaded">
<!-- 订单状态 --> <!-- 订单状态 -->
<view class="order-status"> <view class="order-status">
<view class="info"> <view class="info">
@@ -45,7 +45,7 @@
<view class="sku">可提个数 <span>x {{account.balance}}</span> </view> <view class="sku">可提个数 <span>x {{account.balance}}</span> </view>
</view> </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> <view class="total-btn">再次购买</view>
</navigator> </navigator>
<view class="goods-type" v-if="type === '1'">运费 <span>免邮</span></view> <view class="goods-type" v-if="type === '1'">运费 <span>免邮</span></view>
@@ -147,7 +147,8 @@
store_Name: '', // 门店名称 store_Name: '', // 门店名称
qty: 1, qty: 1,
showCode:false, showCode:false,
showCodeImg:'' showCodeImg:'',
loaded:false
}; };
}, },
onLoad(e) { onLoad(e) {
@@ -176,6 +177,7 @@
this.stores = res.stores this.stores = res.stores
this.qty = res.account.balance this.qty = res.account.balance
this.type = res.logistic_type + '' this.type = res.logistic_type + ''
this.loaded = true
}).catch(err => { }).catch(err => {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: err.message, title: err.message,

View File

@@ -8,7 +8,7 @@
<span>修改头像</span> <span>修改头像</span>
</view> </view>
<view class="avatar" > <view class="avatar" >
<image :src="avatar.showPath" mode="aspectFill" /> <image :src="avatar.showPath || require('@/static/images/boss.png')" mode="aspectFill" />
<u-icon name="arrow-right" color="#f1f1f1" size="28"></u-icon> <u-icon name="arrow-right" color="#f1f1f1" size="28"></u-icon>
</view> </view>
</view> </view>
@@ -25,16 +25,12 @@
<view @click="loginOut" class="list-item"> <view @click="loginOut" class="list-item">
<view class="list-item-left"> <view class="list-item-left">
<image src="/static/images/reset-info.png" mode="widthFix" /> <image src="/static/images/reset-info.png" mode="widthFix" />
<span>切换账户</span> <span>退出登录</span>
</view> </view>
<u-icon name="arrow-right" color="#f1f1f1" size="28"></u-icon> <u-icon name="arrow-right" color="#f1f1f1" size="28"></u-icon>
</view> </view>
</view> </view>
<!-- 底部banner -->
<!-- <u-toast ref="uToast" /> -->
<u-toast ref="uToast" /> <u-toast ref="uToast" />
</view> </view>
</template> </template>
@@ -81,14 +77,16 @@
}) })
}, },
loginOut() { loginOut() {
uni.removeStorageSync('token') this.$store.commit('setToken', '')
uni.reLaunch({ this.$Router.replaceAll({name: 'Equity'})
url: '/pages/login/login'
})
}, },
// 上传头像 // 上传头像
updImgs(type) { updImgs(type) {
uni.chooseImage({ uni.chooseImage({
crop: {
width: 80,
height: 80
},
success: res => { success: res => {
let path = res.tempFiles.map((val, index) => { let path = res.tempFiles.map((val, index) => {
return { return {
@@ -166,7 +164,6 @@
margin: 0 40rpx; margin: 0 40rpx;
padding: 30rpx 0; padding: 30rpx 0;
width: calc(100% - 80rpx); width: calc(100% - 80rpx);
button::after { button::after {
border: none; border: none;
background-color: none; background-color: none;

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>

View File

@@ -258,6 +258,7 @@
}, },
// 添加展示模块 // 添加展示模块
addModule(){ addModule(){
console.log('添加模板,,,,')
let modulesList = this.modulesType.map(val => { let modulesList = this.modulesType.map(val => {
return val.value return val.value
}) })
@@ -407,6 +408,8 @@
color: $text-price; color: $text-price;
background: white; background: white;
margin-top: $margin; margin-top: $margin;
position: relative;
z-index: 10;
.icon{ .icon{
vertical-align: middle; vertical-align: middle;
margin-right: $margin/3; margin-right: $margin/3;

View File

@@ -8,14 +8,19 @@
</view> </view>
<!-- 统计信息 --> <!-- 统计信息 -->
<view class="statistics"> <view class="statistics">
<picker mode="date" :fields="tabsIndex" :value="dateValue" :end="endDate" @change="pickerDate"> <view class="statistics-flex">
<view class="statistics-date"> <picker mode="date" :fields="tabsIndex" :value="dateValue" :end="endDate" @change="pickerDate">
{{dateValue}}<uni-icons class="arrowdown" type="arrowdown" color="#555"></uni-icons> <view class="statistics-date">
{{dateValue}}<uni-icons class="arrowdown" type="arrowdown" color="#555"></uni-icons>
</view>
</picker>
<view class="statistics-lay" :class="{ 'show' : sort != '' || payType != '' || channel != ''}" @click="onScreening">
筛选 <uni-icons class="arrowdown" type="settings" color="gray"></uni-icons>
</view> </view>
</picker> </view>
<view class="statistics-text"> <view class="statistics-text">
<text>成交客户 {{visitor.day}} </text> <text>成交产品数 {{visitor.goods_count}} </text>
<text>累计访客量 {{visitor.all}} </text> <text>成交产品金额 {{visitor.total}} </text>
</view> </view>
</view> </view>
<!-- 数据列表 --> <!-- 数据列表 -->
@@ -24,12 +29,18 @@
<view class="item" v-for="(item, index) in orders" :key="index"> <view class="item" v-for="(item, index) in orders" :key="index">
<image class="cover" :src="item.user.avatar" mode="aspectFill"></image> <image class="cover" :src="item.user.avatar" mode="aspectFill"></image>
<view class="title nowrap"> <view class="title nowrap">
{{item.user.username}} {{item.user.nickname}}
<view class="type">{{item.state}}</view> <view class="type">{{item.amount}}</view>
</view>
<view class="sub-title nowrap">订单号码: {{item.order_no}}</view>
<view class="sub-title nowrap">订单时间: {{item.created_at}}</view>
<view class="sub-tabs">
<text>{{item.driver}}</text>
<text>{{item.channel}}</text>
</view> </view>
<view class="sub-title nowrap">订单号: {{item.order_no}}</view>
<view class="sub-title nowrap">{{item.created_at}}</view>
</view> </view>
<!-- 分页 -->
<uni-load-more :status="pageStatus" :iconSize="16"></uni-load-more>
</block> </block>
<block v-else> <block v-else>
<view class="list-null"> <view class="list-null">
@@ -38,24 +49,57 @@
</view> </view>
</block> </block>
</view> </view>
<!-- 列表筛选 -->
<uni-popup ref="settingsPopup" background-color="#FFFFFF" @maskClick="onReset">
<view class="popup-content">
<view class="title">排序方式</view>
<view class="popup-choose-flex">
<view class="item" :class="{'show' : sort == 'money_asc'}" @click="sort = 'money_asc'">金额从低到高</view>
<view class="item" :class="{'show' : sort == 'money_desc'}" @click="sort = 'money_desc'">金额从高到低</view>
<view class="item" :class="{'show' : sort == 'sold_asc'}" @click="sort = 'sold_asc'">销量从低到高</view>
<view class="item" :class="{'show' : sort == 'sold_desc'}" @click="sort = 'sold_desc'">销量从高到低</view>
</view>
<view class="title">支付方式</view>
<view class="popup-choose-flex">
<view class="item" :class="{'show' : payType == 'eb'}" @click="payType = 'eb'">易币交易</view>
<view class="item" :class="{'show' : payType == 'money'}" @click="payType = 'money'">现金交易</view>
</view>
<view class="title">成交渠道</view>
<view class="popup-choose-flex">
<view class="item" :class="{'show' : channel == 'app'}" @click="channel = 'app'">APP</view>
<view class="item" :class="{'show' : channel == 'mini'}" @click="channel = 'mini'">自媒体</view>
</view>
<view class="popup-btns">
<view class="item" @click="onReset">重置</view>
<view class="item" @click="onSettings">确定</view>
</view>
</view>
<view class="ios-bottom"></view>
</uni-popup>
<!-- :status="more" -->
</view> </view>
</template> </template>
<script> <script>
import getDate from '@/public/date' import getDate from '@/public/date'
import { customer } from '@/apis/interfaces/store' import { orderUsers } from '@/apis/interfaces/store'
export default { export default {
data() { data() {
return { return {
tabsIndex: 'day', tabsIndex : 'day',
dateValue: '', dateValue : '',
endDate : '', endDate : '',
visitor : { visitor : {
day: 0, day: 0,
all: 0 all: 0
}, },
orders : [], orders : [],
pages : {} sort : '',
payType : '',
channel : '',
// 分页
pageStatus : '',
page : 1
}; };
}, },
created() { created() {
@@ -68,28 +112,49 @@
methods:{ methods:{
// tabs筛选 // tabs筛选
onTbas(type){ onTbas(type){
console.log(type)
getDate(type).then(res => { getDate(type).then(res => {
this.tabsIndex = type this.tabsIndex = type
this.dateValue = res this.dateValue = res
this.page = 1
this.getLists() this.getLists()
}) })
}, },
onReset(){
this.sort = ''
this.payType = ''
this.channel = ''
},
onSettings(){
this.getLists()
this.$refs.settingsPopup.close()
},
// 日期筛选 // 日期筛选
pickerDate(e){ pickerDate(e){
let dateValue = e.detail.value let dateValue = e.detail.value
this.dateValue = dateValue this.dateValue = dateValue
this.getLists() this.getLists()
}, },
// 列表筛选
onScreening(){
this.$refs.settingsPopup.open('bottom')
},
// 获取列表 // 获取列表
getLists(){ getLists(){
customer({ orderUsers({
type: this.tabsIndex, type : this.tabsIndex,
date: this.dateValue date : this.dateValue,
sort : this.sort,
pay_type : this.payType,
channel : this.channel,
page : this.page
}).then(res => { }).then(res => {
this.visitor = res.visitor if(res.orders.page.current === 1){
this.orders = res.orders.data this.orders = []
this.pages = res.orders.page }
this.visitor = res.visitor
this.orders = this.orders.concat(res.orders.data)
this.page = res.orders.page.current
this.pageStatus = res.orders.page.has_more ? 'more': 'noMore'
}).catch(err => { }).catch(err => {
uni.showToast({ uni.showToast({
title: err, title: err,
@@ -97,11 +162,68 @@
}) })
}) })
} }
},
onReachBottom() {
if(this.pageStatus == 'more'){
this.pageStatus = 'loading'
this.page += 1
this.getLists()
}
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
// 筛选层
.popup-content{
padding: $padding * 2;
.title{
font-weight: bold;
font-size: $title-size;
color: $text-color;
margin-top: $margin;
}
.popup-choose-flex{
padding: $padding /2 0;
margin: 0 -($margin - 20rpx);
display: flex;
flex-wrap: wrap;
.item{
width: calc(33.33% - #{$margin - 10});
font-size: $title-size-sm;
text-align: center;
background: $border-color-lg;
line-height: 68rpx;
margin: $margin - 20;
color: $text-gray;
border:solid 1rpx $border-color-lg;
box-sizing: border-box;
&.show{
border:solid 1rpx $text-price;
color: $text-price;
}
}
}
.popup-btns{
padding-top: $padding*2;
display: flex;
justify-content: space-between;
margin: 0 -$margin/2;
.item{
margin: $margin/2;
color: $text-price;
background: rgba($color: $text-price, $alpha: .1);
width: calc(50% - #{$margin});
height: 80rpx;
line-height: 80rpx;
text-align: center;
&:last-child{
background-color: $text-price;
color: white;
}
}
}
}
// 空提示 // 空提示
.list-null{ .list-null{
width: 100vw; width: 100vw;
@@ -145,14 +267,30 @@
background-color: white; background-color: white;
border-bottom: solid 1rpx $border-color; border-bottom: solid 1rpx $border-color;
padding: $padding; padding: $padding;
.statistics-date{ .statistics-flex{
font-size: $title-size + 4; display: flex;
font-weight: bold; justify-content: space-between;
line-height: 60rpx; .statistics-date{
.arrowdown{ font-size: $title-size + 4;
margin-left: $margin/2; font-weight: bold;
line-height: 60rpx;
.arrowdown{
margin-left: $margin/2;
}
}
.statistics-lay{
font-size: $title-size-sm;;
color: gray;
line-height: 50rpx;
&.show{
color: $text-price;
}
.arrowdown{
margin-left: $margin/2;
}
} }
} }
.statistics-text{ .statistics-text{
font-size: $title-size-sm; font-size: $title-size-sm;
color: gray; color: gray;
@@ -212,6 +350,16 @@
font-size: $title-size-sm; font-size: $title-size-sm;
color: $text-gray; color: $text-gray;
} }
.sub-tabs{
padding-top: $padding/2;
font-size: $title-size-sm;
text{
margin-right: $margin - 10;
background: $border-color-lg;
color: $text-gray;
padding: 0 ($padding/2);
}
}
} }
} }
</style> </style>

162
pages/store/deliver.vue Normal file
View File

@@ -0,0 +1,162 @@
<template>
<view>
<!-- 订单分类 -->
<scroll-view class="nav" scroll-x="true" scroll-with-animation="true">
<view :class="['nav-item', selectNavId === item.state ? 'nav-item-selected':'']" v-for="(item,index) in navList" :key="index" @click="selectNav(item.state)">
{{item.name}}
</view>
</scroll-view>
<!-- 订单列表 -->
<store-order :list="returnInfo" listType="deliver" />
<!-- 分页 -->
<uni-load-more :status="pageStatus" :iconSize="16" v-if="returnInfo.length > 0"></uni-load-more>
</view>
</template>
<script>
import { storeDeliver } from '@/apis/interfaces/store'
import storeOrder from '@/components/store-order/store-order'
export default {
comments:{
storeOrder
},
data() {
return {
returnInfo : [] ,// 列表
navList : [{
name : '待发货',
state : '1'
},{
name : '已发货',
state : '2'
},{
name : '待提货',
state : '3'
},{
name : '已提货',
state : '4'
}
],
selectNavId : '1',
// 分页
pageStatus : '',
page : 1
}
},
created() {
},
onShow() {
// 获取退货单列表
this.returnData();
},
methods: {
// 退货单列表
returnData(){
storeDeliver({
state: this.selectNavId,
page : this.goodsPage
}).then(res=>{
if(res.page.current === 1){
this.returnInfo = []
}
this.returnInfo = this.returnInfo.concat(res.data)
this.goodsPage = res.page.current
this.pageStatus = res.page.has_more ? 'more': 'noMore'
})
},
// 选择订单
selectNav(id) {
if (this.selectNavId !== id) {
this.selectNavId = id
this.returnData()
}
},
// 我要发货
goSend(orderNo) {
console.log(orderNo)
return
uni.showModal({
title: '是否签收此订单?',
success: res => {
if(res.confirm) {
storeSign(orderNo).then(() => {
uni.showToast({
icon: 'none',
title: '签收成功'
})
setTimeout(()=>{
this.returnData()
},3000)
}).catch(err => {
uni.showToast({
icon: 'none',
title: err.message
})
})
}
}
})
},
// 下拉加载
onReachBottom() {
if(this.pageStatus == 'more'){
this.pageStatus = 'loading'
if(this.selectNavId === '1') {
this.goodsPage += 1
// 获取退货单列表
this.returnData();
}
}
}
}
}
</script>
<style lang="scss" scoped>
// 订单nav
.nav {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
white-space: nowrap;
font-size: $title-size*0.95;
padding: 0 30rpx;
background-color: #fff;
color: #666;
position: sticky;
top: 0rpx;
z-index: 1;
.nav-item {
width: 25%;
text-align: center;
display: inline-block;
border-bottom: solid 4rpx #fff;
padding: 30rpx 0;
}
.nav-item-selected {
color: $main-color;
}
}
// 暂无订单
.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>

166
pages/store/deliverForm.vue Normal file
View File

@@ -0,0 +1,166 @@
<template>
<view>
<form @submit="sendSubmit">
<view class="nickname">
<view class="examineTitle">
选择发货方式
</view>
<view class="toExamine" v-if="send.sendWay[send.sendIndex]">
<picker mode="selector" :value="send.sendIndex" range-key="name" :range="send.sendWay" @change="wayChange">
<view>{{send.sendWay[send.sendIndex].name}}</view>
</picker>
<image class="toExamine-row" src="../../static/icons/goods_row.png" mode="aspectFill"></image>
</view>
</view>
<view class="nickname" v-if="send.sendIndex == 0">
<view class="examineTitle">
选择物流公司
</view>
<view class="toExamine" v-if="state.array[state.index]">
<picker mode="selector" :value="state.index" range-key="name" :range="state.array" @change="sexChange">
<view>{{state.array[state.index].name}}</view>
</picker>
<image class="toExamine-row" src="../../static/icons/goods_row.png" mode="aspectFill"></image>
</view>
</view>
<view class="nickname" v-if="send.sendIndex == 0">
<view class="examineTitle">
填写物流单号
</view>
<input class="remarks" @blur="bindExpressNo" auto-height placeholder="" />
</view>
<!-- 选择其他方式显示 -->
<view class="nickname" v-if="send.sendIndex == 1">
<view class="examineTitle">
送货人姓名
</view>
<input class="remarks" name="courier_name" auto-height placeholder="" />
</view>
<view class="nickname" v-if="send.sendIndex == 1">
<view class="examineTitle">
送货人联系方式
</view>
<input class="remarks" name="courier_mobile" auto-height placeholder="" />
</view>
<button class="submit" form-type="submit" type="default">提交</button>
</form>
</view>
</template>
<script>
import { deliverFront, deliverForm } from '@/apis/interfaces/store'
export default {
data() {
return {
send : {
sendWay : [{
id : 'post',
name : '邮寄'
},{
id : 'other',
name : '其他'
}],
sendIndex : 0,
},
state : {
// 快递筛选
array : [],
// 快递筛选默认下标
index : 0,
},
expressNo : '',
courierName : '',
courierMobile : ''
}
},
created() {
deliverFront(this.$Route.query.id).then(res=>{
this.state.array = res
})
},
methods: {
// 选择发货方式
wayChange(e) {
this.send.sendIndex = e.detail.value
this.expressNo = ''
this.courierName = ''
this.courierMobile = ''
},
// 筛选
sexChange(e) {
this.state.index = e.detail.value
},
// 物流单号
bindExpressNo(val) {
this.expressNo = val.detail.value
},
// 送货人姓名
bindCourierName(val) {
this.courierName = val.detail.value
},
// 送货人联系方式
bindCourierMobile(val) {
this.courierMobile = val.detail.value
},
// 提交表单
sendSubmit() {
deliverForm(this.$Route.query.id,{
type : this.send.sendWay[this.send.sendIndex].id || '',
express_id : this.state.array[this.state.index].id || '',
express_no : this.expressNo || '',
courier_name : this.courierName || '',
courier_mobile : this.courierMobile || ''
}).then(res=>{
uni.showToast({
icon: 'none',
title: '发送成功'
})
this.$Router.back()
})
}
}
}
</script>
<style lang="scss" scoped>
.nickname {
background-color: #FFFFFF;
padding: $padding;
margin-bottom: $margin;
display: flex;
position: relative;
font-size: $title-size-lg;
.examineTitle {
width: 210rpx;
}
.remarks {
width: calc(100% - 210rpx);
font-size: $title-size-lg;
color: $text-color;
}
.toExamine {
position: absolute;
top: $padding;
right: $padding;
display: flex;
.toExamine-row {
width: 32rpx;
height: 32rpx;
margin-top: 6rpx;
filter: grayscale(100%);
}
}
}
.submit {
background: #e93340;
color: white;
border-color: #e93340;
margin: $margin*4 $margin 0;
}
</style>

114
pages/store/examine.vue Normal file
View File

@@ -0,0 +1,114 @@
<template>
<view>
<form @submit="sendSubmit">
<view class="nickname">
<view class="examineTitle">
退换单操作
</view>
<view class="toExamine">
<picker mode="selector" :value="state.index" range-key="name" :range="state.array" @change="sexChange">
<view>{{state.array[state.index].name}}</view>
</picker>
<image class="toExamine-row" src="../../static/icons/goods_row.png" mode="aspectFill"></image>
</view>
</view>
<view class="nickname">
<view class="examineTitle">
退换单备注
</view>
<textarea class="remarks" @blur="bindTextAreaBlur" auto-height placeholder="请填写备注" />
</view>
<button class="submit" form-type="submit" type="default">提交</button>
</form>
</view>
</template>
<script>
import { storeAudit } from '@/apis/interfaces/store'
export default {
data() {
return {
state : {
// 退货单-筛选
array : [{
id : 'agree',
name: '审核通过'
},{
id : 'refuse',
name: '审核驳回'
}],
// 退货单筛选默认下标
index : 0,
},
remarks : ''
}
},
created() {
},
methods: {
bindTextAreaBlur(val) {
this.remarks = val.detail.value
},
// 筛选
sexChange(e) {
this.state.index = e.detail.value
},
sendSubmit(){
let newState = this.state.array[this.state.index].id,
newRemark = this.remarks
storeAudit(this.$Route.query.id, {
state : newState,
remark: newRemark
}).then(res=>{
uni.showToast({
icon: 'none',
title: '审核成功'
})
this.$Router.back()
})
}
}
}
</script>
<style lang="scss" scoped>
.nickname {
background-color: #FFFFFF;
padding: $padding;
margin-bottom: $margin;
display: flex;
position: relative;
font-size: $title-size-lg;
.examineTitle {
width: 210rpx;
}
.remarks {
width: calc(100% - 210rpx);
font-size: $title-size-lg;
color: $text-color;
}
.toExamine {
position: absolute;
top: $padding;
right: $padding;
display: flex;
.toExamine-row {
width: 32rpx;
height: 32rpx;
margin-top: 6rpx;
filter: grayscale(100%);
}
}
}
.submit {
background: #e93340;
color: white;
border-color: #e93340;
margin: $margin*4 $margin 0;
}
</style>

View File

@@ -12,6 +12,11 @@
<view class="sub-title">{{appliesState.message}}</view> <view class="sub-title">{{appliesState.message}}</view>
<button type="default" @click="onRightBtn">认证并开通</button> <button type="default" @click="onRightBtn">认证并开通</button>
</block> </block>
<block v-if="appliesState.code === -2">
<image class="icon" src="@/static/icons/approve-icon.png" mode="widthFix"></image>
<view class="sub-title">{{appliesState.message}}</view>
<button type="default" @click="onRightBtn1">企业未注册</button>
</block>
<block v-else-if="appliesState.code === 2"> <block v-else-if="appliesState.code === 2">
<image class="icon" src="@/static/icons/approve-icon.png" mode="widthFix"></image> <image class="icon" src="@/static/icons/approve-icon.png" mode="widthFix"></image>
<view class="title">认证失败</view> <view class="title">认证失败</view>
@@ -29,7 +34,7 @@
<view class="statusBar-box"> <view class="statusBar-box">
<image class="logo" :src="company.logo" mode="aspectFill"></image> <image class="logo" :src="company.logo" mode="aspectFill"></image>
<view class="company"> <view class="company">
<view class="name">{{company.name}}<image @click="$Router.push({name: 'Basics'})" class="name-img" src="../../static/icons/store_icon_pen.png" mode="aspectFill"></image></view> <view class="name">{{company.name}}<image v-if="!employee" @click="$Router.push({name: 'Basics'})" class="name-img" src="../../static/icons/store_icon_pen.png" mode="aspectFill"></image></view>
<view class="tool"> <view class="tool">
<view class="faith"><image class="faith-img" src="../../static/icons/store_icon_row.png" mode="aspectFill"></image>诚信{{company.faith}}</view> <view class="faith"><image class="faith-img" src="../../static/icons/store_icon_row.png" mode="aspectFill"></image>诚信{{company.faith}}</view>
<view class="btn"><image class="btn-img" src="../../static/icons/store_icon_icon.png" mode="aspectFill"></image>{{company.identity}}</view> <view class="btn"><image class="btn-img" src="../../static/icons/store_icon_icon.png" mode="aspectFill"></image>{{company.identity}}</view>
@@ -82,14 +87,6 @@
}, },
onShow(){ onShow(){
this.getIndex() this.getIndex()
// 获取员工管理列表
if(this.$store.state.token != ''){
if(!this.employee) {
employeesTool().then(res=>{
this.toolList = res.permission
})
}
}
}, },
methods: { methods: {
// 首页数据 // 首页数据
@@ -111,14 +108,23 @@
faith : res.integrity faith : res.integrity
} }
this.workbench = { this.workbench = {
identity: res.identity_time,
grade : res.identity_sign,
top : res.top, top : res.top,
middle : res.middle, middle : res.middle,
order : res.order order : res.order
} }
this.employee = res.is_employee this.employee = res.is_employee
this.loding = false this.loding = false
// 若为员工身份-则调取员工管理信息
if(res.is_employee) {
employeesTool().then(res=>{
this.toolList = res.permission
})
}
}).catch(err =>{ }).catch(err =>{
console.log(err)
uni.showToast({ uni.showToast({
title: err.message, title: err.message,
icon : 'none' icon : 'none'
@@ -128,7 +134,6 @@
// 查询企业认证状态 // 查询企业认证状态
getAppliesQuery(){ getAppliesQuery(){
appliesQuery().then(res=>{ appliesQuery().then(res=>{
console.log(res)
this.appliesState = res this.appliesState = res
this.loding = false this.loding = false
}).catch(err => { }).catch(err => {
@@ -166,6 +171,10 @@
} }
}) })
}) })
},
// 跳转到创建企业选择企业类型的页面
onRightBtn1(){
this.$Router.push({name: 'Registered'})
} }
} }
} }
@@ -215,7 +224,7 @@
.statusBar-box{ .statusBar-box{
min-height: 90rpx; min-height: 90rpx;
position: relative; position: relative;
padding: $padding ($padding + 200) $padding ($padding + 88); padding: $padding $padding $padding ($padding + 88);
color: white; color: white;
.logo{ .logo{
position: absolute; position: absolute;
@@ -226,14 +235,16 @@
border: 4rpx solid #ed8483; border: 4rpx solid #ed8483;
box-sizing: border-box; box-sizing: border-box;
box-shadow: 0 4rpx 15rpx rgba(109,1,0,.8); box-shadow: 0 4rpx 15rpx rgba(109,1,0,.8);
background-color: #fff;
} }
.company{ .company{
margin-left: 30rpx; width: calc(100% - 94rpx);
padding-left: 30rpx;
box-sizing: border-box;
.name{ .name{
line-height: 40rpx; line-height: 40rpx;
@extend .nowrap; @extend .nowrap;
font-size: $title-size; font-size: $title-size;
display: flex;
.name-img { .name-img {
width: 30rpx; width: 30rpx;
height: 30rpx; height: 30rpx;
@@ -268,6 +279,7 @@
display: inline-block; display: inline-block;
border-radius: 0 60rpx 60rpx 0; border-radius: 0 60rpx 60rpx 0;
position: relative; position: relative;
text-transform: uppercase;
.btn-img { .btn-img {
position: absolute; position: absolute;
width: 38rpx; width: 38rpx;

83
pages/store/journal.vue Normal file
View File

@@ -0,0 +1,83 @@
<template>
<view>
<view class="logsBack">
<view class="logsList" v-for="(item ,index) in logArr" :key="index">
<view class="logsLabel">
<view class="logsLabel-name">操作来源</view>
<view class="logsTips" :class="[item.isMy ? 'active' : '']">{{ item.isMy ? '个人' : '商家' }}</view>
</view>
<view class="logsLabel" v-if="item.title">
<view class="logsLabel-name">申请原因</view>
<view class="logsLabel-text">{{ item.title }}</view>
</view>
<view class="logsLabel" v-if="item.state_text">
<view class="logsLabel-name">申请状态</view>
<view class="logsLabel-text">{{ item.state_text }}</view>
</view>
<view class="logsLabel" v-if="item.remark">
<view class="logsLabel-name">补充描述</view>
<view class="logsLabel-text">{{ item.remark }}</view>
</view>
<view class="logsLabel">
<view class="logsLabel-name">退款时间</view>
<view class="logsLabel-text">{{ item.created_at }}</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { orderJournal } from '@/apis/interfaces/store'
export default {
data() {
return {
logArr : '', //订单数组列表
}
},
created() {
orderJournal(this.$Route.query.id).then(res=>{
this.logArr = res
})
},
methods: {
}
}
</script>
<style lang="scss" scoped>
.logsBack {
background: #f7f7f7;
padding: $padding;
box-sizing: border-box;
font-size: $title-size-sm;
.logsList {
background: #fff;
padding: $padding;
box-sizing: border-box;
border-radius: 10rpx;
margin-bottom: $margin;
position: relative;
}
.logsTips {
color: #e1293f;
&.active {
color: #e1293f;
}
}
.logsLabel {
padding: $padding 0;
overflow: hidden;
display: flex;
.logsLabel-name {
margin-right: $margin;
width: 140rpx;
}
.logsLabel-text {
color: $text-gray;
width: calc(100% - 140rpx - #{$margin});
}
}
}
</style>

161
pages/store/logistic.vue Normal file
View File

@@ -0,0 +1,161 @@
<template>
<view>
<!-- 物流状态 start -->
<view class="state" v-if="logistic.length > 0">
<view class="take">
<view class="take-tips">
</view>
<view class="take-text">
收货地址发接口返回绝对是放假客户端上看见发货数据库大黄蜂教科书的浩丰科技
</view>
</view>
<view class="list">
<!-- v-for="(item, index) in logistic" :key="index" -->
<view class="list-label">
<view class="list-name">
<text>发货中</text> 2020-15-12
</view>
<view class="list-time">
华东师范邯郸市科技发货圣诞节客服
</view>
</view>
</view>
</view>
<view class="pack-center" v-else>
<image src="../../static/icons/store_logistic.png" mode="aspectFill"></image>
<view>{{message}} </view>
</view>
</view>
</template>
<script>
import { deliverLogistic } from '@/apis/interfaces/store'
export default {
data() {
return {
message : '',
logistic: ''
}
},
created() {
deliverLogistic(this.$Route.query.id).then(res=>{
console.log(res)
}).catch(err => {
this.message = err.message
})
},
methods: {
}
}
</script>
<style lang="scss" scoped>
page {
background-color: #f6f6f6;
}
// 物流状态
.state {
background-color: $uni-bg-color;
margin-top: $margin;
padding: $padding;
font-size: $title-size-m;
color: $text-gray;
.take {
display: flex;
padding-bottom: $padding;
position: relative;
&::before {
position: absolute;
content: '';
left: $uni-img-size-sm / 3 + 2;
top: $margin;
background-color: $uni-text-color-grey;
width: 2rpx;
height: 100%;
}
.take-tips {
background-color: #e53d4c;
width: $uni-img-size-sm;
height: $uni-img-size-sm;
border-radius: $uni-border-radius-circle;
font-size: $title-size-sm;
transform: scale(.9);
text-align: center;
color: $uni-text-color-inverse;
margin-top: 10rpx;
margin-left: -4rpx;
}
.take-text {
margin-left: $margin;
line-height: 40rpx;
margin-top: $margin - 10;
width: calc(100% - #{$uni-img-size-sm} + #{$margin});
}
}
.list {
font-size: $title-size-sm;
.list-label {
padding-left: $padding * 3;
padding-bottom: $padding;
padding-top: $padding - 10;
position: relative;
&::after {
position: absolute;
content: '';
left: $uni-img-size-sm / 3 - 4;
top: $margin;
background-color: $uni-text-color-grey;
width: $uni-img-size-sm / 3;
height: $uni-img-size-sm / 3;
border-radius: $uni-border-radius-circle;
z-index: 9;
}
&::before {
position: absolute;
content: '';
left: $uni-img-size-sm / 3 + 2;
top: $margin;
background-color: $uni-text-color-grey;
width: 2rpx;
height: 100%;
}
&:first-child {
color: #e53d4c;
}
&:last-child::before {
background-color: $uni-bg-color;
}
&:first-child::after {
background-color: #e53d4c;
}
.list-name {
margin-bottom: $margin - 10;
text {
font-weight: 600;
padding-right: $padding;
}
}
.list-time {
font-size: $uni-font-size-sm;
line-height: 34rpx;
}
}
}
}
// 暂无订单
.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;
margin: 0 auto $margin;
}
}
</style>

View File

@@ -0,0 +1,38 @@
<template>
<view>
<!-- 订单详情 -->
<store-order-details :info="info" :listType="newType" />
</view>
</template>
<script>
import { deliverDetails, orderDetails } from '@/apis/interfaces/store'
import storeOrderDet from '@/components/store-order-details/store-order-details'
export default {
comments:{
storeOrderDet
},
data() {
return {
info : '',
newType : ''
}
},
created() {
this.newType = this.$Route.query.type
if(this.$Route.query.type == 'deliver') {
deliverDetails(this.$Route.query.id).then(res=>{
this.info = res
})
return
}
orderDetails(this.$Route.query.id).then(res=>{
this.info = res
})
},
methods: {}
}
</script>
<style lang="scss" scoped></style>

196
pages/store/return.vue Normal file
View File

@@ -0,0 +1,196 @@
<template>
<view>
<!-- 订单分类 -->
<scroll-view class="nav" scroll-x="true" scroll-with-animation="true">
<view :class="['nav-item', selectNavId === item.id ? 'nav-item-selected':'']"
v-for="(item,index) in navList" :key="index" @click="selectNav(item.id)">
{{item.name}}
</view>
</scroll-view>
<!-- 订单列表 -->
<store-order :list="returnInfo" @goSign="goSign" @goReToken="goReToken" />
<!-- 分页 -->
<uni-load-more :status="pageStatus" :iconSize="16" v-if="returnInfo.length > 0"></uni-load-more>
</view>
</template>
<script>
import {
storeReturn,
storeSign,
storeToken
} from '@/apis/interfaces/store'
import storeOrder from '@/components/store-order/store-order'
export default {
comments: {
storeOrder
},
data() {
return {
returnInfo: [], // 列表
navList: [{
name: '待审核',
id: 'apply'
}, {
name: '已驳回',
id: 'refuse'
}, {
name: '待返货',
id: 'deliver'
}, {
name: '待签收',
id: 'delivered'
},
// {
// name: '已签收',
// id: 'signed'
// },
{
name: '待确认退货',
id: 'process'
},
{
name: '完成退货',
id: 'completed'
}
],
selectNavId: 'apply',
// 分页
pageStatus: '',
page: 1
}
},
created() {},
onShow() {
// 获取退货单列表
this.returnData();
},
methods: {
// 退货单列表
returnData() {
storeReturn({
state: this.selectNavId,
page: this.goodsPage
}).then(res => {
if (res.page.current === 1) {
this.returnInfo = []
}
this.returnInfo = this.returnInfo.concat(res.data)
this.goodsPage = res.page.current
this.pageStatus = res.page.has_more ? 'more' : 'noMore'
})
},
// 选择订单
selectNav(id) {
if (this.selectNavId !== id) {
this.selectNavId = id
this.returnData()
}
},
// 签收订单
goSign(info) {
console.log('goSign',info)
let id = info.id
let index = info.index
uni.showModal({
title: '是否签收此订单?',
success: res => {
if (res.confirm) {
storeSign(id).then(() => {
uni.showToast({
icon: 'none',
title: '签收成功'
})
setTimeout(() => {
this.returnInfo.splice(index,1)
// this.returnData()
}, 500)
}).catch(err => {
uni.showToast({
icon: 'none',
title: err.message
})
})
}
}
})
},
// 确认退货
goReToken(info) {
let id = info.id
let index = info.index
uni.showModal({
title: '是否确认退货此订单?',
success: res => {
if (res.confirm) {
storeToken(id).then(() => {
uni.showToast({
icon: 'none',
title: '退货成功'
})
setTimeout(() => {
// this.returnData()
this.returnInfo.splice(index,1)
}, 500)
}).catch(err => {
uni.showToast({
icon: 'none',
title: err.message
})
})
}
}
})
},
// 下拉加载
onReachBottom() {
if (this.pageStatus == 'more') {
this.pageStatus = 'loading'
if (this.tabIndex === 'apply') {
this.goodsPage += 1
// 获取退货单列表
this.returnData();
}
}
}
}
}
</script>
<style lang="scss" scoped>
// 订单nav
.nav {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
white-space: nowrap;
font-size: $title-size*0.95;
padding: 0 30rpx;
background-color: #fff;
color: #666;
position: sticky;
top: 0rpx;
z-index: 1;
.nav-item {
display: inline-block;
border-bottom: solid 4rpx #fff;
padding: 30rpx 10rpx;
margin-right: 10rpx;
}
.nav-item-selected {
border-bottom: solid 4rpx $main-color;
color: $main-color;
}
}
</style>

View File

@@ -2,9 +2,9 @@
<view class="content"> <view class="content">
<!-- tabs --> <!-- tabs -->
<view class="tabs"> <view class="tabs">
<view class="item" :class="{'show': tabsIndex == 'day'}" @click="onTbas('day')">成交</view> <view class="item" :class="{'show': tabsIndex == 'day'}" @click="onTbas('day')">访客</view>
<view class="item" :class="{'show': tabsIndex == 'month'}" @click="onTbas('month')">成交</view> <view class="item" :class="{'show': tabsIndex == 'month'}" @click="onTbas('month')">访客</view>
<view class="item" :class="{'show': tabsIndex == 'year'}" @click="onTbas('year')">成交</view> <view class="item" :class="{'show': tabsIndex == 'year'}" @click="onTbas('year')">访客</view>
</view> </view>
<!-- 统计信息 --> <!-- 统计信息 -->
<view class="statistics"> <view class="statistics">
@@ -24,7 +24,9 @@
<view class="item" v-for="(item, index) in orders" :key="index"> <view class="item" v-for="(item, index) in orders" :key="index">
<image class="cover" :src="item.avatar" mode="aspectFill"></image> <image class="cover" :src="item.avatar" mode="aspectFill"></image>
<view class="title">{{item.nickname || '-'}}</view> <view class="title">{{item.nickname || '-'}}</view>
<view class="sub-title">{{item.date || '-'}}</view> <view class="sub-title">访问记录: {{item.content || '-'}}</view>
<view class="sub-title">手机号码: {{item.mobile || '-'}}</view>
<view class="sub-title">访问时间: {{item.date || '-'}}</view>
</view> </view>
</view> </view>
</block> </block>
@@ -107,6 +109,7 @@
.sub-title{ .sub-title{
color: $text-gray; color: $text-gray;
font-size: $title-size-m; font-size: $title-size-m;
@extend .nowrap;
} }
.icon{ .icon{
width: 288rpx; width: 288rpx;

View File

@@ -1,19 +0,0 @@
<template>
<view>
核销详情
</view>
</template>
<script>
export default {
data() {
return {
};
}
}
</script>
<style lang="scss">
</style>

View File

@@ -0,0 +1,517 @@
<template>
<view class="Record" v-if="loaded">
<view class="record-top">
<image src="/static/images/ver-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',scantype==='goods'?'pay_type_item_select':'']"
@click="selectCoinType('goods')">权证</view>
<view :class="['pay_type_item',scantype==='coupons'?'pay_type_item_select':'']"
@click="selectCoinType('coupons')">优惠券</view>
</view>
</view>
<view class="record-title">核销总数 ( ) </view>
<view class="record-money"><span></span>{{account}}
<span></span>
</view>
</view>
<view class="boss" v-if="isBos">
<view class="boss-left">
<image src="/static/images/boss.png" mode="mode" class="boss-img">我是BOSS
</view>
<view class="boss-right" @click="shopShow = true">
<u-select v-model="shopShow" :list="ShopList" @confirm="shopConfirm" value-name='store_id'
label-name='name' />
门店<u-icon name="arrow-down" color="#606266" label-color='#606266' margin-right='10' label-pos='left'
:label='store_id?store_name:"全部门店"' size="28" />
</view>
</view>
<!-- 列表 -->
<view class="lists" v-if="lists.length>0">
<view class="list-item" v-for="(item,index) in lists" :key='index'>
<view class="list-item-title">
<view class="left">
<view class="tags">{{scantype === 'goods'?'权证核销':'优惠券核销'}}</view>
<view class='title' v-if="scantype === 'goods'">{{item.goods_sku.goods_name}}</view>
<view class='title' v-else>{{item.coupon.title}}</view>
</view>
<!-- <view class="right"> -->
<!-- <u-icon name="checkmark-circle-fill" size='50' color='#e93340' /> -->
<!-- </view> -->
</view>
<view class="list-item-content" v-if='scantype === "goods"'>
<image class="good-img" :src="item.goods_sku.cover" mode="aspectFill" />
<view class="list-item-right">
<view class="content-item">核销商品数量X {{item.qty}} </view>
<view class="content-item">核销商品规格{{item.goods_sku.unit || '通用规格'}}</view>
<view class="content-item">核销时间{{item.used_at}}</view>
</view>
</view>
<view class="list-item-content" v-else>
<image class="good-img" v-if='item.source.type ==="goods"' :src="item.source.cover"
mode="aspectFill" />
<view class="list-item-right">
<view class="content-item" v-if='item.source.type ==="goods"'>兑换商品名称{{item.source.name}}
</view>
<view class="content-item"> 优惠券规格 {{item.coupon.full}} {{item.coupon.price}} </view>
<view class="content-item">优惠券类型{{item.coupon.type.text}}</view>
<view class="content-item">核销时间{{item.used_at}}</view>
</view>
</view>
<view class="person">
<image class="avatar" :src="item.clerk.avatar" mode="aspectFill" />
{{item.clerk.nickname}}
<view class="shop-name">{{item.store.name}}</view>
</view>
</view>
</view>
<!-- 无列表 -->
<no-list v-if="lists.length === 0 && scantype === 'goods'" name='no-in' txt="没有任何权证核销记录" />
<no-list v-if="lists.length === 0 && scantype === 'coupons'" name='no-out' txt="没有任何优惠券核销记录" />
<!-- <u-toast ref="uToast" /> -->
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
scanList
} from '@/apis/interfaces/scan';
export default {
data() {
return {
lists: [],
has_more: true,
page: 1,
type: 'year', // 统计类型day日month月year年
scantype: 'goods', // goods 数权核销 coupons 优惠券核销
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: '',
loaded: false,
shopShow: false,
ShopList: [],
store_name: '',
store_id: '',
isBos:false
}
},
onLoad() {
this.getList()
},
onReachBottom() {
if (this.has_more) {
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,
date_type: this.type,
date: this.date,
store_id:this.store_id
}
let apiUrl = ''
if (this.scantype === 'goods') {
apiUrl = 'manages/warrants/logs'
} else {
apiUrl = 'coupons/verify/logs/coupons'
}
scanList(apiUrl, data).then(res => {
console.log(res)
this.account = res.all
this.lists = this.lists.concat(res.lists.data)
this.has_more = res.lists.page.has_more
this.loaded = true
this.ShopList = [{name:'全部',store_id:''},...res.stores]
this.isBos = res.isBos
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'error',
icon: false,
duration: 3000
})
})
},
selectCoinType(type) {
if (this.scantype !== type) {
this.scantype = type
this.store_id = ''
this.reset()
}
},
// 重置
reset() {
this.page = 1
this.lists = []
this.has_more = 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.store_id = ''
this.reset()
break;
case 'month':
this.type = type
this.params = {
year: true,
month: true,
day: false
}
this.date = this.currentMonth
this.store_id = ''
this.reset()
break;
case 'day':
this.type = type
this.params = {
year: true,
month: false,
day: false
}
this.date = this.currentDay
this.store_id = ''
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;
}
},
// 筛选门店信息
shopConfirm(e) {
this.store_id = e[0].value
this.store_name = e[0].label
this.reset()
}
}
}
</script>
<style lang="scss" scoped>
.Record {
width: 100%;
min-height: 100vh;
padding-top: 30rpx;
background-color: #f5f5f5;
}
.record-top {
width: calc(100% - 60rpx);
height: 360rpx;
background-image: linear-gradient(to left, #076cff, #076cff);
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;
}
}
}
.boss {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 30rpx;
background-color: #fff;
.boss-left {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
font-size: 32rpx;
font-weight: bold;
}
.boss-right {
font-size: 28rpx;
u-icon {
padding-left: 20rpx;
}
}
.boss-img {
width: 90rpx;
height: 90rpx;
border-radius: 50%;
margin-right: 20rpx;
}
}
// 列表
.lists {
// box-shadow: 0 10rpx 20rpx 0rpx rgba($color: #000, $alpha: 0.4);
padding: 20rpx;
.list-item {
background-color: #fff;
width: 100%;
border-radius: 20rpx;
margin-bottom: 20rpx;
padding: 20rpx;
.list-item-title {
width: 100%;
border-bottom: solid 1rpx #f7f7f7;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 20rpx 0;
.left {
flex: 1;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
.title {
width: 500rpx;
overflow: hidden;
font-size: 30rpx;
margin-left: 12rpx;
text-overflow: ellipsis;
white-space: nowrap;
}
.tags {
padding: 4rpx 10rpx;
border-radius: 20rpx 0 20rpx 0;
background-color: #076cff;
font-size: 26rpx;
color: #fff;
}
}
// .right{
// padding: 20rpx 30rpx;
// }
}
.list-item-content {
width: 100%;
color: #999;
padding: 20rpx 0;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
border-bottom: solid 1rpx #f7f7f7;
.good-img {
margin-right: 20rpx;
width: 160rpx;
height: 160rpx;
border-radius: 10rpx;
}
.list-item-right {
flex: 1;
.content-item {
padding: 10rpx 0;
}
}
}
.person {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
font-size: 30rpx;
padding: 20rpx 0 0 0;
font-weight: bold;
.avatar {
width: 70rpx;
height: 70rpx;
border-radius: 50%;
margin-right: 10rpx;
}
.shop-name {
background-color: #076cff;
color: #fff;
font-size: 24rpx;
font-weight: 400;
padding: 4rpx 20rpx;
border-radius: 12rpx;
margin-left: 20rpx;
}
}
}
}
</style>

View File

@@ -9,7 +9,7 @@
<view class="goods" @click="scanCode('goods','get')"> 权证核销 </view> <view class="goods" @click="scanCode('goods','get')"> 权证核销 </view>
<view class="coupons" @click="scanCode('coupons','get')"> 优惠券核销 </view> <view class="coupons" @click="scanCode('coupons','get')"> 优惠券核销 </view>
</view> </view>
<view class="history">核销记录</view> <view class="history" @click="goHistory">核销记录</view>
<u-toast ref="uToast" /> <u-toast ref="uToast" />
<!-- 二维码展示动画效果 --> <!-- 二维码展示动画效果 -->
@@ -74,7 +74,7 @@
} }
}); });
}, },
// 请求核销前置,优惠券前置和权证前置 // 请求核销前置,优惠券前置和权证前置get post 是核销
scanInfo(token, method) { scanInfo(token, method) {
console.log(token, this.scanType) console.log(token, this.scanType)
let apiUrl = '' let apiUrl = ''
@@ -122,7 +122,8 @@
success: (res1) => { success: (res1) => {
if (res1.confirm) { if (res1.confirm) {
uni.navigateTo({ uni.navigateTo({
url:'/pages/property/coupon/canUseList?code='+this.code url: '/pages/property/coupon/canUseList?code=' +
this.code
}) })
} else { } else {
this.showCode = true this.showCode = true
@@ -145,6 +146,12 @@
}) })
this.showCode = false this.showCode = false
}) })
},
// 核销记录
goHistory() {
uni.navigateTo({
url:'/pages/verification/history'
})
} }
} }
} }

39
pages/vip/agree.vue Normal file
View File

@@ -0,0 +1,39 @@
<template>
<view>
<view class="contentTitle">
<rich-text :nodes="content"></rich-text>
</view>
</view>
</template>
<script>
import { userAgree } from '@/apis/interfaces/vip'
export default {
data() {
return {
content: ''
}
},
created() {
userAgree().then(res => {
console.log(res.content)
this.content = res.content
}).catch(err =>{
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
methods: {
}
}
</script>
<style lang="scss" scoped>
.contentTitle {
padding: $padding;
box-sizing: border-box;
}
</style>

View File

@@ -1,67 +1,106 @@
<template> <template>
<!-- v-if="!loding" -->
<view class="content"> <view class="content">
<!-- <swiper class="vip-container" previous-margin="45rpx" next-margin="45rpx" circular @change="swiperChange"> <swiper class="vip-container" previous-margin="45rpx" next-margin="45rpx" circular @change="swiperChange">
<swiper-item class="vip-item"> <swiper-item class="swiper-item" v-for="(item, index) in identities" :key="index">
<view> <image class="swiper-item-bg" src="/static/imgs/account-bg.png" mode="widthFix" />
VIP企业会员 <view class="vip-item" :class="tabsIndex == index ? 'color-item-img' : ''">
<view class="vip-top">
<view :class="tabsIndex == index ? 'vip-name' : 'vip-name1'">
<image class="vip-name-icon" src="../../static/icons/vip_icon.png" mode="aspectFill" />
{{item.name}}
</view>
<view class="vip-price">
{{identities[tabsIndex].price}}/
</view>
</view>
<view class="vip-time">
{{identityTime}}
</view>
</view> </view>
</swiper-item> </swiper-item>
<swiper-item class="vip-item"> </swiper>
<view>
普通会员
</view>
</swiper-item>
<swiper-item class="vip-item">
<view>
超级会员
</view>
</swiper-item>
</swiper> -->
<!-- 会员类型 --> <!-- 轮播点 -->
<view class="tabs"> <view class="vip-spot">
<view class="item" :class="{'show': index === tabsIndex}" v-for="(item, index) in identities" :key="index" @click="onTabs(index)">{{item.name}}</view> <view class="vip-spot-label" :class="tabsIndex == index ? 'vip-spot-color' : ''" v-for="(item, index) in identities" :key="index"></view>
</view> </view>
<!-- 会员信息 -->
<view class="cards"> <!-- 选择开通年限 -->
<view class="card"> <view class="vip-years">
<view class="card-content"> <view class="vip-years-name">
<image class="cover" src="@/static/dev/good_cover_01.png" mode="aspectFill"></image> <image class="vip-years-icon" src="../../static/icons/vip_yearsIcon.png" mode="aspectFill"></image>
<view class="user nowrap">{{user.username}}</view> 选择开通年限
<view class="sub-time nowrap">{{user.identity.name}}{{user.identity.ended_at}}</view> </view>
<view class="btn" @click="openOrder">开通/续费</view> <view class="vip-years-tool">
</view> <view class="vip-years-btn" @click="yearsBtn('remove')">-</view>
</view> <view class="vip-years-input">{{sumNumber}}</view>
<view class="cards-back"></view> <view class="vip-years-btn" @click="yearsBtn('plus')">+</view>
<image class="cards-angle" src="@/static/imgs/vip-angle-back.png" mode="widthFix"></image> </view>
</view> </view>
<!-- 会员权限 -->
<view class="privilege"> <!-- 会员特权 -->
<view class="title">开通会员享特权</view> <view class="privilege">
<view class="privilege-box"> <image class="privilege-img" src="../../static/icons/vip_privilege_tittle.png" mode="heightFix"></image>
<view class="item" v-for="(item, index) in rights" :key="index" @click="showRemark(item.name, item.remark)"> <view class="privilege-list">
<image class="icon" :src="item.cover" mode="aspectFill"></image> <view class="privilege-label" v-for="(item, index) in rights" :key="index">
<view class="text">{{item.name}}</view> <image class="privilege-label-tips" src="../../static/icons/vip_privilege_tips.png" mode="heightFix"></image>
</view> <view class="privilege-label-text">
</view> {{item.name}}
</view> </view>
<!-- 会员 --> </view>
<view class="footer"> </view>
<button class="footer-btn" type="default" @click="openOrder">{{identities[tabsIndex].price}}/&nbsp;开通</button> </view>
</view>
<!-- 会员服务信息 --> <!-- 支付方式 -->
<view class="notice"> <view class="privilege payWay">
<view class="title">开通须知</view> <image class="privilege-img" src="../../static/icons/vip_pay_title.png" mode="heightFix"></image>
<view class="item"> <view class="payWay-way">
<text>{{description}}</text> <radio-group @change="radioChange">
</view> <view class="payWay-way-label">
</view> <view class="payWay-way-name">
<image class="payWay-way-img" src="../../static/icons/payWay_icon_00.png"></image>
<text>微信支付</text>
</view>
<radio class="radio" value="weChat" checked style="transform: scale(.8);" color="#ff2828"></radio>
</view>
<view class="payWay-way-label">
<view class="payWay-way-name">
<image class="payWay-way-img" src="../../static/icons/payWay_icon_01.png"></image>
<text>余额支付</text>
</view>
<radio class="radio" value="balance" style="transform: scale(.8);" color="#9b9b9b"></radio>
</view>
</radio-group>
</view>
</view>
<!-- 用户协议 -->
<view class="agree">
<view class="agree-tips" @click="$Router.push({name: 'vipAgree'})">
请仔细阅读并确认服务协议
</view>
</view>
<view class="agree-btn" @click="agreeChange">
<radio :checked="selected" style="transform: scale(.7);" color="#ff2828"></radio>会员服务协议
</view>
<!-- 开通按钮 -->
<view class="footer">
<button class="footer-btn" type="default" @click="openOrder" :disabled="payChecked">
<view class="footer-btn-num">
合计{{total}}
</view>
<view class="footer-btn-pay">
立即支付
</view>
</button>
</view>
</view> </view>
</template> </template>
<script> <script>
import { identities, vipOrder, vipWechatPay } from '@/apis/interfaces/vip' import { identities, vipOrder, vipWechatPay, vipCont } from '@/apis/interfaces/vip'
export default { export default {
data() { data() {
return { return {
@@ -70,43 +109,58 @@
user : {}, user : {},
identities : [], identities : [],
rights : [], rights : [],
description : '' description : '',
identityTime: '', // 到期时间
valuePay : 'weChat', // 支付方式
sumNumber : 1, // 开通年限
total : '', // 开通年限总资金额
selected : false, // 用户协议
payChecked : false // 支付选择
} }
}, },
created() { created() {
// 获取当前用户信息
identities().then(res => { identities().then(res => {
console.log(res)
this.loding = false this.loding = false
this.user = res.user this.user = res.user
this.description= res.description this.description= res.description
this.identities = res.identities this.identities = res.identities
this.rights = res.identities[0].rights this.rights = res.identities[0].rights
this.total = res.identities[0].price
}).catch(err =>{ }).catch(err =>{
uni.showToast({ uni.showToast({
title: err.message, title: err.message,
icon : 'none' icon : 'none'
}) })
}) })
// 获取支付总金额 默认传VIP会员id=2
this.totalData(2);
}, },
methods: { methods: {
// 切换开通身份 // 切换开通身份
onTabs(index){ swiperChange(e) {
if(this.tabsIndex === index) return this.tabsIndex = e.detail.current
this.tabsIndex = index this.total = this.identities[e.detail.current].price
this.rights = this.identities[index].rights this.rights = this.identities[e.detail.current].rights
}, this.totalData(this.identities[e.detail.current].identity_id);
// 会员权益介绍 this.sumNumber = 1
showRemark(title, text){ },
uni.showModal({
title : title + '说明',
content : text,
showCancel : false
})
},
// 开通会员 // 开通会员
openOrder(){ openOrder(){
if(this.selected == false) {
uni.showToast({
title: '请勾选用户协议',
icon : 'none'
})
return
}
let identitiesId = this.identities[this.tabsIndex].identity_id let identitiesId = this.identities[this.tabsIndex].identity_id
vipOrder(identitiesId).then(res => { vipOrder(identitiesId,{
console.log(res.test) year: this.sumNumber
}).then(res => {
if(!res.test){ if(!res.test){
let verifyForm = res let verifyForm = res
this.wechatPay(res.id) this.wechatPay(res.id)
@@ -138,6 +192,40 @@
}) })
}, },
// 选择权限
yearsBtn(val) {
let newNumber = this.sumNumber
if (val == 'plus'){
newNumber ++;
}else{
if (newNumber > 1){
newNumber --;
}else{
uni.showToast({
title : '商品数量不能小于1',
icon : 'none'
})
}
}
this.sumNumber = newNumber
this.totalData(this.identities[this.tabsIndex].identity_id);
},
// 支付总金额数据
totalData(id) {
vipCont(id,{
year: this.sumNumber
}).then(res => {
this.identityTime = res.identity.description
this.total = res.identity.price
}).catch(err =>{
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
// 微信支付 // 微信支付
wechatPay(id){ wechatPay(id){
vipWechatPay(id).then(res => { vipWechatPay(id).then(res => {
@@ -154,7 +242,35 @@
} }
}) })
}) })
} },
// 支付选择
radioChange(val) {
let valuePay = val.detail.value
if( val.detail.value == 'balance') {
uni.showToast({
title: '抱歉暂未开通',
icon : 'none'
})
this.payChecked = true
return
}
this.payChecked = false
},
// 勾选协议
agreeChange() {
this.selected = !this.selected
},
// 会员权益介绍
showRemark(title, text){
uni.showModal({
title : title + '说明',
content : text,
showCancel : false
})
}
} }
} }
</script> </script>
@@ -164,20 +280,238 @@
background-color: #FFFFFF; background-color: #FFFFFF;
} }
// 新增样式
.vip-container { .vip-container {
width: 750rpx; width: 750rpx;
height: 350rpx; height: 300rpx;
.vip-item { margin-top: $margin;
background-color: #c8c8c8; }
border-radius: 20rpx;
.swiper-item {
width: 630rpx;
height: 280rpx;
display: flex;
position: relative;
.swiper-item-bg{
width: 100%;
height: 100%;
position: absolute;
z-index: 10;
bottom: 0;
}
}
.vip-item {
width: 630rpx;
height: 280rpx;
border-radius: 20rpx;
background-color: #c7c7c7;
padding: 0 40rpx;
box-sizing: border-box;
color: #cacaca;
.vip-top {
display: flex;
position: relative;
height: 80rpx;
line-height: 80rpx;
margin: $margin + 20 0 $margin + 20;
.vip-name {
font-size: $title-size + 6;
border-radius: 60rpx;
padding: 0 $padding;
box-sizing: border-box;
background-image: linear-gradient(to bottom ,#e93340,#e8252f);
display: flex;
.vip-name-icon {
width: 50rpx;
height: 50rpx;
margin: $margin - 15 $margin - 10 0 0;
}
}
.vip-name1{
font-size: $title-size + 6;
border-radius: 60rpx;
padding: 0 $padding;
box-sizing: border-box;
background-image: linear-gradient(to bottom ,#cacaca,#cacaca);
display: flex;
color: #fff;
.vip-name-icon {
width: 50rpx;
height: 50rpx;
margin: $margin - 15 $margin - 10 0 0;
}
}
.vip-price {
font-size: $title-size + 10;
font-weight: 600;
position: absolute;
right: 0;
top: 0;
}
}
.vip-time {
font-size: $title-size-lg;
text-align: center;
} }
} }
.content{ .color-item-img {
min-height: 100vh; background-color: #e93340;
background: #fefaef; background-image: linear-gradient(to bottom ,#e93340,#e8252f);
} color: #FFFFFF;
box-shadow: 0 0 20rpx 4rpx rgba($color: #e93340, $alpha: 1.0);
}
// 轮播点
.vip-spot {
margin-bottom: $margin;
text-align: center;
.vip-spot-label {
display: inline-block;
background-color: #e8ecf1;
width: 80rpx;
height: 8rpx;
margin: 0 10rpx;
&.vip-spot-color {
background-color: #fb560a;
}
}
}
// 选择年限
.vip-years {
display: flex;
line-height: 60rpx;
padding: $padding + 10 $padding + 20;
box-sizing: border-box;
border-top: $padding - 10 solid #f8fbfe;
border-bottom: $padding - 10 solid #f8fbfe;
.vip-years-name {
flex: 1;
display: flex;
color: #c2c2c2;
.vip-years-icon {
width: 60rpx;
height: 60rpx;
margin-right: 20rpx;
}
}
.vip-years-tool {
display: flex;
.vip-years-btn {
background-color: #ff9f43;
color: #ffffff;
border-radius: 10rpx;
width: 48rpx;
height: 48rpx;
line-height: 40rpx;
text-align: center;
border: 2rpx solid #f8fbfe;
font-size: $title-size + 4;
font-weight: 600;
}
.vip-years-input {
line-height: 48rpx;
padding: 0 $padding;
color: #000000;
}
}
}
// 会员特权
.privilege {
text-align: center;
.privilege-img {
height: 40rpx;
margin-top: 40rpx;
}
.privilege-list {
padding: 0 $padding;
box-sizing: border-box;
text-align: left;
margin-top: $margin * 0.5;
.privilege-label {
border-bottom: 2rpx #e6eaef dashed;
font-size: 30rpx;
padding: $padding 0;
display: flex;
.privilege-label-tips {
width: 40rpx;
height: 40rpx;
margin-right: 20rpx;
margin-top: 10rpx;
}
.privilege-label-text {
width: calc(100% - 60rpx);
}
}
}
}
// 支付方式
.payWay {
.payWay-way {
padding: 0 $padding;
box-sizing: border-box;
margin-top: $margin;
.payWay-way-label {
display: flex;
border-bottom: 2rpx #e6eaef dashed;
padding: $padding 0;
.payWay-way-name {
font-size: $title-size;
line-height: 58rpx;
flex: 1;
display: flex;
.payWay-way-img {
width: 58rpx;
height: 58rpx;
margin-right: $margin - 10;
}
}
}
.radio[type="radio"].disabled {
background-color: #007aff;
border-color: #007aff;
color: #007aff;
&::before {
background-color: #007aff;
border-color: #007aff;
}
&::after {
background-color: #007aff;
border-color: #007aff;
}
}
}
}
// 用户协议
.agree {
margin: $margin 0;
text-align: center;
.agree-tips {
background-color: #d9d9d9;
display: inline-block;
padding: 14rpx $padding;
color: #FFFFFF;
border-radius: 60rpx;
}
}
.agree-btn {
display: flex;
font-size: $title-size-lg;
text-align: left;
color: #999999;
padding: $padding;
}
// .content{
// min-height: 100vh;
// background: #fefaef;
// }
// 开通须知 // 开通须知
.notice{ .notice{
font-size: $title-size-m; font-size: $title-size-m;
@@ -195,16 +529,29 @@
} }
// footer // footer
.footer{ .footer{
padding: $padding $padding*2; padding: $padding;
box-sizing: border-box;
.footer-btn{ .footer-btn{
background-color: #201212; padding: 0 $padding + 10;
box-sizing: border-box;
background-color: #e93340;
height: 90rpx; height: 90rpx;
line-height: 90rpx; line-height: 90rpx;
padding: 0; border-radius: 60rpx;
border-radius: 0; color: #ececec;
color: #f7d79c;
font-size: $title-size; font-size: $title-size;
font-weight: bold; font-weight: bold;
text-align: left;
display: flex;
.footer-btn-num {
flex: 1;
}
.footer-btn-pay {
color: rgba($color: #ff0, $alpha: .8);
}
&[disabled] {
background-color: #b1b1b1;
}
} }
} }
// 会员权限 // 会员权限

335
pages/wallet/addBank.vue Normal file
View File

@@ -0,0 +1,335 @@
<template>
<view class="WithdrawingCoin">
<view class="withdrawing-content">
<view class="item-name">{{bank_account_id===''?'添加':'编辑'}}提现银行</view>
<view class="item">
<view class="title">收款人姓名</view>
<input class="input_num" v-model="name" maxlength="13" placeholder="请输入收款人姓名"
placeholder-style="color:#999;font-weight:normal; font-size:30rpx;" />
</view>
<view class="item">
<view class="title">收款人手机号</view>
<input class="input_num" v-model="mobile" maxlength="11" placeholder="请输入手机号"
placeholder-style="color:#999;font-weight:normal; font-size:30rpx;" />
</view>
<view class="item">
<view class="title">开户行</view>
<u-select v-model="bankShow" value-name='id' :default-value='[0]' label-name='name'
@confirm='selectBank' :list="banks" />
<view class="input_num" @click="bankShow = true">
{{selectBankObj.label?selectBankObj.label:'请选择开户行'}}
</view>
</view>
<view class="item">
<view class="title">收款人账号</view>
<input class="input_num" v-model="no" maxlength="20" type="number" placeholder="请输入收款人账号"
placeholder-style="color:#999;font-weight:normal; font-size:30rpx;" />
</view>
<view class="item">
<view class="title">支行名称</view>
<input class="input_num" v-model="branch_name" maxlength="20" placeholder="省-市-区-支行名称"
placeholder-style="color:#999;font-weight:normal; font-size:30rpx;" />
</view>
</view>
<view class="btn" @click="sureAdd">确认{{bank_account_id===''?'添加':'编辑'}}银行</view>
<view class="history" @click="$Router.push({name:'withdrawList'})">提现记录
<u-icon name="question-circle-fill" />
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
accountsCreate,
withdrawsAccounts,
accountsCreateEdit,
withdrawsAccountsEdits
} from '@/apis/interfaces/withdraws'
export default {
data() {
return {
no: '', // 银行卡号
name: '', // 用户姓名
branch_name: '', // 支行名称
mobile: '', // 手机号
bank_id: '', // 银行卡id
banks: [], // 开户行列表
bankShow: false, // 显示开户行列表
selectBankObj: {}, // 选择银行
bank_account_id:''
};
},
onLoad(e) {
// 有id 是编辑
if (e.id) {
this.bank_account_id = e.id
this.getAccountsCreateEdit()
} else {
this.getAccountsCreate()
}
},
methods: {
// 获取添加银行前置条件
getAccountsCreate() {
accountsCreate().then(res => {
console.log(res)
this.banks = res.banks
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'primary',
duration: 3000
})
})
},
// 编辑前置
getAccountsCreateEdit() {
accountsCreateEdit(this.bank_account_id).then(res => {
console.log(res)
this.banks = res.banks
this.no = res.info.no
this.name = res.info.name
this.mobile = res.info.mobile
this.branch_name = res.info.branch_name
this.selectBankObj.label = res.info.bank.name
this.bank_id = res.info.bank.id
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'primary',
duration: 3000
})
})
},
// 选择银行
selectBank(e) {
console.log(e[0])
this.selectBankObj = e[0]
this.bank_id = e[0].value
},
sureAdd() {
let data = {
no: this.no, // 银行卡号
name: this.name, // 用户姓名
branch_name: this.branch_name, // 支行名称
mobile: this.mobile, // 手机号
bank_id: this.bank_id, // 银行卡id
}
if (data.name === '') {
this.$refs.uToast.show({
title: '请核对收款人姓名',
type: 'primary',
duration: 3000
})
return;
}
if (data.mobile.length !== 11) {
this.$refs.uToast.show({
title: '请核对收款人手机号',
type: 'primary',
duration: 3000
})
return;
}
if (data.bank_id === '') {
this.$refs.uToast.show({
title: '请勾选开户行',
type: 'primary',
duration: 3000
})
return;
}
if (data.no === '') {
this.$refs.uToast.show({
title: '请核对收款账号',
type: 'primary',
duration: 3000
})
return;
}
if (data.branch_name === '') {
this.$refs.uToast.show({
title: '请核对省-市-区-支行名称',
type: 'primary',
duration: 3000
})
return;
}
if (this.bank_account_id) {
data.bank_account_id = this.bank_account_id
console.log(data)
this.withdrawsAccountsEdits(data)
} else {
this.withdrawsAccounts(data)
}
},
// 添加银行
withdrawsAccounts(data) {
withdrawsAccounts(data).then(res => {
this.$refs.uToast.show({
title: res,
type: 'primary',
duration: 3000
})
setTimeout(res => {
uni.setStorageSync('refresh',true)
uni.navigateBack({})
}, 3000)
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'primary',
duration: 3000
})
})
},
// 编辑银行卡银行
withdrawsAccountsEdits(data) {
withdrawsAccountsEdits(data).then(res => {
this.$refs.uToast.show({
title: res,
type: 'primary',
duration: 3000
})
uni.setStorageSync('refresh',true)
setTimeout(res => {
uni.navigateBack({})
}, 3000)
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'primary',
duration: 3000
})
})
}
}
}
</script>
<style lang="scss">
page {
width: 100%;
min-height: 100vh;
background-color: #fff;
}
.history {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
color: #cacaca;
.u-icon {
margin-left: 10rpx;
}
}
.withdrawing-content {
min-height: 300rpx;
background-color: #fff;
box-shadow: 0 0 30rpx 1rpx rgba($color: #000000, $alpha: 0.2);
margin: $margin;
border-radius: 20rpx;
padding: $padding;
font-size: $title-size-m;
.item-name {
text-align: center;
padding: $padding * .6;
color: #303030;
font-weight: bold;
margin-bottom: $margin;
font-size: $title-size *1.2;
position: relative;
&::after {
content: '';
position: absolute;
background-color: rgba($color: $text-price, $alpha: .4);
width: 200rpx;
height: 10rpx;
left: 50%;
margin-left: -100rpx;
bottom: 16rpx;
z-index: 1;
box-shadow: 0 10rpx 20rpx 0rpx rgba($color: #e93340, $alpha: 0.6);
}
}
.item {
border-bottom: solid 1rpx #f8f8f8;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
padding: $padding 0;
span:nth-child(1) {
color: #666;
margin-right: 20rpx;
}
.title {
width: 200rpx;
font-size: 28rpx;
&::before {
content: '*';
color: red;
padding-right: 4rpx;
}
}
.input_num {
font-size: 30rpx;
color: #3a3a3a;
// font-weight: bolder;
flex: 1;
margin-left: 20rpx;
}
}
.item-total {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: $padding*1 0 0 0;
color: #3a3a3a;
.total {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
box-sizing: border-box;
.money {
padding-top: $padding *0.5;
}
}
.lists {
color: $text-price;
}
}
}
.btn {
background-image: linear-gradient(to right, #e93340, #e93340);
color: #fff;
border-radius: 10rpx;
text-align: center;
padding: $padding * .9;
margin: $margin*3 $margin * 2 $margin $margin*2;
font-size: $title-size;
font-weight: bold;
letter-spacing: 2rpx;
}
</style>

269
pages/wallet/bankList.vue Normal file
View File

@@ -0,0 +1,269 @@
<template>
<view class="selectCard">
<block v-if="lists.length>0" >
<view class="demo11">
<icon type="warn" size="16"/>
长按删除添加银行卡
</view>
<view class="bankInfo" v-for="(item,index) in lists" :key='index' @longpress='delBank(item.bank_account_id,index)'>
<image class="bankLogin" @click="selectBank(item)" :src="item.bank.cover" mode="widthFix" />
<view class="right" @click="selectBank(item)">
<view class="left">
<view class="title">{{item.bank.name}}
<view class="tags">快捷支付</view>
</view>
<view class="des">储值卡</view>
<view class="no">{{item.no}}</view>
</view>
</view>
<u-icon name="edit-pen-fill" @click='editBank(item.bank_account_id)' color="rgba(255,255,255,0.6)"
size='50' />
</view>
</block>
<!-- 底部新增按钮 -->
<view class="addBtn" @click="$Router.push({ name: 'addBank'})">
<u-icon name="plus" label-pos='bottom' color='#fff' label-color='#fff' label='新增' />
</view>
<!-- 无列表 -->
<no-list v-if="lists.length === 0" name='no-shop' txt="没有任何提现银行 ~ " />
<!-- <u-toast ref="uToast" /> -->
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
withdrawsAccountsList,
withdrawsAccountsDelete
} from '@/apis/interfaces/withdraws'
export default {
data() {
return {
lists: [],
page: 1,
has_more: true
}
},
onLoad() {
this.withdrawsAccountsList()
},
onShow() {
if (uni.getStorageSync('refresh')) {
this.lists = []
this.page = 1
this.has_more = true
this.withdrawsAccountsList()
}
},
onReachBottom() {
if (this.has_more) {
this.page = this.page + 1
this.withdrawsAccountsList()
} else {
this.$refs.uToast.show({
title: '哎呦,没有更多了~',
type: 'primary',
duration: 3000
})
}
},
methods: {
// 添加银行
withdrawsAccountsList() {
let data = {
page: this.page
}
withdrawsAccountsList(data).then(res => {
console.log(res)
this.lists = this.lists.concat(res.data)
this.has_more = res.page.has_more
uni.setStorageSync('refresh', false)
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'primary',
duration: 3000
})
})
},
// 跳转到编辑银行卡的页面
editBank(id) {
this.$Router.push({
name: 'addBank',
params: {
id: id
}
})
},
// 删除银行
delBank(id, index) {
let that = this
uni.showModal({
title: '温馨提示',
content: '是否确认删除该银行',
cancelColor: '#cacaca',
cancelText: '我再想想',
confirmColor: '#e93340',
confirmText: '确认删除',
success(res) {
if (res.confirm) {
withdrawsAccountsDelete(id).then(res => {
console.log(res)
that.lists.splice(index, 1)
if (that.lists.length === 0) {
uni.navigateBack({})
uni.setStorageSync('refresh', true)
}
}).catch(err => {
that.$refs.uToast.show({
title: err.message,
type: 'primary',
duration: 3000
})
})
}
}
})
},
// 选择银行返回上一页携带参数
selectBank(item) {
let bankInfo = {
name: item.bank.name + '-' + item.no.substring(item.no.length - 4),
bank_account_id: item.bank_account_id
}
let pages = getCurrentPages()
let prevPage = pages[pages.length - 2]
// prevPage._data.bankInfo = bankInfo
prevPage.$vm.bankInfo = bankInfo;
uni.navigateBack() //返回上一页面
}
}
}
</script>
<style lang="scss" scoped>
.addBtn{
position: fixed;
bottom: 0;
margin: 40rpx;
text-align: center;
width: 130rpx;
height: 130rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
border-radius: 50%;
z-index: 100;
right: 0;
box-shadow: 0 0 20rpx 20rpx rgba($color: #fff, $alpha: .5);
background-image: linear-gradient(to right, #e93340, #e93340);
}
.selectCard {
width: 100%;
min-height: 100vh;
padding-top: 30rpx;
background-color: #fff;
padding-bottom: 80rpx;
.demo11{
color: #e93340;
font-size: 26rpx;
text-align: center;
display: flex;
justify-content: center;
// background-color: #e93340;
icon{
margin-right: 10rpx;
}
}
.bankInfo {
width: calc(100% - 60rpx);
background-image: linear-gradient(to right, #e93340, #e93340);
box-shadow: 0 10rpx 20rpx 0rpx rgba($color: #e93340, $alpha: 0.6);
margin: 20rpx 30rpx 0 30rpx;
border-radius: 20rpx;
box-sizing: border-box;
position: relative;
padding: 40rpx 30rpx;
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: space-between;
z-index: 1;
.bankLogin {
width: 70rpx;
height: 70rpx;
opacity: .9;
}
.right {
flex: 1;
margin-left: 20rpx;
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: space-between;
box-sizing: border-box;
color: rgba($color: #fff, $alpha: .9);
position: relative;
z-index: 1;
.u-icon {
position: absolute;
background-color: pink;
z-index: 100;
right: 0;
}
.left {
flex: 1;
.title {
font-size: 38rpx;
font-weight: bold;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
.tags {
color: $text-price;
font-size: 24rpx;
margin-left: 20rpx;
padding: 4rpx 14rpx;
position: relative;
display: inline-block;
color: #e93340;
&::before {
background: rgba($color: #fff, $alpha: .8);
z-index: -1;
position: absolute;
content: '';
top: 0;
left: 0;
right: 0;
bottom: 0;
transform: skewX(-10deg);
}
}
}
.des {
font-size: 28rpx;
margin-top: 14rpx;
}
.no {
font-size: 36rpx;
font-weight: bold;
margin-top: 20rpx;
}
}
}
}
}
</style>

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