信用积分多店铺改造

This commit is contained in:
aixianling
2022-04-13 18:27:25 +08:00
parent 5e5d0b4308
commit fac5ed82bb

View File

@@ -53,13 +53,12 @@
</template> </template>
</ai-list> </ai-list>
<ai-dialog <ai-dialog
:title="dialog.title" :title="dialog.title||'添加店铺'"
:visible.sync="dialog.visible" :visible.sync="dialog.visible"
:customFooter="true" :customFooter="true"
:destroyOnClose="true" :destroyOnClose="true"
@close="init('ruleForm')" @close="dialogInfo={}"
width="520px" width="520px">
>
<div class="form_div"> <div class="form_div">
<el-form <el-form
ref="ruleForm" ref="ruleForm"
@@ -88,12 +87,18 @@
maxlength="11" maxlength="11"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="所在地区" prop="areaId">
<ai-area-get v-model="dialogInfo.areaId" :instance="instance" :root="rootArea"/>
</el-form-item>
<el-form-item label="店铺地址" prop="shopAddress"> <el-form-item label="店铺地址" prop="shopAddress">
<el-input <el-input
placeholder="请输入…" placeholder="请输入…"
v-model="dialogInfo.shopAddress" v-model="dialogInfo.shopAddress"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="店铺照片" prop="shopPhoto">
<ai-uploader :instance="instance" :limit="1" @change="handleShopPhoto"/>
</el-form-item>
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-radio-group v-model="dialogInfo.status"> <el-radio-group v-model="dialogInfo.status">
<el-radio label="1">启用</el-radio> <el-radio label="1">启用</el-radio>
@@ -103,14 +108,8 @@
</el-form> </el-form>
</div> </div>
<div class="dialog-footer" slot="footer"> <div class="dialog-footer" slot="footer">
<el-button @click="dialog.visible = false" size="medium" <el-button @click="dialog.visible = false">取消</el-button>
>取消 <el-button @click="onConfirm" type="primary">确认</el-button>
</el-button
>
<el-button @click="onConfirm('ruleForm')" type="primary" size="medium"
>确认
</el-button
>
</div> </div>
</ai-dialog> </ai-dialog>
<ai-dialog :visible.sync="authDialog" title="授权" @onConfirm="handleAuth" @closed="form={}" width="500px"> <ai-dialog :visible.sync="authDialog" title="授权" @onConfirm="handleAuth" @closed="form={}" width="500px">
@@ -214,6 +213,7 @@ export default {
operators: [ operators: [
{required: true, message: "请选择操作员", trigger: "blur"}, {required: true, message: "请选择操作员", trigger: "blur"},
], ],
shopPhoto: [{required: true, message: "请上传店铺图片"}]
}, },
peopleAjaxUrl: "/admin/user/page", peopleAjaxUrl: "/admin/user/page",
authDialog: false, authDialog: false,
@@ -224,11 +224,13 @@ export default {
computed: { computed: {
...mapState(["user"]), ...mapState(["user"]),
rootArea() {
return this.user.info.areaId?.replace(/(\d{6}).+/, '$1' + Array(7).join("0"))
}
}, },
created() { created() {
this.unitId = this.user.info.unitId; this.unitId = this.user.info.unitId;
this.$dict.load("assessmentStartStatus").then(() => { this.$dict.load("assessmentStartStatus").then(() => {
this.getList(); this.getList();
}); });
@@ -307,7 +309,7 @@ export default {
this.getList(); this.getList();
}, },
onConfirm(formName) { onConfirm() {
if (this.dialogInfo.operators.length) { if (this.dialogInfo.operators.length) {
this.dialogInfo.operators.map((item) => { this.dialogInfo.operators.map((item) => {
if (!item.name) { if (!item.name) {
@@ -315,16 +317,14 @@ export default {
} }
}); });
} }
this.$refs[formName].validate((valid) => { this.$refs.ruleForm.validate((valid) => {
if (valid) { if (valid) {
this.instance this.instance.post(`/app/appvillagerintegralshop/addOrUpdate`, this.dialogInfo).then(res => {
.post(`/app/appvillagerintegralshop/addOrUpdate`, this.dialogInfo) if (res?.code == 0) {
.then((res) => {
if (res.code == 0) {
this.onReset(); this.onReset();
this.onCancel(); this.onCancel();
} }
}); })
} else { } else {
return false; return false;
} }
@@ -335,32 +335,16 @@ export default {
this.dialog.visible = false; this.dialog.visible = false;
this.dialog.visibleStatus = false; this.dialog.visibleStatus = false;
}, },
init(formName) {
this.$refs[formName].clearValidate();
Object.keys(this.dialogInfo).forEach((e) => {
this.dialogInfo[e] = "";
});
this.dialogInfo.status = "1";
this.dialogInfo.operators = [];
},
delate(index) {
this.dialogInfo.operators.splice(index, 1);
},
onAdd() { onAdd() {
Object.keys(this.dialogInfo).forEach((e) => {
this.dialogInfo[e] = "";
});
this.dialogInfo.status = "1"; this.dialogInfo.status = "1";
this.dialogInfo.operators = []; this.dialogInfo.operators = [];
this.dialog.visible = true; this.dialog.visible = true;
this.dialogInfo.areaId = this.areaId;
}, },
handleShopPhoto(v) {
this.dialogInfo.shopPhoto = v?.[0]?.url || ""
}
}, },
}; }
</script> </script>
<style lang="scss"> <style lang="scss">