This commit is contained in:
weipengfei 2024-04-15 10:50:24 +08:00
parent f4cba29c3d
commit d23ad0114f
2 changed files with 101 additions and 12 deletions

View File

@ -53,6 +53,22 @@ export function productLstApi(merId, data) {
login: true login: true
}); });
} }
/**
* 检测收银状态
*/
export function micropayQueryApi(data) {
return request.get(`micropay_query`, data, {
login: true
});
}
/**
* 支付失败后进行提单
*/
export function orderLadingApi(data) {
return request.get(`order_lading`, data, {
login: true
});
}
/** /**
* 商品列表 -- 删除 * 商品列表 -- 删除

View File

@ -85,7 +85,8 @@
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}} <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
</view> --> </view> -->
</view> </view>
<view class='footer acea-row row-between-wrapper' :class="isFooter?'':'on'" v-if="cartList.valid.length > 0"> <view style="text-align: center;color: #999;font-size: 22rpx;" @click="copyText(PC_URL)">PC收银台网址: <text style="margin-left: 20rpx;">{{PC_URL}}</text></view>
<view class='footer acea-row row-between-wrapper' :class="isFooter?'':'on'">
<block v-if="footerswitch==true"> <block v-if="footerswitch==true">
<view class='money acea-row row-middle'> <view class='money acea-row row-middle'>
<text class='t-color' style="font-weight: bold;font-size: 32rpx;">{{selectCountPrice}}</text> <text class='t-color' style="font-weight: bold;font-size: 32rpx;">{{selectCountPrice}}</text>
@ -124,8 +125,7 @@
</block> </block>
<block v-else> <block v-else>
<view class="order-list"> <view class="order-list">
<view class="item" v-for="(item, index) in orderList" <view class="item" v-for="(item, index) in orderList" :key="index" @click="navTo(item)">
:key="index" @click="navTo(item)">
<view class="top"> <view class="top">
<view class="sn" :class=" <view class="sn" :class="
item.pay_type === 11 || item.pay_type === 11 ||
@ -172,9 +172,9 @@
<view class="cashier" v-else>平台订单</view> <view class="cashier" v-else>平台订单</view>
</view> </view>
<view v-if="!item.paid" class="b-button"> <view v-if="!item.paid" class="b-button">
<button>重新支付</button> <button @click.stop="reOrderPay(item)">重新支付</button>
<button>检测状态</button> <button @click.stop="micropayQuery(item)">检测状态</button>
<button style="background-color: #1890ff;">提单</button> <button @click.stop="orderLading(item)" style="background-color: #1890ff;">提单</button>
</view> </view>
</view> </view>
</view> </view>
@ -226,7 +226,8 @@
cartDel, cartDel,
cartProductAttr, cartProductAttr,
createOrder, createOrder,
getOrderConfirm getOrderConfirm,
orderPay
} from '@/api/order.js'; } from '@/api/order.js';
import { import {
getCoupons, getCoupons,
@ -237,7 +238,9 @@
collectAll collectAll
} from '@/api/store.js'; } from '@/api/store.js';
import { import {
productLstApi productLstApi,
micropayQueryApi,
orderLadingApi
} from "@/api/product.js"; } from "@/api/product.js";
import { import {
getOrderList getOrderList
@ -251,6 +254,7 @@
configMap configMap
} from '@/utils'; } from '@/utils';
import { ENV } from "@/config/app.js" import { ENV } from "@/config/app.js"
import { Toast } from '../../libs/uniApi';
const app = getApp(); const app = getApp();
export default { export default {
props: { props: {
@ -316,7 +320,7 @@
newData: {}, newData: {},
activeRouter: '', activeRouter: '',
userInfo: '', userInfo: '',
navTab: 2, navTab: 1,
orderList: [] orderList: []
}; };
}, },
@ -661,6 +665,69 @@
updatePrice() { updatePrice() {
console.log('改价'); console.log('改价');
}, },
//
reOrderPay(item) {
uni.scanCode({
onlyFromCamera: true,
hideAlbum: true,
success: (res) => {
if (res.result) {
const regexWechat = /^(10|11|12|13|14|15)\d{16}$/; // 10-1518
const regexPay = /^(25|26|27|28|29|30)\d{14,22}$/; // 25-3016-24
let pay_type;
if (regexWechat.test(res.result)) pay_type = "micropay";
else if (regexPay.test(res.result)) pay_type = "alipayBar";
else {
return uni.showToast({
icon: 'none',
title: '请输入正确的支付码'
})
}
orderPay(item.group_order_id, {
type: pay_type,
auth_code: res.result
}).then(res => {
uni.showToast({
title: '支付成功',
icon: 'success'
})
}).catch(err => {
console.log(err);
Toast(err)
})
}
}
})
},
//
micropayQuery(item) {
console.log(item);
micropayQueryApi({
order_sn: item.order_sn
}).then(res => {
uni.showToast({
title: '支付成功',
icon: 'success'
})
}).catch(err => {
console.log(err);
Toast(err)
})
},
//
orderLading(item) {
orderLadingApi({
order_sn: item.order_sn,
staff_id: this.$store.state.app.userInfo.service.service_id
}).then(res => {
console.log(res);
Toast(res.message);
this.changeNavTab(1);
}).catch(err => {
console.log(err);
Toast(err);
})
},
// //
scanShopCode() { scanShopCode() {
productLstApi(this.$store.state.app.userInfo.service.mer_id, { productLstApi(this.$store.state.app.userInfo.service.mer_id, {
@ -670,6 +737,8 @@
staff_id: this.$store.state.app.userInfo.service.service_id staff_id: this.$store.state.app.userInfo.service.service_id
}).then(({ data }) => { }).then(({ data }) => {
console.log(data); console.log(data);
}).catch(err => {
console.error(err);
}) })
uni.scanCode({ uni.scanCode({
success: (res) => { success: (res) => {
@ -686,6 +755,7 @@
}, },
// //
subOrder: function(event) { subOrder: function(event) {
if (this.cartList.valid.length == 0) return Toast('请先添加商品')
let selectValue = [] let selectValue = []
this.cartList.valid.forEach(el => { this.cartList.valid.forEach(el => {
el.list.forEach(goods => { el.list.forEach(goods => {
@ -1066,6 +1136,7 @@
}); });
}, },
navTo(item) { navTo(item) {
if (item.paid == 0) return Toast('订单未支付!');
uni.navigateTo({ uni.navigateTo({
url: `/pages/admin/orderDetail/index?id=${item.order_id}&mer_id=${this.userInfo.service.mer_id}` url: `/pages/admin/orderDetail/index?id=${item.order_id}&mer_id=${this.userInfo.service.mer_id}`
}) })
@ -1690,10 +1761,12 @@
font-size: 26rpx; font-size: 26rpx;
color: #777; color: #777;
} }
.b-button { .b-button {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
margin-top: 20rpx; margin-top: 20rpx;
button { button {
font-size: 26rpx; font-size: 26rpx;
background-color: #2ec479; background-color: #2ec479;