添加:立即进货 - 下单及支付流程
This commit is contained in:
parent
21b1340734
commit
76a1221880
30
api/order.js
30
api/order.js
|
|
@ -10,7 +10,7 @@ export function getCartCounts() {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 获取购物车列表
|
* 获取购物车列表
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export function getCartList() {
|
export function getCartList() {
|
||||||
return request.get("user/cart/lst");
|
return request.get("user/cart/lst");
|
||||||
|
|
@ -41,7 +41,7 @@ export function getOrderList(data){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单产品信息
|
* 订单产品信息
|
||||||
* @param string unique
|
* @param string unique
|
||||||
*/
|
*/
|
||||||
export function orderProduct(orderId){
|
export function orderProduct(orderId){
|
||||||
return request.get('reply/product/'+orderId);
|
return request.get('reply/product/'+orderId);
|
||||||
|
|
@ -50,7 +50,7 @@ export function orderProduct(orderId){
|
||||||
/**
|
/**
|
||||||
* 订单评价
|
* 订单评价
|
||||||
* @param object data
|
* @param object data
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export function orderComment(id,data){
|
export function orderComment(id,data){
|
||||||
return request.post('reply/'+id,data);
|
return request.post('reply/'+id,data);
|
||||||
|
|
@ -74,14 +74,14 @@ export function integralOrderPay(id,data){
|
||||||
/**
|
/**
|
||||||
* 订单统计数据
|
* 订单统计数据
|
||||||
*/
|
*/
|
||||||
export function orderData(){
|
export function orderData(data){
|
||||||
return request.get('order/number')
|
return request.get('order/number',data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单取消
|
* 订单取消
|
||||||
* @param string id
|
* @param string id
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// export function orderCancel(id){
|
// export function orderCancel(id){
|
||||||
// return request.post('order/cancel',{id:id});
|
// return request.post('order/cancel',{id:id});
|
||||||
|
|
@ -90,7 +90,7 @@ export function orderData(){
|
||||||
/**
|
/**
|
||||||
* 未支付订单取消
|
* 未支付订单取消
|
||||||
* @param string id
|
* @param string id
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export function unOrderCancel(id){
|
export function unOrderCancel(id){
|
||||||
return request.post('order/cancel/'+id);
|
return request.post('order/cancel/'+id);
|
||||||
|
|
@ -99,7 +99,7 @@ export function unOrderCancel(id){
|
||||||
/**
|
/**
|
||||||
* 删除已完成订单
|
* 删除已完成订单
|
||||||
* @param string uni
|
* @param string uni
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export function orderDel(id){
|
export function orderDel(id){
|
||||||
return request.post('order/del/'+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){
|
export function getOrderDetail(uni){
|
||||||
return request.get('order/detail/'+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){
|
export function groupOrderDetail(uni){
|
||||||
return request.get('order/group_order_detail/'+uni);
|
return request.get('order/group_order_detail/'+uni);
|
||||||
|
|
@ -129,7 +129,7 @@ export function getPayOrder(uni){
|
||||||
/**
|
/**
|
||||||
* 再次下单
|
* 再次下单
|
||||||
* @param string uni
|
* @param string uni
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export function orderAgain(data){
|
export function orderAgain(data){
|
||||||
return request.post('user/cart/again',data);
|
return request.post('user/cart/again',data);
|
||||||
|
|
@ -138,7 +138,7 @@ export function orderAgain(data){
|
||||||
/**
|
/**
|
||||||
* 订单收货
|
* 订单收货
|
||||||
* @param string uni
|
* @param string uni
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export function orderTake(uni){
|
export function orderTake(uni){
|
||||||
return request.post('order/take/'+uni);
|
return request.post('order/take/'+uni);
|
||||||
|
|
@ -160,7 +160,7 @@ export function refundOrderExpress(merId,id) {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 获取退款理由
|
* 获取退款理由
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export function ordeRefundReason(){
|
export function ordeRefundReason(){
|
||||||
return request.get('order/refund/reason');
|
return request.get('order/refund/reason');
|
||||||
|
|
@ -191,7 +191,7 @@ export function getOrderConfirm(data){
|
||||||
/**
|
/**
|
||||||
* 获取当前金额能使用的优惠卷
|
* 获取当前金额能使用的优惠卷
|
||||||
* @param string price
|
* @param string price
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export function getCouponsOrderPrice(price, data){
|
export function getCouponsOrderPrice(price, data){
|
||||||
return request.get('coupons/order/' + price, data)
|
return request.get('coupons/order/' + price, data)
|
||||||
|
|
@ -325,4 +325,4 @@ export function applyInvoiceApi(id, data){
|
||||||
*/
|
*/
|
||||||
export function refundCancelApi(id){
|
export function refundCancelApi(id){
|
||||||
return request.post(`refund/cancel/${id}`);
|
return request.post(`refund/cancel/${id}`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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{
|
||||||
|
|
|
||||||
|
|
@ -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,45 +422,24 @@
|
||||||
<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
|
import couponListWindow from '@/components/orderCoupon';
|
||||||
} from '@/api/order.js';
|
import addressWindow from '@/components/addressWindow';
|
||||||
import {
|
import orderGoods from '@/components/orderGoods';
|
||||||
getAddressDefault,
|
import checkDelivery from '@/components/checkDelivery/index.vue';
|
||||||
getAddressDetail,
|
import discountDetails from '@/components/discountDetails/index.vue';
|
||||||
getAddressList,
|
import addInvoicing from '@/components/addInvoicing';
|
||||||
getUserInfo,
|
import parser from "@/components/jyf-parser/jyf-parser";
|
||||||
getAgreementApi
|
import {mapGetters} from "vuex";
|
||||||
} from '@/api/user.js';
|
import authorize from '@/components/Authorize';
|
||||||
import {
|
import {configMap} from '@/utils';
|
||||||
openPaySubscribe
|
import {HTTP_REQUEST_URL} from '@/config/app';
|
||||||
} from '@/utils/SubscribeMessage.js';
|
|
||||||
import {
|
export default {
|
||||||
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 {
|
|
||||||
components: {
|
components: {
|
||||||
couponListWindow,
|
couponListWindow,
|
||||||
addressWindow,
|
addressWindow,
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue