文件

126 行
5.6 KiB
HTML
可执行文件

<!--[1.7.90]-->
<div id="delStore" style="padding-bottom: 80px" v-loading="loading"
element-loading-text="数据加载中,请等待"
element-loading-spinner="el-icon-loading">
<el-form id="forms" label-width="68px">
<div>
<el-alert title="只有已关闭的门店才能进行删除操作" type="warning" :show-icon="false"></el-alert>
<el-form-item label="门店选择">
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选
</el-checkbox>
<el-checkbox-group v-model="checkedStore" @change="handleCheckedStoreChange">
<div v-for="(item,index) in stores" :key="index">
<el-checkbox :label="item.id">{{item.storetag}}</el-checkbox>
</div>
</el-checkbox-group>
</el-form-item>
</div>
</el-form>
<div class="footer-button-box">
<el-button type="primary" @click="sureSetManage">确 定</el-button>
</div>
</div>
<script type="text/javascript">
var delStore = new Vue({
el: "#delStore",
data: {
loading: false,
checkAll: false,
checkedStore: [],
isIndeterminate: false,
stores: {$stores},
allStoreId: []
},
methods: {
handleCheckAllChange(val) {
this.checkedStore = val ? this.allStoreId : [];
this.isIndeterminate = false;
},
handleCheckedStoreChange(value) {
let checkedCount = value.length;
this.checkAll = checkedCount === this.stores.length;
this.isIndeterminate = checkedCount > 0 && checkedCount < this.stores.length;
},
sureSetManage: function () {
this.$confirm(`<div>
<p style="line-height: 28px">
<i class='el-icon-warning' style="color: #e6a23c;font-size: 18px;padding-top: 4px;display: inline-block;vertical-align: top;"></i>
<span style='color: #333;'>确认删除已选择门店吗?</span>
</p>
<p style="padding-left: 22px;font-size: 12px">确定后将给商户发送验证码进行身份验证</p>
</div>`, '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
dangerouslyUseHTMLString: true,
}).then(() => {
$.ajax({
url: '/index.php/Retail/Store/sendDelPhoneMessage',
type: 'post',
success: (res) => {
if (res.status == 1) {
this.delStore();
setTimeout(() => {
this.$message.success(res.message);
}, 500)
} else {
this.$message.error(res.message);
}
}
});
}).catch(() => {
});
},
delStore() {
this.$prompt('删除门店需要验证商户身份,请输入验证码', '提示', {
closeOnClickModal: false,
confirmButtonText: '删除门店',
cancelButtonText: '取消',
title: '验证码',
inputPlaceholder: '请输入验证码',
inputPattern: /^\d{6}$/,
inputErrorMessage: '验证码为6位数字',
showClose: false,
closeOnHashChange: false,
beforeClose: (action, instance, done) => {
if (action == 'confirm') {
$.ajax({
url: "{:U('delstore')}",
type: "POST",
data: {
storeIds: this.checkedStore,
code: instance.inputValue,
},
success: (res) => {
if (res.status == 1) {
done();
this.$message({
type: 'success',
message: res.msg,
duration: 1000,
onClose: () => {
MenuApp.backPreview();
}
});
} else {
this.$message.error(res.msg);
$(instance.$el).find('input').focus();
}
}
})
} else {
done();
}
}
}).catch(() => {
})
},
},
mounted: function () {
for (var i = 0; i < this.stores.length; i++) {
this.allStoreId.push(this.stores[i].id);
}
}
});
</script>