修改一些看到的bug以及功能上的问题

master
lemon橪 2021-06-25 19:15:27 +08:00
parent 75ca4de9e1
commit 3cb3fd81e7
11 changed files with 161 additions and 213 deletions

View File

@ -69,7 +69,7 @@ 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]))) decodeURIComponent(escape(window.atob(accessToken.split('.')[1].replace(/-/g, '+').replace(/_/g, '/'))))
); );
if (jwtData.exp < Math.round(new Date() / 1000)) { if (jwtData.exp < Math.round(new Date() / 1000)) {
refresh(config) refresh(config)

View File

@ -17,14 +17,14 @@ export default {
* @description api请求基础路径 * @description api请求基础路径
*/ */
api_dev: { api_dev: {
common: "https://common-api.pickmall.cn", // common: "https://common-api.pickmall.cn",
buyer: "https://buyer-api.pickmall.cn", // buyer: "https://buyer-api.pickmall.cn",
seller: "https://store-api.pickmall.cn", // seller: "https://store-api.pickmall.cn",
manager: "https://admin-api.pickmall.cn" // manager: "https://admin-api.pickmall.cn"
// common: 'http://192.168.0.109:8890', common: 'http://192.168.0.109:8890',
// buyer: 'http://192.168.0.109:8888', buyer: 'http://192.168.0.109:8888',
// seller: 'http://192.168.0.109:8889', seller: 'http://192.168.0.109:8889',
// manager: 'http://192.168.0.109:8887' manager: 'http://192.168.0.109:8887'
}, },
api_prod: { api_prod: {
common: "https://common-api.pickmall.cn", common: "https://common-api.pickmall.cn",

View File

@ -39,9 +39,11 @@
</FormItem> </FormItem>
<FormItem label="发放数量" prop="publishNum" v-if="form.getType==='FREE'"> <FormItem label="发放数量" prop="publishNum" v-if="form.getType==='FREE'">
<Input v-model="form.publishNum" placeholder="发放数量" style="width: 260px"/> <Input v-model="form.publishNum" placeholder="发放数量" style="width: 260px"/>
<div class="tips">如果发放数量为0时,则代表不限制发放数量</div>
</FormItem> </FormItem>
<FormItem label="领取数量限制" prop="couponLimitNum" v-if="form.getType==='FREE'"> <FormItem label="领取数量限制" prop="couponLimitNum" v-if="form.getType==='FREE'">
<Input v-model="form.couponLimitNum" placeholder="领取限制" clearable style="width: 260px"/> <Input v-model="form.couponLimitNum" placeholder="领取限制" clearable style="width: 260px"/>
<div class="tips">如果领取数量为0时,则代表不限制领取数量</div>
</FormItem> </FormItem>
<FormItem label="范围描述" prop="description"> <FormItem label="范围描述" prop="description">
<Input v-model="form.description" type="textarea" :rows="4" maxlength="50" show-word-limit clearable <Input v-model="form.description" type="textarea" :rows="4" maxlength="50" show-word-limit clearable
@ -576,5 +578,9 @@ h4 {
margin: 0 4px; margin: 0 4px;
} }
} }
.tips {
font-size: 12px;
color: #999;
}
</style> </style>

View File

@ -44,7 +44,7 @@ export default {
// //
pageNumber: 0, // pageNumber: 0, //
pageSize: 10, // pageSize: 10, //
sort: "startTime", // sort: "createTime", //
order: "desc", // order: "desc", //
}, },
form: { form: {

View File

@ -18,14 +18,14 @@ export default {
* @description api请求基础路径 * @description api请求基础路径
*/ */
api_dev: { api_dev: {
common: 'https://common-api.pickmall.cn', // common: 'https://common-api.pickmall.cn',
buyer: 'https://buyer-api.pickmall.cn', // buyer: 'https://buyer-api.pickmall.cn',
seller: 'https://store-api.pickmall.cn', // seller: 'https://store-api.pickmall.cn',
manager: 'https://admin-api.pickmall.cn', // manager: 'https://admin-api.pickmall.cn',
// common: 'http://192.168.0.109:8890', common: 'http://192.168.0.109:8890',
// buyer: 'http://192.168.0.109:8888', buyer: 'http://192.168.0.109:8888',
// seller: 'http://192.168.0.109:8889', seller: 'http://192.168.0.109:8889',
// manager: 'http://192.168.0.109:8887' manager: 'http://192.168.0.109:8887'
}, },
api_prod: { api_prod: {
common: 'https://common-api.pickmall.cn', common: 'https://common-api.pickmall.cn',

View File

@ -7,6 +7,7 @@ import Vue from 'vue';
const app = { const app = {
state: { state: {
shipTemplates:"", shipTemplates:"",
regions:[], //此处是在地区选择器时赋值一次
styleStore:"", //移动端楼层装修中选择风格存储 styleStore:"", //移动端楼层装修中选择风格存储
loading: false, // 全局加载动画 loading: false, // 全局加载动画
added: false, // 加载路由标识 added: false, // 加载路由标识

View File

@ -44,23 +44,27 @@ export default {
*/ */
open(val, index) { open(val, index) {
if (val) { if (val) {
// console.warn(val);
// //
let checkedData = this.$store.state.shipTemplate; let checkedData = this.$store.state.shipTemplate;
// console.warn(this.$store.state.shipTemplate);
// //
let disabledData = checkedData.filter((item, i) => { let disabledData = checkedData.filter((item, i) => {
return i != index; return i != index;
}); });
disabledData.forEach((dis) => { disabledData.forEach((dis) => {
console.log(dis)
// id // id
dis.areaId.split(",").forEach((ids) => { dis.areaId.split(",").forEach((ids) => {
// //
this.data.forEach((item) => { this.data.forEach((item) => {
// //
if (dis.selectedAll) { if (dis.selectedAll) {
dis.area.split(",").forEach((area) => { dis.area.split(",").forEach((area) => {
if (area == item.name) { if (area == item.name) {
console.log(item.name +"选中")
this.$set(item, "disabled", true); this.$set(item, "disabled", true);
} }
}); });
@ -99,7 +103,11 @@ export default {
// //
sort.forEach((sortItem, sortIndex) => { sort.forEach((sortItem, sortIndex) => {
if (item.level != "province" && sortItem.id == item.parentId && !item.disabled) { if (
item.level != "province" &&
sortItem.id == item.parentId &&
!item.disabled
) {
sortItem.selectedList.push({ sortItem.selectedList.push({
...item, ...item,
}); });
@ -147,6 +155,7 @@ export default {
this.selectedWay.push({ name: data.title, id: data.id }); this.selectedWay.push({ name: data.title, id: data.id });
}); });
console.log(this.data); console.log(this.data);
this.$store.state.regions = this.data;
} }
}); });
}, },

View File

@ -6,22 +6,10 @@
<h4>基本信息</h4> <h4>基本信息</h4>
<div class="form-item-view"> <div class="form-item-view">
<FormItem label="活动名称" prop="promotionName"> <FormItem label="活动名称" prop="promotionName">
<Input <Input type="text" v-model="form.promotionName" placeholder="活动名称" clearable style="width: 260px" />
type="text"
v-model="form.promotionName"
placeholder="活动名称"
clearable
style="width: 260px"
/>
</FormItem> </FormItem>
<FormItem label="优惠券名称" prop="couponName"> <FormItem label="优惠券名称" prop="couponName">
<Input <Input type="text" v-model="form.couponName" placeholder="优惠券名称" clearable style="width: 260px" />
type="text"
v-model="form.couponName"
placeholder="优惠券名称"
clearable
style="width: 260px"
/>
</FormItem> </FormItem>
<FormItem label="优惠券类型" prop="couponType"> <FormItem label="优惠券类型" prop="couponType">
<Select v-model="form.couponType" style="width: 260px"> <Select v-model="form.couponType" style="width: 260px">
@ -29,32 +17,12 @@
<Option value="PRICE">减免现金</Option> <Option value="PRICE">减免现金</Option>
</Select> </Select>
</FormItem> </FormItem>
<FormItem <FormItem label="折扣" prop="discount" v-if="form.couponType == 'DISCOUNT'">
label="折扣" <Input type="number" v-model="form.couponDiscount" placeholder="折扣" clearable style="width: 260px" />
prop="discount"
v-if="form.couponType == 'DISCOUNT'"
>
<Input
type="number"
v-model="form.couponDiscount"
placeholder="折扣"
clearable
style="width: 260px"
/>
<span class="describe">请输入0-10之间数字可以输入一位小数</span> <span class="describe">请输入0-10之间数字可以输入一位小数</span>
</FormItem> </FormItem>
<FormItem <FormItem label="面额" prop="price" v-if="form.couponType == 'PRICE'">
label="面额" <Input type="text" v-model="form.price" placeholder="面额" clearable style="width: 260px" />
prop="price"
v-if="form.couponType == 'PRICE'"
>
<Input
type="text"
v-model="form.price"
placeholder="面额"
clearable
style="width: 260px"
/>
</FormItem> </FormItem>
<FormItem label="活动类型" prop="getType"> <FormItem label="活动类型" prop="getType">
<Select v-model="form.getType" style="width: 260px"> <Select v-model="form.getType" style="width: 260px">
@ -63,42 +31,22 @@
</Select> </Select>
</FormItem> </FormItem>
<FormItem label="发放数量" prop="publishNum"> <FormItem label="发放数量" v-if="form.getType == 'FREE'" prop="publishNum">
<Input <Input v-model="form.publishNum" placeholder="发放数量" style="width: 260px" />
v-model="form.publishNum" <div class="tips">如果发放数量为0时,则代表不限制发放数量</div>
placeholder="发放数量"
style="width: 260px"
/>
</FormItem> </FormItem>
</div> </div>
<h4>使用限制</h4> <h4>使用限制</h4>
<div class="form-item-view"> <div class="form-item-view">
<FormItem label="消费门槛" prop="consumeThreshold"> <FormItem label="消费门槛" prop="consumeThreshold">
<Input <Input type="text" v-model="form.consumeThreshold" placeholder="消费门槛" clearable style="width: 260px" />
type="text"
v-model="form.consumeThreshold"
placeholder="消费门槛"
clearable
style="width: 260px"
/>
</FormItem> </FormItem>
<FormItem label="领取限制" prop="couponLimitNum"> <FormItem label="领取限制" v-if="form.getType == 'FREE'" prop="couponLimitNum">
<Input <Input v-model="form.couponLimitNum" placeholder="领取限制" clearable style="width: 260px" />
v-model="form.couponLimitNum" <div class="tips">如果领取限制为0时,则代表不限制领取数量</div>
placeholder="领取限制"
clearable
style="width: 260px"
/>
</FormItem> </FormItem>
<FormItem label="有效期" prop="rangeTime"> <FormItem label="有效期" prop="rangeTime">
<DatePicker <DatePicker type="datetimerange" v-model="form.rangeTime" format="yyyy-MM-dd HH:mm:ss" placeholder="请选择" :options="options" style="width: 260px">
type="datetimerange"
v-model="form.rangeTime"
format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择"
:options="options"
style="width: 260px"
>
</DatePicker> </DatePicker>
</FormItem> </FormItem>
<FormItem label="使用范围" prop="scopeType"> <FormItem label="使用范围" prop="scopeType">
@ -109,34 +57,14 @@
</RadioGroup> </RadioGroup>
</FormItem> </FormItem>
<FormItem <FormItem style="width: 100%" v-if="form.scopeType == 'PORTION_GOODS'">
style="width: 100%"
v-if="form.scopeType == 'PORTION_GOODS'"
>
<div style="display: flex; margin-bottom: 10px"> <div style="display: flex; margin-bottom: 10px">
<Button type="primary" @click="openSkuList" <Button type="primary" @click="openSkuList"></Button>
>选择商品</Button> <Button type="error" ghost style="margin-left: 10px" @click="delSelectGoods"></Button>
<Button
type="error"
ghost
style="margin-left: 10px"
@click="delSelectGoods"
>批量删除</Button
>
</div> </div>
<Table <Table border :columns="columns" :data="form.promotionGoodsList" @on-selection-change="changeSelect">
border
:columns="columns"
:data="form.promotionGoodsList"
@on-selection-change="changeSelect"
>
<template slot-scope="{ row }" slot="QRCode"> <template slot-scope="{ row }" slot="QRCode">
<img <img :src="row.QRCode || '../../../assets/lili.png'" width="50px" height="50px" alt="" />
:src="row.QRCode || '../../../assets/lili.png'"
width="50px"
height="50px"
alt=""
/>
</template> </template>
</Table> </Table>
</FormItem> </FormItem>
@ -147,35 +75,17 @@
</FormItem> </FormItem>
<FormItem label="范围描述" prop="description"> <FormItem label="范围描述" prop="description">
<Input <Input v-model="form.description" type="textarea" :rows="4" maxlength="50" show-word-limit clearable style="width: 260px" />
v-model="form.description"
type="textarea"
:rows="4"
maxlength="50"
show-word-limit
clearable
style="width: 260px"
/>
</FormItem> </FormItem>
<div> <div>
<Button type="text" @click="$router.push({ name: 'coupon' })" <Button type="text" @click="$router.push({ name: 'coupon' })">返回</Button>
>返回</Button <Button type="primary" :loading="submitLoading" @click="handleSubmit"></Button>
>
<Button
type="primary"
:loading="submitLoading"
@click="handleSubmit"
>提交</Button
>
</div> </div>
</div> </div>
</div> </div>
</Form> </Form>
</Card> </Card>
<sku-select <sku-select ref="skuSelect" @selectedGoodsData="selectedGoodsData"></sku-select>
ref="skuSelect"
@selectedGoodsData="selectedGoodsData"
></sku-select>
</div> </div>
</template> </template>
@ -232,6 +142,7 @@ export default {
getType: "FREE", getType: "FREE",
promotionGoodsList: [], promotionGoodsList: [],
scopeIdGoods: [], scopeIdGoods: [],
rangeDayType: "FIXEDTIME",
}, },
id: this.$route.query.id, id: this.$route.query.id,
submitLoading: false, // submitLoading: false, //
@ -392,7 +303,11 @@ export default {
params.endTime = this.$options.filters.unixToDate( params.endTime = this.$options.filters.unixToDate(
this.form.rangeTime[1] / 1000 this.form.rangeTime[1] / 1000
); );
delete params.rangeTime if (params.getType == "ACTIVITY") {
params.couponLimitNum = 0;
params.publishNum = 0;
}
delete params.rangeTime;
let scopeId = []; let scopeId = [];
if ( if (
params.scopeType == "PORTION_GOODS" && params.scopeType == "PORTION_GOODS" &&
@ -465,12 +380,13 @@ export default {
name: "coupon", name: "coupon",
}); });
}, },
openSkuList() { // openSkuList() {
//
this.$refs.skuSelect.open("goods"); this.$refs.skuSelect.open("goods");
let data = JSON.parse(JSON.stringify(this.form.promotionGoodsList)) let data = JSON.parse(JSON.stringify(this.form.promotionGoodsList));
data.forEach(e => { data.forEach((e) => {
e.id = e.skuId e.id = e.skuId;
}) });
this.$refs.skuSelect.goodsData = data; this.$refs.skuSelect.goodsData = data;
}, },
changeSelect(e) { changeSelect(e) {
@ -604,5 +520,9 @@ h4 {
.wrapper { .wrapper {
min-height: 1000px; min-height: 1000px;
} }
.tips {
font-size: 12px;
color: #999;
}
</style> </style>

View File

@ -97,7 +97,7 @@
</FormItem> </FormItem>
<FormItem label="商品" v-if="$route.query.id"> <FormItem label="商品" v-if="$route.query.id">
<Button type="primary" :disabled="liveStatus!='NEW'" ghost @click="liveGoodsVisible=true" icon="md-add">添加商品</Button> <Button type="primary" ghost @click="liveGoodsVisible=true" :disabled="liveStatus!='NEW'" icon="md-add">添加商品</Button>
<Table class="goods-table" :columns="liveColumns" :data="liveData"> <Table class="goods-table" :columns="liveColumns" :data="liveData">
<template slot-scope="{ row,index }" slot="goodsName"> <template slot-scope="{ row,index }" slot="goodsName">
<div class="flex-goods"> <div class="flex-goods">
@ -140,8 +140,8 @@
<img :src="imageSrc" v-if="imageVisible" style="width: 100%"> <img :src="imageSrc" v-if="imageVisible" style="width: 100%">
</Modal> </Modal>
<Modal width="800" v-model="liveGoodsVisible" @on-ok="addGoods"> <Modal width="800" v-model="liveGoodsVisible" footer-hide>
<liveGoods :init="liveData" @selectedGoods="callBackData" reviewed /> <liveGoods @selectedGoods="callBackData" reviewed />
</Modal> </Modal>
</div> </div>
</template> </template>
@ -259,10 +259,14 @@ export default {
* 删除直播间商品 * 删除直播间商品
*/ */
async deleteGoods(val, index) { async deleteGoods(val, index) {
this.$Spin.show();
let res = await delRoomLiveGoods(this.liveForm.roomId, val.liveGoodsId); let res = await delRoomLiveGoods(this.liveForm.roomId, val.liveGoodsId);
if (res.success) { if (res.success) {
this.$Message.success("删除成功!"); this.$Message.success("删除成功!");
this.liveData.splice(index, 1); this.liveData.splice(index, 1);
this.$Spin.hide();
} else {
this.$Spin.hide();
} }
}, },
/** /**
@ -325,35 +329,19 @@ export default {
* 回调的商品选择数据 * 回调的商品选择数据
*/ */
callBackData(way) { callBackData(way) {
this.$set(this, "liveData", way); console.log(way);
}, this.liveGoodsVisible = false;
this.$Spin.show();
/**
* 提交直播间商品
*/
addGoods() {
addLiveGoods({ addLiveGoods({
roomId: this.$route.query.roomId, roomId: this.$route.query.roomId,
liveGoodsId: item.liveGoodsId, liveGoodsId: way.liveGoodsId,
}); }).then((res) => {
}, if (res.success) {
this.liveData.push(way);
/** this.$Spin.hide();
* dialog点击确定时判断 console.log(this.liveData);
*/
addGoods() {
this.liveData.forEach((item) => {
if (this.commodityList.length == 1 && this.liveData.length == 1) {
addLiveGoods({
roomId: this.$route.query.roomId,
liveGoodsId: item.liveGoodsId,
});
} else { } else {
this.commodityList.forEach((oldVal, i) => { this.$Spin.hide();
//
if (oldVal.liveGoodsId != item.liveGoodsId) {
}
});
} }
}); });
}, },

View File

@ -208,20 +208,20 @@ export default {
* 回调参数补充 * 回调参数补充
*/ */
selectedLiveGoods(val, index) { selectedLiveGoods(val, index) {
if (!val.___selected) { // if (!val.___selected) {
val.___selected = true; // val.___selected = true;
this.$set(this.liveGoodsData[index], "___selected", true); // this.$set(this.liveGoodsData[index], "___selected", true);
this.selectedGoods.push(this.liveGoodsData[index]); // this.selectedGoods.push(this.liveGoodsData[index]);
} else { // } else {
this.$nextTick(() => { // this.$nextTick(() => {
val.___selected = false; // val.___selected = false;
this.$set(this.liveGoodsData[index], "___selected", true); // this.$set(this.liveGoodsData[index], "___selected", true);
this.selectedGoods.splice(index, 1); // this.selectedGoods.splice(index, 1);
}); // });
} // }
this.$emit("selectedGoods", this.selectedGoods); this.$emit("selectedGoods", val);
}, },
/** /**
* 解决radio数据不回显问题 * 解决radio数据不回显问题
@ -279,7 +279,7 @@ export default {
console.log(element); console.log(element);
return { return {
goodsId: element.goodsId, //id goodsId: element.goodsId, //id
goodsImage: element.small, // 300 * 300 goodsImage: element.small, // 300 * 300
name: element.goodsName, // name: element.goodsName, //
price: parseInt(element.price), // price: parseInt(element.price), //
quantity: element.quantity, // quantity: element.quantity, //

View File

@ -195,6 +195,11 @@ export default {
}, },
}; };
}, },
computed: {
regions() {
return this.$store.state.regions;
},
},
methods: { methods: {
init() { init() {
this.getData(); this.getData();
@ -224,7 +229,7 @@ export default {
firstPrice: "", firstPrice: "",
continuedCompany: "1", continuedCompany: "1",
continuedPrice: "", continuedPrice: "",
selectedAll:false selectedAll: false,
}, },
], ],
}; };
@ -241,10 +246,22 @@ export default {
}, },
// //
editRegion(item, index) { editRegion(item, index) {
this.selectedIndex = index this.selectedIndex = index;
this.item = item; this.item = item;
this.$store.state.shipTemplate = this.form.freightTemplateChildList this.regions.forEach((addr) => {
this.form.freightTemplateChildList.forEach((child) => {
child.area.split(",").forEach((area) => {
if (addr.name == area) {
addr.selectedAll = true;
this.$set(child, "selectedAll", true);
}
});
});
});
this.$store.state.shipTemplate = this.form.freightTemplateChildList;
this.$refs.region.open(item, index); this.$refs.region.open(item, index);
}, },
// //
@ -274,8 +291,10 @@ export default {
// //
if (child.selectedAll) { if (child.selectedAll) {
area += child.name + "," area += child.name + ",";
this.form.freightTemplateChildList[this.selectedIndex].selectedAll = true this.form.freightTemplateChildList[
this.selectedIndex
].selectedAll = true;
} }
child.selectedList.forEach((son) => { child.selectedList.forEach((son) => {
@ -302,11 +321,16 @@ export default {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
const regNumber = /^\+?[1-9][0-9]*$/; const regNumber = /^\+?[1-9][0-9]*$/;
const regMoney = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/; const regMoney =
/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
if (valid) { if (valid) {
if (this.form.pricingMethod != 'FREE') { if (this.form.pricingMethod != "FREE") {
// //
for (let i = 0; i < this.form.freightTemplateChildList.length; i++) { for (
let i = 0;
i < this.form.freightTemplateChildList.length;
i++
) {
if ( if (
this.form.freightTemplateChildList[i].area == "" || this.form.freightTemplateChildList[i].area == "" ||
this.form.freightTemplateChildList[i].firstCompany == "" || this.form.freightTemplateChildList[i].firstCompany == "" ||
@ -324,8 +348,9 @@ export default {
regNumber.test( regNumber.test(
this.form.freightTemplateChildList[i].continuedCompany this.form.freightTemplateChildList[i].continuedCompany
) == false || ) == false ||
regMoney.test(this.form.freightTemplateChildList[i].firstPrice) == regMoney.test(
false || this.form.freightTemplateChildList[i].firstPrice
) == false ||
regMoney.test( regMoney.test(
this.form.freightTemplateChildList[i].continuedPrice this.form.freightTemplateChildList[i].continuedPrice
) == false ) == false
@ -336,7 +361,6 @@ export default {
} }
} }
if (this.operation == "ADD") { if (this.operation == "ADD") {
API_Shop.addShipTemplate(this.form, headers).then((res) => { API_Shop.addShipTemplate(this.form, headers).then((res) => {
if (res.success) { if (res.success) {
@ -372,7 +396,7 @@ export default {
firstPrice: "", firstPrice: "",
continuedCompany: "1", continuedCompany: "1",
continuedPrice: "", continuedPrice: "",
selectedAll:false selectedAll: false,
}; };
this.form.freightTemplateChildList.push(params); this.form.freightTemplateChildList.push(params);
}, },