|
@@ -251,7 +251,7 @@
|
|
|
>
|
|
|
<i
|
|
|
class="el-icon-download tb-icon"
|
|
|
- @click="get_donline(scope.row.platform_youzan_id)"
|
|
|
+ @click="showDonlineDlg(scope.row.platform_youzan_id)"
|
|
|
></i>
|
|
|
</el-tooltip>
|
|
|
</template>
|
|
@@ -264,10 +264,10 @@
|
|
|
class="demo-ruleForm"
|
|
|
label-width="80px"
|
|
|
>
|
|
|
- <el-form-item label="下线原因" prop="offline_reason">
|
|
|
+ <el-form-item label="下线原因" prop="offline_reason_id">
|
|
|
<el-select
|
|
|
style="width: 100%"
|
|
|
- v-model="donline_form.offline_reason"
|
|
|
+ v-model="donline_form.offline_reason_id"
|
|
|
placeholder="请选择下线原因"
|
|
|
>
|
|
|
<el-option
|
|
@@ -389,7 +389,7 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
data() {
|
|
|
- var validate = (rule, value, callback) => {
|
|
|
+ const validate = (rule, value, callback) => {
|
|
|
if (value == "") {
|
|
|
return callback(new Error("必填项不能为空"));
|
|
|
} else {
|
|
@@ -400,13 +400,15 @@ export default {
|
|
|
dialogFormVisible: false,
|
|
|
donline_formStOps: [],
|
|
|
donline_form: {
|
|
|
- offline_reason: "",
|
|
|
+ offline_reason_id: "",
|
|
|
offline_remark: "",
|
|
|
- skuCode: "",
|
|
|
+ platform_youzan_id: "",
|
|
|
},
|
|
|
donline_rules: {
|
|
|
- offline_reason: [{ validator: validate, required: true, trigger: "blur" }],
|
|
|
- offline_remark: [{ validator: validate, required: true, trigger: "blur" }],
|
|
|
+ offline_reason_id: [
|
|
|
+ { message: "请选择下线原因", required: true, trigger: "change" },
|
|
|
+ ],
|
|
|
+ offline_remark: [{ message: "请输入下线备注", required: true, trigger: "blur" }],
|
|
|
},
|
|
|
fileUrl: urlConfig.baseURL,
|
|
|
ruleForm: {
|
|
@@ -539,6 +541,42 @@ export default {
|
|
|
this.parmValue.page = 1;
|
|
|
await this.searchList();
|
|
|
},
|
|
|
+ //点击下线
|
|
|
+ async showDonlineDlg(platform_youzan_id) {
|
|
|
+ this.donline_form = {
|
|
|
+ offline_reason_id: "",
|
|
|
+ offline_remark: "",
|
|
|
+ platform_youzan_id: platform_youzan_id,
|
|
|
+ };
|
|
|
+ this.dialogFormVisible = true;
|
|
|
+ },
|
|
|
+ //商品下线原因 确定
|
|
|
+ async donlineDlg() {
|
|
|
+ await this.$refs.donline_Form.validate(async (valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.loading = true;
|
|
|
+ const obj = JSON.parse(JSON.stringify(this.donline_form));
|
|
|
+ const res = await asyncRequest.yz_goodoff(obj);
|
|
|
+ this.dialogFormVisible = false;
|
|
|
+ if (res && res.code === 0) {
|
|
|
+ this.loading = false;
|
|
|
+ this.$notify.success({
|
|
|
+ title: res.message,
|
|
|
+ message: "",
|
|
|
+ });
|
|
|
+ await this.searchList();
|
|
|
+ } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
+ this.loading = false;
|
|
|
+ this.$message.warning(res.message);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log("error submit!!");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
//导出
|
|
|
async goodsExport() {
|
|
|
if (
|
|
@@ -744,100 +782,7 @@ export default {
|
|
|
* @param {String} id id
|
|
|
* @param {String} status 0-禁用 1-启用
|
|
|
*/
|
|
|
- async get_donline(platform_youzan_id) {
|
|
|
- await this.$confirm(`确定要下线商品?`, {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning",
|
|
|
- })
|
|
|
- .then(async () => {
|
|
|
- this.loading = true;
|
|
|
- let obj = {
|
|
|
- platform_youzan_id: platform_youzan_id,
|
|
|
- };
|
|
|
|
|
|
- const res = await asyncRequest.yz_goodoff(obj);
|
|
|
- if (res && res.code === 0) {
|
|
|
- this.loading = false;
|
|
|
- this.$notify.success({
|
|
|
- title: res.message,
|
|
|
- message: "",
|
|
|
- });
|
|
|
- await this.searchList();
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
- } else {
|
|
|
- this.loading = false;
|
|
|
- this.$message.warning(res.message);
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- console.log("取消");
|
|
|
- });
|
|
|
- },
|
|
|
- /**
|
|
|
- * 启用/禁用
|
|
|
- * @param {String} id id
|
|
|
- * @param {String} status 0-禁用 1-启用
|
|
|
- */
|
|
|
- async changeStatus(id, status) {
|
|
|
- await this.$confirm(`确定要改为${status === "1" ? "禁用" : "启用"}?`, {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning",
|
|
|
- })
|
|
|
- .then(async () => {
|
|
|
- this.loading = true;
|
|
|
- const model = {
|
|
|
- id: id,
|
|
|
- status: status === "1" ? "0" : "1",
|
|
|
- };
|
|
|
- const res = await asyncRequest.status(model);
|
|
|
- if (res && res.code === 0) {
|
|
|
- this.loading = false;
|
|
|
- this.$notify.success({
|
|
|
- title: "状态修改成功!",
|
|
|
- message: "",
|
|
|
- });
|
|
|
- await this.searchList();
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
- } else {
|
|
|
- this.loading = false;
|
|
|
- this.$message.warning(res.message);
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- console.log("取消");
|
|
|
- });
|
|
|
- },
|
|
|
- async deleteItem(code) {
|
|
|
- await this.$confirm("确定要删除?", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning",
|
|
|
- })
|
|
|
- .then(async () => {
|
|
|
- const model = {
|
|
|
- codes: [code],
|
|
|
- };
|
|
|
- const res = await asyncRequest.delete(model);
|
|
|
- if (res && res.code === 0) {
|
|
|
- this.$notify.success({
|
|
|
- title: "删除成功",
|
|
|
- message: "",
|
|
|
- });
|
|
|
- this.searchList();
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
- } else {
|
|
|
- this.$message.warning(res.message);
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- console.log("取消");
|
|
|
- });
|
|
|
- },
|
|
|
// 刷新表格
|
|
|
async searchList() {
|
|
|
if (
|