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

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

@ -10,7 +10,7 @@ export function getCartCounts() {
}
/**
* 获取购物车列表
*
*
*/
export function getCartList() {
return request.get("user/cart/lst");
@ -41,7 +41,7 @@ export function getOrderList(data){
/**
* 订单产品信息
* @param string unique
* @param string unique
*/
export function orderProduct(orderId){
return request.get('reply/product/'+orderId);
@ -50,7 +50,7 @@ export function orderProduct(orderId){
/**
* 订单评价
* @param object data
*
*
*/
export function orderComment(id,data){
return request.post('reply/'+id,data);
@ -74,14 +74,14 @@ export function integralOrderPay(id,data){
/**
* 订单统计数据
*/
export function orderData(){
return request.get('order/number')
export function orderData(data){
return request.get('order/number',data)
}
/**
* 订单取消
* @param string id
*
*
*/
// export function orderCancel(id){
// return request.post('order/cancel',{id:id});
@ -90,7 +90,7 @@ export function orderData(){
/**
* 未支付订单取消
* @param string id
*
*
*/
export function unOrderCancel(id){
return request.post('order/cancel/'+id);
@ -99,7 +99,7 @@ export function unOrderCancel(id){
/**
* 删除已完成订单
* @param string uni
*
*
*/
export function orderDel(id){
return request.post('order/del/'+id);
@ -107,7 +107,7 @@ export function orderDel(id){
/**
* 订单详情
* @param string uni
* @param string uni
*/
export function getOrderDetail(uni){
return request.get('order/detail/'+uni);
@ -115,7 +115,7 @@ export function getOrderDetail(uni){
/**
* 订单详情
* @param string uni
* @param string uni
*/
export function groupOrderDetail(uni){
return request.get('order/group_order_detail/'+uni);
@ -129,7 +129,7 @@ export function getPayOrder(uni){
/**
* 再次下单
* @param string uni
*
*
*/
export function orderAgain(data){
return request.post('user/cart/again',data);
@ -138,7 +138,7 @@ export function orderAgain(data){
/**
* 订单收货
* @param string uni
*
*
*/
export function orderTake(uni){
return request.post('order/take/'+uni);
@ -160,7 +160,7 @@ export function refundOrderExpress(merId,id) {
}
/**
* 获取退款理由
*
*
*/
export function ordeRefundReason(){
return request.get('order/refund/reason');
@ -191,7 +191,7 @@ export function getOrderConfirm(data){
/**
* 获取当前金额能使用的优惠卷
* @param string price
*
*
*/
export function getCouponsOrderPrice(price, data){
return request.get('coupons/order/' + price, data)
@ -325,4 +325,4 @@ export function applyInvoiceApi(id, data){
*/
export function refundCancelApi(id){
return request.post(`refund/cancel/${id}`);
}
}

View File

@ -10,7 +10,10 @@
</view>
</view>
<!--顶部提示-->
<view class="top-tips">请添加你需要的商品进行进货</view>
<view class="top-tips">
请添加你需要的商品进行进货
<view class="record-btn" @click="withGoodsRecord">进货记录</view>
</view>
<!--商品列表-->
<view class="list">
<view class="item" v-for="(item,index) in Object.values(list)" :key="index">
@ -154,7 +157,7 @@ export default {
return spec.cart_num || 0;
},
...mapGetters(['isLogin', 'uid', 'userInfo', 'viewColor','shopToken', 'shopIsLogin', 'shopMerId'])
...mapGetters(['isLogin', 'uid', 'userInfo', 'viewColor', 'shopIsLogin', 'shopMerId'])
},
data() {
return {
@ -540,13 +543,21 @@ export default {
}
//
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 => {
_this.$util.Tips({title: err});
});
},
//
withGoodsRecord(){
uni.navigateTo({
url: '/pages/users/order_list/index?is_with_goods=1'
});
}
},
//
onReachBottom() {
@ -608,6 +619,19 @@ export default {
width: 100%;
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{

View File

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

View File

@ -125,7 +125,7 @@
<text class='money p-color'>{{item.pay_price}}</text>
</view>
<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>
@ -279,6 +279,8 @@
import emptyPage from '@/components/emptyPage.vue';
import { configMap } from '@/utils'
import { HTTP_REQUEST_URL } from '@/config/app';
import {getStoreDetail} from '@/api/store.js';
export default {
components: {
payment,
@ -333,16 +335,20 @@
invoice: {
invoice: 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)
},
computed: {
...mapGetters(['isLogin','uid','viewColor']),
...mapGetters(['isLogin','uid','viewColor', 'shopIsLogin', 'shopMerId']),
...configMap(['hide_mer_status', 'community_status', 'alipay_open', 'yue_pay_status']),
},
watch: {
@ -407,8 +413,14 @@
getUserInfo: function() {
let that = this;
getUserInfo().then(res => {
that.user_balance = res.data.now_money || 0.00;
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) {
this.is_with_goods = options.is_with_goods || 0;
if (options.status) this.orderStatus = options.status;
},
/**
@ -429,7 +442,10 @@
*/
getOrderData: function() {
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);
})
},
@ -458,15 +474,16 @@
});
});
},
/**
* 打开支付组件
*
*/
goPay: function(pay_price, order_id) {
//
goPay: function(item) {
//
if(item.activity_type == 35) this.payMode[2].number = this.mer_balance || 0.00;
else this.payMode[2].number = this.user_balance || 0.00;
//
this.$set(this, 'pay_close', true);
this.order_id = order_id;
this.pay_order_id = order_id.toString()
this.$set(this, 'totalPrice', pay_price);
this.order_id = item.group_order_id;
this.pay_order_id = item.group_order_id.toString()
this.$set(this, 'totalPrice', item.pay_price);
},
/**
* 支付成功回调
@ -586,6 +603,8 @@
groupOrderList({
page: that.page,
limit: that.limit,
is_with_goods: that.is_with_goods || 0,
with_goods_mer_id: that.shopMerId || 0,
}).then(res => {
that.isReady = true;
let list = res.data.list || [];
@ -605,6 +624,8 @@
status: that.orderStatus - 1,
page: that.page,
limit: that.limit,
is_with_goods: that.is_with_goods || 0,
with_goods_mer_id: that.shopMerId || 0,
}).then(res => {
let list = res.data.list || [];
let loadend = list.length < that.limit;