浏览代码

产品上下架二次确认

zhaoxiaohai 3 年之前
父节点
当前提交
8b993d086b
共有 1 个文件被更改,包括 16 次插入7 次删除
  1. 16 7
      pages/productManagement/change.js

+ 16 - 7
pages/productManagement/change.js

@@ -19,7 +19,7 @@ Page({
         showSaleprod: "", //标签显示
         tagents_productid: 0, //识别产品ID
         checked: true, //开关控件
-        fisonsale: 0, //是否上架
+        fisonsale: 1, //是否上架
         throttle: false, //保存节流阀
         errTips: {
             fprodname: false,
@@ -87,12 +87,21 @@ Page({
     },
     /* 上架开关 */
     switchChange() {
-        const checked = !this.data.checked,
-            fisonsale = (checked) ? 1 : 0;
-        this.setData({
-            checked,
-            fisonsale
-        });
+        const that = this;
+        wx.showModal({
+            title: "提示",
+            content: (this.data.checked) ? '是否确认下架该产品' : '是否确认上架该产品',
+            success(res) {
+                if (res.confirm) {
+                    const checked = !that.data.checked,
+                        fisonsale = (checked) ? 1 : 0;
+                    that.setData({
+                        checked,
+                        fisonsale
+                    });
+                }
+            }
+        })
     },
     /* 表单验证 */
     formVerify() {