Merge branch 'wwz_d' of https://e.coding.net/g-cphe0354/xiaochengxusaomadiancan/cashier_weapp into wwz_x
This commit is contained in:
@@ -16,8 +16,12 @@ const baseUrl = debug ? proxyApi : "https://wxcashiertest.sxczgkj.cn/cashierServ
|
||||
const baseUrlwws = 'ws://cashier.sxczgkj.cn/cashierService'
|
||||
// #endif
|
||||
// #ifdef APP || MP-WEIXIN
|
||||
const baseUrl = 'https://cashier.sxczgkj.cn/cashierService'// 线上
|
||||
const baseUrlwws = 'wss://cashier.sxczgkj.cn/cashierService' // 线上
|
||||
// const baseUrl = 'https://cashier.sxczgkj.cn/cashierService'// 线上
|
||||
// const baseUrlwws = 'wss://cashier.sxczgkj.cn/cashierService' // 线上
|
||||
// const baseUrl = 'http://192.168.2.42:9888/cashierService'// 测试-w
|
||||
// const baseUrlwws ='ws://192.168.2.42:9888/cashierService' // 测试-w
|
||||
const baseUrl = 'https://wxcashiertest.sxczgkj.cn/cashierService'// 测试
|
||||
const baseUrlwws ='wss://wxcashiertest.sxczgkj.cn/cashierService' // 测试
|
||||
|
||||
// #endif
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
</view>
|
||||
<view class="towcontentitemthere flex-start">
|
||||
余额:<text class="towcontentitemtheretext">{{userInfo.amount || '0.00'}}</text>
|
||||
|
||||
</view>
|
||||
<view class="towcontentitemtow flex-between">
|
||||
<text class="towcontentitemtowetext">VIP{{userInfo.code || '无'}}</text>
|
||||
@@ -141,7 +140,9 @@
|
||||
font-weight: Medium;
|
||||
font-size: 24rpx;
|
||||
color: #333333;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.towcontentitemtheretext {
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
|
||||
@@ -182,6 +182,24 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/** 扫码支付逻辑
|
||||
* 进入该页面调用一次获取用户信息的接口
|
||||
* 扫码后,未登录去登录
|
||||
* 登录后,链接wx接口拿到列表
|
||||
* 下单后,通过切换微信\余额两种支付方式
|
||||
* : 余额支付:点击立即付款,获取userinfo中的字段,是否设置支付密码。未设置去设置
|
||||
* 如果设置发送数据,通过wx接口获取creatdorder返回,调用支付密码。。。
|
||||
* 输入完支付密码后,接口返回
|
||||
* 微信支付
|
||||
*
|
||||
*
|
||||
*
|
||||
* 接口/pay/accountPay
|
||||
* 返回 code 都为0
|
||||
* data -> 1 支付成功
|
||||
* -> 2 余额不足
|
||||
* ->3 未设置支付密码,(前后都做。根据userinfo的ispws做判断的。
|
||||
**/
|
||||
import webSocketUtils from '@/common/js/websocket.js'
|
||||
import payPassword from '@/components/payPassword.vue'
|
||||
export default {
|
||||
@@ -219,11 +237,22 @@
|
||||
this.listinfo = JSON.parse(e.tablelist)
|
||||
// 获取余额
|
||||
this.getAount()
|
||||
// 获取用户信息,判断是否设置支付密码
|
||||
this.getuserinfo()
|
||||
},
|
||||
onShow() {
|
||||
this.getAount()
|
||||
this.getuserinfo()
|
||||
},
|
||||
methods: {
|
||||
async getuserinfo() {
|
||||
let res = await this.api.loginwxuserInfo({
|
||||
userId: uni.cache.get('userInfo').id
|
||||
})
|
||||
if (res.code == 0) {
|
||||
uni.cache.set('userInfo', res.data);
|
||||
}
|
||||
},
|
||||
groupChange(n) {
|
||||
this.radiovalue1 = n
|
||||
uni.cache.set('radiovalue1', n)
|
||||
@@ -351,12 +380,16 @@
|
||||
},
|
||||
|
||||
showpopupclickdd() {
|
||||
// radiovalue1为1是微信支付
|
||||
if (this.radiovalue1 == 1) {
|
||||
this.showpopupclickdds() //微信支付
|
||||
} else {
|
||||
// 判断是否有绑定支付密码
|
||||
// 先判断是否设置支付密码。0是没设置。没设置的情况下跳转到设置页面。有的话输入支付密码
|
||||
if (uni.cache.get('userInfo').isPwd == 0) {
|
||||
let {
|
||||
isPwd
|
||||
} = uni.cache.get('userInfo')
|
||||
// console.log(isPwd,'是否设置了支付密码')
|
||||
if (isPwd == 0) {
|
||||
uni.pro.navigateTo('/pages/user/repairpassword', {
|
||||
shopId_id: uni.cache.get('shopUser')
|
||||
})
|
||||
@@ -411,32 +444,55 @@
|
||||
let res = await this.api.accountPay({
|
||||
orderId: this.listinfo.id,
|
||||
memberId: this.amountVIP.id,
|
||||
pwd: pwd
|
||||
pwd
|
||||
})
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '支付成功',
|
||||
success: () => {
|
||||
setTimeout(res => {
|
||||
uni.cache.set('shopUser', '') //删除shopUser
|
||||
uni.redirectTo({
|
||||
url: '/pages/order/order_detail?orderId=' + this
|
||||
.listinfo.id,
|
||||
});
|
||||
}, 500)
|
||||
}
|
||||
})
|
||||
} else if (res.data == 1) {
|
||||
setTimeout(() => {
|
||||
// 去充值
|
||||
this.goRecharge()
|
||||
}, 2000)
|
||||
// data ->1 支付成功
|
||||
// ->2 余额不足
|
||||
// ->3 未设置支付密码,
|
||||
// ->4 不是会员,
|
||||
if (res.data == 1) {
|
||||
this.showToastUppop('支付成功')
|
||||
setTimeout(res => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/order/order_detail?orderId=' + this
|
||||
.listinfo.id
|
||||
});
|
||||
}, 700)
|
||||
} else if (res.data == 2) {
|
||||
this.showToastUppop('余额不足')
|
||||
setTimeout(() => {
|
||||
// 去充值
|
||||
this.goRecharge()
|
||||
}, 1500)
|
||||
} else if (res.data == 3) {
|
||||
this.showToastUppop('未设置支付密码')
|
||||
setTimeout(() => {
|
||||
uni.pro.navigateTo('/pages/user/repairpassword', {
|
||||
shopId_id: uni.cache.get('shopUser')
|
||||
})
|
||||
}, 1500)
|
||||
|
||||
} else if (res.data == 4) {
|
||||
this.showToastUppop('非会员请充值')
|
||||
setTimeout(() => {
|
||||
// 去充值
|
||||
this.goRecharge()
|
||||
}, 1500)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
showToastUppop(title) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title,
|
||||
success: () => {
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
clickselect(b) {
|
||||
this.pay_type = b
|
||||
},
|
||||
|
||||
@@ -272,7 +272,7 @@
|
||||
}
|
||||
this.countScrollTitle(e.scrollTop);
|
||||
},
|
||||
async onLoad(e) {
|
||||
onLoad(e) {
|
||||
if (e.q) {
|
||||
let tableCode = this.getQueryString(decodeURIComponent(e.q), 'code')
|
||||
uni.cache.set('tableCode', tableCode)
|
||||
@@ -391,9 +391,10 @@
|
||||
msg.data.forEach((item, index, arr) => { //初始化skuidname的数据 选择第一个
|
||||
if (item.skuId == this.skuidsearch) {
|
||||
this.$set(this, 'amountcartNumber', item.number)
|
||||
} else {
|
||||
this.$set(this, 'amountcartNumber', 0)
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// this.$set(this, 'amountcartNumber', 0)
|
||||
// }
|
||||
})
|
||||
} else {
|
||||
this.$set(this, 'amountcartNumber', 0)
|
||||
@@ -409,7 +410,8 @@
|
||||
handlemessage() {
|
||||
// this.socketTicket ? this.socketTicket.Close() : null //调用前先判断是否有socket正在进行 先关闭后链接
|
||||
this.socketTicket = new webSocketUtils(
|
||||
`${uni.conf.baseUrlwws}/websocket/table/${uni.cache.get('tableCode')}/${uni.cache.get('shopUser')}/${uni.cache.get('userInfo').id}`,
|
||||
`${uni.conf.baseUrlwws}/websocket/table?tableId=${uni.cache.get('tableCode')}&shopId=${uni.cache.get('shopUser')}&userId=${uni.cache.get('userInfo').id}`,
|
||||
// `${uni.conf.baseUrlwws}/websocket/table/${uni.cache.get('tableCode')}/${uni.cache.get('shopUser')}/${uni.cache.get('userInfo').id}`,
|
||||
5000)
|
||||
},
|
||||
// 数据处理
|
||||
@@ -526,6 +528,7 @@
|
||||
return res
|
||||
})
|
||||
this.specifications.tagSnap.forEach((val, index, arr) => { //初始化skuidname的数据 选择第一个
|
||||
console.log(val.children[0],'skuidnam是否为空1')
|
||||
this.skuidname.push(val.children[0])
|
||||
})
|
||||
try {
|
||||
@@ -538,6 +541,7 @@
|
||||
}
|
||||
},
|
||||
async morloe(e, index, index1, item) {
|
||||
console.log(index,'skuidnam是否为空2')
|
||||
this.specifications.tagSnap[index]['start'] = index1
|
||||
this.skuidname.splice(index, 1, e) //替换skuidname的数据
|
||||
this.hodgepodge(item, 2)
|
||||
|
||||
@@ -98,7 +98,6 @@
|
||||
this.$emit('KeyInfo', KeyInfo);
|
||||
// 不是删除键
|
||||
if (KeyInfo.keyCode != 8) {
|
||||
console.log(this.keyIndex, '支付键盘');
|
||||
if (this.keyIndex = 4) {
|
||||
this.keyIndex = -1;
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user