添加:文创豆兑换商品

This commit is contained in:
wuhui_zzw 2023-11-30 17:00:11 +08:00
parent 6b280438ed
commit adbd9a9c6a
5 changed files with 68 additions and 24 deletions

View File

@ -520,7 +520,7 @@ export default {
}
this.menu_button.reverse().reverse(); //
console.log(this.menu_button);
// console.log(this.menu_button);
this.show = true;
},
/**

View File

@ -386,11 +386,12 @@ export default {
getAddress() {
$http.get("member.member-address.page", {page: this.page||1}, "获取中").then((response)=> {
if (response.result === 1) {
this.addressData = this.addressData.concat(response.data.data);
let addressData = response.data || response.data.data;
this.addressData = this.addressData.concat(addressData);
this.total_page = response.data.last_page;
this.page = response.data.current_page + 1;
if(response.data.last_page == response.data.current_page) this.finished = false;
let defaultAddress = response.data.data.filter(function(item) {
let defaultAddress = addressData.filter(function(item) {
return item.isdefault === 1;
});
this.defaultAddress = this.defaultAddress.concat(defaultAddress);

View File

@ -828,6 +828,16 @@
</div>
</div>
<div class="price list" v-if="is_legumes_exchange && is_allow_use_legumes_exchange && use_legumes_exchange > 0">
<div class="left ">需要文创豆</div>
<div class="right">
<div class="right">
<span style="color: #e84e40;">{{ use_legumes_exchange }}</span>
</div>
</div>
</div>
<div>
<div class="agreement" v-if="isRent">
<div class="right">
@ -854,6 +864,11 @@
<div style="height: 3.125rem;"></div>
<div class="detail_pay">
<template v-if="is_legumes_exchange == 1">
<div v-if="is_allow_use_legumes_exchange" class="order_delete" :class="{ disabled: yz_subscribe_disabled }" @click="submit">立即兑换</div>
<div v-else class="order_delete" :class="{ disabled: yz_subscribe_disabled }">文创豆不足</div>
</template>
<template v-else>
<ul class="total">
<li class="deposit" v-if="root_tag != 'yzlease'">
<small v-if="isRent">(押金{{ $i18n.t("money") }}{{ goodsInfo.total_deposit }}可退)</small>
@ -864,12 +879,12 @@
>
</li>
</ul>
<div class="order_delete" :class="{ disabled: yz_subscribe_disabled }" @click="submit">
提交订单
<!-- 订阅信息 -->
<yzSubscribe v-on:confirm="confirmSub" v-on:error="errorSub" :tagName="'submit_order'" :styleWidth="'150px'"></yzSubscribe>
</div>
</template>
</div>
<!--自定义表单-->

View File

@ -341,6 +341,10 @@ export default {
},
isRentSetting:false,
storeTable: null,//门店餐桌扫码
is_legumes_exchange: 0,// 是否使用文创豆兑换
is_allow_use_legumes_exchange: 0,// 是否允许使用文创豆兑换
use_legumes_exchange: 0,// 使用的文创豆数量
};
},
@ -356,12 +360,14 @@ export default {
this.initAdress();
},
activated() {
// 判断:当前购买流程是否为文创豆兑换流程
this.is_legumes_exchange = !isNaN(parseInt(this.$route.query.is_legumes_exchange)) ? parseInt(this.$route.query.is_legumes_exchange) : 0;
this.initData();
this.handleQueryData();
if ((this.$route.query.orderShowDate ?? "") !== "") {
this.orderShowDate = this.$route.query.orderShowDate;
}
// 重新计算
if (this.selected == "10") {
// 定位
@ -376,7 +382,6 @@ export default {
})
.catch(err => {});
}
let yz_basic_info = JSON.parse(window.localStorage.getItem("yz_basic_info"));
if (yz_basic_info.plugin_setting.address_code && yz_basic_info.plugin_setting.address_code.enable) {
this.address_codeEnable = true;
@ -1625,6 +1630,7 @@ export default {
}
json = this.handleDataActionBuyUrl(json);
json.is_legumes_exchange = this.is_legumes_exchange;
if (this.$route.query.orderType == "newRetail" && this.$route.query.retail_state == 2) {
json.goods = JSON.parse(this.$route.query.goods) || []; // 自由发货
@ -1726,6 +1732,7 @@ export default {
this.order_other_json = {};
json = this.handleDataActionCartUrl(json);
json.is_legumes_exchange = this.is_legumes_exchange;
$http.get(this.pre_order_url, json, "生成中").then(
response => {
if (response.result === 1) {
@ -2100,6 +2107,10 @@ export default {
},
// 设置界面
setViewData(data, cart_ids) {
this.use_legumes_exchange = data.use_legumes_exchange_total || 0;
this.is_allow_use_legumes_exchange = data.is_allow_exchange || 0;
if (data.discount && data.discount.default_deduction && data.discount.default_deduction != 0) {
// 获取第一次接口默认积分抵扣
this.default_deduction = data.discount.default_deduction;
@ -2592,6 +2603,8 @@ export default {
},
submitBtnPost() {
let json = this.assembleJson();
json.is_legumes_exchange = this.is_legumes_exchange;
if (this.$route.query.tag === "tourAround") {
if (this.orderShowIdCard && this.fun.isTextEmpty(this.idCard)) {
Toast("身份证必填");
@ -2782,7 +2795,9 @@ export default {
invoice: this.invoice_list,
mark: this.$route.query.mark || 0,
dispatch_type_id: this.selected //配送方式 1快递 ||2门店自提||3门店配送送货上门||8自提点
dispatch_type_id: this.selected, //配送方式 1快递 ||2门店自提||3门店配送送货上门||8自提点
is_legumes_exchange: this.is_legumes_exchange,
};
// 分销活动页面购买的商品带活动id
if (this.$route.query.activity_id) {

View File

@ -54,7 +54,7 @@
<span class="need-num">{{ item.use_legumes }}</span>文创豆
</div>
</div>
<div v-if="item.is_allow_exchange" class="g-f-btn">立即兑换</div>
<div v-if="item.is_allow_exchange" class="g-f-btn" @click="exchangeGoods(item)">立即兑换</div>
<div v-else class="g-f-btn not-click">文创豆不足</div>
</div>
</div>
@ -410,6 +410,18 @@ export default {
console.log(error);
});
},
//
exchangeGoods(item){
console.log('商品信息',item);
let json_data = {
goodsId: item.goods_id,
optionsId: 0,
total: "1",
tag: "-2",
is_legumes_exchange: 1,//
};
this.$router.push(this.fun.getUrl("goodsorder", {}, json_data));
},
/****** 第三方代发相关操作 ********************/
//
thirdPartyBankCardInfo(is_show = true){
@ -431,6 +443,7 @@ export default {
let day = start.slice(6, 8);
_this.selectedTime = new Date(year, month, day).getTime();
}
_this.$forceUpdate();
}
})
.catch(error => {