Commit 7e0bb981 authored by jisiyu's avatar jisiyu

add: 商家管家

parent d94838c6
...@@ -18,11 +18,13 @@ ...@@ -18,11 +18,13 @@
<el-button type="text" :disabled="scope.row.status == 1" @click="modifyMerchant(scope.row.ota_id, scope.$index)"> <el-button type="text" :disabled="scope.row.status == 1" @click="modifyMerchant(scope.row.ota_id, scope.$index)">
修改 修改
</el-button> </el-button>
<el-button type="text" :disabled="scope.row.status == 1" @click="handleDisable(scope.row)">禁用</el-button> <el-button type="text" :disabled="scope.row.status == 1" @click="handleDisable(scope.row)">
{{ scope.row.status == 1 ? "启用" : "禁用" }}
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 添加商家 --> <!-- 添加商家弹窗 -->
<el-dialog title="商家编辑" v-model="merchantAdd" width="70%" :show-close="false"> <el-dialog title="商家编辑" v-model="merchantAdd" width="70%" :show-close="false">
<el-form class="dioFor" :model="addMerchant" :rules="rules"> <el-form class="dioFor" :model="addMerchant" :rules="rules">
<el-form-item label="商家名称" label-width="100px" prop="ota_name"> <el-form-item label="商家名称" label-width="100px" prop="ota_name">
...@@ -92,7 +94,7 @@ ...@@ -92,7 +94,7 @@
rules: { rules: {
name: [{ required: true, message: "请输入商家名称", trigger: "blur" }], name: [{ required: true, message: "请输入商家名称", trigger: "blur" }],
}, },
//修改信息 //弹窗初始:关闭
merchantAdd: false, merchantAdd: false,
addMerchant: { addMerchant: {
ota_name: "", ota_name: "",
...@@ -114,22 +116,25 @@ ...@@ -114,22 +116,25 @@
// this.addMerchant = this.merchantList[index]; // this.addMerchant = this.merchantList[index];
this.addMerchant = JSON.parse(JSON.stringify(this.merchantList[index])); this.addMerchant = JSON.parse(JSON.stringify(this.merchantList[index]));
} }
//点击“添加商家”按钮,弹窗打开
this.merchantAdd = true; this.merchantAdd = true;
}, },
async getOtaList() { async getOtaList() {
const { result, code, reason } = await otaList(); const { result, code, reason } = await otaList();
this.merchantList = result.list;
if (code !== 0) return this.$message.error(reason); if (code !== 0) return this.$message.error(reason);
this.merchantList = result.list;
}, },
//保存 //保存
async saveMerchant() { async saveMerchant() {
let { result, code, reason } = this.addMerchant.ota_id ? await updateOta(this.addMerchant) : await addOta(this.addMerchant); let { result, code, reason } = this.addMerchant.ota_id ? await updateOta(this.addMerchant) : await addOta(this.addMerchant);
if (code !== 0) return this.$message.error(reason); if (code !== 0) return this.$message.error(reason);
await this.getOtaList(); await this.getOtaList();
//点击保存时,弹窗关闭
this.merchantAdd = false; this.merchantAdd = false;
}, },
// 取消 // 取消
addCancel() { addCancel() {
//点击取消时,弹窗关闭
this.merchantAdd = false; this.merchantAdd = false;
this.resetDate(); this.resetDate();
}, },
......
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