commit
eb5816ff80
|
@ -199,13 +199,18 @@ export default {
|
||||||
skuId: this.skuDetail.id
|
skuId: this.skuDetail.id
|
||||||
};
|
};
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
console.log(11111111);
|
||||||
addCartGoods(params).then(res => {
|
addCartGoods(params).then(res => {
|
||||||
|
debugger;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$router.push({path: '/shoppingCart', query: {detail: this.skuDetail, count: this.count}});
|
this.$router.push({path: '/shoppingCart', query: {detail: this.skuDetail, count: this.count}});
|
||||||
} else {
|
} else {
|
||||||
this.$Message.warning(res.message);
|
this.$Message.warning(res.message);
|
||||||
}
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
console.log('catch');
|
||||||
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
buyNow () { // 立即购买
|
buyNow () { // 立即购买
|
||||||
|
@ -222,6 +227,8 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.$Message.warning(res.message);
|
this.$Message.warning(res.message);
|
||||||
}
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
this.loading1 = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
pointPay () { // 积分购买
|
pointPay () { // 积分购买
|
||||||
|
|
|
@ -11,42 +11,37 @@
|
||||||
</div> -->
|
</div> -->
|
||||||
<!-- 普通发票 -->
|
<!-- 普通发票 -->
|
||||||
<div class="nav-content">
|
<div class="nav-content">
|
||||||
<Form
|
<Form :model="invoiceForm" ref="form" label-position="left" :rules="ruleInline" :label-width="110">
|
||||||
:model="invoiceForm"
|
|
||||||
ref="form"
|
|
||||||
label-position="left"
|
|
||||||
:rules="ruleInline"
|
|
||||||
:label-width="110"
|
|
||||||
>
|
|
||||||
<FormItem label="发票类型">
|
<FormItem label="发票类型">
|
||||||
<RadioGroup v-model="invoiceForm.type" type="button" button-style="solid">
|
<RadioGroup v-model="invoice" type="button" button-style="solid">
|
||||||
|
<Radio @on-change="changeInvoice" :label="1">电子普通发票</Radio>
|
||||||
|
<Radio :label="2" :disabled="true">增值税专用发票</Radio>
|
||||||
|
</RadioGroup>
|
||||||
|
</FormItem>
|
||||||
|
<FormItem label="发票抬头">
|
||||||
|
<RadioGroup v-model="type" @on-change="changeInvoice" type="button" button-style="solid">
|
||||||
<Radio :label="1">个人</Radio>
|
<Radio :label="1">个人</Radio>
|
||||||
<Radio :label="2">单位</Radio>
|
<Radio :label="2">单位</Radio>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem
|
<FormItem label="个人名称" v-if="type === 1" prop="receiptTitle">
|
||||||
label="发票抬头"
|
|
||||||
v-if="invoiceForm.type == 2"
|
|
||||||
prop="receiptTitle"
|
|
||||||
>
|
|
||||||
<i-input v-model="invoiceForm.receiptTitle"></i-input>
|
<i-input v-model="invoiceForm.receiptTitle"></i-input>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem
|
<FormItem label="单位名称" v-if="type === 2" prop="receiptTitle">
|
||||||
label="纳税人识别号"
|
<i-input v-model="invoiceForm.receiptTitle"></i-input>
|
||||||
v-if="invoiceForm.type == 2"
|
</FormItem>
|
||||||
prop="taxpayerId"
|
<FormItem label="纳税人识别号" v-if="type === 2" prop="taxpayerId">
|
||||||
>
|
|
||||||
<i-input v-model="invoiceForm.taxpayerId"></i-input>
|
<i-input v-model="invoiceForm.taxpayerId"></i-input>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="发票内容">
|
<FormItem label="发票内容">
|
||||||
<RadioGroup v-model="invoiceForm.receiptContent" type="button" button-style="solid">
|
<RadioGroup v-model="invoiceForm.receiptContent" type="button" button-style="solid">
|
||||||
<Radio label="不开发票">不开发票</Radio>
|
|
||||||
<Radio label="商品明细">商品明细</Radio>
|
<Radio label="商品明细">商品明细</Radio>
|
||||||
|
<Radio label="商品类别">商品类别</Radio>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</Form>
|
</Form>
|
||||||
<div style="text-align: center">
|
<div style="text-align: center">
|
||||||
<Button type="primary" :loading="loading" @click="save">保存发票信息</Button>
|
<Button type="primary" :loading="loading" @click="submit">保存发票信息</Button>
|
||||||
<Button type="default" @click="invoiceAvailable = false">取消</Button>
|
<Button type="default" @click="invoiceAvailable = false">取消</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -54,20 +49,21 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { saveReceipt } from '@/api/member.js';
|
import { receiptSelect } from '@/api/cart.js';
|
||||||
import { TINumber } from '@/plugins/RegExp.js';
|
import { TINumber } from '@/plugins/RegExp.js';
|
||||||
export default {
|
export default {
|
||||||
name: 'invoiceModal',
|
name: 'invoiceModal',
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
invoice: 1,
|
||||||
invoiceAvailable: false, // 模态框显隐
|
invoiceAvailable: false, // 模态框显隐
|
||||||
loading: false, // 提交状态
|
loading: false, // 提交状态
|
||||||
invoiceForm: { // 发票表单
|
invoiceForm: {
|
||||||
|
// 发票表单
|
||||||
// 普票表单
|
// 普票表单
|
||||||
receiptTitle: '', // 发票抬头
|
receiptTitle: '', // 发票抬头
|
||||||
taxpayerId: '', // 纳税人识别号
|
taxpayerId: '', // 纳税人识别号
|
||||||
receiptContent: '不开发票', // 发票内容
|
receiptContent: '商品明细', // 发票内容
|
||||||
type: 1 // 1 个人 2 单位
|
|
||||||
},
|
},
|
||||||
type: 1, // 1 个人 2 单位
|
type: 1, // 1 个人 2 单位
|
||||||
ruleInline: {
|
ruleInline: {
|
||||||
|
@ -78,63 +74,76 @@ export default {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: ["invoiceData"],
|
props: ['invoiceData'],
|
||||||
watch: {
|
watch: {
|
||||||
invoiceData: {
|
invoiceData: {
|
||||||
handler(val) {
|
handler (val) {
|
||||||
this.invoiceForm = { ...val };
|
this.invoiceForm = { ...val };
|
||||||
|
|
||||||
if (flag) {
|
if (val.taxpayerId) {
|
||||||
let params = {
|
this.type = 2;
|
||||||
receiptTitle: '个人',
|
} else {
|
||||||
receiptContent: this.invoiceForm.receiptContent
|
this.type = 1;
|
||||||
};
|
|
||||||
this.loading = true;
|
|
||||||
saveReceipt(params)
|
|
||||||
.then((res) => {
|
|
||||||
this.loading = false;
|
|
||||||
if (res.success) {
|
|
||||||
this.$emit('change', res.result);
|
|
||||||
this.invoiceAvailable = false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
this.loading = false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else {
|
},
|
||||||
// 单位
|
deep: true,
|
||||||
|
immeadite: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/**
|
||||||
|
* 选择发票抬头
|
||||||
|
*/
|
||||||
|
changeInvoice (val) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.type = val;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存判断
|
||||||
|
*/
|
||||||
|
save () {
|
||||||
|
let flage = true;
|
||||||
|
|
||||||
|
// 保存分为两种类型,个人以及企业
|
||||||
|
const { type, receiptTitle, receiptContent } = JSON.parse(
|
||||||
|
JSON.stringify(this.invoiceForm)
|
||||||
|
);
|
||||||
|
|
||||||
|
// 判断是否填写发票抬头
|
||||||
|
if (!receiptTitle) {
|
||||||
|
this.$Message.error('请填写发票抬头!');
|
||||||
|
flage = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === 2) {
|
||||||
this.$refs.form.validate((valid) => {
|
this.$refs.form.validate((valid) => {
|
||||||
if (valid) {
|
if (!valid) {
|
||||||
this.loading = true;
|
flage = false;
|
||||||
let params = {
|
|
||||||
receiptTitle: this.invoiceForm.receiptTitle,
|
|
||||||
taxpayerId: this.invoiceForm.taxpayerId,
|
|
||||||
receiptContent: this.invoiceForm.receiptContent
|
|
||||||
};
|
|
||||||
let flag = true;
|
|
||||||
this.receiptItems.forEach((e) => {
|
|
||||||
if (e.taxpayerId === params.taxpayerId) {
|
|
||||||
flag = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (!flag) {
|
|
||||||
this.$Message.error('已有当前税号的发票信息,请直接选择已有发票');
|
|
||||||
} else {
|
|
||||||
saveReceipt(params)
|
|
||||||
.then((res) => {
|
|
||||||
this.loading = false;
|
|
||||||
if (res.success) {
|
|
||||||
this.$emit('change', res.result);
|
|
||||||
this.invoiceAvailable = false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
this.loading = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
delete this.invoiceForm.taxpayerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
return flage;
|
||||||
|
},
|
||||||
|
|
||||||
|
async submit () {
|
||||||
|
if (this.save()) {
|
||||||
|
this.loading = true;
|
||||||
|
let submit = {
|
||||||
|
way: this.$route.query.way,
|
||||||
|
...this.invoiceForm
|
||||||
|
};
|
||||||
|
let receipt = await receiptSelect(submit);
|
||||||
|
if (receipt.success) {
|
||||||
|
this.$emit('change', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.loading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,6 @@ export default {
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
this.getGoodsDetail();
|
this.getGoodsDetail();
|
||||||
|
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -108,7 +108,7 @@ export default {
|
||||||
this.pageNumber = 1;
|
this.pageNumber = 1;
|
||||||
this.params.pageSize = val;
|
this.params.pageSize = val;
|
||||||
this.getList()
|
this.getList()
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -132,10 +132,10 @@ export default {
|
||||||
color: $theme_color;
|
color: $theme_color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.selected-cate{
|
.selected-cate{
|
||||||
color: $theme_color;
|
color: $theme_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
.page-size {
|
.page-size {
|
||||||
width: 1200px;
|
width: 1200px;
|
||||||
|
|
|
@ -4,15 +4,23 @@
|
||||||
<!-- LOGO 步骤条 -->
|
<!-- LOGO 步骤条 -->
|
||||||
<div class="width_1200 logo">
|
<div class="width_1200 logo">
|
||||||
<div>
|
<div>
|
||||||
<router-link to="/"><img :src="logoImg" alt="lili shop" title="lilishop"></router-link>
|
<router-link to="/"
|
||||||
|
><img :src="logoImg" alt="lili shop" title="lilishop"
|
||||||
|
/></router-link>
|
||||||
<div>结算页</div>
|
<div>结算页</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cart-steps">
|
<div class="cart-steps">
|
||||||
<span :class="stepIndex==1?'active':''">1.我的购物车</span>
|
<span :class="stepIndex == 1 ? 'active' : ''">1.我的购物车</span>
|
||||||
<Icon :class="stepIndex==1?'active-arrow':''" custom="icomoon icon-next"></Icon>
|
<Icon
|
||||||
<span :class="stepIndex==1?'active':''">2.填写订单信息</span>
|
:class="stepIndex == 1 ? 'active-arrow' : ''"
|
||||||
<Icon :class="stepIndex==1?'active-arrow':''" custom="icomoon icon-next"></Icon>
|
custom="icomoon icon-next"
|
||||||
<span :class="stepIndex==2?'active':''">3.成功提交订单</span>
|
></Icon>
|
||||||
|
<span :class="stepIndex == 1 ? 'active' : ''">2.填写订单信息</span>
|
||||||
|
<Icon
|
||||||
|
:class="stepIndex == 1 ? 'active-arrow' : ''"
|
||||||
|
custom="icomoon icon-next"
|
||||||
|
></Icon>
|
||||||
|
<span :class="stepIndex == 2 ? 'active' : ''">3.成功提交订单</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Divider />
|
<Divider />
|
||||||
|
@ -24,18 +32,35 @@
|
||||||
<span @click="goAddressManage">管理收货人地址</span>
|
<span @click="goAddressManage">管理收货人地址</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="address-manage">
|
<div class="address-manage">
|
||||||
<div class="address-item" v-show="moreAddr ? true : index < 3" :class="selectedAddress.id === item.id?'border-red':''" @mouseenter="showEditBtn = index" @mouseleave="showEditBtn = ''"
|
<div
|
||||||
@click="selectAddress(item)" v-for="(item,index) in addressList" :key="index">
|
class="address-item"
|
||||||
|
v-show="moreAddr ? true : index < 3"
|
||||||
|
:class="selectedAddress.id === item.id ? 'border-red' : ''"
|
||||||
|
@mouseenter="showEditBtn = index"
|
||||||
|
@mouseleave="showEditBtn = ''"
|
||||||
|
@click="selectAddress(item)"
|
||||||
|
v-for="(item, index) in addressList"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
<div>
|
<div>
|
||||||
<span>{{item.name}}</span>
|
<span>{{ item.name }}</span>
|
||||||
<Tag class="ml_10" v-if="item.isDefault" color="red">默认</Tag>
|
<Tag class="ml_10" v-if="item.isDefault" color="red">默认</Tag>
|
||||||
<Tag class="ml_10" v-if="item.alias" color="warning">{{item.alias}}</Tag>
|
<Tag class="ml_10" v-if="item.alias" color="warning">{{
|
||||||
|
item.alias
|
||||||
|
}}</Tag>
|
||||||
|
</div>
|
||||||
|
<div>{{ item.mobile }}</div>
|
||||||
|
<div>
|
||||||
|
{{ item.consigneeAddressPath | unitAddress }} {{ item.detail }}
|
||||||
</div>
|
</div>
|
||||||
<div>{{item.mobile}}</div>
|
|
||||||
<div>{{ item.consigneeAddressPath | unitAddress }} {{item.detail}}</div>
|
|
||||||
<div class="edit-btn" v-show="showEditBtn === index">
|
<div class="edit-btn" v-show="showEditBtn === index">
|
||||||
<span @click.stop="editAddress(item.id)">修改</span>
|
<span @click.stop="editAddress(item.id)">修改</span>
|
||||||
<span class="ml_10" v-if="!item.isDefault" @click.stop="delAddress(item)">删除</span>
|
<span
|
||||||
|
class="ml_10"
|
||||||
|
v-if="!item.isDefault"
|
||||||
|
@click.stop="delAddress(item)"
|
||||||
|
>删除</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="corner-icon" v-show="selectedAddress.id === item.id">
|
<div class="corner-icon" v-show="selectedAddress.id === item.id">
|
||||||
<div></div>
|
<div></div>
|
||||||
|
@ -48,8 +73,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="more-addr" @click="moreAddr = !moreAddr" v-if="addressList.length>3">
|
<div
|
||||||
{{moreAddr ? '收起地址' : '更多地址'}}
|
class="more-addr"
|
||||||
|
@click="moreAddr = !moreAddr"
|
||||||
|
v-if="addressList.length > 3"
|
||||||
|
>
|
||||||
|
{{ moreAddr ? "收起地址" : "更多地址" }}
|
||||||
<Icon v-show="!moreAddr" type="md-arrow-dropdown" />
|
<Icon v-show="!moreAddr" type="md-arrow-dropdown" />
|
||||||
<Icon v-show="moreAddr" type="md-arrow-dropup" />
|
<Icon v-show="moreAddr" type="md-arrow-dropup" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -60,10 +89,17 @@
|
||||||
<span>商品信息</span>
|
<span>商品信息</span>
|
||||||
<span @click="$router.push('/cart')">返回购物车</span>
|
<span @click="$router.push('/cart')">返回购物车</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="goods-msg" v-for="(shop,shopIndex) in goodsList" :key="shopIndex">
|
<div
|
||||||
|
class="goods-msg"
|
||||||
|
v-for="(shop, shopIndex) in goodsList"
|
||||||
|
:key="shopIndex"
|
||||||
|
>
|
||||||
<div class="shop-name">
|
<div class="shop-name">
|
||||||
<span>
|
<span>
|
||||||
<span class="hover-color" @click="goShopPage(shop.storeId)">{{shop.storeName}}</span>
|
<span class="hover-color" @click="goShopPage(shop.storeId)">{{
|
||||||
|
shop.storeName
|
||||||
|
}}</span
|
||||||
|
>
|
||||||
</span>
|
</span>
|
||||||
<!-- <span>
|
<!-- <span>
|
||||||
<p style="width:120px">配送方式:</p>
|
<p style="width:120px">配送方式:</p>
|
||||||
|
@ -73,33 +109,60 @@
|
||||||
</span> -->
|
</span> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="goods-list">
|
<div class="goods-list">
|
||||||
<div class="goods-item" v-for="(goods,goodsIndex) in shop.skuList" :key="goodsIndex">
|
<div
|
||||||
<span class="hover-color" @click="goGoodsDetail(goods.goodsSku.id, goods.goodsSku.goodsId)">
|
class="goods-item"
|
||||||
<img :src="goods.goodsSku.thumbnail" alt="">
|
v-for="(goods, goodsIndex) in shop.skuList"
|
||||||
<span style="vertical-align:top;">{{goods.goodsSku.goodsName}}</span>
|
:key="goodsIndex"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="hover-color"
|
||||||
|
@click="
|
||||||
|
goGoodsDetail(goods.goodsSku.id, goods.goodsSku.goodsId)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<img :src="goods.goodsSku.thumbnail" alt="" />
|
||||||
|
<span style="vertical-align: top">{{
|
||||||
|
goods.goodsSku.goodsName
|
||||||
|
}}</span>
|
||||||
</span>
|
</span>
|
||||||
<span class="goods-price">{{goods.goodsSku.price | unitPrice('¥')}}</span>
|
<span class="goods-price">{{
|
||||||
<span>x{{goods.num}}</span>
|
goods.goodsSku.price | unitPrice("¥")
|
||||||
<span>{{goods.goodsSku.quantity > 0 ? '有货' : '无货'}}</span>
|
}}</span>
|
||||||
<span class="goods-price">{{goods.goodsSku.price * goods.num | unitPrice('¥')}}</span>
|
<span>x{{ goods.num }}</span>
|
||||||
|
<span>{{ goods.goodsSku.quantity > 0 ? "有货" : "无货" }}</span>
|
||||||
|
<span class="goods-price">{{
|
||||||
|
(goods.goodsSku.price * goods.num) | unitPrice("¥")
|
||||||
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="order-mark">
|
<div class="order-mark">
|
||||||
<Input type="textarea" maxlength="60" v-model="shop.remark" show-word-limit placeholder="订单备注" />
|
<Input
|
||||||
<span style="font-size:12px;color:#999;">提示:请勿填写有关支付、收货、发票方面的信息</span>
|
type="textarea"
|
||||||
|
maxlength="60"
|
||||||
|
v-model="shop.remark"
|
||||||
|
show-word-limit
|
||||||
|
placeholder="订单备注"
|
||||||
|
/>
|
||||||
|
<span style="font-size: 12px; color: #999"
|
||||||
|
>提示:请勿填写有关支付、收货、发票方面的信息</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 发票信息 -->
|
<!-- 发票信息 -->
|
||||||
<div class="invoice">
|
<div class="invoice">
|
||||||
<div class="card-head mt_20 mb_20">
|
<div class="card-head mt_20 mb_20">
|
||||||
<span class="relative">发票信息<span class="inv-tips">
|
<span class="relative"
|
||||||
<Icon type="ios-alert-outline" />开企业抬头发票须填写纳税人识别号,以免影响报销
|
>发票信息<span class="inv-tips">
|
||||||
</span></span>
|
<Icon
|
||||||
|
type="ios-alert-outline"
|
||||||
|
/>开企业抬头发票须填写纳税人识别号,以免影响报销
|
||||||
|
</span></span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="inovice-content">
|
<div class="inovice-content">
|
||||||
<span>{{invoiceData.receiptTitle}}</span>
|
<span>{{ invoiceData.receiptTitle }}</span>
|
||||||
<span>{{invoiceData.receiptContent}}</span>
|
<span>{{ invoiceData.receiptContent }}</span>
|
||||||
<span @click="editInvoice">编辑</span>
|
<span @click="editInvoice">编辑</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -108,24 +171,49 @@
|
||||||
<div class="card-head mt_20 mb_20">
|
<div class="card-head mt_20 mb_20">
|
||||||
<span class="relative">优惠券</span>
|
<span class="relative">优惠券</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="couponList.length === 0">
|
<div v-if="couponList.length === 0">无可用优惠券</div>
|
||||||
无可用优惠券
|
|
||||||
</div>
|
|
||||||
<ul v-else class="coupon-list">
|
<ul v-else class="coupon-list">
|
||||||
<li v-for="(item, index) in couponList" class="coupon-item" :key="index">
|
<li
|
||||||
|
v-for="(item, index) in couponList"
|
||||||
|
class="coupon-item"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
<div class="c-left">
|
<div class="c-left">
|
||||||
<div>
|
<div>
|
||||||
<span v-if="item.couponType === 'PRICE'" class="fontsize_12 global_color">¥<span class="price">{{item.price | unitPrice}}</span></span>
|
<span
|
||||||
<span v-if="item.couponType === 'DISCOUNT'" class="fontsize_12 global_color"><span class="price">{{item.couponDiscount}}</span>折</span>
|
v-if="item.couponType === 'PRICE'"
|
||||||
<span class="describe">满{{item.consumeThreshold}}元可用</span>
|
class="fontsize_12 global_color"
|
||||||
|
>¥<span class="price">{{
|
||||||
|
item.price | unitPrice
|
||||||
|
}}</span></span
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
v-if="item.couponType === 'DISCOUNT'"
|
||||||
|
class="fontsize_12 global_color"
|
||||||
|
><span class="price">{{ item.couponDiscount }}</span
|
||||||
|
>折</span
|
||||||
|
>
|
||||||
|
<span class="describe"
|
||||||
|
>满{{ item.consumeThreshold }}元可用</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<p>使用范围:{{useScope(item.scopeType)}}</p>
|
<p>使用范围:{{ useScope(item.scopeType) }}</p>
|
||||||
<p>有效期:{{item.endTime}}</p>
|
<p>有效期:{{ item.endTime }}</p>
|
||||||
</div>
|
</div>
|
||||||
<img class="used" v-if="usedCouponId.includes(item.id)" src="../../assets/images/geted.png" alt="">
|
<img
|
||||||
|
class="used"
|
||||||
|
v-if="usedCouponId.includes(item.id)"
|
||||||
|
src="../../assets/images/geted.png"
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
<b></b>
|
<b></b>
|
||||||
<a class="c-right" @click="useCoupon(item.id, true)">立即使用</a>
|
<a class="c-right" @click="useCoupon(item.id, true)">立即使用</a>
|
||||||
<a class="c-right" v-if="usedCouponId.includes(item.id)" @click="useCoupon(item.id, false)">放弃优惠</a>
|
<a
|
||||||
|
class="c-right"
|
||||||
|
v-if="usedCouponId.includes(item.id)"
|
||||||
|
@click="useCoupon(item.id, false)"
|
||||||
|
>放弃优惠</a
|
||||||
|
>
|
||||||
<i class="circle-top"></i>
|
<i class="circle-top"></i>
|
||||||
<i class="circle-bottom"></i>
|
<i class="circle-bottom"></i>
|
||||||
</li>
|
</li>
|
||||||
|
@ -138,81 +226,116 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<span>使用积分:</span><Input type="text" style="width:100px;" v-model.number="otherMsgForm.point" placeholder="请输入使用积分" /> <span style="color:#999;">您当前的可用积分为 {{otherMsgForm.totalPoint}}
|
<span>使用积分:</span
|
||||||
,本订单最多可以使用{{otherMsgForm.availablePoint}}</span>
|
><Input
|
||||||
|
type="text"
|
||||||
|
style="width: 100px"
|
||||||
|
v-model.number="otherMsgForm.point"
|
||||||
|
placeholder="请输入使用积分"
|
||||||
|
/>
|
||||||
|
<span style="color: #999"
|
||||||
|
>您当前的可用积分为
|
||||||
|
{{ otherMsgForm.totalPoint }} ,本订单最多可以使用{{
|
||||||
|
otherMsgForm.availablePoint
|
||||||
|
}}</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 订单价格 -->
|
<!-- 订单价格 -->
|
||||||
<div class="order-price">
|
<div class="order-price">
|
||||||
<div>
|
<div>
|
||||||
<span>{{totalNum}}件商品,总商品金额:</span><span>{{priceDetailDTO.goodsPrice | unitPrice('¥')}}</span>
|
<span>{{ totalNum }}件商品,总商品金额:</span
|
||||||
|
><span>{{ priceDetailDTO.goodsPrice | unitPrice("¥") }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span>运费:</span><span>{{ priceDetailDTO.freightPrice | unitPrice('¥')}}</span>
|
<span>运费:</span
|
||||||
|
><span>{{ priceDetailDTO.freightPrice | unitPrice("¥") }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span>优惠金额:</span><span>-{{ priceDetailDTO.discountPrice + priceDetailDTO.couponPrice + priceDetailDTO.updatePrice | unitPrice('¥')}}</span>
|
<span>优惠金额:</span
|
||||||
|
><span
|
||||||
|
>-{{
|
||||||
|
(priceDetailDTO.discountPrice +
|
||||||
|
priceDetailDTO.couponPrice +
|
||||||
|
priceDetailDTO.updatePrice)
|
||||||
|
| unitPrice("¥")
|
||||||
|
}}</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span>应付金额:</span><span class='actrual-price'>{{priceDetailDTO.billPrice | unitPrice('¥')}}</span>
|
<span>应付金额:</span
|
||||||
|
><span class="actrual-price">{{
|
||||||
|
priceDetailDTO.billPrice | unitPrice("¥")
|
||||||
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- 底部支付栏 -->
|
<!-- 底部支付栏 -->
|
||||||
<div class="order-footer width_1200">
|
<div class="order-footer width_1200">
|
||||||
<div class="pay ml_20" @click="pay">提交订单</div>
|
<div class="pay ml_20" @click="pay">提交订单</div>
|
||||||
<div class="pay-address" v-if="addressList.length">配送至:{{ selectedAddress.consigneeAddressPath | unitAddress }}
|
<div class="pay-address" v-if="addressList.length">
|
||||||
{{selectedAddress.detail}} 收货人:{{selectedAddress.name}} {{selectedAddress.mobile}}</div>
|
配送至:{{ selectedAddress.consigneeAddressPath | unitAddress }}
|
||||||
|
{{ selectedAddress.detail }} 收货人:{{
|
||||||
|
selectedAddress.name
|
||||||
|
}} {{ selectedAddress.mobile }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<BaseFooter></BaseFooter>
|
<BaseFooter></BaseFooter>
|
||||||
<!-- 添加发票模态框 -->
|
<!-- 添加发票模态框 -->
|
||||||
<invoice-modal ref="invModal" :invoiceData="invoiceData" @change="getInvMsg" />
|
<invoice-modal
|
||||||
|
ref="invModal"
|
||||||
|
:invoiceData="invoiceData"
|
||||||
|
@change="getInvMsg"
|
||||||
|
/>
|
||||||
<!-- 选择地址模态框 -->
|
<!-- 选择地址模态框 -->
|
||||||
<address-manage ref="address" :id="addrId" @change="addrChange"></address-manage>
|
<address-manage
|
||||||
|
ref="address"
|
||||||
|
:id="addrId"
|
||||||
|
@change="addrChange"
|
||||||
|
></address-manage>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import invoiceModal from "@/components/invoiceModal";
|
import invoiceModal from '@/components/invoiceModal';
|
||||||
import addressManage from "@/components/addressManage";
|
import addressManage from '@/components/addressManage';
|
||||||
import { memberAddress, delMemberAddress } from "@/api/address";
|
import { memberAddress, delMemberAddress } from '@/api/address';
|
||||||
import {
|
import {
|
||||||
cartGoodsPay,
|
cartGoodsPay,
|
||||||
createTrade,
|
createTrade,
|
||||||
selectAddr,
|
selectAddr,
|
||||||
shippingMethod,
|
shippingMethod,
|
||||||
selectCoupon,
|
selectCoupon,
|
||||||
couponNum,
|
couponNum
|
||||||
} from "@/api/cart";
|
} from '@/api/cart';
|
||||||
import { canUseCouponList } from "@/api/member.js";
|
import { canUseCouponList } from '@/api/member.js';
|
||||||
import { getLogo } from "@/api/common.js";
|
import { getLogo } from '@/api/common.js';
|
||||||
export default {
|
export default {
|
||||||
name: "Pay",
|
name: 'Pay',
|
||||||
components: { invoiceModal, addressManage },
|
components: { invoiceModal, addressManage },
|
||||||
data() {
|
data () {
|
||||||
return {
|
return {
|
||||||
stepIndex: 1, // 顶部步骤条状态
|
stepIndex: 1, // 顶部步骤条状态
|
||||||
invoiceAvailable: false, // 发票编辑按钮
|
invoiceAvailable: false, // 发票编辑按钮
|
||||||
showEditBtn: "", // 鼠标移入显示编辑按钮
|
showEditBtn: '', // 鼠标移入显示编辑按钮
|
||||||
orderMark: "", // 订单备注
|
orderMark: '', // 订单备注
|
||||||
invoiceData: {
|
invoiceData: {
|
||||||
// 发票数据
|
// 发票数据
|
||||||
receiptTitle: "个人",
|
receiptTitle: '个人',
|
||||||
receiptContent: "不开发票",
|
receiptContent: '不开发票'
|
||||||
},
|
},
|
||||||
otherMsgForm: {
|
otherMsgForm: {
|
||||||
// 其他信息模块数据
|
// 其他信息模块数据
|
||||||
point: 0,
|
point: 0,
|
||||||
availablePoint: 10,
|
availablePoint: 10,
|
||||||
totalPoint: 100,
|
totalPoint: 100,
|
||||||
noGoods: 0,
|
noGoods: 0
|
||||||
},
|
},
|
||||||
deliveryList: [
|
deliveryList: [
|
||||||
// 物流
|
// 物流
|
||||||
// {value: 'SELF_PICK_UP', label: '自提'},
|
// {value: 'SELF_PICK_UP', label: '自提'},
|
||||||
{ value: "LOGISTICS", label: "物流" },
|
{ value: 'LOGISTICS', label: '物流' }
|
||||||
// {value: 'LOCAL_TOWN_DELIVERY', label: '同城配送'}
|
// {value: 'LOCAL_TOWN_DELIVERY', label: '同城配送'}
|
||||||
],
|
],
|
||||||
addressList: [], // 地址列表
|
addressList: [], // 地址列表
|
||||||
|
@ -220,37 +343,37 @@ export default {
|
||||||
goodsList: [], // 商品列表
|
goodsList: [], // 商品列表
|
||||||
priceDetailDTO: {}, // 商品价格
|
priceDetailDTO: {}, // 商品价格
|
||||||
totalNum: 0, // 购买数量
|
totalNum: 0, // 购买数量
|
||||||
addrId: "", // 编辑地址传入的id
|
addrId: '', // 编辑地址传入的id
|
||||||
moreAddr: false, // 更多地址
|
moreAddr: false, // 更多地址
|
||||||
canUseCouponNum: 0, // 可用优惠券数量
|
canUseCouponNum: 0, // 可用优惠券数量
|
||||||
couponList: [], // 可用优惠券列表
|
couponList: [], // 可用优惠券列表
|
||||||
logoImg: "", // 平台logo
|
logoImg: '', // 平台logo
|
||||||
usedCouponId: [], // 已使用优惠券id
|
usedCouponId: [], // 已使用优惠券id
|
||||||
selectedCoupon: {}, // 已选优惠券对象
|
selectedCoupon: {} // 已选优惠券对象
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted () {
|
||||||
this.init();
|
this.init();
|
||||||
if (!this.Cookies.getItem("logo")) {
|
if (!this.Cookies.getItem('logo')) {
|
||||||
getLogo().then((res) => {
|
getLogo().then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
let logoObj = JSON.parse(res.result.settingValue);
|
let logoObj = JSON.parse(res.result.settingValue);
|
||||||
this.Cookies.setItem("logo", logoObj.buyerSideLogo);
|
this.Cookies.setItem('logo', logoObj.buyerSideLogo);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.logoImg = this.Cookies.getItem("logo");
|
this.logoImg = this.Cookies.getItem('logo');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
init () {
|
||||||
this.getGoodsDetail();
|
this.getGoodsDetail();
|
||||||
},
|
},
|
||||||
goAddressManage() {
|
goAddressManage () {
|
||||||
// 跳转地址管理页面
|
// 跳转地址管理页面
|
||||||
this.$router.push("/home/MyAddress");
|
this.$router.push('/home/MyAddress');
|
||||||
},
|
},
|
||||||
getAddress() {
|
getAddress () {
|
||||||
// 获取收货地址列表
|
// 获取收货地址列表
|
||||||
memberAddress().then((res) => {
|
memberAddress().then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
|
@ -263,7 +386,7 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getGoodsDetail() {
|
getGoodsDetail () {
|
||||||
// 订单商品详情
|
// 订单商品详情
|
||||||
this.$Spin.show();
|
this.$Spin.show();
|
||||||
cartGoodsPay({ way: this.$route.query.way })
|
cartGoodsPay({ way: this.$route.query.way })
|
||||||
|
@ -274,24 +397,21 @@ export default {
|
||||||
this.priceDetailDTO = res.result.priceDetailDTO;
|
this.priceDetailDTO = res.result.priceDetailDTO;
|
||||||
this.skuList = res.result.skuList;
|
this.skuList = res.result.skuList;
|
||||||
|
|
||||||
res.result.receiptVO
|
res.result.receiptVO ? (this.invoiceData = res.result.receiptVO) : '';
|
||||||
? (this.invoiceData = res.result.receiptVO)
|
|
||||||
: "";
|
|
||||||
|
|
||||||
let notSupArea = res.result.notSupportFreight;
|
let notSupArea = res.result.notSupportFreight;
|
||||||
this.selectedCoupon = {};
|
this.selectedCoupon = {};
|
||||||
if (res.result.platformCoupon)
|
if (res.result.platformCoupon) this.selectedCoupon.platformCoupon = res.result.platformCoupon;
|
||||||
this.selectedCoupon.platformCoupon = res.result.platformCoupon;
|
|
||||||
Object.assign(this.selectedCoupon, res.result.storeCoupons);
|
Object.assign(this.selectedCoupon, res.result.storeCoupons);
|
||||||
if (notSupArea) {
|
if (notSupArea) {
|
||||||
let content = [];
|
let content = [];
|
||||||
let title = "";
|
let title = '';
|
||||||
notSupArea.forEach((e) => {
|
notSupArea.forEach((e) => {
|
||||||
title = e.errorMessage;
|
title = e.errorMessage;
|
||||||
content.push(e.goodsSku.goodsName);
|
content.push(e.goodsSku.goodsName);
|
||||||
});
|
});
|
||||||
this.$Modal.warning({
|
this.$Modal.warning({
|
||||||
title: "以下商品超出配送区域" || title,
|
title: '以下商品超出配送区域' || title,
|
||||||
content: content.toString(),
|
content: content.toString(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -310,7 +430,7 @@ export default {
|
||||||
this.$Spin.hide();
|
this.$Spin.hide();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getCouponNum() {
|
getCouponNum () {
|
||||||
// 获取可用优惠券数量
|
// 获取可用优惠券数量
|
||||||
couponNum({ way: this.$route.query.way }).then((res) => {
|
couponNum({ way: this.$route.query.way }).then((res) => {
|
||||||
this.canUseCouponNum = res.result;
|
this.canUseCouponNum = res.result;
|
||||||
|
@ -326,10 +446,10 @@ export default {
|
||||||
let params = {
|
let params = {
|
||||||
pageNumber: 1,
|
pageNumber: 1,
|
||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
memberCouponStatus: "NEW",
|
memberCouponStatus: 'NEW',
|
||||||
scopeId: skuArr.toString(),
|
scopeId: skuArr.toString(),
|
||||||
storeId: storeArr.toString(),
|
storeId: storeArr.toString(),
|
||||||
totalPrice: this.priceDetailDTO.goodsPrice,
|
totalPrice: this.priceDetailDTO.goodsPrice
|
||||||
};
|
};
|
||||||
canUseCouponList(params).then((res) => {
|
canUseCouponList(params).then((res) => {
|
||||||
// 可用优惠券列表
|
// 可用优惠券列表
|
||||||
|
@ -350,86 +470,85 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
selectAddress(item) {
|
selectAddress (item) {
|
||||||
// 选择地址
|
// 选择地址
|
||||||
let params = {
|
let params = {
|
||||||
way: this.$route.query.way,
|
way: this.$route.query.way,
|
||||||
shippingAddressId: item.id,
|
shippingAddressId: item.id
|
||||||
};
|
};
|
||||||
selectAddr(params).then((res) => {
|
selectAddr(params).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success("选择收货地址成功");
|
this.$Message.success('选择收货地址成功');
|
||||||
this.selectedAddress = item;
|
this.selectedAddress = item;
|
||||||
this.getGoodsDetail();
|
this.getGoodsDetail();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
editAddress(id) {
|
editAddress (id) {
|
||||||
// 编辑地址
|
// 编辑地址
|
||||||
this.addrId = id;
|
this.addrId = id;
|
||||||
this.$refs.address.show();
|
this.$refs.address.show();
|
||||||
},
|
},
|
||||||
addrChange(item) {
|
addrChange () {
|
||||||
// 添加,编辑地址回显
|
// 添加,编辑地址回显
|
||||||
this.getAddress();
|
this.getAddress();
|
||||||
},
|
},
|
||||||
delAddress(item) {
|
delAddress (item) {
|
||||||
// 删除地址
|
// 删除地址
|
||||||
this.$Modal.confirm({
|
this.$Modal.confirm({
|
||||||
title: "提示",
|
title: '提示',
|
||||||
content: "你确定删除这个收货地址",
|
content: '你确定删除这个收货地址',
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
delMemberAddress(item.id).then((res) => {
|
delMemberAddress(item.id).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success("删除成功");
|
this.$Message.success('删除成功');
|
||||||
this.getAddress();
|
this.getAddress();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onCancel: () => {},
|
onCancel: () => {}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
goGoodsDetail(skuId, goodsId) {
|
goGoodsDetail (skuId, goodsId) {
|
||||||
// 跳转商品详情
|
// 跳转商品详情
|
||||||
let routeUrl = this.$router.resolve({
|
let routeUrl = this.$router.resolve({
|
||||||
path: "/goodsDetail",
|
path: '/goodsDetail',
|
||||||
query: { skuId, goodsId },
|
query: { skuId, goodsId }
|
||||||
});
|
});
|
||||||
window.open(routeUrl.href, "_blank");
|
window.open(routeUrl.href, '_blank');
|
||||||
},
|
},
|
||||||
// 跳转店铺首页
|
// 跳转店铺首页
|
||||||
goShopPage(id) {
|
goShopPage (id) {
|
||||||
let routeUrl = this.$router.resolve({
|
let routeUrl = this.$router.resolve({
|
||||||
path: "/Merchant",
|
path: '/Merchant',
|
||||||
query: { id: id },
|
query: { id: id }
|
||||||
});
|
});
|
||||||
window.open(routeUrl.href, "_blank");
|
window.open(routeUrl.href, '_blank');
|
||||||
},
|
},
|
||||||
selectDelivery(delivery) {
|
selectDelivery (delivery) {
|
||||||
// 选择配送方式
|
// 选择配送方式
|
||||||
let params = {
|
let params = {
|
||||||
way: this.$route.query.way,
|
way: this.$route.query.way,
|
||||||
shippingMethod: delivery.value,
|
shippingMethod: delivery.value
|
||||||
};
|
};
|
||||||
shippingMethod(params).then((res) => {});
|
shippingMethod(params).then((res) => {});
|
||||||
},
|
},
|
||||||
useCoupon(id, used) {
|
useCoupon (id, used) {
|
||||||
// 使用优惠券
|
// 使用优惠券
|
||||||
let params = {
|
let params = {
|
||||||
way: this.$route.query.way,
|
way: this.$route.query.way,
|
||||||
memberCouponId: id,
|
memberCouponId: id,
|
||||||
used: used, // true 为使用, false为弃用
|
used: used // true 为使用, false为弃用
|
||||||
};
|
};
|
||||||
selectCoupon(params).then((res) => {
|
selectCoupon(params).then((res) => {
|
||||||
if (res.success) this.init();
|
if (res.success) this.init();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
editInvoice() {
|
editInvoice () {
|
||||||
|
|
||||||
// 编辑发票信息
|
// 编辑发票信息
|
||||||
this.$refs.invModal.invoiceAvailable = true;
|
this.$refs.invModal.invoiceAvailable = true;
|
||||||
},
|
},
|
||||||
getInvMsg(item) {
|
getInvMsg (item) {
|
||||||
// 获取发票信息
|
// 获取发票信息
|
||||||
if (item) {
|
if (item) {
|
||||||
this.init();
|
this.init();
|
||||||
|
@ -437,18 +556,18 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
pay() {
|
pay () {
|
||||||
// 结算
|
// 结算
|
||||||
const params = {
|
const params = {
|
||||||
client: "PC",
|
client: 'PC',
|
||||||
remark: [],
|
remark: [],
|
||||||
way: this.$route.query.way,
|
way: this.$route.query.way
|
||||||
};
|
};
|
||||||
this.goodsList.forEach((e) => {
|
this.goodsList.forEach((e) => {
|
||||||
if (e.remark) {
|
if (e.remark) {
|
||||||
params.remark.push({
|
params.remark.push({
|
||||||
remark: e.remark,
|
remark: e.remark,
|
||||||
storeId: e.storeId,
|
storeId: e.storeId
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -461,8 +580,8 @@ export default {
|
||||||
this.$Spin.hide();
|
this.$Spin.hide();
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: "/payment",
|
path: '/payment',
|
||||||
query: { orderType: "TRADE", sn: res.result.sn },
|
query: { orderType: 'TRADE', sn: res.result.sn }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -470,22 +589,22 @@ export default {
|
||||||
this.$Spin.hide();
|
this.$Spin.hide();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
useScope(type) {
|
useScope (type) {
|
||||||
let goods = "全部商品";
|
let goods = '全部商品';
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "ALL":
|
case 'ALL':
|
||||||
goods = "全部商品";
|
goods = '全部商品';
|
||||||
break;
|
break;
|
||||||
case "PORTION_GOODS":
|
case 'PORTION_GOODS':
|
||||||
goods = "部分商品";
|
goods = '部分商品';
|
||||||
break;
|
break;
|
||||||
case "PORTION_GOODS_CATEGORY":
|
case 'PORTION_GOODS_CATEGORY':
|
||||||
goods = "部分分类商品";
|
goods = '部分分类商品';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return `${goods}可用`;
|
return `${goods}可用`;
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -69,10 +69,10 @@ service.interceptors.request.use(
|
||||||
config.headers['accessToken'] = accessToken;
|
config.headers['accessToken'] = accessToken;
|
||||||
// 解析当前token时间
|
// 解析当前token时间
|
||||||
let jwtData = JSON.parse(
|
let jwtData = JSON.parse(
|
||||||
decodeURIComponent(escape(window.atob(accessToken.split('.')[1].replace(/-/g, '+').replace(/_/g, '/'))))
|
decodeURIComponent(escape(window.atob(accessToken.split('.')[1])))
|
||||||
);
|
);
|
||||||
if (jwtData.exp < Math.round(new Date() / 1000)) {
|
if (jwtData.exp < Math.round(new Date() / 1000)) {
|
||||||
refresh()
|
refresh(config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ service.interceptors.request.use(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
async function refresh () {
|
async function refresh (error) {
|
||||||
const getTokenRes = await refreshToken();
|
const getTokenRes = await refreshToken();
|
||||||
if (getTokenRes === 'success') {
|
if (getTokenRes === 'success') {
|
||||||
// 刷新token
|
// 刷新token
|
||||||
|
@ -101,7 +101,6 @@ async function refresh () {
|
||||||
Storage.removeItem('userInfo');
|
Storage.removeItem('userInfo');
|
||||||
Storage.setItem('cartNum', 0);
|
Storage.setItem('cartNum', 0);
|
||||||
store.commit('SET_CARTNUM', 0);
|
store.commit('SET_CARTNUM', 0);
|
||||||
console.log('1111');
|
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
title: '请登录',
|
title: '请登录',
|
||||||
content: '<p>请登录后执行此操作</p>',
|
content: '<p>请登录后执行此操作</p>',
|
||||||
|
@ -140,7 +139,7 @@ service.interceptors.response.use(
|
||||||
isRefreshToken++;
|
isRefreshToken++;
|
||||||
|
|
||||||
if (isRefreshToken === 1) {
|
if (isRefreshToken === 1) {
|
||||||
refresh()
|
refresh(error)
|
||||||
isRefreshToken = 0;
|
isRefreshToken = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import ViewUI from "view-design";
|
||||||
import "./styles/theme.less";
|
import "./styles/theme.less";
|
||||||
|
|
||||||
import "core-js/stable";
|
import "core-js/stable";
|
||||||
import "regenerator-runtime/runtime";
|
// import "regenerator-runtime/runtime";
|
||||||
import vueQr from 'vue-qr'
|
import vueQr from 'vue-qr'
|
||||||
|
|
||||||
import App from "./App";
|
import App from "./App";
|
||||||
|
|
Loading…
Reference in New Issue