团购支付
This commit is contained in:
@@ -65,3 +65,76 @@ export interface StockBean {
|
||||
stockId: string;
|
||||
count: number;
|
||||
}
|
||||
|
||||
export interface OrderBean {
|
||||
allowIntegral: boolean;
|
||||
bizId: string;
|
||||
classify: number;
|
||||
companyId: string;
|
||||
consignTime: string;
|
||||
consumerId: string;
|
||||
consumerName: string;
|
||||
coupon: string;
|
||||
couponIds: string;
|
||||
couponsStatus: number;
|
||||
createTime: string;
|
||||
creatorId: number;
|
||||
creatorName: string;
|
||||
device: string;
|
||||
discount: number;
|
||||
discountPrice: number;
|
||||
finishTime: string;
|
||||
freePrice: number;
|
||||
goodsNum: number;
|
||||
id: string;
|
||||
integral: number;
|
||||
itemNum: number;
|
||||
marketingPrice: number;
|
||||
marketingText: string;
|
||||
modifierIds: string;
|
||||
needPaid: number;
|
||||
ogList: any[];
|
||||
orderGoods: GoodsBean[];
|
||||
changeStockNum: number;
|
||||
consumePrice: number;
|
||||
discountOriginPrice: number;
|
||||
goodsCode: string;
|
||||
goodsId: string;
|
||||
goodsName: string;
|
||||
goodsPriceModify: string;
|
||||
goodsTypeName: string;
|
||||
images: string;
|
||||
offset: string;
|
||||
orderId: string;
|
||||
orderNo: string;
|
||||
originPrice: number;
|
||||
originStockNum: number;
|
||||
priceModify: [];
|
||||
produceIntegral: number;
|
||||
salePrice: number;
|
||||
stockId: string;
|
||||
stockStock: StockBean[];
|
||||
payStatus: number;
|
||||
payTypeIds: string;
|
||||
printed: string;
|
||||
produceIntegralNumber: number;
|
||||
profit: string;
|
||||
reducePrice: number;
|
||||
relatedId: string;
|
||||
remark: string;
|
||||
replacementOrder: string;
|
||||
saleNum: number;
|
||||
salers: [];
|
||||
status: number;
|
||||
storeId: string;
|
||||
storeName: string;
|
||||
storeOrder: string;
|
||||
totalPrice: number;
|
||||
transactionPrice: number;
|
||||
type: number;
|
||||
typeName: string;
|
||||
updateTime: string;
|
||||
updated: boolean;
|
||||
useGold: number;
|
||||
wholePrice: number;
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { GoodsBean, StockBean } from '@/api/goods/types';
|
||||
import { GoodsBean } from '@/api/goods/types';
|
||||
import { CouponBean } from '@/api/user/types';
|
||||
|
||||
export interface GroupBuyBean {
|
||||
@@ -35,76 +35,3 @@ export interface RecordBean {
|
||||
groupId: string;
|
||||
memberImage: string;
|
||||
}
|
||||
|
||||
export interface OrderBean {
|
||||
allowIntegral: boolean;
|
||||
bizId: string;
|
||||
classify: number;
|
||||
companyId: string;
|
||||
consignTime: string;
|
||||
consumerId: string;
|
||||
consumerName: string;
|
||||
coupon: string;
|
||||
couponIds: string;
|
||||
couponsStatus: number;
|
||||
createTime: string;
|
||||
creatorId: number;
|
||||
creatorName: string;
|
||||
device: string;
|
||||
discount: number;
|
||||
discountPrice: number;
|
||||
finishTime: string;
|
||||
freePrice: number;
|
||||
goodsNum: number;
|
||||
id: string;
|
||||
integral: number;
|
||||
itemNum: number;
|
||||
marketingPrice: number;
|
||||
marketingText: string;
|
||||
modifierIds: string;
|
||||
needPaid: number;
|
||||
ogList: any[];
|
||||
orderGoods: GoodsBean[];
|
||||
changeStockNum: number;
|
||||
consumePrice: number;
|
||||
discountOriginPrice: number;
|
||||
goodsCode: string;
|
||||
goodsId: string;
|
||||
goodsName: string;
|
||||
goodsPriceModify: string;
|
||||
goodsTypeName: string;
|
||||
images: string;
|
||||
offset: string;
|
||||
orderId: string;
|
||||
orderNo: string;
|
||||
originPrice: number;
|
||||
originStockNum: number;
|
||||
priceModify: [];
|
||||
produceIntegral: number;
|
||||
salePrice: number;
|
||||
stockId: string;
|
||||
stockStock: StockBean[];
|
||||
payStatus: number;
|
||||
payTypeIds: string;
|
||||
printed: string;
|
||||
produceIntegralNumber: number;
|
||||
profit: string;
|
||||
reducePrice: number;
|
||||
relatedId: string;
|
||||
remark: string;
|
||||
replacementOrder: string;
|
||||
saleNum: number;
|
||||
salers: [];
|
||||
status: number;
|
||||
storeId: string;
|
||||
storeName: string;
|
||||
storeOrder: string;
|
||||
totalPrice: number;
|
||||
transactionPrice: number;
|
||||
type: number;
|
||||
typeName: string;
|
||||
updateTime: string;
|
||||
updated: boolean;
|
||||
useGold: number;
|
||||
wholePrice: number;
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@
|
||||
<view class='divider' style='margin: 40rpx 0' />
|
||||
<view class='c-flex-row' @click.stop='doPayment(PAYMENT_TYPE_BALANCE)'>
|
||||
<image :src='assetsUrl("ic_balance.png")' />
|
||||
<text>余额(剩余¥100)</text>
|
||||
<text>余额(剩余¥{{ userInfo.balance }})</text>
|
||||
<image :src='assetsUrl(currentType===PAYMENT_TYPE_BALANCE?"ic_checkbox_active.png":"ic_checkbox_normal.png")' />
|
||||
</view>
|
||||
</view>
|
||||
@@ -23,11 +23,16 @@
|
||||
|
||||
<script lang='ts' setup>
|
||||
import { assetsUrl } from '@/utils/assets';
|
||||
import { useUserStore } from '@/store';
|
||||
|
||||
const popupRef = ref();
|
||||
const PAYMENT_TYPE_WECHAT = 0;
|
||||
const PAYMENT_TYPE_BALANCE = 1;
|
||||
const currentType = ref(PAYMENT_TYPE_WECHAT);
|
||||
const PAYMENT_TYPE_WECHAT = ref(0);
|
||||
const PAYMENT_TYPE_BALANCE = ref(1);
|
||||
const currentType = ref(PAYMENT_TYPE_WECHAT.value);
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
const { userInfo } = storeToRefs(userStore);
|
||||
|
||||
const emits = defineEmits(['change']);
|
||||
const show = () => {
|
||||
@@ -42,10 +47,10 @@ const doPayment = (paymentType: number) => {
|
||||
emits('change', paymentType);
|
||||
currentType.value = paymentType;
|
||||
switch (paymentType) {
|
||||
case PAYMENT_TYPE_WECHAT:
|
||||
case PAYMENT_TYPE_WECHAT.value:
|
||||
console.log('PAYMENT_TYPE_WECHAT');
|
||||
break;
|
||||
case PAYMENT_TYPE_BALANCE:
|
||||
case PAYMENT_TYPE_BALANCE.value:
|
||||
console.log('PAYMENT_TYPE_BALANCE');
|
||||
break;
|
||||
}
|
||||
|
@@ -5,13 +5,11 @@
|
||||
"versionName": "1.0.0",
|
||||
"versionCode": "100",
|
||||
"transformPx": false,
|
||||
"app-plus":
|
||||
{
|
||||
"app-plus": {
|
||||
"usingComponents": true,
|
||||
"nvueStyleCompiler": "uni-app",
|
||||
"compilerVersion": 3,
|
||||
"splashscreen":
|
||||
{
|
||||
"splashscreen": {
|
||||
"alwaysShowBeforeRender": true,
|
||||
"waiting": true,
|
||||
"autoclose": true,
|
||||
@@ -19,25 +17,27 @@
|
||||
},
|
||||
"modules": {}
|
||||
},
|
||||
"mp-weixin":
|
||||
{
|
||||
"mp-weixin": {
|
||||
"appid": "wx92e663dc11d0c0a8",
|
||||
// "appid": "wx67a750d0ceed4d88",
|
||||
"setting":
|
||||
{
|
||||
// "appid": "wx67a750d0ceed4d88",
|
||||
"setting": {
|
||||
"urlCheck": false
|
||||
},
|
||||
"usingComponents": true
|
||||
"usingComponents": true,
|
||||
|
||||
"plugins": {
|
||||
"sqb-pay": {
|
||||
"version": "1.3.0",
|
||||
"provider": "wx55540b288c5ce319"
|
||||
}
|
||||
}
|
||||
},
|
||||
"uniStatistics":
|
||||
{
|
||||
"uniStatistics": {
|
||||
"enable": false
|
||||
},
|
||||
"vueVersion": "3",
|
||||
"h5":
|
||||
{
|
||||
"router":
|
||||
{
|
||||
"h5": {
|
||||
"router": {
|
||||
"mode": "hash",
|
||||
"base": "/uniapp-vue3-template/"
|
||||
}
|
||||
|
@@ -65,9 +65,12 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "groupbuy/order",
|
||||
"path": "groupbuy/order-confirm",
|
||||
"style": {
|
||||
"navigationBarTitleText": "确认订单"
|
||||
"navigationBarTitleText": "确认订单",
|
||||
"usingComponents": {
|
||||
"sqb-pay": "plugin://sqb-pay/sqb-pay"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -99,7 +102,10 @@
|
||||
{
|
||||
"path": "order/order-confirm",
|
||||
"style": {
|
||||
"navigationBarTitleText": "确认订单"
|
||||
"navigationBarTitleText": "确认订单",
|
||||
"usingComponents": {
|
||||
"sqb-pay": "plugin://sqb-pay/sqb-pay"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@@ -125,7 +125,7 @@
|
||||
<view class='place-order-button' @click.stop='placeOrder'>跟团购买</view>
|
||||
</view>
|
||||
</view>
|
||||
<sku-dialog ref='skuDialogRef' :flash-price='groupBuyBean?.payPrice || 0' />
|
||||
<sku-dialog ref='skuDialogRef' :flash-price='Number(groupBuyBean?.payPrice) || 0' />
|
||||
</template>
|
||||
|
||||
<script lang='ts' setup>
|
||||
@@ -252,7 +252,7 @@ const placeOrder = async () => {
|
||||
};
|
||||
|
||||
const result = await preOrder(params);
|
||||
goPath(`/pages/common/groupbuy/order?orderBean=${encodeURIComponent(JSON.stringify(result))}`);
|
||||
goPath(`/pages/common/groupbuy/order-confirm?orderBean=${encodeURIComponent(JSON.stringify(result))}`);
|
||||
}
|
||||
|
||||
showSkuDialog((e: GoodsBean) => {
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<view class='content'>
|
||||
|
||||
<view class='card-view'>
|
||||
<template v-for='(item,index) in orderBean?.orderGoods' :key='index'>
|
||||
<template class='c-flex-row' v-for='item in orderBean?.orderGoods' :key='item.id'>
|
||||
<image class='goods-image' :src='item?.images' />
|
||||
<view class='c-flex-column' style='flex: 1'>
|
||||
<text class='goods-name'>{{ item?.goodsName }}</text>
|
||||
@@ -26,7 +26,18 @@
|
||||
</view>
|
||||
|
||||
<view class='bottom-view c-flex-row'>
|
||||
<view class='confirm-button' @click.stop='payment'>支付</view>
|
||||
<sqb-pay @bindnavigateTo='navigateTo'
|
||||
:return_url='payParams.return_url'
|
||||
:total_amount='payParams.total_amount'
|
||||
:terminal_sn='payParams.terminal_sn'
|
||||
:client_sn='payParams.client_sn'
|
||||
:subject='payParams.subject'
|
||||
:subject_img='payParams.subject_img '
|
||||
:merchant_name='payParams.merchant_name'
|
||||
:notify_url='payParams.notify_url'
|
||||
:sign='payParams.sign'>
|
||||
<button class='confirm-button' @click='payment'>支付</button>
|
||||
</sqb-pay>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -34,7 +45,7 @@
|
||||
|
||||
<script lang='ts' setup>
|
||||
import { pay, progress } from '@/api/groupbuy';
|
||||
import { OrderBean } from '@/api/groupbuy/types';
|
||||
import { OrderBean } from '@/api/goods/types';
|
||||
import { parseParameter, sortASCII } from '@/utils';
|
||||
import { hexMD5 } from '@/utils/common/md5';
|
||||
import { useUserStore } from '@/store';
|
||||
@@ -43,36 +54,59 @@ const userState = useUserStore();
|
||||
const { terminalInfo } = storeToRefs(userState);
|
||||
|
||||
const orderBean = ref<OrderBean>();
|
||||
const payParams = ref({
|
||||
return_url: '',
|
||||
total_amount: '',
|
||||
client_sn: '',
|
||||
terminal_sn: '',
|
||||
subject: '',
|
||||
subject_img: '',
|
||||
merchant_name: '',
|
||||
notify_url: '',
|
||||
sign: ''
|
||||
});
|
||||
|
||||
onLoad((e: any) => {
|
||||
orderBean.value = JSON.parse(decodeURIComponent(e?.orderBean));
|
||||
|
||||
let signParams = buildSignParams.value;
|
||||
const signStr = parseParameter(signParams) + '&key=' + terminalInfo.value.terminalKey;
|
||||
const sign = hexMD5(signStr).toUpperCase();
|
||||
payParams.value = {
|
||||
...signParams,
|
||||
sign: sign
|
||||
};
|
||||
});
|
||||
|
||||
const payment = () => {
|
||||
let signParams = {
|
||||
return_url: 'return_url',
|
||||
total_amount: orderBean.value?.totalPrice,
|
||||
client_sn: orderBean.value?.id,
|
||||
const buildSignParams = computed(() => {
|
||||
return sortASCII({
|
||||
client_sn: orderBean.value?.id || '',
|
||||
return_url: '/pages/payResult/index',
|
||||
total_amount: ((orderBean.value?.totalPrice || 0) * 100).toString(),
|
||||
terminal_sn: terminalInfo.value.terminalSn,
|
||||
subject: 'subject',
|
||||
subject_img: 'subject_img',
|
||||
merchant_name: 'merchant_name',
|
||||
subject: '商品团购券',
|
||||
subject_img: orderBean?.value?.orderGoods[0].images || '',
|
||||
merchant_name: terminalInfo.value.companyName,
|
||||
notify_url: 'https://www.baidu.com'
|
||||
};
|
||||
// signParams = util.sortASCII(signParams, true);
|
||||
sortASCII(signParams, true);
|
||||
//参数拼接
|
||||
// const signStr = util.pars(signParams) + '&key=' + terminalInfo.value.terminalKey;
|
||||
const signStr = parseParameter(signParams) + '&key=' + terminalInfo.value.terminalKey;
|
||||
console.log('签名字符串', signStr);
|
||||
// const sign = utilMd5.hexMD5(signStr).toUpperCase();
|
||||
const sign = hexMD5(signStr);
|
||||
}, true);
|
||||
});
|
||||
|
||||
console.log('签名结果', sign);
|
||||
const navigateTo = (e: any) => {
|
||||
console.log('----------->>>>>navigateTo ', e);
|
||||
uni.redirectTo({
|
||||
url: e.detail.url,
|
||||
fail(e) {
|
||||
uni.showToast({
|
||||
title: '支付失败'
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const payment = () => {
|
||||
const params = {
|
||||
'id': orderBean.value?.id,
|
||||
'orderSn': signParams.client_sn,
|
||||
'orderSn': buildSignParams.value.client_sn,
|
||||
'terminal_key': terminalInfo.value.terminalKey,
|
||||
'terminal_sn': terminalInfo.value.terminalSn
|
||||
};
|
||||
@@ -80,14 +114,13 @@ const payment = () => {
|
||||
progress(params);
|
||||
pay({
|
||||
'orderId': orderBean.value?.id,
|
||||
'result': JSON.stringify('{payResult:xxx}')
|
||||
'result': '{payResult:xxx}'
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
|
||||
.content {
|
||||
.card-view:nth-of-type(1) {
|
||||
margin-top: 30rpx;
|
||||
@@ -142,18 +175,22 @@ const payment = () => {
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
|
||||
.confirm-button {
|
||||
display: flex;
|
||||
sqb-pay {
|
||||
flex: 1;
|
||||
font-weight: bold;
|
||||
width: 100%;
|
||||
font-size: 30rpx;
|
||||
height: 80rpx;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #F32B2B;
|
||||
color: #FFFFFF;
|
||||
border-radius: 40rpx;
|
||||
|
||||
.confirm-button {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
font-weight: bold;
|
||||
width: 100%;
|
||||
font-size: 30rpx;
|
||||
height: 80rpx;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #F32B2B;
|
||||
color: #FFFFFF;
|
||||
border-radius: 40rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@@ -107,7 +107,7 @@ onShow(async () => {
|
||||
getCompanyList(userInfo.value.maOpenId).then(res => {
|
||||
const companyList = res.map((res: { company: any }) => res.company);
|
||||
const userList = res.map((res: { user: any }) => res.user);
|
||||
if(!getCompanyId()) {
|
||||
// if(!getCompanyId()) {
|
||||
uni.showActionSheet({
|
||||
itemList: companyList.map((res: { companyName: string }) => res.companyName),
|
||||
success: (res) => {
|
||||
@@ -116,7 +116,7 @@ onShow(async () => {
|
||||
userStore.fetchTerminal();
|
||||
}
|
||||
});
|
||||
}
|
||||
// }
|
||||
});
|
||||
} else {
|
||||
await userStore.getProfile();
|
||||
|
@@ -98,7 +98,7 @@ import { assetsUrl } from '@/utils/assets';
|
||||
import SkuDialog from '@/components/sku-dialog.vue';
|
||||
import { goPath, showToast } from '@/utils';
|
||||
import { getGoodsDetail, getGoodsList } from '@/api/goods';
|
||||
import { GoodsBean, StockBean } from '@/api/goods/types';
|
||||
import { GoodsBean } from '@/api/goods/types';
|
||||
import useShoppingCartStore from '@/store/modules/shoppingcart';
|
||||
|
||||
const shoppingCartStore = useShoppingCartStore();
|
||||
@@ -158,8 +158,12 @@ const addShoppingCart = () => {
|
||||
};
|
||||
|
||||
const placeOrder = () => {
|
||||
showSkuDialog((e: StockBean) => {
|
||||
goPath('/pages/mall/subs/order/order-confirm');
|
||||
showSkuDialog((e: GoodsBean) => {
|
||||
const orderBean = {
|
||||
totalPrice: e.price * e.checkedStock.count,
|
||||
orderGoods: [e]
|
||||
};
|
||||
goPath(`/pages/mall/subs/order/order-confirm?orderBean=${encodeURIComponent(JSON.stringify(orderBean))}`);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
@@ -1,102 +1,116 @@
|
||||
<template>
|
||||
<view class='content'>
|
||||
<view class='c-flex-row'>
|
||||
<view class='tab c-flex-row' :class='{"tab-active": tabIndex === 0}' @click.stop='tabIndex=0'>
|
||||
<image :src='assetsUrl("ic_order_dd.png")' />
|
||||
<text>到店</text>
|
||||
</view>
|
||||
<view class='tab c-flex-row' :class='{"tab-active": tabIndex === 1}' @click.stop='tabIndex=1'>
|
||||
<image :src='assetsUrl("ic_order_yj.png")' />
|
||||
<text>邮寄</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-show='tabIndex==1' class='address-view c-flex-column'
|
||||
@click.stop='goPath("/pages/mine/subs/address/index")'>
|
||||
<view class='user-info c-flex-row'>
|
||||
<text>默认</text>
|
||||
<text>黄先生</text>
|
||||
<text>155****6532</text>
|
||||
<view style='flex: 1' />
|
||||
<image :src='assetsUrl("ic_arrow_right_gray.png")' />
|
||||
</view>
|
||||
|
||||
<view class='addr c-flex-row'>
|
||||
<image :src='assetsUrl("ic_location.png")' />
|
||||
<text>湖南省 长沙市 详细地址详细地址详细地址</text>
|
||||
</view>
|
||||
<image class='dashed-line' :src='assetsUrl("ic_address_dashed_line.png")' />
|
||||
</view>
|
||||
|
||||
<view class='goods-info-view c-flex-column'>
|
||||
<scroll-view scroll-y>
|
||||
<view class='content'>
|
||||
<view class='c-flex-row'>
|
||||
<image class='goods-image' :src='assetsUrl("test_bg.png")' />
|
||||
<view class='c-flex-column' style='flex: 1;'>
|
||||
<view class='c-flex-row'>
|
||||
<text class='goods-name'>女童夏装套装洋气装短袖阔腿裤子夏装套装</text>
|
||||
</view>
|
||||
<text style='color: #999999;margin-top: 30rpx'>
|
||||
2356235654
|
||||
</text>
|
||||
<view class='bottom-view c-flex-row'>
|
||||
<text>
|
||||
紫色,120cm x1
|
||||
<view class='tab c-flex-row' :class='{"tab-active": tabIndex === 0}' @click.stop='tabIndex=0'>
|
||||
<image :src='assetsUrl("ic_order_dd.png")' />
|
||||
<text>到店</text>
|
||||
</view>
|
||||
<view class='tab c-flex-row' :class='{"tab-active": tabIndex === 1}' @click.stop='tabIndex=1'>
|
||||
<image :src='assetsUrl("ic_order_yj.png")' />
|
||||
<text>邮寄</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-show='tabIndex==1' class='address-view c-flex-column'
|
||||
@click.stop='goPath("/pages/mine/subs/address/index")'>
|
||||
<view class='user-info c-flex-row'>
|
||||
<text>默认</text>
|
||||
<text>黄先生</text>
|
||||
<text>155****6532</text>
|
||||
<view style='flex: 1' />
|
||||
<image :src='assetsUrl("ic_arrow_right_gray.png")' />
|
||||
</view>
|
||||
|
||||
<view class='addr c-flex-row'>
|
||||
<image :src='assetsUrl("ic_location.png")' />
|
||||
<text>湖南省 长沙市 详细地址详细地址详细地址</text>
|
||||
</view>
|
||||
<image class='dashed-line' :src='assetsUrl("ic_address_dashed_line.png")' />
|
||||
</view>
|
||||
|
||||
<view class='goods-info-view c-flex-column'>
|
||||
<view class='c-flex-row' style='margin-bottom: 20rpx' v-for='(item,index) in orderBean?.orderGoods'
|
||||
:key='index'>
|
||||
<image class='goods-image' :src='item.images' />
|
||||
<view class='c-flex-column' style='flex: 1;'>
|
||||
<view class='c-flex-row'>
|
||||
<text class='goods-name'>{{ item.name }}</text>
|
||||
</view>
|
||||
<text style='color: #999999;margin-top: 30rpx'>
|
||||
{{ item.code }}
|
||||
</text>
|
||||
<view class='bottom-sku-view c-flex-row'>
|
||||
<text>
|
||||
{{ item.checkedStock.colorName }},{{ item.checkedStock.sizeName }} x{{ item.checkedStock.count }}
|
||||
</text>
|
||||
<text>¥{{ item.price }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='divider' />
|
||||
|
||||
<view class='remark-view c-flex-row'>
|
||||
<text>备注</text>
|
||||
<input placeholder='请填写订单备注' @input='orderBean!.remark = $event.detail.value' />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class='card-view'>
|
||||
<view class='c-flex-row'>
|
||||
<text class='card-view-title'>商品总价</text>
|
||||
<text class='card-view-value'>¥{{ orderBean?.totalPrice || 0 }}</text>
|
||||
</view>
|
||||
<view class='c-flex-row'>
|
||||
<text class='card-view-title'>运费</text>
|
||||
<text class='card-view-value'>¥8</text>
|
||||
</view>
|
||||
<view class='c-flex-row' @click.stop='showCouponDialog'>
|
||||
<text class='card-view-title'>优惠券
|
||||
<text style='font-size: 22rpx;color: #F32B2B;'>已选最大优惠</text>
|
||||
</text>
|
||||
<view class='card-view-value' style='color: #F32B2B;margin: 0'>-¥{{ checkedCoupon?.reduce || 0 }}
|
||||
<image :src='assetsUrl("ic_arrow_right_gray.png")' />
|
||||
</view>
|
||||
</view>
|
||||
<view class='divider' />
|
||||
<view class='c-flex-row'>
|
||||
<view style='flex: 1' />
|
||||
<view class='c-flex-row'>
|
||||
<text class='card-view-value'>共1件商品 合计:
|
||||
<text style='font-size: 34rpx;color:#F32B2B'>¥{{ orderBean?.totalPrice || 0 }}</text>
|
||||
</text>
|
||||
<text>23.20元</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='divider' />
|
||||
|
||||
<view class='remark-view c-flex-row'>
|
||||
<text>备注</text>
|
||||
<input placeholder='请填写订单备注' />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class='card-view'>
|
||||
<view class='c-flex-row'>
|
||||
<text class='card-view-title'>商品总价</text>
|
||||
<text class='card-view-value'>¥29.90</text>
|
||||
</view>
|
||||
<view class='c-flex-row'>
|
||||
<text class='card-view-title'>运费</text>
|
||||
<text class='card-view-value'>¥8</text>
|
||||
</view>
|
||||
<view class='c-flex-row' @click.stop='showCouponDialog'>
|
||||
<text class='card-view-title'>优惠券
|
||||
<text style='font-size: 22rpx;color: #F32B2B;'>已选最大优惠</text>
|
||||
</text>
|
||||
<view class='card-view-value' style='color: #F32B2B;margin: 0'>-¥{{ checkedCoupon?.reduce || 0 }}
|
||||
<view class='payment-way c-flex-row' @click.stop='changePayment'>
|
||||
<text>支付方式</text>
|
||||
<view>{{ paymentType === 0 ? '微信支付' : '余额' }}
|
||||
<image :src='assetsUrl("ic_arrow_right_gray.png")' />
|
||||
</view>
|
||||
</view>
|
||||
<view class='divider' />
|
||||
<view class='c-flex-row'>
|
||||
<view style='flex: 1' />
|
||||
<view class='c-flex-row'>
|
||||
<text class='card-view-value'>共1件商品 合计:
|
||||
<text style='font-size: 34rpx;color:#F32B2B'>¥29.90</text>
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view class='bottom-view c-flex-row'>
|
||||
<text>合计</text>
|
||||
<text>¥{{ orderBean?.totalPrice || 0 }}</text>
|
||||
<sqb-pay @bindnavigateTo='navigateTo'
|
||||
:return_url='payParams.return_url'
|
||||
:total_amount='payParams.total_amount'
|
||||
:terminal_sn='payParams.terminal_sn'
|
||||
:client_sn='payParams.client_sn'
|
||||
:subject='payParams.subject'
|
||||
:subject_img='payParams.subject_img '
|
||||
:merchant_name='payParams.merchant_name'
|
||||
:notify_url='payParams.notify_url'
|
||||
:sign='payParams.sign'>
|
||||
<text class='confirm-order' @click.stop='payment'>确认订单</text>
|
||||
</sqb-pay>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class='payment-way c-flex-row' @click.stop='changePayment'>
|
||||
<text>支付方式</text>
|
||||
<view>{{ paymentType === 0 ? '微信支付' : '余额' }}
|
||||
<image :src='assetsUrl("ic_arrow_right_gray.png")' />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class='bottom-view c-flex-row'>
|
||||
<text>合计</text>
|
||||
<text>¥29.90</text>
|
||||
<text @click.stop='payment'>确认订单</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<payment-dialog ref='paymentDialogRef' @change='args => paymentType=args' />
|
||||
<coupon-dialog ref='couponDialogRef' @confirm='confirmCoupon' :order-price='500' />
|
||||
<coupon-dialog ref='couponDialogRef' @confirm='confirmCoupon' :order-price='orderBean?.totalPrice' />
|
||||
</template>
|
||||
|
||||
<script lang='ts' setup>
|
||||
@@ -106,6 +120,11 @@ import CouponDialog from '@/pages/mall/subs/components/coupon-dialog.vue';
|
||||
import { goPath } from '@/utils';
|
||||
import { orderCreate } from '@/api/goods';
|
||||
import { CouponBean } from '@/api/user/types';
|
||||
import { OrderBean } from '@/api/goods/types';
|
||||
import { useUserStore } from '@/store';
|
||||
|
||||
const userStore = useUserStore();
|
||||
const { terminalInfo } = storeToRefs(userStore);
|
||||
|
||||
const couponDialogRef = ref();
|
||||
const paymentDialogRef = ref();
|
||||
@@ -114,6 +133,24 @@ const tabIndex = ref(0);
|
||||
|
||||
const checkedCoupon = ref<CouponBean>();
|
||||
|
||||
const payParams = ref({
|
||||
return_url: '',
|
||||
total_amount: '',
|
||||
client_sn: '',
|
||||
terminal_sn: '',
|
||||
subject: '',
|
||||
subject_img: '',
|
||||
merchant_name: '',
|
||||
notify_url: '',
|
||||
sign: ''
|
||||
});
|
||||
|
||||
const orderBean = ref<OrderBean>();
|
||||
|
||||
onLoad((e) => {
|
||||
orderBean.value = JSON.parse(decodeURIComponent(e?.orderBean));
|
||||
console.log(orderBean.value);
|
||||
});
|
||||
const changePayment = () => {
|
||||
paymentDialogRef.value.show();
|
||||
};
|
||||
@@ -126,42 +163,46 @@ const confirmCoupon = (item: CouponBean) => {
|
||||
checkedCoupon.value = item;
|
||||
};
|
||||
|
||||
const navigateTo = (e: any) => {
|
||||
|
||||
};
|
||||
|
||||
const payment = async () => {
|
||||
await uni.showLoading();
|
||||
const params = {
|
||||
'discount': 0,
|
||||
'freePrice': 0,
|
||||
'reducePrice': 0,
|
||||
'totalPrice': 0,
|
||||
'totalPrice': orderBean?.value?.totalPrice,
|
||||
'integral': 0,
|
||||
'allowIntegral': 0,
|
||||
'produceIntegralNumber': 0,
|
||||
'remark': 'string',
|
||||
'orderGoods': [
|
||||
'remark': orderBean.value?.remark,
|
||||
'orderGoods': orderBean?.value?.orderGoods?.map(item => (
|
||||
{
|
||||
'goodsId': 'string',
|
||||
'goodsCode': 'string',
|
||||
'goodsNum': 0,
|
||||
'stockId': 'string',
|
||||
'originPrice': 0,
|
||||
'consumePrice': 0,
|
||||
'goodsId': item.goodsId,
|
||||
'goodsCode': item.code,
|
||||
'goodsNum': item.checkedStock.count,
|
||||
'stockId': item.checkedStock.stockId,
|
||||
'originPrice': item.price,
|
||||
'consumePrice': item.price,
|
||||
'discount': 0,
|
||||
'discountOriginPrice': 0,
|
||||
'produceIntegral': 0,
|
||||
'priceModify': [
|
||||
0
|
||||
],
|
||||
'priceModify': [0],
|
||||
'offset': 0
|
||||
}
|
||||
]
|
||||
))
|
||||
};
|
||||
|
||||
const result = await orderCreate(params);
|
||||
uni.hideLoading();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
.content {
|
||||
padding: 20rpx 30rpx;
|
||||
padding: 20rpx 30rpx 200rpx 30rpx;
|
||||
}
|
||||
|
||||
.tab {
|
||||
@@ -283,7 +324,7 @@ const payment = async () => {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.bottom-view {
|
||||
.bottom-sku-view {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 10rpx;
|
||||
@@ -296,8 +337,9 @@ const payment = async () => {
|
||||
}
|
||||
|
||||
text:nth-of-type(2) {
|
||||
font-size: 24rpx;
|
||||
font-size: 30rpx;
|
||||
color: #333333;
|
||||
font-weight: bold;
|
||||
margin-right: 5rpx;
|
||||
}
|
||||
|
||||
@@ -326,6 +368,7 @@ const payment = async () => {
|
||||
text-align: right;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
z-index: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -390,8 +433,7 @@ const payment = async () => {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 12rpx 30rpx 78rpx 30rpx;
|
||||
|
||||
padding: 30rpx 30rpx 78rpx 30rpx;
|
||||
|
||||
text:nth-of-type(1) {
|
||||
font-weight: 400;
|
||||
@@ -407,7 +449,7 @@ const payment = async () => {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
text:nth-of-type(3) {
|
||||
sqb-pay .confirm-order {
|
||||
padding: 17rpx 45rpx;
|
||||
border-radius: 43rpx;
|
||||
border: 1rpx solid #F32B2B;
|
||||
|
@@ -131,7 +131,11 @@ const settlement = () => {
|
||||
showToast('请选择商品');
|
||||
return;
|
||||
}
|
||||
goPath('/pages/mall/subs/order/order-confirm');
|
||||
const orderBean = {
|
||||
totalPrice: totalPayPrice.value,
|
||||
orderGoods: shoppingCartList.value.filter(res => res.checked)
|
||||
};
|
||||
goPath(`/pages/mall/subs/order/order-confirm?orderBean=${encodeURIComponent(JSON.stringify(orderBean))}`);
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@@ -77,10 +77,10 @@ export function sortASCII(obj: any, isSort = true) {
|
||||
export function parseParameter(obj: any) {
|
||||
if(obj === null || obj === undefined) return '';
|
||||
const arr = [];
|
||||
const keys: any = Object.keys(obj);
|
||||
const keys: string[] = Object.keys(obj);
|
||||
const entries: any[] = Object.entries(obj);
|
||||
for (const [key, value] of entries) {
|
||||
if(keys.contains(key) && !key.startsWith('function')) {
|
||||
if(keys.includes(key) && !key.startsWith('function')) {
|
||||
arr.push(key + '=' + value);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user