Ver código fonte

Merge branch 'sit'

戴艳蓉 3 anos atrás
pai
commit
afc9fab76c

+ 8 - 0
src/apis/user/index.js

@@ -32,6 +32,14 @@ export function dingdingdetail(data) {
     data
   })
 }
+// 获取账号业务设置
+export function usergetinfo(data) {
+  return http({
+    url:  `${urlConfig.baseURL}admin/usergetinfo`,
+    method: 'post',
+    data
+  })
+}
 
 
 

+ 6 - 0
src/components/globalComponents/digital-input/main.vue

@@ -44,6 +44,7 @@ export default {
     "name",
     "disabled",
     "controls",
+    "newTime",
     "placeholder",
     "position",
   ],
@@ -54,6 +55,11 @@ export default {
         this.num = val;
       }
     },
+    newTime: function (val) {
+      if (val) {
+        this.num = this.values;
+      }
+    },
   },
   data() {
     return {

+ 3 - 0
src/store/getters.js

@@ -15,5 +15,8 @@ const getters = {
   btnList: state => state.user.btnList,
   navList: state => state.user.navList,
   mainList: state => state.user.mainList,
+  business_company: state => state.user.business_company,
+  business_companyNo: state => state.user.business_companyNo,
+  private_field: state => state.user.private_field,
 }
 export default getters

+ 98 - 113
src/store/modules/user.js

@@ -1,4 +1,4 @@
-import { login, logout, userinfo, menuList, dingdingdetail } from '@/apis/user'
+import { login, logout, userinfo, menuList, dingdingdetail, usergetinfo } from '@/apis/user'
 import {
   getToken,
   setToken,
@@ -9,9 +9,15 @@ import {
   getBtn,
   setBtn,
   removeBtn,
-  // getMainList,
-  // setMainList,
-  // removeMainList
+  get_business_company,
+  set_business_company,
+  remove_business_company,
+  get_business_companyNo,
+  set_business_companyNo,
+  remove_business_companyNo,
+  get_private_field,
+  set_private_field,
+  remove_private_field,
 } from '@/utils/auth'
 
 const state = {
@@ -22,9 +28,10 @@ const state = {
   roles: ['admin'],
   btnList: getBtn(),
   navList: getMenu(),
-  // mainList: getMainList(),
+  business_company: get_business_company() || "",
+  business_companyNo: get_business_companyNo() || "",
+  private_field: get_private_field() || [],
 }
-
 const mutations = {
   SET_TOKEN: (state, token) => {
     state.token = token
@@ -67,7 +74,18 @@ const mutations = {
     }
     state.btnList = val
     setBtn(val)
-
+  },
+  business_company(state, val) {
+    state.business_company = val
+    set_business_company(val)
+  },
+  business_companyNo(state, val) {
+    state.business_companyNo = val
+    set_business_companyNo(val)
+  },
+  private_field(state, val) {
+    state.private_field = val
+    set_private_field(val)
   },
 }
 
@@ -114,120 +132,81 @@ const actions = {
       if (!getToken()) {
         resolve("noToken")
       } else {
-        let res = await menuList({})
-        if (res.code === 0) {
-          let list = res.data
-          list = list.filter((item) => item.child && item.child.length > 0)
-          let arrag = []
-          let btnList = []
-          console.log(list)
-          list.forEach(v1 => {
-            let pItem = {
-              name: v1.menu_route,
-              path: `/${v1.menu_route}`,
-              meta: {
-                title: v1.menu_name,
-                icon: v1.menu_img
-              },
-              children: []
-            }
-            v1.child.forEach(v2 => {
-              let item = {
-                path: v2.menu_route,
-                name: v2.menu_route,
-                hidden: parseInt(v2.is_display + "") === 0,
+        let userRes = await usergetinfo({})
+        if (userRes.code === 0) {
+          const { business, private_field } = userRes.data
+          let business_company = "", business_companyNo = "";
+          if (business && business.length > 0) {
+            business.forEach(e => {
+              if (e.is_main === '1') {
+                business_company = e.company
+                business_companyNo = e.companyNo
+              }
+            });
+          }
+          // 保存默认业务公司名称
+          commit("business_company", business_company);
+          // 保存默认业务公司编号
+          commit("business_companyNo", business_companyNo);
+          // 关键字段设置
+          commit("private_field", private_field === '' ? [] : private_field);
+
+          let res = await menuList({})
+          if (res.code === 0) {
+            let list = res.data
+            list = list.filter((item) => item.child && item.child.length > 0)
+            let arrag = []
+            let btnList = []
+            console.log(list)
+            list.forEach(v1 => {
+              let pItem = {
+                name: v1.menu_route,
+                path: `/${v1.menu_route}`,
                 meta: {
-                  title: v2.menu_name,
-                  icon: v2.menu_img
+                  title: v1.menu_name,
+                  icon: v1.menu_img
                 },
-                url: v2.menu_url
+                children: []
               }
-              let model = {
-                menu_route: v2.menu_route,
-                action: v2.action
-              }
-              btnList.push(model)
-              pItem.children.push(item)
+              v1.child.forEach(v2 => {
+                let item = {
+                  path: v2.menu_route,
+                  name: v2.menu_route,
+                  hidden: parseInt(v2.is_display + "") === 0,
+                  meta: {
+                    title: v2.menu_name,
+                    icon: v2.menu_img
+                  },
+                  url: v2.menu_url
+                }
+                let model = {
+                  menu_route: v2.menu_route,
+                  action: v2.action
+                }
+                btnList.push(model)
+                pItem.children.push(item)
+              })
+              arrag.push(pItem)
             })
-            arrag.push(pItem)
-          })
-          console.log(arrag);
-
-          // 生成页面权限
-          commit("navListFn", arrag);
-          // 生成按钮权限
-          commit("btnListFn", btnList);
-          // 生成路由
-          initRouter(arrag, that);
-          // state.commit("loginInfoCommit", res.data);
-          resolve("success")
-        } else if (res.code === 101 || res.code === 102) {
+            console.log(arrag);
+            // 生成页面权限
+            commit("navListFn", arrag);
+            // 生成按钮权限
+            commit("btnListFn", btnList);
+            // 生成路由
+            initRouter(arrag, that);
+            // state.commit("loginInfoCommit", res.data);
+            resolve("success")
+          } else if (res.code >= 100 && res.code <= 104) {
+            resolve("noToken")
+          } else {
+            resolve(res)
+          }
+        } else if (userRes.code >= 100 && userRes.code <= 104) {
           resolve("noToken")
         } else {
           resolve(res)
         }
-
-
-
-        // let res = await menuList({})
-        // if (res.code === 0) {
-        //   let list = res.data
-        //   list = list.filter((item) => item.child && item.child.length > 0)
-        //   let arrag = []
-        //   let btnList = []
-        //   let mainMenu = []
-        //   list.forEach(v1 => {
-        //     let pItem = {
-        //       name: v1.menu_route,
-        //       path: `/${v1.menu_route}`,
-        //       hidden: parseInt(v1.is_display + "") === 0,
-        //       meta: {
-        //         title: v1.menu_name,
-        //         icon: v1.menu_img
-        //       },
-        //       children: []
-        //     }
-        //     let mitem = Object.assign({ child: `/${v1.menu_route}/` }, pItem)
-        //     delete mitem['children']
-        //     mainMenu.push(mitem)
-        //     v1.child.forEach((v2, i2) => {
-        //       if (i2 === 0) {
-        //         mitem.child += v2.menu_route
-        //       }
-        //       let item = {
-        //         path: v2.menu_route,
-        //         name: v2.menu_route,
-        //         hidden: parseInt(v2.is_display + "") === 0,
-        //         meta: {
-        //           title: v2.menu_name,
-        //           icon: v2.menu_img
-        //         },
-        //         url: v2.menu_url
-        //       }
-        //       let model = {
-        //         menu_route: v2.menu_route,
-        //         action: v2.action
-        //       }
-        //       btnList.push(model)
-        //       pItem.children.push(item)
-        //     })
-        //     arrag.push(pItem)
-        //   })
-        //   //生成主菜单
-        //   commit("mainListFn", mainMenu);
-        //   // 生成页面权限
-        //   commit("navListFn", arrag);
-        //   // 生成按钮权限
-        //   commit("btnListFn", btnList);
-        //   // 生成路由
-        //   initRouter(arrag, that);
-        //   // state.commit("loginInfoCommit", res.data);
-        //   resolve("success")
-        // } else if (res.code === 101 || res.code === 102) {
-        //   resolve("noToken")
-        // } else {
-        //   resolve(res)
-        // }
       }
     })
   },
@@ -245,6 +224,12 @@ const actions = {
 
       removeMenu()
       removeBtn()
+      remove_business_company()
+      commit('business_company', '')
+      commit('business_companyNo', '')
+      remove_business_companyNo()
+      remove_private_field()
+      commit('private_field', [])
       // removeMainList()
       // reset visited views and cached views
       // to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485

+ 41 - 0
src/utils/auth.js

@@ -5,6 +5,9 @@ const MenuKey = 'Purchase-Console-Menu'
 const BtnKey = 'Purchase-Console-MenuBtn'
 const NoticeKey = "Purchase-Console-Notice"
 const mainMenuKey = 'Purchase-Console-MainMenu'
+const businessCompanyKey = 'Purchase-Console-businessCompany'
+const businessCompanyNoKey = 'Purchase-Console-businessCompanyNo'
+const privateFieldKey = 'Purchase-Console-privateField'
 export function getToken() {
   return Cookies.get(TokenKey)
 }
@@ -69,3 +72,41 @@ export function setMainList(has) {
 export function removeMainList() {
   return Cookies.remove(mainMenuKey)
 }
+
+export function get_business_company() {
+  return Cookies.get(businessCompanyKey)
+}
+
+export function set_business_company(has) {
+  return Cookies.set(businessCompanyKey, has)
+}
+
+export function remove_business_company() {
+  return Cookies.remove(businessCompanyKey)
+}
+export function get_business_companyNo() {
+  return Cookies.get(businessCompanyNoKey)
+}
+
+export function set_business_companyNo(has) {
+  return Cookies.set(businessCompanyNoKey, has)
+}
+
+export function remove_business_companyNo() {
+  return Cookies.remove(businessCompanyNoKey)
+}
+
+
+export function get_private_field() {
+  return Cookies.get(privateFieldKey)
+}
+
+export function set_private_field(has) {
+  return Cookies.set(privateFieldKey, has)
+}
+
+export function remove_private_field() {
+  return Cookies.remove(privateFieldKey)
+}
+
+

+ 31 - 7
src/views/goodStore/goodsCost/components/baseForm.vue

@@ -883,7 +883,7 @@
                 :precision="2"
                 :size="'mini'"
                 :controls="false"
-                :append="'元'"
+                :append="'元/件'"
                 @reschange="number_change($event, 'open_fee')"
               />
             </el-form-item>
@@ -959,7 +959,7 @@
                 :precision="2"
                 :size="'mini'"
                 :controls="false"
-                :append="'元'"
+                :append="'元/g'"
                 @reschange="number_change($event, 'cgd_gold_price')"
               />
             </el-form-item>
@@ -983,10 +983,10 @@
               <el-select
                 v-model="ruleForm.is_step"
                 filterable
-                clearable
                 :disabled="type === 'view' || type === 'editBase'"
                 style="width: 100%"
                 placeholder="启用阶梯"
+                @change="is_step_change"
               >
                 <el-option
                   v-for="group in options5"
@@ -1177,6 +1177,11 @@ export default {
       this.showModel = true;
     },
     openCostEdit(index, sitem) {
+      const { is_step } = this.ruleForm;
+      if (index === -1 && is_step === "0" && this.ladder_tableData.length > 0) {
+        this.$message.warning("不启用阶梯成本,只能录入一条阶梯成本信息!");
+        return;
+      }
       this.costmodelIndex = index;
       this.costsitem = sitem;
       this.costshowModel = true;
@@ -1187,6 +1192,20 @@ export default {
     openCostEditDelete(index) {
       this.ladder_tableData.splice(index, 1);
     },
+    is_step_change() {
+      const { is_step } = this.ruleForm;
+      if (is_step === "0") {
+        let res = [];
+        let list =
+          this.ladder_tableData.length === 0
+            ? []
+            : JSON.parse(JSON.stringify(this.ladder_tableData));
+        if (list.length > 0) {
+          res.push(list[0]);
+        }
+        this.ladder_tableData = res;
+      }
+    },
     async submitForm() {
       this.sch_is_noble();
       this.good_type_change();
@@ -1518,7 +1537,7 @@ export default {
         market_price: "0",
         nake_price: "0",
         cgd_gold_price: "0",
-        is_step: "",
+        is_step: "0",
         is_diff: "",
         config: [],
         other_config: "",
@@ -1709,7 +1728,7 @@ export default {
             market_price: market_price || "",
             nake_price: nake_price || "",
             cgd_gold_price: cgd_gold_price || "",
-            is_step: is_step || "",
+            is_step: is_step || "0",
             is_diff: is_diff || "",
             config: config ? config.split(",") : [],
             other_config: other_config || "",
@@ -1726,7 +1745,12 @@ export default {
         "is_diff",
         "config",
         "other_config",
+<<<<<<< HEAD
         'cgd_gold_price'
+=======
+        "cgd_gold_price",
+        
+>>>>>>> sit
       ];
       for (let i = 0; i < list.length; i++) {
         this.rulesThis[list[i]][0].required = this.is_noble;
@@ -1749,7 +1773,7 @@ export default {
         delete item["is_gold_price"];
         delete item["market_price"];
         delete item["nake_price"];
-        delete item['cgd_gold_price'];
+        delete item["cgd_gold_price"];
         delete item["is_step"];
         delete item["good_ladder"];
       } else {
@@ -1782,7 +1806,7 @@ export default {
           is_gold_price: is_gold_price || "",
           market_price: market_price || "",
           nake_price: nake_price || "",
-          cgd_gold_price:cgd_gold_price||"",
+          cgd_gold_price: cgd_gold_price || "",
           is_step: is_step || "",
           good_ladder: good_ladder || [],
           spuCode: spuCode || "",

+ 46 - 20
src/views/goodStore/goodsOnline/ShowDataTableColumns.js

@@ -4,26 +4,28 @@ const public_listCol = [
     prop: "good_name",
     label: "商品名称",
     _slot_: "good_name",
+    span: 24,
   },
 
-  {
-    prop: "speclist",
-    label: "规格",
-    _slot_: "speclist",
-  },
+  // {
+  //   prop: "speclist",
+  //   label: "规格",
+  //   _slot_: "speclist",
+  // },
   {
     prop: "skuCode",
     label: "上线商品编号",
-    span: 6,
+    span: 7,
   },
   {
     prop: "companyNo",
     label: "业务企业编号",
-    span: 6,
+    span: 7,
   },
   {
     prop: "company",
     label: "业务企业名称",
+    span: 10,
   },
   {
     prop: "good_info_img",
@@ -192,13 +194,10 @@ const public_listCol = [
     span: 4,
   },
 
-
-
-
-
   {
-    prop: "after_sales",
-    label: "售后说明",
+    prop: "noble",
+    label: "贵金属信息",
+    _slot_: "noble",
     span: 24,
   },
   {
@@ -207,6 +206,15 @@ const public_listCol = [
     span: 24,
   },
 
+
+  {
+    prop: "after_sales",
+    label: "售后说明",
+    span: 24,
+  },
+
+
+
   {
     prop: "craft_desc",
     label: "工艺说明",
@@ -218,9 +226,20 @@ const public_listCol = [
 
 ]
 const purchase_listCol = [
+  {
+    prop: "spuCode",
+    label: "商品成本编号",
+    span: 7,
+  },
+  {
+    prop: "supplierNo",
+    label: "供应商编号",
+    span: 7,
+  },
   {
     prop: "supplierName",
     label: "供应商名称",
+    span: 10,
   },
   {
     prop: "is_auth",
@@ -228,12 +247,7 @@ const purchase_listCol = [
     _slot_: "is_auth",
     span: 6,
   },
-  {
-    prop: "is_step",
-    label: "启用成本阶梯",
-    _slot_: "is_step",
-    span: 4,
-  },
+
 
   {
     prop: "cert_fee",
@@ -269,7 +283,7 @@ const purchase_listCol = [
   {
     prop: "open_fee",
     label: "开模费",
-    append: '元',
+    append: '元/件',
     span: 6,
   },
 
@@ -291,6 +305,18 @@ const purchase_listCol = [
     append: '元',
     span: 6,
   },
+  {
+    prop: "cgd_gold_price",
+    label: "供应商采购金价",
+    append: '元/g',
+    span: 6,
+  },
+  {
+    prop: "is_step",
+    label: "启用成本阶梯",
+    _slot_: "is_step",
+    span: 6,
+  },
   {
     prop: "nakelist",
     label: "采购起订量",

+ 1 - 2
src/views/goodStore/goodsOnline/columns.js

@@ -106,7 +106,6 @@ const listCol = [
     label: "业务公司名称",
     width: "150px",
   },
-
   {
     prop: "plat_code",
     label: "平台商品编号",
@@ -128,7 +127,7 @@ const listCol = [
     label: "操作",
     fixed: "right",
     _noset_: true,
-    width: "80px",
+    width: "110px",
     _slot_: "operation",
   },
 ]

+ 245 - 38
src/views/goodStore/goodsOnline/components/fixed-price-form.vue

@@ -5,7 +5,6 @@
     :model="ruleForm"
     status-icon
     :rules="rulesThis"
-    :label-width="labelWidth || '110px'"
     class="demo-ruleForm-goodsOnline"
     :size="'mini'"
   >
@@ -28,37 +27,81 @@
           >
             <template slot-scope="scope">
               <el-form-item
-                v-if="scope.row.edit"
+                v-show="scope.row.edit"
                 :prop="'good_ladder.' + scope.$index + '.' + 'min_num'"
                 :rules="addrRules.min_num"
                 :size="'mini'"
                 :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
               >
-                <el-input
-                  v-model="scope.min_num"
-                  placeholder="起订量(>=)"
+                <digital-input
+                  :values="scope.row.min_num"
+                  :placeholder="'起订量(>=)'"
+                  :min="0"
+                  :max="100000000000"
+                  :position="'right'"
+                  :precision="0"
+                  :controls="false"
+                  :append="''"
+                  :newTime="scope.row.newTime"
+                  :size="'mini'"
                   :disabled="!scope.row.edit"
+                  @reschange="num_change($event, 'min_num', scope.$index)"
+                />
+              </el-form-item>
+              <span v-show="!scope.row.edit">{{ scope.row.min_num }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="new_sale_price"
+            label="系统售价(元)"
+            show-overflow-tooltip
+          >
+            <template slot-scope="scope">
+              <el-form-item
+                v-show="scope.row.edit"
+                :prop="'good_ladder.' + scope.$index + '.' + 'new_sale_price'"
+                :rules="addrRules.new_sale_price"
+                :size="'mini'"
+                :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
+              >
+                <el-input
+                  v-loading="scope.row.loading"
+                  v-model="scope.row.new_sale_price"
+                  placeholder="系统售价"
+                  :disabled="true"
+                  :size="'mini'"
                 />
               </el-form-item>
-              <span v-if="!scope.row.edit">{{ scope.row.min_num }}</span>
+              <span v-show="!scope.row.edit">{{
+                scope.row.new_sale_price
+              }}</span>
             </template>
           </el-table-column>
           <el-table-column prop="sale_price" label="售价" show-overflow-tooltip>
             <template slot-scope="scope">
               <el-form-item
-                v-if="scope.row.edit"
+                v-show="scope.row.edit"
                 :prop="'good_ladder.' + scope.$index + '.' + 'sale_price'"
                 :rules="addrRules.sale_price"
                 :size="'mini'"
                 :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
               >
-                <el-input
-                  v-model="scope.sale_price"
-                  placeholder="售价"
+                <digital-input
+                  :values="scope.row.sale_price"
+                  :placeholder="'售价'"
+                  :min="0"
+                  :max="100000000000"
+                  :position="'right'"
+                  :precision="2"
+                  :controls="false"
+                  :append="''"
+                  :newTime="scope.row.newTime"
+                  :size="'mini'"
                   :disabled="!scope.row.edit"
+                  @reschange="num_change($event, 'sale_price', scope.$index)"
                 />
               </el-form-item>
-              <span v-if="!scope.row.edit">{{ scope.row.sale_price }}</span>
+              <span v-show="!scope.row.edit">{{ scope.row.sale_price }}</span>
             </template>
           </el-table-column>
           <el-table-column
@@ -68,19 +111,28 @@
           >
             <template slot-scope="scope">
               <el-form-item
-                v-if="scope.row.edit"
+                v-show="scope.row.edit"
                 :prop="'good_ladder.' + scope.$index + '.' + 'market_price'"
                 :rules="addrRules.market_price"
                 :size="'mini'"
                 :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
               >
-                <el-input
-                  v-model="scope.market_price"
-                  placeholder="市场价"
+                <digital-input
+                  :values="scope.row.market_price"
+                  :placeholder="'市场价'"
+                  :min="0"
+                  :max="100000000000"
+                  :position="'right'"
+                  :precision="2"
+                  :controls="false"
+                  :append="''"
+                  :newTime="scope.row.newTime"
+                  :size="'mini'"
                   :disabled="!scope.row.edit"
+                  @reschange="num_change($event, 'market_price', scope.$index)"
                 />
               </el-form-item>
-              <span v-if="!scope.row.edit">{{ scope.row.market_price }}</span>
+              <span v-show="!scope.row.edit">{{ scope.row.market_price }}</span>
             </template>
           </el-table-column>
           <el-table-column
@@ -90,30 +142,45 @@
           >
             <template slot-scope="scope">
               <el-form-item
-                v-if="scope.row.edit"
+                v-show="scope.row.edit"
                 :prop="'good_ladder.' + scope.$index + '.' + 'market_platform'"
                 :rules="addrRules.market_platform"
                 :size="'mini'"
                 :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
               >
                 <el-input
-                  v-model="scope.market_platform"
+                  v-model="scope.row.market_platform"
                   placeholder="对比平台"
                   :disabled="!scope.row.edit"
                 />
               </el-form-item>
-              <span v-if="!scope.row.edit">{{
+              <span v-show="!scope.row.edit">{{
                 scope.row.market_platform
               }}</span>
             </template>
           </el-table-column>
           <el-table-column prop="status" label="状态" show-overflow-tooltip>
             <template slot-scope="scope">
-              <el-tag
+              <el-form-item
+                v-show="scope.row.edit"
+                :prop="'good_ladder.' + scope.$index + '.' + 'status'"
+                :rules="addrRules.status"
                 :size="'mini'"
-                :type="scope.row.status == '1' ? '' : 'warning'"
-                >{{ scope.row.status == "1" ? "启用" : "禁用" }}</el-tag
+                :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
               >
+                <el-select v-model="scope.row.status" placeholder="状态">
+                  <el-option
+                    v-for="item in status_options"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+              <span v-show="!scope.row.edit">{{
+                scope.row.status == "1" ? "启用" : "禁用"
+              }}</span>
             </template>
           </el-table-column>
           <el-table-column fixed="right">
@@ -122,18 +189,28 @@
               <el-tooltip effect="dark" content="添加阶梯" placement="top">
                 <i
                   class="el-icon-circle-plus-outline tb-icon fr"
-                  @click="openCostEdit(-1, {})"
+                  @click="openCostEdit(-1)"
                 ></i>
               </el-tooltip>
             </template>
             <template slot-scope="scope">
-              <el-tooltip effect="dark" content="修改" placement="top">
+              <el-tooltip
+                effect="dark"
+                content="保存"
+                v-if="scope.row.edit"
+                placement="top"
+              >
+                <i
+                  class="el-icon-circle-check tb-icon"
+                  @click="checkRow(scope.$index)"
+                ></i>
+              </el-tooltip>
+              <el-tooltip effect="dark" v-else content="修改" placement="top">
                 <i
                   class="el-icon-edit tb-icon"
-                  @click="openCostEdit(scope.$index, scope.row)"
+                  @click="openCostEdit(scope.$index)"
                 ></i>
               </el-tooltip>
-
               <el-tooltip effect="dark" content="删除" placement="top">
                 <i
                   class="el-icon-delete tb-icon"
@@ -144,14 +221,14 @@
           </el-table-column>
         </el-table>
         <!-- 弹窗 新增/修改 -->
-        <cost-form-add-edit
+        <!-- <cost-form-add-edit
           :index="costmodelIndex"
           :show-model="costshowModel"
           :sitem="costsitem"
           :spuCode="spuCode"
           @refresh="costrefreshEdit"
           @cancel="costshowModel = false"
-        />
+        /> -->
       </el-col>
       <el-col :span="24"
         ><el-form-item label="售价凭证类型" prop="proof_type">
@@ -302,7 +379,7 @@
 </template>
 
 <script>
-import costFormAddEdit from "./costFormAddEdit";
+// import costFormAddEdit from "./costFormAddEdit";
 import asyncRequest from "@/apis/service/goodStore/goodsOnline";
 import showVoucherModel from "@/components/show-voucher-model";
 export default {
@@ -318,7 +395,7 @@ export default {
     "sitem",
   ],
   components: {
-    costFormAddEdit,
+    // costFormAddEdit,
     showVoucherModel,
   },
   /**
@@ -380,6 +457,16 @@ export default {
           label: "其他",
         },
       ],
+      status_options: [
+        {
+          value: "1",
+          label: "启用",
+        },
+        {
+          value: "0",
+          label: "禁用",
+        },
+      ],
       showModelThis: this.showModel,
       pickerOptions: {
         disabledDate(time) {
@@ -495,15 +582,88 @@ export default {
       this.loading = false;
     },
 
-    openCostEdit(index, sitem) {
-      this.costmodelIndex = index;
-      this.costsitem = sitem;
-      this.costshowModel = true;
+    openCostEdit(index) {
+      let findex = this.ruleForm.good_ladder.findIndex((v) => v.edit === true);
+      if (findex !== -1) {
+        this.$message.warning("当前已有阶梯售价在编辑,请保存后再试!");
+        return;
+      } else {
+        if (index === -1) {
+          this.ruleForm.good_ladder.push({
+            edit: true,
+            min_num: "",
+            new_sale_price: "",
+            sale_price: "",
+            market_price: "",
+            market_platform: "",
+            status: "1",
+          });
+        } else {
+          this.ruleForm.good_ladder[index].edit = true;
+        }
+      }
+    },
+    async get_new(index) {
+      const { min_num } = this.ruleForm.good_ladder[index];
+      this.ruleForm.good_ladder[index].search_loading = true;
+      let { code, data, message } = await asyncRequest.goodupprice({
+        min_num: min_num,
+        spuCode: this.spuCode,
+      });
+      let resModel = {
+        isok: code,
+        price: code === 0 ? data.sale_price : "0",
+        message: message,
+      };
+      this.ruleForm.good_ladder[index].search_loading = false;
+      return resModel;
+    },
+    //保存某一行
+    async checkRow(rowIndex) {
+      await this.$refs.ruleForm.validate(async (valid) => {
+        if (valid) {
+          if (!this.ruleForm.good_ladder[rowIndex].search_loading) {
+            let { isok, price, message } = await this.get_new(rowIndex);
+            if (isok === 0) {
+              this.ruleForm.good_ladder[rowIndex].new_sale_price = price;
+              this.ruleForm.good_ladder[rowIndex].edit = false;
+            } else if (isok >= 100 && isok <= 104) {
+              await this.logout();
+            } else {
+              this.ruleForm.good_ladder[rowIndex].new_sale_price = price;
+              this.$message.warning(message);
+            }
+          }
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
     },
-
     openCostEditDelete(index) {
       this.ruleForm.good_ladder.splice(index, 1);
     },
+    async num_change(e, key, index) {
+      this.ruleForm.good_ladder[index][key] = e + "" || "0";
+      if (key === "min_num") {
+        const { min_num } = this.ruleForm.good_ladder[index];
+        if (min_num === "" || min_num === "0") {
+          this.ruleForm.good_ladder[index].new_sale_price = "0";
+        } else {
+          if (!this.ruleForm.good_ladder[index].search_loading) {
+            let { isok, price, message } = await this.get_new(index);
+            if (isok === 0) {
+              this.ruleForm.good_ladder[index].new_sale_price = price;
+            } else if (isok >= 100 && isok <= 104) {
+              await this.logout();
+            } else {
+              this.ruleForm.good_ladder[index].new_sale_price = price;
+              this.$message.warning(message);
+            }
+          }
+        }
+      }
+    },
     //阶梯成本修改
     costrefreshEdit(e) {
       let item = JSON.parse(JSON.stringify(e));
@@ -527,6 +687,7 @@ export default {
           this.ruleForm.good_ladder[findex].market_price = market_price;
           this.ruleForm.good_ladder[findex].min_num = min_num;
           this.ruleForm.good_ladder[findex].market_platform = market_platform;
+          this.ruleForm.good_ladder[findex].newTime = new Date().valueOf() + "";
           this.ruleForm.good_ladder[findex].status = status;
           this.ruleForm.good_ladder[findex].id_del = is_del;
         }
@@ -539,12 +700,18 @@ export default {
 
     async resetForm() {
       // 重置
-      await this.$nextTick(() => {
+      await this.$nextTick(async () => {
         if (this.$refs.ruleForm) {
           this.$refs.ruleForm.resetFields();
           this.$refs.ruleForm.clearValidate();
-          const { proof, ladderlist } = this.sitem;
-
+          let { proof, ladderlist } = this.sitem;
+          ladderlist.map((a) => {
+            a.search_loading = false;
+            a.new_sale_price = "0";
+            a.newTime = new Date().valueOf() + "";
+            a.edit = false;
+            return a;
+          });
           this.ruleForm = {
             skuCode: this.id,
             proof_type: proof && proof.proof_type ? proof.proof_type : "1", // 通过or驳回
@@ -569,14 +736,54 @@ export default {
               this.video_url = this.ruleForm.proof_url;
           }
           this.$refs.ruleForm.validateField("proof_url");
+          for (let i = 0; i < this.ruleForm.good_ladder.length; i++) {
+            let { isok, price, message } = await this.get_new(i);
+            if (isok === 0) {
+              this.ruleForm.good_ladder[i].new_sale_price = price;
+              this.ruleForm.good_ladder[i].edit = false;
+            } else if (isok >= 100 && isok <= 104) {
+              await this.logout();
+            } else {
+              this.ruleForm.good_ladder[i].new_sale_price = price;
+              this.ruleForm.good_ladder[i].edit = true;
+              this.ruleForm.good_ladder[i].newTime = new Date().valueOf() + "";
+              this.$message.warning(message);
+            }
+          }
         }
       });
     },
     async submitForm() {
       await this.$refs.ruleForm.validate(async (valid) => {
         if (valid) {
+          this.loading = true;
           let model = JSON.parse(JSON.stringify(this.ruleForm));
           let list = JSON.parse(JSON.stringify(model.good_ladder));
+          if (this.ruleForm.good_ladder.length === 0) {
+            this.$message.warning("至少添加条销售价信息!");
+            this.loading = false;
+            return;
+          }
+          let all_is_ok = true;
+          for (let i = 0; i < this.ruleForm.good_ladder; i++) {
+            this.ruleForm.good_ladder[i].search_loading = true;
+            let { isok, price } = await this.get_new(i);
+            if (isok === 0) {
+              this.ruleForm.good_ladder[i].new_sale_price = price;
+              this.ruleForm.good_ladder[i].edit = false;
+            } else if (isok >= 100 && isok <= 104) {
+              await this.logout();
+            } else {
+              all_is_ok = false;
+              this.ruleForm.good_ladder[i].new_sale_price = price;
+              this.ruleForm.good_ladder[i].edit = true;
+              this.ruleForm.good_ladder[i].newTime = new Date().valueOf() + "";
+            }
+          }
+          if (!all_is_ok) {
+            this.$message.warning("阶梯售价未满足成本最低起订量!");
+            this.loading = false;
+          }
           let list2 = [];
           list.forEach((e) => {
             let n = JSON.parse(JSON.stringify(e));

+ 62 - 36
src/views/goodStore/goodsOnline/detail.vue

@@ -1,6 +1,7 @@
 <template>
   <div class="goodsOnlineDetail">
     <!-- {{ status }}-{{ powers }} -->
+    {{ FieldPromise }}
     <div
       class="goodsOnlineDetail-main"
       v-if="powers && powers.length > 0 && powers.some((item) => item == '007')"
@@ -24,12 +25,11 @@
                     :src="sitem.good_thumb_img"
                     alt=""
                   />
-                  <div>{{ sitem.good_name }}</div>
-                </template>
-                <template slot="speclist">
+                  <span>{{ sitem.good_name }}</span>
                   <span v-for="(si, i) in sitem.speclist" :key="si.spec_id + i">
-                    <span v-if="i !== 0">--</span
-                    ><span>{{ si.spec_name }}[{{ si.spec_value }}]</span>
+                    <span v-if="i !== 0">-</span>
+                    <span v-else>_</span>
+                    <span>{{ si.spec_name }}[{{ si.spec_value }}]</span>
                   </span>
                 </template>
                 <template slot="good_info_img">
@@ -42,30 +42,39 @@
                     :key="si + i"
                   />
                 </template>
-                <template slot="is_auth">
+                <template slot="exclusive">
+                  <span v-for="(si, sii) in sitem.exclusive" :key="si.id">
+                    <span v-if="sii !== 0">/</span> <span>{{ si.name }}</span>
+                  </span>
+                </template>
+                <template slot="supply_area">
                   <el-tag
                     :size="'mini'"
                     v-text="
-                      (options3.find((item) => item.id == sitem.is_auth) || {})
-                        .name || '--'
+                      (
+                        options6.find((item) => item.id == sitem.supply_area) ||
+                        {}
+                      ).name || '--'
                     "
                   />
                 </template>
-                <!-- <template slot="exclusive">
+                <template slot="is_stock">
                   <el-tag
                     :size="'mini'"
                     v-text="
-                      (options2.find((item) => item.id == sitem.exclusive) || {})
+                      (options4.find((item) => item.id == sitem.is_stock) || {})
                         .name || '--'
                     "
                   />
-                </template> -->
-                <template slot="is_stock">
+                </template>
+                <template slot="exam_status">
                   <el-tag
                     :size="'mini'"
                     v-text="
-                      (options4.find((item) => item.id == sitem.is_stock) || {})
-                        .name || '--'
+                      (
+                        options8.find((item) => item.id == sitem.exam_status) ||
+                        {}
+                      ).name || '--'
                     "
                   />
                 </template>
@@ -85,23 +94,39 @@
                     >{{ sitem.moq }}起订/工期{{ sitem.customized }}天</span
                   >
                 </template>
-                <template slot="exclusive">
-                  <span v-for="(si, sii) in sitem.exclusive" :key="si.id">
-                    <span v-if="sii !== 0">/</span> <span>{{ si.name }}</span>
-                  </span>
+                <template slot="noble">
+                  <span v-if="sitem.noble_metal"
+                    >{{ sitem.noble_weight ? sitem.noble_weight : "0" }}g-{{
+                      sitem.noble_name
+                    }}-{{ sitem.gold_price ? sitem.gold_price : "0" }}元/g-{{
+                      sitem.is_gold_price === "0" ? "不" : ""
+                    }}启用实时金价-{{
+                      sitem.is_diff === "1" ? "有" : "无"
+                    }}工差-{{ sitem.config }}-{{ sitem.other_config }}</span
+                  >
                 </template>
-
-                <template slot="supply_area">
+              </show-data-table>
+              <show-data-table
+                :newTime="newTime"
+                v-if="
+                  newTime !== '' &&
+                  private_field &&
+                  private_field.length > 0 &&
+                  private_field.some((item) => item == '1')
+                "
+                :sitem="sitem"
+                :columns="purchase_listCol"
+              >
+                <template slot="is_auth">
                   <el-tag
                     :size="'mini'"
                     v-text="
-                      (
-                        options6.find((item) => item.id == sitem.supply_area) ||
-                        {}
-                      ).name || '--'
+                      (options3.find((item) => item.id == sitem.is_auth) || {})
+                        .name || '--'
                     "
                   />
                 </template>
+
                 <template slot="is_step">
                   <el-tag
                     :size="'mini'"
@@ -112,17 +137,6 @@
                   />
                 </template>
 
-                <template slot="exam_status">
-                  <el-tag
-                    :size="'mini'"
-                    v-text="
-                      (
-                        options8.find((item) => item.id == sitem.exam_status) ||
-                        {}
-                      ).name || '--'
-                    "
-                  />
-                </template>
                 <template slot="nakelist">
                   <el-table
                     :data="nakelist"
@@ -137,6 +151,18 @@
                     <el-table-column prop="delivery_fee" label="物流费" />
                   </el-table>
                 </template>
+              </show-data-table>
+              <show-data-table
+                :newTime="newTime"
+                v-if="
+                  newTime !== '' &&
+                  private_field &&
+                  private_field.length > 0 &&
+                  private_field.some((item) => item == '2')
+                "
+                :sitem="sitem"
+                :columns="sale_listCol"
+              >
                 <template slot="ladderlist">
                   <el-table
                     :data="ladderlist"
@@ -276,7 +302,7 @@ export default {
     handleOnlineForm,
   },
   computed: {
-    ...mapGetters(["tablebtnSize", "searchSize", "size"]),
+    ...mapGetters(["tablebtnSize", "searchSize", "size", "private_field"]),
     powers() {
       let tran =
         this.$store.getters.btnList.find(

+ 2 - 0
src/views/interest/role/addEdit.vue

@@ -515,7 +515,9 @@ export default {
       const res = await asyncRequest.detail({ roleid: this.id });
       if (res && res.code === 0 && res.data) {
         let resD = res.data;
+        resD.private_field=resD.private_field===''?[]:resD.private_field
         this.ruleForm = resD;
+
         if (resD.action && resD.action.length > 0) {
           this.action = resD.action;
         } else {