订单添加备注

This commit is contained in:
2020-09-11 11:24:05 +08:00
parent 83afd6216e
commit eedb40b9d0
5 changed files with 213 additions and 17 deletions

View File

@@ -34,24 +34,29 @@
</view>
</view>
<view class="order-info">
<view @click="showCoupon({type: 2, store_id: item[0].store_id})" v-if="orderType == 1 || orderType == 5">
<view class="show-view" @click="showCoupon({type: 2, store_id: item[0].store_id})" v-if="orderType == 1 || orderType == 5">
<view class="title">优惠券折扣</view>
<view class="value">
<view>-{{ storeCoupon[item[0].store_id] ? storeCoupon[item[0].store_id].voucher_price.toFixed(2) : '0.00' }}</view>
<image src="../static/image/1.png"></image>
</view>
</view>
<view>
<view class="show-view">
<view class="title">运费</view>
<view class="value">
<view v-if="freight">{{ freight | setFreight(index) }}</view>
</view>
</view>
<view class="remark">
<view class="title">订单备注</view>
<u-input v-model="remark[index]" type="textarea" :height="88" placeholder="选填" />
</view>
</view>
<view class="pick-up" v-if="delivery.type == 3">
<view class="title">自提地址</view>
<view class="content">{{ orderInfo.store_list[index].store_address }}</view>
</view>
<view class="store-total">{{ item | getTotalNum }} 小计<text>{{ orderInfo.store_goods_total[index] | getStorePrice(storeCoupon, index) }}</text></view>
</view>
</view>
<view class="common-active">
@@ -146,12 +151,34 @@ export default {
orderType: '', // 订单类型 1 普通订单 2 拼团订单 3 秒杀订单 4 优惠券 5 购物车订单
debounce: true,
hasInvoice: 0,
remark: {}
}
},
components: {
Coupon
},
filters: {
// 店铺总数量
getTotalNum(data, coupon) {
let num = 0;
data.forEach(item => {
num += item.goods_num;
})
return num;
},
// 店铺总金额
getStorePrice(price, coupon, index) {
for (const key in coupon) {
if (coupon.hasOwnProperty(key)) {
const element = coupon[key];
if(index == key) {
price -= Number(element.voucher_price);
}
}
}
return price;
},
// 订单总数量
setTotalNumber(data) {
let num = 0;
for (const key in data) {
@@ -175,6 +202,7 @@ export default {
if(!this.orderInfo.is_selfraising) this.deliveryList[2].disabled = true;
// console.log('orderType' + this.orderType);
// console.log(this.orderInfo);
this.initRemark();
this.getGoodsClass();
this.setTotalPrice();
},
@@ -188,8 +216,9 @@ export default {
} else {
if(this.$store.getters.getOrderAddress) this.addressInfo = this.$store.state.orderAddress;
}
// 是否开发票
this.hasInvoice = this.$store.getters.hasInvoice;
console.log(this.hasInvoice);
// console.log(this.hasInvoice);
},
beforeDestroy() {
this.$store.commit('updateAddress', {});
@@ -202,6 +231,17 @@ export default {
},
},
methods: {
initRemark() {
// 初始化备注
const obj = this.orderInfo.store_cart_list;
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
const element = obj[key];
this.remark[key] = '';
}
}
console.log(this.remark);
},
// 如果有pintuangroup_headid为参团不然为开团
async withImmediate(type) {
let params = {
@@ -228,6 +268,7 @@ export default {
})
},
intermediate() {
console.log(this.remark);
if(!this.debounce) return;
this.debounce = false;
if(this.orderType == 2) {
@@ -281,6 +322,7 @@ export default {
buy_city_id: this.addressInfo.city_id,
member_deliver_type: this.delivery.type,
invoice_id: this.$store.getters.getInvoiceId, // 发票抬头ID不开票传0
pay_message: this.remark,
}
if(coupon.length) Object.assign(params, { voucher_id: coupon });
if(this.orderType == 2) {
@@ -288,6 +330,7 @@ export default {
if(this.orderInfo.pintuangroup_id) Object.assign(params, { pintuangroup_id: this.orderInfo.pintuangroup_id });
}
// console.log(params);
// return;
this.$u.api.sendOrder(params).then(res => {
if(res.errCode == 0) {
this.$u.route({
@@ -587,7 +630,7 @@ export default {
}
}
.order-info {
> view {
.show-view {
height: 98rpx;
background: rgba(255,255,255,1);
padding: 35rpx 30rpx;
@@ -612,6 +655,24 @@ export default {
}
}
}
.remark {
background: rgba(255,255,255,1);
padding: 35rpx 30rpx;
display: flex;
justify-content: space-between;
margin-bottom: 2rpx;
.title {
font-size: 28rpx;
color: rgba(102,102,102,1);
margin-right: 20rpx;
}
/deep/ .u-input {
font-size: 28rpx;
.u-input__textarea {
padding: 0;
}
}
}
}
.pick-up {
padding: 30rpx;
@@ -627,6 +688,16 @@ export default {
line-height: 40rpx;
}
}
.store-total {
text-align: right;
padding: 34rpx 30rpx;
background: rgba(255,255,255,1);
font-size: 28rpx;
color: #656565;
> text {
color: #FF770F;
}
}
}
}
.common-active {