支付联调

This commit is contained in:
duan
2024-05-24 09:28:14 +08:00
parent dd5adf82b8
commit 7cea9eb628
21 changed files with 254 additions and 170 deletions

View File

@@ -1,111 +1,111 @@
{ {
"name": "cashier_weapp", "name" : "cashier_weapp",
"appid": "__UNI__8092421", "appid" : "__UNI__8092421",
"description": "", "description" : "",
"versionName": "1.0.0", "versionName" : "1.0.0",
"versionCode": "100", "versionCode" : "100",
"transformPx": false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus": { "app-plus" : {
"usingComponents": true, "usingComponents" : true,
"nvueStyleCompiler": "uni-app", "nvueStyleCompiler" : "uni-app",
"compilerVersion": 3, "compilerVersion" : 3,
"splashscreen": { "splashscreen" : {
"alwaysShowBeforeRender": true, "alwaysShowBeforeRender" : true,
"waiting": true, "waiting" : true,
"autoclose": true, "autoclose" : true,
"delay": 0 "delay" : 0
}, },
/* */ /* */
"modules": { "modules" : {
"Barcode": {} "Barcode" : {}
}, },
/* */ /* */
"distribute": { "distribute" : {
/* android */ /* android */
"android": { "android" : {
"permissions": [ "permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>", "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>", "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>", "<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>", "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>", "<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
] ]
}, },
/* ios */ /* ios */
"ios": { "ios" : {
"dSYMs": false "dSYMs" : false
}, },
/* SDK */ /* SDK */
"sdkConfigs": { "sdkConfigs" : {
"ad": {} "ad" : {}
} }
} }
}, },
/* */ /* */
"quickapp": {}, "quickapp" : {},
/* */ /* */
"mp-weixin": { "mp-weixin" : {
"appid": "wxd88fffa983758a30", "appid" : "wxd88fffa983758a30",
"setting": { "setting" : {
"urlCheck": false, "urlCheck" : false,
"minified": true, "minified" : true,
"es6": true, "es6" : true,
"postcss": true "postcss" : true
}, },
"usingComponents": true, "usingComponents" : true,
"libVersion": "latest", "libVersion" : "latest",
"permission": { "permission" : {
"scope.userLocation": { "scope.userLocation" : {
"desc": "你的位置信息将用于小程序位置接口的效果展示" "desc" : "你的位置信息将用于小程序位置接口的效果展示"
} }
}, },
"requiredPrivateInfos": ["getLocation", "onLocationChange", "chooseLocation", "chooseAddress"] "requiredPrivateInfos" : [ "getLocation", "onLocationChange", "chooseLocation", "chooseAddress" ]
}, },
"h5": { "h5" : {
"devServer": { "devServer" : {
"https": false, "https" : false,
"disableHostCheck": false, "disableHostCheck" : false,
"proxy": { "proxy" : {
"/api": { "/api" : {
"target": "https://wxcashiertest.sxczgkj.cn/cashierService", "target" : "https://wxcashiertest.sxczgkj.cn/cashierService",
// "target" : "https://ky.sxczgkj.cn", // "target" : "https://ky.sxczgkj.cn",
"ws": false, "ws" : false,
"changeOrigin": true, //是否跨域 "changeOrigin" : true, //是否跨域
"secure": false, // 设置支持https协议的代理 "secure" : false, // 设置支持https协议的代理
"pathRewrite": { "pathRewrite" : {
"^/api": "" //需要rewrite重写的, "^/api" : "" //需要rewrite重写的,
} }
} }
} }
}, },
"template": "template.h5.html", "template" : "template.h5.html",
"router": { "router" : {
"mode": "history", "mode" : "history",
"base": "/h5/" "base" : "/h5/"
} }
}, },
"mp-alipay": { "mp-alipay" : {
"usingComponents": true "usingComponents" : true
}, },
"mp-baidu": { "mp-baidu" : {
"usingComponents": true "usingComponents" : true
}, },
"mp-toutiao": { "mp-toutiao" : {
"usingComponents": true "usingComponents" : true
}, },
"uniStatistics": { "uniStatistics" : {
"enable": false "enable" : false
}, },
"vueVersion": "2" "vueVersion" : "2"
} }

View File

@@ -137,7 +137,7 @@
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<u-loadmore height='40' :status="form.status" iconSize='24' fontSize='24' /> <u-loadmore height='40' :status="form.status" iconSize='24' fontSize='24' />
<!-- </scroll-view> --> <!-- </scroll-view> -->

View File

@@ -183,7 +183,7 @@
<script> <script>
import webSocketUtils from '@/common/js/websocket.js' import webSocketUtils from '@/common/js/websocket.js'
import payPassword from './components/payPassword.vue' import payPassword from '@/components/payPassword.vue'
export default { export default {
components: { components: {
payPassword payPassword
@@ -207,14 +207,19 @@
orderInfo: '', orderInfo: '',
// 可用优惠券数据 // 可用优惠券数据
couponAmount: 0, couponAmount: 0,
// 输入支付密码 // 输入支付密码 123
passwordArr: [], passwordArr: [],
ispws: false ispws: false,
numValue: 0
}; };
}, },
onUnload() { onUnload() {
uni.$off('getMessage') uni.$off('getMessage')
// uni.showToast({
// title: this.radiovalue1 + '-110',
// duration:5000
// })
}, },
onLoad(e) { onLoad(e) {
// 获取用户信息 // 获取用户信息
@@ -232,6 +237,7 @@
// 获取可用优惠券数量 // 获取可用优惠券数量
this.getcoupon() this.getcoupon()
this.vipId = uni.cache.get('userInfo').id this.vipId = uni.cache.get('userInfo').id
}, },
onShow() { onShow() {
@@ -250,7 +256,7 @@
}) })
}, },
methods: { methods: {
async loginwxuserInfo() { async loginwxuserInfo() {
let res = await this.api.loginwxuserInfo({ let res = await this.api.loginwxuserInfo({
userId: uni.cache.get('userInfo').id userId: uni.cache.get('userInfo').id
}) })
@@ -279,6 +285,7 @@ async loginwxuserInfo() {
} }
}, },
getMessage(msg) { getMessage(msg) {
if (msg.status != 'success') { if (msg.status != 'success') {
uni.showToast({ uni.showToast({
title: msg.msg, title: msg.msg,
@@ -339,23 +346,24 @@ async loginwxuserInfo() {
}, },
// 去结算 // 去结算
showpopupclick() { showpopupclick() {
if (this.numValue == 0) {
let data = { //定义socket数据传参 let data = { //定义socket数据传参
"skuId": '', "skuId": '',
"num": '', //数量 "num": '', //数量
"type": "createOrder", //“addcart:添加购物车create0rder:生成订单clearCart:庆康购物车”, "type": "createOrder", //“addcart:添加购物车create0rder:生成订单clearCart:庆康购物车”,
"couponsId": this.emitorderfoodform.id ? this.emitorderfoodform.id : '', //优惠券ID, "couponsId": this.emitorderfoodform.id ? this.emitorderfoodform.id : '', //优惠券ID,
"isYhq": this.emitorderfoodform.id ? 1 : 0, // 是否使用优惠券( 1 使用, 0 不使用), "isYhq": this.emitorderfoodform.id ? 1 : 0, // 是否使用优惠券( 1 使用, 0 不使用),
"isBuyYhq": this.emitorderfoodform.clickiconone == 1 ? 1 : 0, // 是否购买优惠券( 1 购买, 0 不够买) "isBuyYhq": this.emitorderfoodform.clickiconone == 1 ? 1 : 0, // 是否购买优惠券( 1 购买, 0 不够买)
"productId": '', //商品id "productId": '', //商品id
"shopId": uni.cache.get('shopUser'), "shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id, "userId": uni.cache.get('userInfo').id,
// tableId:uni.cache.get('tableCode') // tableId:uni.cache.get('tableCode')
}
this.numValue = 1
uni.$u.debounce(this.socketSendMsg(data), 500)
} else {
this.showpopupclickdd()
} }
console.log(data)
uni.$u.debounce(this.socketSendMsg(data), 500)
}, },
// 去充值 // 去充值
goRecharge() { goRecharge() {
@@ -363,8 +371,10 @@ async loginwxuserInfo() {
shopId_id: uni.cache.get('shopUser') shopId_id: uni.cache.get('shopUser')
}) })
}, },
async showpopupclickdd(i) { async showpopupclickdd(i) {
console.log(this.radiovalue1, '调试121')
if (this.radiovalue1 == 1) { if (this.radiovalue1 == 1) {
let res = await this.api.payorderPay({ let res = await this.api.payorderPay({
orderId: this.listinfoid orderId: this.listinfoid
@@ -403,16 +413,14 @@ async loginwxuserInfo() {
// }); // });
}, },
fail: (err) => { fail: (err) => {
setTimeout(() => {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '支付失败' title: '支付失败'
}) })
uni.hideLoading() uni.hideLoading()
}, 2000) // uni.redirectTo({
uni.redirectTo({ // url: '/pages/order/order_detail?orderId=' + this.listinfoid
url: '/pages/order/order_detail?orderId=' + this.listinfoid // });
});
}, },
complete: (data) => { complete: (data) => {
console.log(data, '成功与否') console.log(data, '成功与否')
@@ -444,29 +452,30 @@ async loginwxuserInfo() {
memberId: this.amountVIP.id, memberId: this.amountVIP.id,
pwd: pwd pwd: pwd
}) })
console.log(res, '是否支付成功') if (res.code == 0) {
if(res.code ==0){
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '支付成功', title: '支付成功',
success:()=>{ success: () => {
setTimeout(()=>{ setTimeout(res => {
uni.redirectTo({ uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + this.listinfoid url: '/pages/order/successful?orderId=' + this
}); .listinfoid + '&orderInfo=' + JSON.stringify(
},2000) this.orderInfo)
});
}, 1000)
} }
}) })
} else if (res.data == 1) {
setTimeout(() => {
// 去充值
this.goRecharge()
}, 2000)
} }
if(res.data==1){
setTimeout(() => {
// 去充值
this.goRecharge()
}, 2000)
}
}, },
clickselect(b) { clickselect(b) {

View File

@@ -49,7 +49,7 @@
</view> </view>
<!-- 支付方式 --> <!-- 支付方式 -->
<view class="payType" v-if="false"> <view class="payType">
<view class=""> <view class="">
支付方式 支付方式
</view> </view>
@@ -77,12 +77,14 @@
</view> </view>
</u-radio> </u-radio>
</u-radio-group> </u-radio-group>
<view style="font-weight: 400;font-size: 24rpx;color: #333333;"> <view style="font-weight: 400;font-size: 24rpx;color: #333333;margin-left: 60rpx;">
会员卡余额${{ amount}} <text style="font-weight: 500;font-size: 28rpx;color: #FF4C11;" 会员卡余额{{ amountVIP.amount}} <text
style="font-weight: 500;font-size: 28rpx;margin-left: 16rpx;color: #FF4C11;"
@click="goRecharge">去充值</text> @click="goRecharge">去充值</text>
</view> </view>
</view> </view>
</view> </view>
<view class="placeBottom"> <view class="placeBottom">
<view class=""> <view class="">
<text style="font-size: 24rpx;font-weight: bold;"> 合计 </text><text <text style="font-size: 24rpx;font-weight: bold;"> 合计 </text><text
@@ -94,14 +96,19 @@
</view> </view>
<button class="btnStyle" @click="sumbitFrom">提交订单</button> <button class="btnStyle" @click="sumbitFrom">提交订单</button>
</view> </view>
<payPassword ref="payPwd" @accountPayevent="accountPayevent" v-show="ispws"></payPassword>
</view> </view>
</template> </template>
<script> <script>
import payPassword from '@/components/payPassword.vue'
export default { export default {
components: {
payPassword
},
onLoad(e) { onLoad(e) {
this.getInfo(e.id) this.getInfo(e.id)
this.orderIds= e.id this.orderIds = e.id
this.amount = uni.cache.get('userInfo').amount this.amount = uni.cache.get('userInfo').amount
this.vipId = uni.cache.get('userInfo').id this.vipId = uni.cache.get('userInfo').id
}, },
@@ -111,13 +118,56 @@
Quantity: 1, Quantity: 1,
radiovalue1: '1', radiovalue1: '1',
amount: 0, amount: 0,
orderIds:null, orderIds: null,
vipId:null vipId: null,
ispws: false,
amountVIP: null,
} }
}, },
methods: { methods: {
async getAount() {
let res = await this.api.shopUserInfo({
// shopId:店铺ID
"shopId":this.info.shopId,
"userId": uni.cache.get('userInfo').id
})
if (res.code == 0) {
this.amountVIP = res.data
}
},
// 余额支付
async accountPayevent(pwd) {
this.ispws = false
let res = await this.api.accountPay({
orderId: this.listinfoid,
memberId: this.amountVIP.id,
pwd: pwd
})
if (res.code == 0) {
uni.showToast({
icon: 'none',
title: '支付成功',
success: () => {
setTimeout(res => {
uni.redirectTo({
url: '/pages/order/successful?orderId=' + this
.listinfoid + '&orderInfo=' + JSON.stringify(
this.orderInfo)
});
}, 1000)
}
})
} else if (res.data == 1) {
setTimeout(() => {
// 去充值
this.goRecharge()
}, 2000)
}
},
goRecharge() { goRecharge() {
// uni.pro.to uni.pro.navigateTo('/pages/member/index', {
shopId_id: uni.cache.get('shopUser')
})
}, },
async sumbitFrom() { async sumbitFrom() {
// radiovalue1:为1的时候微信支付,为2是会员卡,需要输入支付密码 // radiovalue1:为1的时候微信支付,为2是会员卡,需要输入支付密码
@@ -134,13 +184,30 @@
// 调用支付接口 // 调用支付接口
this.payEvent(res.data.id) this.payEvent(res.data.id)
} }
}else{ } else {
let res = await this.api.accountPay({ // let res = await this.api.accountPay({
orderId: this.orderIds, // orderId: this.orderIds,
memberId:this.vipId // memberId:this.vipId
}) // })
if (res.code == 0) { // if (res.code == 0) {
// }
// 先判断是否设置支付密码。0是没设置。没设置的情况下跳转到设置页面。有的话输入支付密码
let isVip = uni.cache.get('userInfo').isPwd
if (isVip == 0) {
uni.pro.navigateTo('/pages/user/repairpassword', {
// shopId_id: uni.cache.get('shopUser')
})
} else {
this.ispws = true
this.$nextTick(() => {
this.$refs.payPwd.onPayUp();
})
} }
} }
}, },
async payEvent(id) { async payEvent(id) {
@@ -184,6 +251,8 @@
}) })
if (res.code == 0) { if (res.code == 0) {
this.info = res.data this.info = res.data
// 获取余额
this.getAount()
} }
} }
} }
@@ -296,6 +365,12 @@
>view:last-child { >view:last-child {
margin-top: 32rpx; margin-top: 32rpx;
} }
.dfs {
display: flex;
align-items: center;
}
} }
.placeBottom { .placeBottom {

View File

@@ -94,17 +94,17 @@
if(KeyInfo.keyCode === 8 && this.keyIndex > -1){ if(KeyInfo.keyCode === 8 && this.keyIndex > -1){
this.keyIndex--; this.keyIndex--;
} }
this.$emit('KeyInfo',KeyInfo);
// 不是删除键 // 不是删除键
if(KeyInfo.keyCode != 8){ if(KeyInfo.keyCode != 8){
if(this.passwrdType == 'pay' && this.keyIndex >= 5){ console.log(this.keyIndex,'支付键盘');
console.log('支付键盘'); if( this.keyIndex = 4){
this.keyIndex = -1; this.keyIndex = -1;
return; return;
} }
this.keyIndex++; this.keyIndex++;
} }
KeyInfo.index = this.keyIndex; KeyInfo.index = this.keyIndex;
this.$emit('KeyInfo',KeyInfo);
} }
} }
} }