Commit cd26d2b6 authored by pengyunqian's avatar pengyunqian

update:bugfile

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