Commit cd26d2b6 authored by pengyunqian's avatar pengyunqian

update:bugfile

parents 47740529 94ce5b84
......@@ -70,19 +70,19 @@
>
<template #reference>
<el-image
v-if="scope.row.sensitiveWord && scope.row.entterprise_image"
v-if="scope.row.sensitiveWord && scope.row.entterprise_image_url"
fit="fill"
:src="scope.row.entterprise_image"
:src="scope.row.entterprise_image_url"
></el-image>
<span v-else-if="
scope.row.sensitiveWord && !scope.row.entterprise_image
scope.row.sensitiveWord && !scope.row.entterprise_image_url
"></span>
<span v-else>无权限</span>
</template>
<el-image
fit="fill"
style="width:100%;height:100%"
:src="scope.row.entterprise_image"
:src="scope.row.entterprise_image_url"
></el-image>
</el-popover>
</template>
......@@ -119,19 +119,19 @@
>
<template #reference>
<el-image
v-if="scope.row.sensitiveWord && scope.row.legal_front_id_card"
:src="scope.row.legal_front_id_card"
v-if="scope.row.sensitiveWord && scope.row.legal_front_id_card_url"
:src="scope.row.legal_front_id_card_url"
fit="fill"
></el-image>
<span v-else-if="
scope.row.sensitiveWord && !scope.row.legal_front_id_card
scope.row.sensitiveWord && !scope.row.legal_front_id_card_url
"></span>
<span v-else>无权限</span>
</template>
<el-image
fit="fill"
style="width:100%;height:100%"
:src="scope.row.legal_front_id_card"
:src="scope.row.legal_front_id_card_url"
></el-image>
</el-popover>
</template>
......@@ -148,19 +148,19 @@
>
<template #reference>
<el-image
v-if="scope.row.sensitiveWord && scope.row.legal_back_id_card"
v-if="scope.row.sensitiveWord && scope.row.legal_back_id_card_url"
fit="fill"
:src="scope.row.legal_back_id_card"
:src="scope.row.legal_back_id_card_url"
></el-image>
<span v-else-if="
scope.row.sensitiveWord && !scope.row.legal_back_id_card
scope.row.sensitiveWord && !scope.row.legal_back_id_card_url
"></span>
<span v-else>无权限</span>
</template>
<el-image
fit="fill"
style="width:100%;height:100%"
:src="scope.row.legal_back_id_card"
:src="scope.row.legal_back_id_card_url"
></el-image>
</el-popover>
......
......@@ -33,12 +33,13 @@
prop="businessLicense"
>
<el-image
v-if="establishForm.entterpriseImage"
v-if="establishForm.entterprise_image_url"
style="width:200px;height:200px;border-radius:10px"
:src="establishForm.entterpriseImage"
:src="establishForm.entterprise_image_url"
fit="cover"
></el-image>
<el-upload
:data="{scenario:`business_license`}"
:show-file-list="false"
:action="domainName"
:accept="'image/*'"
......@@ -84,12 +85,13 @@
prop="front_img"
>
<el-image
v-if="establishForm.frontImg"
v-if="establishForm.legal_front_id_card_url"
style="width:200px;height:200px;border-radius:10px"
:src="establishForm.frontImg"
:src="establishForm.legal_front_id_card_url"
fit="cover"
></el-image>
<el-upload
:data="{scenario:`id_card`}"
:show-file-list="false"
:action="domainName"
:accept="'image/*'"
......@@ -109,12 +111,13 @@
prop="bak_img"
>
<el-image
v-if="establishForm.bakImg"
v-if="establishForm.legal_back_id_card_url"
style="width:200px;height:200px;border-radius:10px"
:src="establishForm.bakImg"
:src="establishForm.legal_back_id_card_url"
fit="cover"
></el-image>
<el-upload
:data="{scenario:`id_card`}"
:show-file-list="false"
:action="domainName"
:accept="'image/*'"
......@@ -188,7 +191,7 @@ export default {
data () {
// 营业执照校验规则
const businessRules = (rule, value, callback) => {
if (!this.establishForm.entterprise_image) {
if (this.establishForm.entterprise_image.length === 0) {
callback(new Error("请上传营业执照"));
} else {
callback();
......@@ -197,7 +200,7 @@ export default {
};
// 身份证照片正面校验规则
const idPhotoFontRules = (rule, value, callback) => {
if (!this.establishForm.front_img) {
if (this.establishForm.legal_front_id_card.length === 0) {
callback(new Error("请上传身份正面证照片"));
} else {
callback();
......@@ -206,7 +209,7 @@ export default {
};
// 身份证照片反面校验规则
const idPhotoBackRules = (rule, value, callback) => {
if (!this.establishForm.bak_img) {
if (this.establishForm.legal_back_id_card.length === 0) {
callback(new Error("请上传身份反面证照片"));
} else {
callback();
......@@ -254,7 +257,7 @@ export default {
establishForm: {
code: null, // 企业代码(!)
name: null, // 企业名称(!)
entterprise_image: null, // 金山云key(!)
entterprise_image_url: null, // 金山云图片地址(!)
/* *********身份认证信息********* */
record_id: null, // 企业认证id
front_img: "", // 身份证正面照的金山云objectid(!)
......@@ -263,7 +266,8 @@ export default {
userName: "", // 用户姓名(!)
legal_mobile: "", // 法人手机号
data_type: null, // 企业类型(!)
mobile: "" // 用户手机号
mobile: "", // 用户手机号
enterprise_id: "" // 返回的企业id
},
// 表单校验规则
......@@ -324,9 +328,12 @@ export default {
this.establishForm.data_type = val.record.data_type;
this.establishForm.name = val.record.name;
this.establishForm.code = val.record.code;
this.establishForm.entterprise_image_url = val.record.entterprise_image_url;
this.establishForm.entterprise_image = val.record.entterprise_image;
this.establishForm.front_img = val.record.legal_front_id_card;
this.establishForm.bak_img = val.record.legal_back_id_card;
this.establishForm.legal_front_id_card_url = val.record.legal_front_id_card_url;
this.establishForm.legal_front_id_card = val.record.legal_front_id_card;
this.establishForm.legal_back_id_card_url = val.record.legal_back_id_card_url;
this.establishForm.legal_back_id_card = val.record.legal_back_id_card;
this.establishForm.idcard_number = val.record.legal_id_card;
this.establishForm.userName = val.record.legal_person;
this.establishForm.legal_mobile = val.record.legal_mobile;
......@@ -334,9 +341,6 @@ export default {
this.establishForm.legal_mobile = val.record.mobile;
this.establishForm.user_id = val.record.user_id;
this.establishForm.sensitiveWord = val.record.sensitiveWord;
this.establishForm.entterpriseImage = val.record.entterprise_image;
this.establishForm.frontImg = val.record.legal_front_id_card;
this.establishForm.bakImg = val.record.legal_back_id_card;
}
},
......@@ -345,24 +349,24 @@ export default {
handleEnterpriseSuccess (res) {
if (res.code !== 0) return this.$message.error(res.reason);
this.clearValidate("entterpriseImageRef");
this.establishForm.entterpriseImage = `http://${res.result.file_url}`;
this.establishForm.entterprise_image = res.result.object_id;
this.establishForm.entterprise_image_url = `http://${res.result.file_url}`;
this.establishForm.entterprise_image = `${res.result.bucket}/${res.result.object_id}`;
},
// 上传身份证前面
handleFontSuccess (res) {
if (res.code !== 0) return this.$message.error(res.reason);
this.clearValidate("frontImgRef");
this.establishForm.frontImg = `http://${res.result.file_url}`;
this.establishForm.front_img = res.result.object_id;
this.establishForm.legal_front_id_card_url = `http://${res.result.file_url}`;
this.establishForm.legal_front_id_card = `${res.result.bucket}/${res.result.object_id}`;
},
// 上传身份证后面
handleBackSuccess (res) {
if (res.code !== 0) return this.$message.error(res.reason);
this.clearValidate("bakImgRef");
this.establishForm.bakImg = `http://${res.result.file_url}`;
this.establishForm.bak_img = res.result.object_id;
this.establishForm.legal_back_id_card_url = `http://${res.result.file_url}`;
this.establishForm.legal_back_id_card = `${res.result.bucket}/${res.result.object_id}`;
},
// 取消创建表单
......@@ -394,7 +398,7 @@ export default {
const enterpriseQuery = {
code,
name,
entterprise_image,
entterprise_image_url: entterprise_image,
data_from: 3,
data_type,
mobile,
......@@ -417,12 +421,11 @@ export default {
data_type,
mobile
} = this.establishForm;
entterprise_image = this.transformObjectId(entterprise_image);
const editQuery = {
record_id: this.enterpriseId,
enterprise_auth_record_id: this.enterpriseId,
code,
name,
entterprise_image,
entterprise_image_url: entterprise_image,
data_type,
data_from: 3,
mobile
......@@ -445,24 +448,22 @@ export default {
let {
data_type,
user_id,
front_img,
bak_img,
legal_front_id_card,
legal_back_id_card,
idcard_number,
userName,
legal_mobile
} = this.establishForm;
front_img = this.transformObjectId(front_img);
bak_img = this.transformObjectId(bak_img);
// 提交法人信息
let legalQuery = {
record_id: this.enterpriseId
enterprise_auth_record_id: this.enterpriseId
? this.enterpriseId
: this.establishForm.enterprise_id,
front_completeness: 0,
bak_completeness: 0,
user_id: user_id ? parseInt(user_id) : "",
front_img,
bak_img,
posit_image_url: legal_front_id_card,
back_image_url: legal_back_id_card,
idcard_number,
name: userName,
legal_mobile,
......@@ -477,18 +478,6 @@ export default {
});
},
// 转换图片地址为ObjectId
transformObjectId (urls) {
try {
const url = new URL(urls);
let pathName = url.pathname;
let objectId = pathName.slice(1);
return objectId;
} catch (error) {
return urls;
}
},
// 清除校验
clearValidate (formName) {
this.$refs[formName].clearValidate();
......
......@@ -48,3 +48,10 @@
background-color: #199ffb;
}
}
.el-input__inner {
padding-right: 15%;
}
.el-textarea__inner {
padding-bottom: 10%;
}
......@@ -63,6 +63,7 @@
show-word-limit
v-if="$route.params.operation === 'EDIT'"
v-model="goodsObj.goods_name"
@input="checkHaveExpression"
@blur="checkSameName"
></el-input>
<span v-else>{{ goodsObj.goods_name }}</span>
......@@ -78,7 +79,7 @@
clearable
></el-cascader>
</el-form-item>
<el-form-item label="描述:">
<el-form-item label="说明:">
<el-input
v-if="$route.params.operation === 'EDIT'"
type="textarea"
......@@ -160,14 +161,16 @@
<i class="el-icon-plus"></i>
</template>
</el-upload>
<h4 style="margin-top:20px">商品介绍:</h4>
<!-- <h4 style="margin-top:20px">商品介绍:</h4>
<el-input
v-if="$route.params.operation === 'EDIT'"
type="textarea"
:readonly="true"
:autosize="{ minRows: 4 }"
v-model="goodsObj.introduce"
:maxlength="500"
show-word-limit
></el-input>
<span v-else>{{ goodsObj.introduce }}</span>
<span v-else>{{ goodsObj.introduce }}</span> -->
</section>
</section>
</el-card>
......@@ -220,8 +223,9 @@
<el-popover
v-if="$route.params.operation === 'EDIT'"
placement="bottom"
:width="600"
:width="800"
trigger="click"
v-model:visible="shopListShow"
>
<template #reference>
<el-button
......@@ -233,13 +237,19 @@
</template>
<!-- 门店列表 -->
<el-table
ref="shopListRef"
:data="shopsList"
@selection-change="handleShopsChange"
row-key="sub_shop_id"
>
<!-- :selectable="canChooseShop"↓ -->
<el-table-column
type="selection"
width="55"
> </el-table-column>
aria-checked="true"
:reserve-selection="true"
>
</el-table-column>
<el-table-column
align="center"
prop="shop_name"
......@@ -269,7 +279,7 @@
<!-- 分页 -->
<el-pagination
style="margin-top:20px"
style="margin-top:20px;"
background
@current-change="changeShopListPage"
v-model:currentPage="shopCurrentPage"
......@@ -278,55 +288,71 @@
:total="shopsCount"
>
</el-pagination>
<!-- 添加门店弹窗 -->
<el-popover
placement="bottom"
:width="600"
trigger="click"
:visible="addShopShow"
>
<template #reference>
<el-button
@click="addShopShow = true"
type="primary"
style="border-radius:20px;margin:20px 0 0 50%;transform: translate(-50%,0);"
>添加门店
</el-button>
</template>
<!-- 添加门店表单 -->
<el-form
label-position="right"
label-width="100px"
:model="shopForm"
<section style="display:flex;justify-content:center;">
<el-button
type="primary"
style="border-radius:20px;"
@click="handleChooseShops"
>确定</el-button>
<!-- 添加门店弹窗 -->
<el-popover
placement="bottom"
:width="600"
trigger="click"
:visible="addShopShow"
>
<el-form-item label="门店名称:">
<el-input v-model="shopForm.shop_name"></el-input>
</el-form-item>
<el-form-item label="联系电话:">
<el-input v-model="shopForm.connect_phone"></el-input>
</el-form-item>
<el-form-item label="地址:">
<el-input v-model="shopForm.address"></el-input>
</el-form-item>
<el-form-item
label="地理定位:"
class="deep_place"
<template #reference>
<el-button
@click="addShopShow = true"
type="primary"
style="border-radius:20px;"
>添加门店
</el-button>
</template>
<!-- 添加门店表单 -->
<el-form
label-position="right"
label-width="100px"
:model="shopForm"
>
<el-input v-model="shopForm.deep_place"></el-input>
<a
style=""
target="_blank"
href="https://lbs.amap.com/tools/picker"
>高德获取定位</a>
</el-form-item>
</el-form>
<section style="display:flex;justify-content:center;">
<el-button
type="primary"
@click="addShop"
>保存</el-button>
</section>
</el-popover>
<el-form-item label="门店名称:">
<el-input
v-model="shopForm.shop_name"
maxlength="20"
show-word-limit
></el-input>
</el-form-item>
<el-form-item label="联系电话:">
<el-input
v-model="shopForm.connect_phone"
maxlength="11"
show-word-limit
></el-input>
</el-form-item>
<el-form-item label="地址:">
<el-input v-model="shopForm.address"></el-input>
</el-form-item>
<el-form-item
label="地理定位:"
class="deep_place"
>
<el-input v-model="shopForm.deep_place"></el-input>
<a
style=""
target="_blank"
href="https://lbs.amap.com/tools/picker"
>高德获取定位</a>
</el-form-item>
</el-form>
<section style="display:flex;justify-content:center;">
<el-button
type="primary"
@click="addShop"
>保存</el-button>
<el-button @click="closeAddShops">取消</el-button>
</section>
</el-popover>
</section>
</el-popover>
</section>
<section class="width50p">
......@@ -342,27 +368,29 @@
<el-form-item label="售价">
<el-input
v-if="$route.params.operation === 'EDIT'"
type="number"
v-model="goodsObj.price"
@blur="salePrice"
@change="salePrice"
></el-input>
<span v-else>{{ goodsObj.price }}</span>
</el-form-item>
<el-form-item label="原价">
<el-input
v-if="$route.params.operation === 'EDIT'"
type="number"
v-model="goodsObj.original_price"
@blur="perPrice"
@change="perPrice"
></el-input>
<span v-else>{{ goodsObj.original_price }}</span>
</el-form-item>
<h4 style="margin:20px 0">库存信息</h4>
<el-form-item label="剩余库存量:">
<span>{{ goodsObj.inventory_rest }}</span>
</el-form-item>
<el-form-item label="库存增减:">
<el-input-number
v-if="$route.params.operation === 'EDIT'"
v-model="goodsObj.inventory_rest"
:min="0"
v-model="inventoryAdd"
@change="hasNumberChange"
@blur="hasNumberChange"
></el-input-number>
<span v-else>{{ goodsObj.inventory_rest }}</span>
</el-form-item>
......@@ -392,7 +420,10 @@
<el-input-number
v-if="$route.params.operation === 'EDIT'"
:min="0"
:precision="0"
v-model="goodsObj.rule_limit"
@change="handleLimitChange"
@blur="handleLimitChange"
></el-input-number>
<span v-else>{{ goodsObj.rule_limit }}</span>
</el-form-item>
......@@ -437,16 +468,24 @@
goodsObj.rule_date_type === 2
">仅工作日可用</span>
</el-form-item>
<el-form-item label="使用时间:">
<el-form-item label="使用开始时间:">
<el-time-picker
arrow-control
v-if="$route.params.operation === 'EDIT'"
v-model="rulesForm.useStartTime"
@change="pickerStartTime"
>
</el-time-picker>
<span v-else>{{
goodsObj.rule_start_time + "-" + goodsObj.rule_end_time
}}</span>
</el-form-item>
<el-form-item label="使用结束时间:">
<el-time-picker
arrow-control
v-if="$route.params.operation === 'EDIT'"
is-range
v-model="rulesForm.useTime"
range-separator="-"
start-placeholder="开始时间"
end-placeholder="结束时间"
placeholder="选择时间范围"
@change="pickerTime"
v-model="rulesForm.useEndTime"
@change="pickerEndTime"
>
</el-time-picker>
<span v-else>{{
......@@ -470,6 +509,7 @@
v-if="$route.params.operation === 'EDIT'"
type="textarea"
maxlength="100"
:autosize="{ minRows: 4 }"
show-word-limit
v-model="goodsObj.rule_desc"
></el-input>
......@@ -542,7 +582,7 @@
:maxlength="200"
type="textarea"
style="width:100%"
v-model="rejectReason.reason"
v-model.trim="rejectReason.reason"
></el-input>
</el-form-item>
</el-form>
......@@ -564,10 +604,7 @@
@click="saveDetailMessage"
>保存
</el-button>
<el-button
type="primary"
@click="backToDetail"
>返回 </el-button>
<el-button @click="backToDetail">返回</el-button>
</section>
</el-card>
<!-- 展示缩略图 -->
......@@ -599,6 +636,8 @@ import {
import { GOODS_URI } from "../../../../server/config.js";
import filterInput from "../utils/filterInput";
export default {
name: "GoodsDetail",
......@@ -612,7 +651,7 @@ export default {
}
},
created () {
mounted () {
this.getOptions();
this.getGoodsDetailList(this.$route.params.spuId);
},
......@@ -620,9 +659,9 @@ export default {
computed: {
// 审核状态
status () {
if (this.goodsObj.status === 0) {
if (this.goodsObj.audit_status === 0) {
return "待审核";
} else if (this.goodsObj.status === 1) {
} else if (this.goodsObj.audit_status === 1) {
return "审核通过";
} else {
return "审核驳回";
......@@ -644,11 +683,14 @@ export default {
watch: {
goodsObj (val) {
this.optionsValue = [val.category_1_id, val.category_2_id];
this.rulesForm.useTime = this.formatDate(
val.rule_start_time,
val.rule_end_time
);
}
this.rulesForm.useStartTime = this.formatDate(val.rule_start_time);
this.rulesForm.useEndTime = this.formatDate(val.rule_end_time);
},
rejectVisible (val) {
if (!val) {
this.rejectReason.reason = "";
}
},
},
data () {
......@@ -669,9 +711,11 @@ export default {
optionsValue: [], // 商品分类的值
// 商品回显信息
goodsObj: {
introduce: ""
introduce: "" // 商品介绍
},
inventoryAdd: 0, // 库存增减
originalGoodsName: "", // 原商品名
isGoodsNameRepeat: false, // 商品名称是否重复
descPicUrlList: [], // 商品详情图回显列表
......@@ -692,7 +736,8 @@ export default {
{ value: 2, label: "购买后不允许退款" },
{ value: 3, label: "到期后不退款" }
],
useTime: [], // 使用时间
useStartTime: "", // 使用开始时间
useEndTime: "", // 使用结束时间
rule_desc: "" // 使用描述
},
......@@ -705,6 +750,9 @@ export default {
},
shopsList: [], // 门店列表
shopListShow: false, // 门店列表是否展示
shopId: [], // 门店id数组
chooseShopsList: [], // 已选门店列表
shopsCount: 0,
shopCurrentPage: 1, // 门店列表当前页
......@@ -744,7 +792,6 @@ export default {
const res = await getGoodsList();
if (res.code !== 0) return this.$message.error(res.reason);
this.optionList = res.result;
console.log(res);
} catch (error) {
console.error(error);
}
......@@ -761,13 +808,15 @@ export default {
const { goods_info, record_list } = res.result;
this.goodsObj = goods_info;
this.recordLits = record_list;
// 初始商品名称
this.originalGoodsName = goods_info.goods_name;
// 渲染过期时间
this.expirationTime = goods_info.expiration_time;
// 初始化门店id
const shopId = goods_info.sub_shop.map(item => {
this.shopId = goods_info.sub_shop.map(item => {
return item.sub_shop_id;
});
this.shopIds = shopId.join(",");
this.shopIds = this.shopId.join(",");
// 初始化规则开始时间
this.activeStartTime = goods_info.rule_start_time;
// 初始化规则结束时间
......@@ -802,45 +851,37 @@ export default {
uploadPicture (response, storageList) {
const responseURL = `${response.result.bucket}/${response.result.object_id}`;
storageList.push(responseURL);
console.log("已上传的列表", storageList);
},
// 删除图片的公共方法
deletePicture (file, fileList, storageList) {
for (let i = 0; i < fileList.length; i++) {
if (fileList[i].uid == file.uid) {
storageList.splice(i, 1);
};
};
console.log(storageList);
}
}
},
// 格式化日期
formatDate (startTime, endTime) {
formatDate (time) {
const nowTime = new Date();
const nowYear = nowTime.getFullYear();
const nowMonth = nowTime.getMonth() + 1;
const nowDate = nowTime.getDate();
const startTimeArray = startTime.split(":");
const endTimeArray = endTime.split(":");
const startHour = parseInt(startTimeArray[0]);
const startMinute = parseInt(startTimeArray[1]);
const startSecond = parseInt(startTimeArray[2]);
const endHour = parseInt(endTimeArray[0]);
const endMinute = parseInt(endTimeArray[1]);
const endSecond = parseInt(endTimeArray[2]);
return [
new Date(
nowYear,
nowMonth,
nowDate,
startHour,
startMinute,
startSecond
),
new Date(nowYear, nowMonth, nowDate, endHour, endMinute, endSecond)
];
const timeArray = time.split(":");
const Hour = parseInt(timeArray[0]);
const Minute = parseInt(timeArray[1]);
const Second = parseInt(timeArray[2]);
return new Date(nowYear, nowMonth, nowDate, Hour, Minute, Second);
},
// 检查输入是否带有表情符号
checkHaveExpression (value) {
if (!filterInput.checkString(value)) {
this.$nextTick(() => {
this.goodsObj.goods_name = "";
});
return this.$message.error("商品名称中不可有表情符号");
}
},
// 获取门店列表
......@@ -851,23 +892,56 @@ export default {
page_size: 5
};
const res = await getShopsList(query);
console.log(res);
if (res.code !== 0) return this.$message.error(res.reason);
console.log(res);
this.shopsList = res.result;
this.shopsCount = res.count;
this.$nextTick(() => {
this.shopsList.forEach(row => {
if (this.shopId.indexOf(row.sub_shop_id) !== -1) {
this.$refs.shopListRef.toggleRowSelection(row, true);
} else {
this.$refs.shopListRef.toggleRowSelection(row, false);
}
});
});
},
// 删除已选择门店
deleteShops (subShopId) {
this.goodsObj.sub_shop = this.goodsObj.sub_shop.filter(item => {
return item.sub_shop_id !== subShopId;
});
this.shopId = this.goodsObj.sub_shop.map(item => {
return item.sub_shop_id;
});
this.shopIds = this.shopId.join(",");
},
// 门店列表更改时操作
handleShopsChange (value) {
this.goodsObj.sub_shop = value;
this.chooseShopsList = [];
this.chooseShopsList = value;
console.log("已选择列表的长度", this.chooseShopsList.length);
const shopList = value.map(item => {
return item.sub_shop_id;
});
this.shopIds = "";
this.shopIds = shopList.join(",");
console.log(this.shopIds);
},
// 商品列表换页
changeShopListPage (page) {
this.shopCurrentPage = page;
this.getShops();
},
// 确认选择的店铺
handleChooseShops () {
this.goodsObj.sub_shop = this.chooseShopsList;
this.shopId = this.goodsObj.sub_shop.map(item => {
return item.sub_shop_id;
});
this.shopListShow = false;
},
// 添加新门店
async addShop () {
const deepPlace = this.shopForm.deep_place.split(",");
......@@ -881,35 +955,61 @@ export default {
latitude, // 纬度
address: this.shopForm.address
};
if (!query.shop_name) {
return this.$message.error("请填写门店名称");
}
if (!query.address) {
return this.$message.error("请填写门店地址");
}
if (!query.phone) {
return this.$message.error("请填写联系电话");
}
if (!query.longitude || !query.latitude) {
return this.$message.error("请填写地理定位");
}
if (
!/([0-9]{3,4}-)?[0-9]{7,8}/.test(query.phone) &&
!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(query.phone)
) {
return this.$message.error("联系电话格式不正确");
}
const res = await postAddShop(query);
if (res.code !== 0) return this.$message.error(res.reason);
this.$message.success("添加门店成功!");
this.addShopShow = false;
console.log(res);
},
// 删除已选择门店
deleteShops (subShopId) {
this.goodsObj.sub_shop = this.goodsObj.sub_shop.filter(item => {
return item.sub_shop_id !== subShopId;
});
const shopIdsList = this.goodsObj.sub_shop.map(item => {
return item.sub_shop_id;
});
this.shopIds = shopIdsList.join(",");
console.log(this.shopIds);
},
// 是否可选门店
// canChooseShop (row) {
// if (
// this.chooseShopsList.length === 0 ||
// this.shopIds === row.sub_shop_id
// ) {
// return true;
// } else {
// return false;
// }
// },
// 商品列表换页
changeShopListPage (page) {
this.shopCurrentPage = page;
this.getShops();
// 取消新建门店
closeAddShops () {
this.shopForm.shop_name = "";
this.shopForm.address = "";
this.shopForm.connect_phone = "";
this.shopForm.deep_place = "";
this.addShopShow = false;
},
// 商品分类列表变化
optionsChange (value) {
this.optionsValue = value;
console.log("商品分类id", this.optionsValue);
},
// 检查商品名称是否重复
......@@ -919,14 +1019,13 @@ export default {
goods_name: this.goodsObj.goods_name,
goods_spu_id: this.goodsObj.goods_spu_id
});
console.log(res);
if (res.code !== 0) return this.$message.error(res.reason);
if (res.result.can_use) {
this.isGoodsNameRepeat = true;
this.$message.success("名称未被占用,请继续填写表单");
} else if (this.originalGoodsName === this.goodsObj.goods_name) {
this.isGoodsNameRepeat = true;
} else {
this.isGoodsNameRepeat = false;
return this.$message.error("名称被占用,换个名称试试吧~~~");
}
},
......@@ -942,7 +1041,6 @@ export default {
introduceSuccess (res) {
this.uploadPicture(res, this.introduceUploadList);
},
// 商品介绍图删除后的钩子
intrRemove (file, fileList) {
this.deletePicture(file, fileList, this.introduceUploadList);
......@@ -954,41 +1052,58 @@ export default {
this.isShowPopver = true;
},
// 选择时间
pickerTime (time) {
let startHours = time[0].getHours() + "";
let startMinutes = time[0].getMinutes() + "";
let startSeconds = time[0].getSeconds() + "";
let endHours = time[1].getHours() + "";
let endMinutes = time[1].getMinutes() + "";
let endSeconds = time[1].getSeconds() + "";
if (startHours < 10) {
startHours = "0" + startHours;
// 库存增减更改
hasNumberChange () {
if (!this.inventoryAdd) {
this.$nextTick(() => {
this.inventoryAdd = 0;
});
}
if (startMinutes < 10) {
startMinutes = "0" + startMinutes;
if (this.inventoryAdd + this.goodsObj.inventory_rest < 0) {
this.$nextTick(() => {
this.inventoryAdd = 0;
});
this.$message.error("库存增减不得超出剩余库存范围");
}
if (startSeconds < 10) {
startSeconds = "0" + startSeconds;
console.log(this.inventoryAdd);
},
// 单人可购买上限的修改
handleLimitChange () {
if (!this.goodsObj.rule_limit) {
this.$nextTick(() => {
this.goodsObj.rule_limit = 0;
});
}
if (endHours < 10) {
endHours = "0" + endHours;
},
// 时间校验器
timePicker (time) {
let Hours = time.getHours() + "";
let Minutes = time.getMinutes() + "";
let Seconds = time.getSeconds() + "";
if (Hours < 10) {
Hours = "0" + Hours;
}
if (endMinutes < 10) {
endMinutes = "0" + endMinutes;
if (Minutes < 10) {
Minutes = "0" + Minutes;
}
if (endSeconds < 10) {
endSeconds = "0" + endSeconds;
if (Seconds < 10) {
Seconds = "0" + Seconds;
}
this.activeStartTime = `${startHours}:${startMinutes}:${startSeconds}`;
this.activeEndTime = `${endHours}:${endMinutes}:${endSeconds}`;
console.log("时间节点", this.activeStartTime, this.activeEndTime);
return `${Hours}:${Minutes}:${Seconds}`;
},
// 选择规则开始时间
pickerStartTime (time) {
this.activeStartTime = this.timePicker(time);
},
// 选择规则结束时间
pickerEndTime (time) {
this.activeEndTime = this.timePicker(time);
},
// 过期时间更改
expirDateChange (time) {
console.log(time);
let YYYY = time.getFullYear();
let MM = time.getMonth() + 1;
let DD = time.getDate();
......@@ -1011,7 +1126,6 @@ export default {
ss = "0" + ss;
}
this.expirationTime = `${YYYY}-${MM}-${DD} ${HH}:${mm}:${ss}`;
console.log(this.expirationTime);
},
// 禁用时间
......@@ -1026,17 +1140,36 @@ export default {
// 更改售价
salePrice () {
if (this.goodsObj.price.length === 0) return (this.goodsObj.price = 0);
this.goodsObj.price = parseFloat(this.goodsObj.price).toFixed(2);
if (this.goodsObj.price.length === 0) {
this.goodsObj.price = 0;
}
const parseFloatValue = Number(this.goodsObj.price).toFixed(2);
this.goodsObj.price = Number(parseFloatValue);
if (
typeof this.goodsObj.price === "number" &&
isNaN(this.goodsObj.price)
) {
this.goodsObj.price = 0;
return this.$message.error("售价价格必须为数字");
}
},
// 更改原价
perPrice () {
if (this.goodsObj.original_price === 0)
return (this.goodsObj.original_price = 0);
this.goodsObj.original_price = parseFloat(
this.goodsObj.original_price
).toFixed(2);
if (this.goodsObj.original_price.length === 0) {
this.goodsObj.original_price = 0;
}
const parseOriginalPrice = Number(this.goodsObj.original_price).toFixed(
2
);
this.goodsObj.original_price = Number(parseOriginalPrice);
if (
typeof this.goodsObj.original_price === "number" &&
isNaN(this.goodsObj.original_price)
) {
this.goodsObj.original_price = 0;
return this.$message.error("原价价格必为数字");
}
},
// 审核通过
......@@ -1049,14 +1182,18 @@ export default {
// 审核拒绝
async onDefault () {
if (!this.rejectReason.reason)
return this.$message.error("审核驳回时,驳回原因不能为空");
const query = {
goods_spu_id: this.goodsObj.goods_spu_id,
rejected_reason: this.rejectReason.reason
};
console.log(query.rejected_reason);
if (query.rejected_reason !== "0" && !query.rejected_reason) {
return this.$message.error("审核驳回时,审核原因不可为空");
}
const res = await auditReject(query);
if (res.code !== 0) return this.$message.error(res.reason);
if (res.code !== 0) {
return this.$message.error(res.reason);
}
this.$message.warning("审核驳回成功!");
this.$router.replace({ name: "GoodsList" });
},
......@@ -1068,6 +1205,10 @@ export default {
// 保存修改信息
async saveDetailMessage () {
await this.checkSameName(); // 检验商品名称是否可用
if (!this.optionsValue) {
return this.$message.error("请选择商品分类");
}
const query = {
goods_spu_id: this.goodsObj.goods_spu_id, // 商品id
category_1_id: this.optionsValue[0], // 商品一级分类id
......@@ -1083,20 +1224,18 @@ export default {
rule_refund: this.goodsObj.rule_refund, // 退款规则
rule_start_time: this.activeStartTime, // 规则开始时间
rule_end_time: this.activeEndTime, // 规则结束时间
inventory_add: this.goodsObj.inventory_rest, // 库存
inventory_add: this.inventoryAdd, // 库存增减
original_price: this.goodsObj.original_price, // 原价
price: this.goodsObj.price, // 现价
sub_shop_ids: this.shopIds // 门店id
sub_shop_ids: this.shopIds, // 门店id
rule_date_type: this.goodsObj.rule_date_type // 使用日期类型(周末/工作日)
};
console.log(query);
// 必填校验
if (!this.goodsObj.goods_spu_id) {
return this.$message.error("未传入商品id");
}
if (!query.category_1_id || !query.category_2_id) {
return this.$message.error("请选择商品分类");
}
if (!query.goods_name) {
return this.$message.error("请填写商品名称");
}
......@@ -1106,26 +1245,33 @@ export default {
if (!query.expiration_time) {
return this.$message.error("过期时间未填写,请填写后再提交");
}
if (!query.rule_limit) {
if (query.rule_limit === "") {
return this.$message.error("请填写单人可购买上限");
}
if (!query.rule_desc) {
return this.$message.error("请填写使用规则描述");
if (typeof this.goodsObj.rule_limit !== "number") {
return this.$message.error("单人可购买上限只能为数字格式");
}
if (typeof query.rule_limit !== "number") {
return this.$message.error("单人可购上线只可为数值");
}
if (!query.rule_refund) {
return this.$message.error("请填写退款规则");
}
if (!query.inventory_add) {
return this.$message.error("请填写库存剩余量");
}
if (!query.original_price) {
if (query.original_price.length === 0) {
return this.$message.error("请填写原价(保留两位小数)");
}
if (!query.price) {
return this.$message.error("请填写价(保留两位小数)");
if (query.price.length === 0) {
return this.$message.error("请填写价(保留两位小数)");
}
if (typeof query.original_price !== "number") {
return this.$message.error("原价价格必须为数字");
}
if (typeof query.price !== "number") {
return this.$message.error("售价价格必须为数字格式");
}
if (!query.sub_shop_ids) {
return this.$message.error("请填写门店id");
return this.$message.error("请至少选择一个门店");
}
const res = await editGoods(query);
......
.goods {
width: 100%;
height: 100%;
padding: 0 30px;
}
.goods .search_condition {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
align-items: center;
}
.goods .search_condition .search_button {
display: flex;
align-items: center;
justify-self: flex-end;
}
.goods .search_condition .search_button .el-form-item__content {
display: flex;
justify-content: space-around;
}
.goods .commodity_list {
margin-top: 30px;
}
.goods .pagination {
margin-top: 30px;
}
......@@ -17,6 +17,7 @@
<!-- 所属分类 -->
<el-form-item label="所属分类">
<el-cascader
v-model="searchProps.classValue"
@change="handleTypeChange"
:options="labelOptions"
:props="cascaderProps"
......@@ -32,8 +33,8 @@
<el-form-item label="生活号名称">
<el-input v-model="searchProps.life_account_name"></el-input>
</el-form-item>
<!-- 商品状态 -->
<el-form-item label="商品状态">
<!-- 审核状态 -->
<el-form-item label="审核状态">
<el-select
v-model="audit_status"
multiple
......@@ -134,15 +135,15 @@
>审核驳回</span>
&nbsp;&nbsp;&nbsp;
<span
v-if="scope.row.online_status == 0"
v-if="scope.row.online_status == 0 && scope.row.audit_status != 2"
style="color:#FF982C;"
>未上架</span>
<span
v-if="scope.row.online_status == 1"
v-if="scope.row.online_status == 1 && scope.row.audit_status != 2"
style="color:#5CC247;"
>已上架</span>
<span
v-if="scope.row.online_status == 2"
v-if="scope.row.online_status == 2 && scope.row.audit_status != 2"
style="color:#FD6B6F;"
>已下架</span>
</template>
......@@ -166,7 +167,6 @@
>
<template #default="scope">
<el-button
v-if="scope.row.audit_status == 2 || scope.row.online_status == 1 || scope.row.online_status == 2"
type="text"
@click="goDetail(`EDIT`, scope.row.goods_spu_id)"
>编辑</el-button>
......@@ -178,7 +178,7 @@
>审核</el-button>
<el-popconfirm
v-if="scope.row.online_status == 2 || scope.row.audit_status != 0 && scope.row.online_status == 0"
v-if="scope.row.online_status == 2 "
title="您确定要上架该商品吗?"
cancelButtonType="default"
@confirm="changeGoodsState('GROUNDING', scope.row.goods_spu_id)"
......@@ -189,7 +189,7 @@
</el-popconfirm>
<el-popconfirm
v-if="scope.row.online_status == 1"
v-if=" scope.row.online_status != 2 && (scope.row.audit_status == 1 || scope.row.online_status == 1) "
title="您确定要下架该商品吗?"
cancelButtonType="default"
@confirm="
......@@ -200,6 +200,11 @@
<el-button type="text">下架</el-button>
</template>
</el-popconfirm>
<el-button
@click="goDetail(`DETAIL`,scope.row.goods_spu_id)"
type="text"
>详情</el-button>
</template>
</el-table-column>
</el-table>
......@@ -262,14 +267,15 @@ export default {
category_2_id: "", // 二级分类id
life_account_id: "",
life_account_name: "",
audit_status: "", // 商品状态
online_status: "" // 上架状态
audit_status: "", // 审核状态
online_status: "", // 上架状态
classValue: ""
},
// 级联选择器
labelOptions: [],
// 商品状态
// 审核状态
stateOption: [
{ value: 0, label: "待审核" },
{ value: 1, label: "审核通过" },
......@@ -333,7 +339,7 @@ export default {
this.searchProps.category_1_id = this.getVal(val, 0);
this.searchProps.category_2_id = this.getVal(val, 1);
},
// 商品状态赋值
// 审核状态赋值
handleStatusChange (val) {
this.searchProps.audit_status = this.getValue(val);
},
......@@ -348,7 +354,7 @@ export default {
},
// 重置表单
resetList () {
(this.searchProps = {
this.searchProps = {
page: 1, // 页码
page_size: 20, // 页数大小
goods_spu_id: "", // 后台商品id
......@@ -357,10 +363,13 @@ export default {
category_2_id: "", // 二级分类id
life_account_id: "",
life_account_name: "",
audit_status: "", // 商品状态
online_status: "" // 上架状态
}),
this.getCommodityList();
audit_status: "", // 审核状态
online_status: "", // 上架状态
classValue: ""
};
this.audit_status = [];
this.onlineStatus = [];
this.getCommodityList();
},
// 上架/下架操作
async changeGoodsState (state, spuId) {
......
<template>
<layout>
<el-card class="container" style="width: 100%; height: 100%">
<el-card
class="container"
style="width: 100%; height: 100%"
>
<div class="retail">
<el-form inline :model="retailActivitie" ref="retailActivitie">
<el-form
inline
:model="retailActivitie"
ref="retailActivitie"
>
<!-- 查询 -->
<el-row>
<el-form-item label="分销活动id" prop="marketing_id">
<el-form-item
label="分销活动id"
prop="marketing_id"
>
<!-- :rules="[{ type: 'number', message: '活动id必须为数字值' }]" -->
<el-input
onkeyup="value=value.replace(/[^\d]/g,'')"
......@@ -34,7 +44,10 @@
</el-form-item>
<!-- 按钮操作 -->
<el-form-item class="search_button">
<el-button type="primary" @click="toSearch">搜索</el-button>
<el-button
type="primary"
@click="toSearch"
>搜索</el-button>
<el-button @click="reset('retailActivitie')">重置</el-button>
</el-form-item>
</el-row>
......@@ -42,10 +55,14 @@
type="primary"
style="margin-bottom: 10px"
@click="createDtb"
>创建分销活动</el-button
>
>创建分销活动</el-button>
<!-- Tab -->
<el-table :data="tableData" type="index" align="center" border>
<el-table
:data="tableData"
type="index"
align="center"
border
>
<el-table-column
align="center"
prop="marketing_id"
......@@ -91,11 +108,13 @@
</span>
</template>
</el-table-column>
<el-table-column align="center" prop="online_status" label="状态">
<el-table-column
align="center"
prop="online_status"
label="状态"
>
<template #default="scope">
<span
:style="{ color: scope.row.online_status == 3 ? 'red' : '' }"
>
<span :style="{ color: scope.row.online_status == 3 ? 'red' : '' }">
{{
scope.row.online_status == 2
? "关闭"
......@@ -112,9 +131,17 @@
label="创建人"
>
</el-table-column>
<el-table-column align="center" prop="create_time" label="创建时间">
<el-table-column
align="center"
prop="create_time"
label="创建时间"
>
</el-table-column>
<el-table-column align="center" prop="update_time" label="更新时间">
<el-table-column
align="center"
prop="update_time"
label="更新时间"
>
</el-table-column>
<el-table-column
align="center"
......@@ -122,14 +149,17 @@
label="分销到期时间"
>
</el-table-column>
<el-table-column fixed="right" align="center" label="操作">
<el-table-column
fixed="right"
align="center"
label="操作"
>
<template #default="scope">
<el-button
@click="handleClick(scope.row)"
type="text"
size="mini"
>查看</el-button
>
>查看</el-button>
<el-button
type="text"
size="mini"
......@@ -149,8 +179,7 @@
scope.row.online_status !== 3
"
@click.stop="handelEnable(scope.row, 1)"
>启用</el-button
>
>启用</el-button>
</template>
</el-table-column>
</el-table>
......@@ -197,7 +226,10 @@
:disabled="shopStart !== 0"
></el-input>
</el-form-item>
<el-form-item label="一级佣金:" prop="first_commission_value">
<el-form-item
label="一级佣金:"
prop="first_commission_value"
>
<el-input
v-model="ruleForm.first_commission_value"
@input="changeValue($event, 'first_commission_value')"
......@@ -206,7 +238,10 @@
<template #append>%</template>
</el-input>
</el-form-item>
<el-form-item label="二级佣金: " prop="second_commission_value">
<el-form-item
label="二级佣金: "
prop="second_commission_value"
>
<el-input
v-model="ruleForm.second_commission_value"
@input="changeValue($event, 'second_commission_value')"
......@@ -238,7 +273,10 @@
ref="ruleIdForm"
size="mini"
>
<div class="queryBox" v-show="shopStart == 0">
<div
class="queryBox"
v-show="shopStart == 0"
>
<el-form-item label="关联商品:"> </el-form-item>
<el-form-item label="商品id:">
<el-input
......@@ -257,8 +295,7 @@
size="mini"
style="margin-bottom: 30px"
@click="findProducts"
>查询</el-button
>
>查询</el-button>
</div>
<div :class="shopStart == 0 ? 'newTab' : 'readTab'">
<el-table
......@@ -271,7 +308,10 @@
style="width: 100%"
@selection-change="selectGoodsChange"
>
<el-table-column align="center" type="selection">
<el-table-column
align="center"
type="selection"
>
</el-table-column>
<el-table-column
align="center"
......@@ -333,7 +373,7 @@ import {
} from "@/service/Goods/goods";
import { ElMessage } from "element-plus";
// 开启关闭防抖
function debounce(callback, delay) {
function debounce (callback, delay) {
let timer = null;
return function (...args) {
if (timer) {
......@@ -443,7 +483,7 @@ export default {
else this.ruleForm[level] = "";
},
// 查看详情列表
async handleClick(row) {
async handleClick (row) {
this.dialogFormVisible = true;
this.shopStart = 1;
this.disabled = true;
......@@ -459,13 +499,13 @@ export default {
}
},
// 页码变化
handleCurrentChange(e) {
handleCurrentChange (e) {
this.retailActivitie.page = e;
this.getMarketingList();
},
// 营销活动列表
async getMarketingList() {
async getMarketingList () {
try {
const res = await getMarketingList(this.retailActivitie);
this.tableData = res.result;
......@@ -493,12 +533,12 @@ export default {
}
}, 300),
// 创建分销活动
createDtb() {
createDtb () {
this.dialogFormVisible = true;
this.shopStart = 0;
},
// 重置
reset(retailActivitie) {
reset (retailActivitie) {
(this.retailActivitie = {
marketing_id: "",
marketing_name: "",
......@@ -511,11 +551,11 @@ export default {
this.getMarketingList({});
},
// 搜索
toSearch() {
toSearch () {
this.getMarketingList();
console.log(this.retailActivitie);
},
selectTime(e) {
selectTime (e) {
let date = new Date();
if (e && e[1] < date) {
ElMessage(`'活动结束时间不能早于当前时间'`);
......@@ -523,9 +563,9 @@ export default {
}
},
// 获取时间格式
formatTime(date) {
formatTime (date) {
// 封装函数判断是否要在目标前边加 ’0‘
function getStr(target) {
function getStr (target) {
return ("" + target).length === 1 ? "0" + target : target;
}
// 获取月
......@@ -546,7 +586,7 @@ export default {
return timeStr;
},
// 查询商品列表
async findProducts() {
async findProducts () {
// 获取参数
const { goods_sku_id, life_account_id } = this.ruleIdForm;
let [start_time, end_time] = this.timeSelect;
......@@ -575,10 +615,10 @@ export default {
ElMessage.error("请求查询商品列表失败");
}
},
selectGoodsChange(e) {
selectGoodsChange (e) {
this.ruleForm.goods_sku_id = e.map((item) => item.goods_sku_id);
},
async getAllList() {
async getAllList () {
let all = await getMarketingList({
page: 1,
page_size: this.retailActivitie.count,
......@@ -640,7 +680,7 @@ export default {
},
// 清空
resetDate() {
resetDate () {
(this.ruleForm = {
marketing_name: "",
first_commission_value: "",
......@@ -659,13 +699,13 @@ export default {
});
},
// 取消
cancel() {
cancel () {
this.dialogFormVisible = false;
this.resetDate();
this.getMarketingList();
},
},
created() {
created () {
this.getMarketingList();
this.getAllList();
},
......
// 检测内容是否带表情符号
function checkString (strings) {
const checkKey = /[^\u0020-\u007E\u00A0-\u00BE\u2E80-\uA4CF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF\u0080-\u009F\u2000-\u201f\u2026\u2022\u20ac\r\n]/g;
if (checkKey.test(strings)) {
return false;
} else {
return true;
};
};
export default { checkString }
\ No newline at end of file
......@@ -14,7 +14,7 @@ import goodsRouter from "./Goods/index";
const routes = [
{
path: "/op/enterprise",
redirect: "/enterprise/certification"
redirect: "/op/enterprise/certification"
},
{
path: "/op/404",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment