添加:立即进货 - 下单及支付流程

This commit is contained in:
wuhui_zzw 2024-03-01 22:04:03 +08:00
parent 21b1340734
commit 76a1221880
4 changed files with 111 additions and 74 deletions

View File

@ -74,8 +74,8 @@ export function integralOrderPay(id,data){
/** /**
* 订单统计数据 * 订单统计数据
*/ */
export function orderData(){ export function orderData(data){
return request.get('order/number') return request.get('order/number',data)
} }
/** /**

View File

@ -10,7 +10,10 @@
</view> </view>
</view> </view>
<!--顶部提示--> <!--顶部提示-->
<view class="top-tips">请添加你需要的商品进行进货</view> <view class="top-tips">
请添加你需要的商品进行进货
<view class="record-btn" @click="withGoodsRecord">进货记录</view>
</view>
<!--商品列表--> <!--商品列表-->
<view class="list"> <view class="list">
<view class="item" v-for="(item,index) in Object.values(list)" :key="index"> <view class="item" v-for="(item,index) in Object.values(list)" :key="index">
@ -154,7 +157,7 @@ export default {
return spec.cart_num || 0; return spec.cart_num || 0;
}, },
...mapGetters(['isLogin', 'uid', 'userInfo', 'viewColor','shopToken', 'shopIsLogin', 'shopMerId']) ...mapGetters(['isLogin', 'uid', 'userInfo', 'viewColor', 'shopIsLogin', 'shopMerId'])
}, },
data() { data() {
return { return {
@ -540,13 +543,21 @@ export default {
} }
// //
uni.navigateTo({ uni.navigateTo({
url: '/pages/users/order_confirm/index?cartId=' + data.join(',') url: '/pages/users/order_confirm/index?is_with_goods=1&cartId=' + data.join(',')
}); });
} }
}).catch(err => { }).catch(err => {
_this.$util.Tips({title: err}); _this.$util.Tips({title: err});
}); });
},
//
withGoodsRecord(){
uni.navigateTo({
url: '/pages/users/order_list/index?is_with_goods=1'
});
} }
}, },
// //
onReachBottom() { onReachBottom() {
@ -608,6 +619,19 @@ export default {
width: 100%; width: 100%;
height: 80rpx; height: 80rpx;
line-height: 80rpx; line-height: 80rpx;
position: relative;
.record-btn{
position: absolute;
top: calc((80rpx - 40rpx) / 2);
right: 0;
font-size: 26rpx;
padding: 0 15rpx;
border: 2rpx solid #813d40;
height: 40rpx;
line-height: 40rpx;
border-radius: 6rpx;
margin-right: 15rpx;
}
} }
// //
.list{ .list{

View File

@ -297,7 +297,7 @@
<view class='tip'> <view class='tip'>
{{item.title}} {{item.title}}
<block v-if="item.value == 'balance'"> <block v-if="item.value == 'balance'">
{{userInfo.now_money}} {{ is_with_goods ? (withGoodsMerInfo.mer_money || 0.00) : userInfo.now_money }}
</block> </block>
</view> </view>
</view> </view>
@ -313,7 +313,7 @@
<view class='tip'> <view class='tip'>
{{item.title}} {{item.title}}
<block v-if="item.value == 'balance'"> <block v-if="item.value == 'balance'">
{{userInfo.now_money}} {{ is_with_goods ? (withGoodsMerInfo.mer_money || 0.00) : userInfo.now_money }}
</block> </block>
</view> </view>
</view> </view>
@ -422,33 +422,11 @@
<script> <script>
let app = getApp(); let app = getApp();
import { import {createOrder, getOrderConfirm} from '@/api/order.js';
orderConfirm, import {getAddressDetail, getAddressList, getAgreementApi, getUserInfo} from '@/api/user.js';
getOrderConfirm, import {openPaySubscribe} from '@/utils/SubscribeMessage.js';
getCouponsOrderPrice, import {presellAgreement} from '@/api/activity.js';
orderCreate, import {storeListApi,getStoreDetail} from '@/api/store.js';
createOrder
} from '@/api/order.js';
import {
getAddressDefault,
getAddressDetail,
getAddressList,
getUserInfo,
getAgreementApi
} from '@/api/user.js';
import {
openPaySubscribe
} from '@/utils/SubscribeMessage.js';
import {
presellAgreement
} from '@/api/activity.js';
import {
storeListApi
} from '@/api/store.js';
import {
CACHE_LONGITUDE,
CACHE_LATITUDE
} from '@/config/cache.js';
import couponListWindow from '@/components/orderCoupon'; import couponListWindow from '@/components/orderCoupon';
import addressWindow from '@/components/addressWindow'; import addressWindow from '@/components/addressWindow';
import orderGoods from '@/components/orderGoods'; import orderGoods from '@/components/orderGoods';
@ -460,6 +438,7 @@
import authorize from '@/components/Authorize'; import authorize from '@/components/Authorize';
import {configMap} from '@/utils'; import {configMap} from '@/utils';
import {HTTP_REQUEST_URL} from '@/config/app'; import {HTTP_REQUEST_URL} from '@/config/app';
export default { export default {
components: { components: {
couponListWindow, couponListWindow,
@ -643,10 +622,13 @@
order_key: '', order_key: '',
is_take: '', is_take: '',
domain: HTTP_REQUEST_URL, domain: HTTP_REQUEST_URL,
//
is_with_goods: 0,// 0=1=
withGoodsMerInfo: {},
}; };
}, },
computed: { computed: {
...mapGetters(['isLogin','viewColor']), ...mapGetters(['isLogin','viewColor', 'shopIsLogin', 'shopMerId']),
...configMap(['hide_mer_status', 'alipay_open', 'yue_pay_status']), ...configMap(['hide_mer_status', 'alipay_open', 'yue_pay_status']),
}, },
watch: { watch: {
@ -660,6 +642,12 @@
onReady() {}, onReady() {},
mounted: function() {}, mounted: function() {},
onLoad: function(options) { onLoad: function(options) {
this.is_with_goods = options.is_with_goods || 0;
if(this.is_with_goods){
getStoreDetail(this.shopMerId).then(res => {
this.withGoodsMerInfo = res.data;
});
}
this.seckillId = options.seckillId this.seckillId = options.seckillId
// #ifdef H5 // #ifdef H5
this.from = this.$wechat.isWeixin() ? 'weixin' : 'h5' this.from = this.$wechat.isWeixin() ? 'weixin' : 'h5'
@ -1016,6 +1004,8 @@
use_integral: that.use_integral, use_integral: that.use_integral,
// use_mer_integral: that.use_mer_integral, // use_mer_integral: that.use_mer_integral,
// use_platform_integral: that.use_platform_integral, // use_platform_integral: that.use_platform_integral,
is_with_goods: that.is_with_goods || 0,
with_goods_mer_id: that.shopMerId || 0
}).then(res => { }).then(res => {
// //
that.is_take = false that.is_take = false
@ -1177,6 +1167,8 @@
}, },
payment: function(data) { payment: function(data) {
let that = this; let that = this;
data.is_with_goods = that.is_with_goods || 0;
data.with_goods_mer_id = that.shopMerId || 0;
createOrder(data).then(res => { createOrder(data).then(res => {
let status = res.data.status, let status = res.data.status,
orderId = res.data.result.order_id, orderId = res.data.result.order_id,

View File

@ -125,7 +125,7 @@
<text class='money p-color'>{{item.pay_price}}</text> <text class='money p-color'>{{item.pay_price}}</text>
</view> </view>
<view class='bottom acea-row row-right row-middle'> <view class='bottom acea-row row-right row-middle'>
<view class='bnt b-color' @click.stop='goPay(item.pay_price,item.group_order_id)'>立即付款</view> <view class='bnt b-color' @click.stop='goPay(item)'>立即付款</view>
</view> </view>
</view> </view>
</view> </view>
@ -279,6 +279,8 @@
import emptyPage from '@/components/emptyPage.vue'; import emptyPage from '@/components/emptyPage.vue';
import { configMap } from '@/utils' import { configMap } from '@/utils'
import { HTTP_REQUEST_URL } from '@/config/app'; import { HTTP_REQUEST_URL } from '@/config/app';
import {getStoreDetail} from '@/api/store.js';
export default { export default {
components: { components: {
payment, payment,
@ -333,16 +335,20 @@
invoice: { invoice: {
invoice: false, invoice: false,
add: false, add: false,
} },
//
user_balance: 0.00,
mer_balance: 0.00,
is_with_goods: 0,
}; };
}, },
onLoad(options) { onLoad: function(options) {
this.is_with_goods = options.is_with_goods || 0;
// //
if(options.spread) spread(options.spread, this.isLogin) if(options.spread) spread(options.spread, this.isLogin)
}, },
computed: { computed: {
...mapGetters(['isLogin','uid','viewColor']), ...mapGetters(['isLogin','uid','viewColor', 'shopIsLogin', 'shopMerId']),
...configMap(['hide_mer_status', 'community_status', 'alipay_open', 'yue_pay_status']), ...configMap(['hide_mer_status', 'community_status', 'alipay_open', 'yue_pay_status']),
}, },
watch: { watch: {
@ -407,8 +413,14 @@
getUserInfo: function() { getUserInfo: function() {
let that = this; let that = this;
getUserInfo().then(res => { getUserInfo().then(res => {
that.user_balance = res.data.now_money || 0.00;
that.payMode[2].number = res.data.now_money; that.payMode[2].number = res.data.now_money;
}); });
if(that.shopIsLogin){
getStoreDetail(that.shopMerId).then(res => {
that.mer_balance = res.data.mer_money || 0.00;
});
}
}, },
/** /**
* 关闭支付组件 * 关闭支付组件
@ -421,6 +433,7 @@
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function(options) { onLoad: function(options) {
this.is_with_goods = options.is_with_goods || 0;
if (options.status) this.orderStatus = options.status; if (options.status) this.orderStatus = options.status;
}, },
/** /**
@ -429,7 +442,10 @@
*/ */
getOrderData: function() { getOrderData: function() {
let that = this; let that = this;
orderData().then(res => { orderData({
is_with_goods: that.is_with_goods || 0,
with_goods_mer_id: that.shopMerId || 0,
}).then(res => {
that.$set(that, 'orderData', res.data); that.$set(that, 'orderData', res.data);
}) })
}, },
@ -458,15 +474,16 @@
}); });
}); });
}, },
/** //
* 打开支付组件 goPay: function(item) {
* //
*/ if(item.activity_type == 35) this.payMode[2].number = this.mer_balance || 0.00;
goPay: function(pay_price, order_id) { else this.payMode[2].number = this.user_balance || 0.00;
//
this.$set(this, 'pay_close', true); this.$set(this, 'pay_close', true);
this.order_id = order_id; this.order_id = item.group_order_id;
this.pay_order_id = order_id.toString() this.pay_order_id = item.group_order_id.toString()
this.$set(this, 'totalPrice', pay_price); this.$set(this, 'totalPrice', item.pay_price);
}, },
/** /**
* 支付成功回调 * 支付成功回调
@ -586,6 +603,8 @@
groupOrderList({ groupOrderList({
page: that.page, page: that.page,
limit: that.limit, limit: that.limit,
is_with_goods: that.is_with_goods || 0,
with_goods_mer_id: that.shopMerId || 0,
}).then(res => { }).then(res => {
that.isReady = true; that.isReady = true;
let list = res.data.list || []; let list = res.data.list || [];
@ -605,6 +624,8 @@
status: that.orderStatus - 1, status: that.orderStatus - 1,
page: that.page, page: that.page,
limit: that.limit, limit: that.limit,
is_with_goods: that.is_with_goods || 0,
with_goods_mer_id: that.shopMerId || 0,
}).then(res => { }).then(res => {
let list = res.data.list || []; let list = res.data.list || [];
let loadend = list.length < that.limit; let loadend = list.length < that.limit;