新增自提

This commit is contained in:
2020-09-01 10:39:59 +08:00
parent 840ba58aa6
commit 89cf7b96db
7 changed files with 63 additions and 32 deletions

View File

@@ -107,9 +107,15 @@ export default {
deliveryList: [{
text: '快递',
value: 'express',
disabled: false,
}, {
text: '骑手',
value: 'takeawayer',
disabled: false,
}, {
text: '自提',
value: 'selfraising',
disabled: false,
}],
delivery: {
text: '快递',
@@ -123,6 +129,7 @@ export default {
goodsClass: [],
orderType: '', // 订单类型 1 普通订单 2 拼团订单 3 秒杀订单 4 优惠券 5 购物车订单
debounce: true,
is_selfraising: 0, // 是否自提0=》否1=》是
}
},
components: {
@@ -148,6 +155,8 @@ export default {
onLoad(option) {
this.orderType = this.$store.state.orderType;
this.orderInfo = this.$store.state.orderInfo;
// 判断是否可选自提
if(!this.orderInfo.is_selfraising) this.deliveryList[2].disabled = true;
// console.log('orderType' + this.orderType);
// console.log(this.orderInfo);
this.getGoodsClass();
@@ -182,8 +191,10 @@ export default {
// console.log(this.orderInfo);
// console.log(this.$store.state.pintuangroup_headid);
if(this.orderInfo.pintuangroup_id) {
Object.assign(params, { pintuangroup_headid: this.$store.state.pintuangroup_headid });
Object.assign(params, { pintuangroup_id: this.orderInfo.pintuangroup_id });
Object.assign(params, {
pintuangroup_headid: this.$store.state.pintuangroup_headid,
pintuangroup_id: this.orderInfo.pintuangroup_id
});
}
console.log(params);
this.$u.api.withImmediate(params).then(res => {
@@ -249,6 +260,7 @@ export default {
cart_id: id,
address_id: this.addressInfo.address_id,
buy_city_id: this.addressInfo.city_id,
is_selfraising: this.is_selfraising,
}
if(coupon.length) Object.assign(params, { voucher_id: coupon });
if(this.orderType == 2) {
@@ -262,10 +274,9 @@ export default {
type: 'redirect',
url: '/pageC/cart/cashier',
params: {
ifcart: params.ifcart,
pay_sn: res.data.pay_sn,
price: res.data.order_total_amount,
order_id: res.data.order_list[0].order_id,
order_id: res.data.order_list[0].order_id,
}
})
} else {
@@ -282,13 +293,8 @@ export default {
this.couponStatus = true;
},
useCoupon(coupon) {
console.log(coupon)
// console.log(coupon)
if(this.couponType.type == 1){
this.choiceCoupon = {}
for(let i in this.orderInfo.store_voucher_all_list){
if(this.orderInfo.store_voucher_all_list[i].voucher_id == coupon.voucher_id && !this.orderInfo.store_voucher_all_list[i].sel){
@@ -338,23 +344,23 @@ export default {
const goods = this.orderInfo.store_goods_total;
let [freight, price, minPrice] = [0, 0, 0];
// 运费
for (const key in this.freight) {
if (this.freight.hasOwnProperty(key)) {
for(const key in this.freight) {
if(this.freight.hasOwnProperty(key)) {
const element = this.freight[key];
freight += Number(element);
}
}
// 商品价格减去优惠券
// 店铺
for (const gid in goods) {
if (goods.hasOwnProperty(gid)) {
for(const gid in goods) {
if(goods.hasOwnProperty(gid)) {
// 计算最小价格
minPrice += 0.01;
// 每个店铺所有商品的价格
let sprice = Number(goods[gid]);
if(JSON.stringify(this.storeCoupon) != '{}') {
for (const cid in this.storeCoupon) {
if (this.storeCoupon.hasOwnProperty(cid)) {
for(const cid in this.storeCoupon) {
if(this.storeCoupon.hasOwnProperty(cid)) {
const cprice = this.storeCoupon[cid];
// 商品减去优惠券价格
if(gid == cid) {
@@ -378,13 +384,31 @@ export default {
// console.log("price:" + price);
this.totalPrice = (price + freight).toFixed(2);
},
setDelivery(index) {
async setDelivery(index) {
// console.log(index);
if(index == 2) {
this.is_selfraising = 1;
for (const key in this.freight) {
if (this.freight.hasOwnProperty(key)) {
this.freight[key] = '0.00';
}
}
this.isTakeawayer = false;
this.setTotalPrice(); // 计算总价
this.delivery = this.deliveryList[index];
} else {
this.is_selfraising = 0;
}
if(index == 1) {
if(!this.isTakeawayer) this.$u.toast('此地区不支持骑手配送');
return false;
this.delivery = this.deliveryList[index];
this.getFreight();
}
if(index == 0) {
this.delivery = this.deliveryList[index];
this.getFreight();
}
this.delivery = this.deliveryList[index];
this.getFreight();
},
settlement() {
uni.navigateTo({
@@ -471,7 +495,7 @@ export default {
height: 60rpx;
border-radius: 50%;
margin-right: 15rpx;
background-color: aquamarine;
// background-color: aquamarine;
}
> view {
font-size: 28rpx;
@@ -479,6 +503,7 @@ export default {
margin-right: 15rpx;
}
.right {
margin-left: auto;
flex-shrink: 0;
width: 11rpx;
height: 22rpx;
@@ -496,7 +521,7 @@ export default {
width: 180rpx;
height: 160rpx;
border-radius: 10rpx;
background-color: aqua;
// background-color: aqua;
flex-shrink: 0;
}
.info {