支付联调

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

View File

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

View File

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

View File

@@ -49,7 +49,7 @@
</view>
<!-- 支付方式 -->
<view class="payType" v-if="false">
<view class="payType">
<view class="">
支付方式
</view>
@@ -77,12 +77,14 @@
</view>
</u-radio>
</u-radio-group>
<view style="font-weight: 400;font-size: 24rpx;color: #333333;">
会员卡余额${{ amount}} <text style="font-weight: 500;font-size: 28rpx;color: #FF4C11;"
<view style="font-weight: 400;font-size: 24rpx;color: #333333;margin-left: 60rpx;">
会员卡余额{{ amountVIP.amount}} <text
style="font-weight: 500;font-size: 28rpx;margin-left: 16rpx;color: #FF4C11;"
@click="goRecharge">去充值</text>
</view>
</view>
</view>
<view class="placeBottom">
<view class="">
<text style="font-size: 24rpx;font-weight: bold;"> 合计 </text><text
@@ -94,14 +96,19 @@
</view>
<button class="btnStyle" @click="sumbitFrom">提交订单</button>
</view>
<payPassword ref="payPwd" @accountPayevent="accountPayevent" v-show="ispws"></payPassword>
</view>
</template>
<script>
import payPassword from '@/components/payPassword.vue'
export default {
components: {
payPassword
},
onLoad(e) {
this.getInfo(e.id)
this.orderIds= e.id
this.orderIds = e.id
this.amount = uni.cache.get('userInfo').amount
this.vipId = uni.cache.get('userInfo').id
},
@@ -111,13 +118,56 @@
Quantity: 1,
radiovalue1: '1',
amount: 0,
orderIds:null,
vipId:null
orderIds: null,
vipId: null,
ispws: false,
amountVIP: null,
}
},
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() {
// uni.pro.to
uni.pro.navigateTo('/pages/member/index', {
shopId_id: uni.cache.get('shopUser')
})
},
async sumbitFrom() {
// radiovalue1:为1的时候微信支付,为2是会员卡,需要输入支付密码
@@ -134,13 +184,30 @@
// 调用支付接口
this.payEvent(res.data.id)
}
}else{
let res = await this.api.accountPay({
orderId: this.orderIds,
memberId:this.vipId
})
if (res.code == 0) {
} else {
// let res = await this.api.accountPay({
// orderId: this.orderIds,
// memberId:this.vipId
// })
// 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) {
@@ -184,6 +251,8 @@
})
if (res.code == 0) {
this.info = res.data
// 获取余额
this.getAount()
}
}
}
@@ -296,6 +365,12 @@
>view:last-child {
margin-top: 32rpx;
}
.dfs {
display: flex;
align-items: center;
}
}
.placeBottom {

View File

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