Browse Source

编辑店铺

master
tianyi 3 months ago
parent
commit
1f6296c66f
  1. 178
      src/views/app/shop/addEdit.vue
  2. 9
      src/views/app/shop/dictManage.vue
  3. 85
      src/views/my-components/hiver/shopArea-tree-choose.vue

178
src/views/app/shop/addEdit.vue

@ -1,30 +1,15 @@
<template> <template>
<div class="user-edit"> <div class="user-edit">
<!-- Drawer抽屉 --> <!-- Drawer抽屉 -->
<Drawer <Drawer :title="title" v-model="visible" width="720" draggable :mask-closable="type == '0'">
:title="title"
v-model="visible"
width="720"
draggable
:mask-closable="type == '0'"
>
<div :style="{ maxHeight: maxHeight }" class="drawer-content"> <div :style="{ maxHeight: maxHeight }" class="drawer-content">
<Form <Form ref="form" :model="form" :rules="formValidate" label-position="top">
ref="form" <Row :gutter="32">
:model="form"
:rules="formValidate"
label-position="top"
>
<Row :gutter="32" >
<Col span="12"> <Col span="12">
<FormItem label="店铺名称" prop="shopName"> <FormItem label="店铺名称" prop="shopName">
<Input <Input v-model="form.shopName" autocomplete="off" :maxlength="16" />
v-model="form.shopName"
autocomplete="off"
:maxlength="16"
/>
</FormItem> </FormItem>
</Col> </Col>
<Col span="12"> <Col span="12">
@ -36,10 +21,8 @@
<Row :gutter="32"> <Row :gutter="32">
<Col span="12"> <Col span="12">
<FormItem label="所属区域" class="form-noheight"> <FormItem label="所属区域" class="form-noheight">
<shopArea-tree-choose <shopArea-tree-choose @on-change="handleSelectShopAreaTree"
@on-change="handleSelectShopAreaTree" ref="shopAreaTree"></shopArea-tree-choose>
ref="shopAreaTree"
></shopArea-tree-choose>
</FormItem> </FormItem>
</Col> </Col>
<Col span="12"> <Col span="12">
@ -55,54 +38,34 @@
</FormItem> </FormItem>
</Col> </Col>
</Row> </Row>
<Row :gutter="32" > <Row :gutter="32">
<Col span="12"> <Col span="12">
<FormItem label="联系方式" prop="contactPhone"> <FormItem label="联系方式" prop="contactPhone">
<Input <Input v-model="form.contactPhone" autocomplete="off" :maxlength="16" />
v-model="form.contactPhone"
autocomplete="off"
:maxlength="16"
/>
</FormItem> </FormItem>
</Col> </Col>
<Col span="12"> <Col span="12">
<FormItem label="副标题" prop="contactPhone"> <FormItem label="副标题" prop="contactPhone">
<Input <Input v-model="form.subtitle" autocomplete="off" :maxlength="16" />
v-model="form.subtitle"
autocomplete="off"
:maxlength="16"
/>
</FormItem> </FormItem>
</Col> </Col>
</Row> </Row>
<Row :gutter="32" > <Row :gutter="32">
<Col span="12"> <Col span="12">
<FormItem label="支付宝账号" prop="contactPhone"> <FormItem label="支付宝账号" prop="contactPhone">
<Input <Input v-model="form.aliAccount" autocomplete="off" :maxlength="16" />
v-model="form.aliAccount"
autocomplete="off"
:maxlength="16"
/>
</FormItem> </FormItem>
</Col> </Col>
<Col span="12"> <Col span="12">
<FormItem label="支付宝户名" prop="contactPhone"> <FormItem label="支付宝户名" prop="contactPhone">
<Input <Input v-model="form.aliName" autocomplete="off" :maxlength="16" />
v-model="form.aliName"
autocomplete="off"
:maxlength="16"
/>
</FormItem> </FormItem>
</Col> </Col>
</Row> </Row>
<Row :gutter="32" > <Row :gutter="32">
<Col span="12"> <Col span="12">
<FormItem label="排名" prop="shoprank"> <FormItem label="排名" prop="shoprank">
<Input <Input v-model="form.shoprank" autocomplete="off" :maxlength="16" />
v-model="form.shoprank"
autocomplete="off"
:maxlength="16"
/>
</FormItem> </FormItem>
</Col> </Col>
</Row> </Row>
@ -121,9 +84,7 @@
</Form> </Form>
</div> </div>
<div class="drawer-footer br" v-show="type != '0'"> <div class="drawer-footer br" v-show="type != '0'">
<Button type="primary" :loading="submitLoading" @click="submit" <Button type="primary" :loading="submitLoading" @click="submit">提交</Button>
>提交</Button
>
<Button @click="visible = false">取消</Button> <Button @click="visible = false">取消</Button>
</div> </div>
</Drawer> </Drawer>
@ -131,18 +92,26 @@
</template> </template>
<script> <script>
import {getUsersByRoleName,getDictDataByType} from "@/api/index"; import {
import { getUsersByRoleName,
getDictDataByType
} from "@/api/index";
import {
validateUsername, validateUsername,
validateMobile, validateMobile,
validatePassword, validatePassword,
} from "@/libs/validate"; } from "@/libs/validate";
import shopAreaTreeChoose from "@/views/my-components/hiver/shopArea-tree-choose"; import shopAreaTreeChoose from "@/views/my-components/hiver/shopArea-tree-choose";
import uploadPicInput from "@/views/my-components/hiver/upload-pic-input"; import uploadPicInput from "@/views/my-components/hiver/upload-pic-input";
import SetPassword from "@/views/my-components/hiver/set-password"; import SetPassword from "@/views/my-components/hiver/set-password";
import dict from "@/views/my-components/hiver/dict"; import dict from "@/views/my-components/hiver/dict";
import {addShop, editShop} from "@/api/app"; import {
export default { addShop,
editShop,
initShopArea,
loadShopArea,
} from "@/api/app";
export default {
name: "addEdit", name: "addEdit",
components: { components: {
shopAreaTreeChoose, shopAreaTreeChoose,
@ -179,33 +148,59 @@ export default {
}, },
formValidate: { formValidate: {
// //
username: [ username: [{
{ required: true, message: "请输入登录账号", trigger: "blur" }, required: true,
{ validator: validateUsername, trigger: "blur" }, message: "请输入登录账号",
], trigger: "blur"
nickname: [ },
{ required: true, message: "请输入用户名", trigger: "blur" }, {
validator: validateUsername,
trigger: "blur"
},
], ],
mobile: [ nickname: [{
{ required: true, message: "请输入手机号", trigger: "blur" }, required: true,
{ validator: validateMobile, trigger: "blur" }, message: "请输入用户名",
trigger: "blur"
}, ],
mobile: [{
required: true,
message: "请输入手机号",
trigger: "blur"
},
{
validator: validateMobile,
trigger: "blur"
},
], ],
password: [ password: [{
{ required: true, message: "请输入密码", trigger: "blur" }, required: true,
{ validator: validatePassword, trigger: "blur" }, message: "请输入密码",
trigger: "blur"
},
{
validator: validatePassword,
trigger: "blur"
},
], ],
email: [ email: [{
{ required: true, message: "请输入邮箱地址" }, required: true,
{ type: "email", message: "邮箱格式不正确" }, message: "请输入邮箱地址"
},
{
type: "email",
message: "邮箱格式不正确"
},
], ],
}, },
}; };
}, },
methods: { methods: {
init() { init(v) {
this.getRoleList(); console.log("111")
this.getRoleList(v);
}, },
getRoleList() { getRoleList(v) {
getUsersByRoleName("ROLE_OWNER").then((res) => { getUsersByRoleName("ROLE_OWNER").then((res) => {
if (res.success) { if (res.success) {
this.roleList = res.result; this.roleList = res.result;
@ -221,9 +216,17 @@ export default {
this.businessDistrictLevelList = res.result; this.businessDistrictLevelList = res.result;
} }
}); });
getDictDataByType("mallRegion").then((res) => { initShopArea().then((res) => {
if (res.success) { if (res.success) {
this.shopAreaList = res.result; res.result.forEach(function(e) {
if (e.isParent) {
e.loading = false;
e.children = [];
e._loading = false;
}
});
this.data = res.result;
} }
}); });
getDictDataByType("shopType").then((res) => { getDictDataByType("shopType").then((res) => {
@ -251,11 +254,11 @@ export default {
this.form.endTime = this.format(this.form.endTime, "yyyy-MM-dd"); this.form.endTime = this.format(this.form.endTime, "yyyy-MM-dd");
} }
debugger; debugger;
if(this.form.users == '' || this.form.users == null){ if (this.form.users == '' || this.form.users == null) {
delete this.form.users; delete this.form.users;
} }
// //
if(this.form.shopType != '' && this.form.shopType != null){ if (this.form.shopType != '' && this.form.shopType != null) {
this.shopType.forEach(item => { this.shopType.forEach(item => {
debugger; debugger;
if (this.form.shopType == item.value) { if (this.form.shopType == item.value) {
@ -348,10 +351,9 @@ export default {
mounted() { mounted() {
this.init(); this.init();
}, },
}; };
</script> </script>
<style lang="less"> <style lang="less">
@import "@/styles/drawer-common.less"; @import "@/styles/drawer-common.less";
</style> </style>

9
src/views/app/shop/dictManage.vue

@ -392,7 +392,7 @@
specNum:9999 specNum:9999
}], }],
sellTime:0, // sellTime:0, //
isMoreBuy:0, isMoreBuy:0, //
sellBeginTime:'', //--- sellBeginTime:'', //---
sellEndTime:'', //--- sellEndTime:'', //---
attributeList:'', attributeList:'',
@ -775,8 +775,6 @@
}).then((res) => { }).then((res) => {
if(res.code == 200){ if(res.code == 200){
this.categorySonData = res.result.content this.categorySonData = res.result.content
console.log("this.modalclassType",this.modalclassType)
console.log("this.categorySonData",this.categorySonData)
if(this.modalclassType == 'shuxing'){ if(this.modalclassType == 'shuxing'){
for (var i = 0; i < this.categorySonData.length; i++) { for (var i = 0; i < this.categorySonData.length; i++) {
if(this.attrValueArr.length>0){ if(this.attrValueArr.length>0){
@ -834,9 +832,6 @@
this.addGoodsForm.isMoreBuy = type; this.addGoodsForm.isMoreBuy = type;
}, },
checkSpecValue(index){ checkSpecValue(index){
//this.typeToAttrName = res.result.content[this.categoryIndex].title
console.log("this.categorySonData[index]",this.categorySonData[index])
console.log("this.modalclassType",this.modalclassType)
this.categorySonData[index].checked = !this.categorySonData[index].checked this.categorySonData[index].checked = !this.categorySonData[index].checked
if(this.modalclassType == 'shuxing'){ if(this.modalclassType == 'shuxing'){
if(this.categorySonData[index].checked == true){ if(this.categorySonData[index].checked == true){
@ -865,8 +860,6 @@
}, },
guigeSubmit(){ guigeSubmit(){
if(this.modalclassType == 'shuxing'){ if(this.modalclassType == 'shuxing'){
console.log("this.addGoodsForm.attributeList1",this.addGoodsForm.attributeList1)
console.log("this.attrValueArr",this.attrValueArr)
for(let i=0;i<this.attrValueArr.length;i++){ for(let i=0;i<this.attrValueArr.length;i++){
if(this.addGoodsForm.attributeList1.size == 0){ if(this.addGoodsForm.attributeList1.size == 0){
//set has get //set has get

85
src/views/my-components/hiver/shopArea-tree-choose.vue

@ -1,49 +1,17 @@
<template> <template>
<div> <div>
<div style="display: flex;"> <div style="display: flex;">
<Input <Input v-model="shopAreaTitle" readonly :size="size" :disabled="disabled" :prefix="prefix" :suffix="suffix"
v-model="shopAreaTitle" style="margin-right: 10px" :placeholder="placeholder" :clearable="clearable" @on-clear="clearSelect" />
readonly <Poptip transfer trigger="click" placement="right" title="选择区域" width="250">
:size="size" <Button :size="size" :disabled="disabled" :icon="icon" :type="type" :shape="shape"
:disabled="disabled" :ghost="ghost">{{ text }}</Button>
:prefix="prefix"
:suffix="suffix"
style="margin-right: 10px"
:placeholder="placeholder"
:clearable="clearable"
@on-clear="clearSelect"
/>
<Poptip
transfer
trigger="click"
placement="right"
title="选择区域"
width="250"
>
<Button
:size="size"
:disabled="disabled"
:icon="icon"
:type="type"
:shape="shape"
:ghost="ghost"
>{{ text }}</Button
>
<div slot="content"> <div slot="content">
<Input <Input v-model="searchKey" suffix="ios-search" @on-change="searchDep" placeholder="输入区域名搜索"
v-model="searchKey" clearable />
suffix="ios-search"
@on-change="searchDep"
placeholder="输入区域名搜索"
clearable
/>
<div class="dep-tree-bar"> <div class="dep-tree-bar">
<Tree <Tree :data="dataDep" :load-data="loadData" @on-select-change="selectTree" :multiple="multiple">
:data="dataDep" </Tree>
:load-data="loadData"
@on-select-change="selectTree"
:multiple="multiple"
></Tree>
<Spin size="large" fix v-if="depLoading"></Spin> <Spin size="large" fix v-if="depLoading"></Spin>
</div> </div>
</div> </div>
@ -53,8 +21,12 @@
</template> </template>
<script> <script>
import { initShopArea, loadShopArea, searchShopArea } from "@/api/app"; import {
export default { initShopArea,
loadShopArea,
searchShopArea
} from "@/api/app";
export default {
name: "shopAreaTreeChoose", name: "shopAreaTreeChoose",
props: { props: {
text: { text: {
@ -103,9 +75,9 @@ export default {
}, },
methods: { methods: {
initShopAreaData() { initShopAreaData() {
loadShopArea(JSON.parse(this.getStore("userInfo")).departmentId).then((res) => { initShopArea().then((res) => {
if (res.success) { if (res.success) {
res.result.forEach(function (e) { res.result.forEach(function(e) {
if (e.isParent) { if (e.isParent) {
e.loading = false; e.loading = false;
e.children = []; e.children = [];
@ -122,7 +94,7 @@ export default {
loadData(item, callback) { loadData(item, callback) {
loadShopArea(item.id).then((res) => { loadShopArea(item.id).then((res) => {
if (res.success) { if (res.success) {
res.result.forEach(function (e) { res.result.forEach(function(e) {
if (e.isParent) { if (e.isParent) {
e.loading = false; e.loading = false;
e.children = []; e.children = [];
@ -140,10 +112,12 @@ export default {
// //
if (this.searchKey) { if (this.searchKey) {
this.depLoading = true; this.depLoading = true;
searchShopArea({ title: this.searchKey }).then((res) => { searchShopArea({
title: this.searchKey
}).then((res) => {
this.depLoading = false; this.depLoading = false;
if (res.success) { if (res.success) {
res.result.forEach(function (e) { res.result.forEach(function(e) {
if (e.status == -1) { if (e.status == -1) {
e.title = "[已禁用] " + e.title; e.title = "[已禁用] " + e.title;
e.disabled = true; e.disabled = true;
@ -200,27 +174,26 @@ export default {
mounted() { mounted() {
this.initShopAreaData(); this.initShopAreaData();
}, },
}; };
</script> </script>
<style lang="less"> <style lang="less">
.dep-tree-bar { .dep-tree-bar {
position: relative; position: relative;
min-height: 80px; min-height: 80px;
max-height: 500px; max-height: 500px;
overflow: auto; overflow: auto;
margin-top: 5px; margin-top: 5px;
} }
.dep-tree-bar::-webkit-scrollbar { .dep-tree-bar::-webkit-scrollbar {
width: 6px; width: 6px;
height: 6px; height: 6px;
} }
.dep-tree-bar::-webkit-scrollbar-thumb { .dep-tree-bar::-webkit-scrollbar-thumb {
border-radius: 4px; border-radius: 4px;
-webkit-box-shadow: inset 0 0 2px #d1d1d1; -webkit-box-shadow: inset 0 0 2px #d1d1d1;
background: #e4e4e4; background: #e4e4e4;
} }
</style> </style>

Loading…
Cancel
Save