Browse Source

fix:添加产品

storeBelieveInLight 1 year ago
parent
commit
b8541807af
2 changed files with 461 additions and 191 deletions
  1. 84 70
      commit/product.js
  2. 377 121
      shop/productManagementModule/addProduct.vue

+ 84 - 70
commit/product.js

@@ -1,4 +1,3 @@
1
-
2
 import {
1
 import {
3
     myRequestPhp
2
     myRequestPhp
4
 } from './requestPhp.js'
3
 } from './requestPhp.js'
@@ -12,11 +11,11 @@ const apiType = "php"
12
 export function getSupplyChainTab(data) {
11
 export function getSupplyChainTab(data) {
13
     return myRequestPhp({
12
     return myRequestPhp({
14
         url: `${pre}mer/store/product/gong_lst_filter`,
13
         url: `${pre}mer/store/product/gong_lst_filter`,
15
-         method: 'GET',
16
-             data,
17
-             apiType
14
+        method: 'GET',
15
+        data,
16
+        apiType
18
     })
17
     })
19
-    
18
+
20
 }
19
 }
21
 /**
20
 /**
22
  * 获取供应链tab
21
  * 获取供应链tab
@@ -61,13 +60,13 @@ export function getSupplyChainList(data) {
61
  * @param {*} data 
60
  * @param {*} data 
62
  * @returns 
61
  * @returns 
63
  */
62
  */
64
-export function editSupplyChainPrice(id,data) {
65
-     return myRequestPhp({
66
-         url: `${pre}mer/store/product/edit_price/${id}`,
67
-         method: 'POST',
68
-         data,
69
-         apiType
70
-     })
63
+export function editSupplyChainPrice(id, data) {
64
+    return myRequestPhp({
65
+        url: `${pre}mer/store/product/edit_price/${id}`,
66
+        method: 'POST',
67
+        data,
68
+        apiType
69
+    })
71
 }
70
 }
72
 /**
71
 /**
73
  * @description 供应链商品 -- 修改销售价
72
  * @description 供应链商品 -- 修改销售价
@@ -76,12 +75,12 @@ export function editSupplyChainPrice(id,data) {
76
  * @description 供应链商品 -- 上下架
75
  * @description 供应链商品 -- 上下架
77
  */
76
  */
78
 export function postchangeshow(data) {
77
 export function postchangeshow(data) {
79
-     return myRequestPhp({
80
-         url: `${pre}mer/store/product/change_show`,
81
-         method: 'POST',
82
-         data,
83
-         apiType
84
-     })
78
+    return myRequestPhp({
79
+        url: `${pre}mer/store/product/change_show`,
80
+        method: 'POST',
81
+        data,
82
+        apiType
83
+    })
85
 }
84
 }
86
 
85
 
87
 
86
 
@@ -103,7 +102,7 @@ export function getGoodsTab(data) {
103
 /**商品列表  
102
 /**商品列表  
104
  * 
103
  * 
105
  * page = 1 & limit = 20 & mer_cate_id = & cate_id = & keyword = & type = 1 & is_gift_bag = & p_type =
104
  * page = 1 & limit = 20 & mer_cate_id = & cate_id = & keyword = & type = 1 & is_gift_bag = & p_type =
106
-  */
105
+ */
107
 
106
 
108
 export function getProductList(data) {
107
 export function getProductList(data) {
109
     return myRequestPhp({
108
     return myRequestPhp({
@@ -160,7 +159,7 @@ export function reviewGoodsEvaluateReply(id) {
160
 }
159
 }
161
 
160
 
162
 //商品评价回复
161
 //商品评价回复
163
-export function reviewGoodsReplyApi(id,data) {
162
+export function reviewGoodsReplyApi(id, data) {
164
     return myRequestPhp({
163
     return myRequestPhp({
165
         url: `${pre}mer/store/reply/reply/${id}.html`,
164
         url: `${pre}mer/store/reply/reply/${id}.html`,
166
         method: 'POST',
165
         method: 'POST',
@@ -175,58 +174,58 @@ export function reviewGoodsReplyApi(id,data) {
175
  */
174
  */
176
 
175
 
177
 export function changeshowApi(id, data) {
176
 export function changeshowApi(id, data) {
178
-     return myRequestPhp({
179
-         url: `${pre}mer/store/product/status/${id}`,
180
-         method: 'POST',
181
-         data,
182
-         apiType
183
-     })
177
+    return myRequestPhp({
178
+        url: `${pre}mer/store/product/status/${id}`,
179
+        method: 'POST',
180
+        data,
181
+        apiType
182
+    })
184
 }
183
 }
185
 /**
184
 /**
186
  * @description 商品列表--删除
185
  * @description 商品列表--删除
187
  */
186
  */
188
-export function destoryApi(id,data) {
189
-     return myRequestPhp({
190
-         url: `${pre}mer/store/product/destory/${id}`,
191
-         method: 'DELETE',
192
-         data,
193
-         apiType
194
-     })
187
+export function destoryApi(id, data) {
188
+    return myRequestPhp({
189
+        url: `${pre}mer/store/product/destory/${id}`,
190
+        method: 'DELETE',
191
+        data,
192
+        apiType
193
+    })
195
 }
194
 }
196
 
195
 
197
 /**
196
 /**
198
  * @description 商品列表 -- 删除
197
  * @description 商品列表 -- 删除
199
  */
198
  */
200
-export function productDeleteApi(id,data) {
201
-     return myRequestPhp({
202
-         url: `${pre}mer/store/product/delete/${id}`,
203
-         method: 'DELETE',
204
-         data,
205
-         apiType
206
-     })
199
+export function productDeleteApi(id, data) {
200
+    return myRequestPhp({
201
+        url: `${pre}mer/store/product/delete/${id}`,
202
+        method: 'DELETE',
203
+        data,
204
+        apiType
205
+    })
207
 }
206
 }
208
 
207
 
209
 /***
208
 /***
210
  * @description 商品列表 -- 恢复商品
209
  * @description 商品列表 -- 恢复商品
211
  */
210
  */
212
-export function productRestoreApi(id,data) {
213
-      return myRequestPhp({
214
-          url: `${pre}mer/store/product/restore/${id}`,
215
-          method: 'POST',
216
-          data,
217
-          apiType
218
-      })
211
+export function productRestoreApi(id, data) {
212
+    return myRequestPhp({
213
+        url: `${pre}mer/store/product/restore/${id}`,
214
+        method: 'POST',
215
+        data,
216
+        apiType
217
+    })
219
 }
218
 }
220
 
219
 
221
 
220
 
222
 
221
 
223
 export function Addseckill(data) {
222
 export function Addseckill(data) {
224
-     return myRequestPhp({
225
-         url: `${pre}mer/store/product/seckill`,
226
-         method: 'POST',
227
-         data,
228
-         apiType
229
-     })
223
+    return myRequestPhp({
224
+        url: `${pre}mer/store/product/seckill`,
225
+        method: 'POST',
226
+        data,
227
+        apiType
228
+    })
230
 }
229
 }
231
 
230
 
232
 
231
 
@@ -234,18 +233,18 @@ export function Addseckill(data) {
234
 
233
 
235
 /** 
234
 /** 
236
  * 文件上传
235
  * 文件上传
237
-*/
236
+ */
238
 
237
 
239
 export function uploadFile(data) {
238
 export function uploadFile(data) {
240
     const params = new FormData()
239
     const params = new FormData()
241
     params.append('file', data.file)
240
     params.append('file', data.file)
242
-     return myRequestPhp({
243
-         url: `${pre}mer/upload/image/0/file`,
244
-         method: 'POST',
245
-         contentType: "application/x-www-form-urlencoded",
246
-         data: params,
247
-         apiType
248
-     })
241
+    return myRequestPhp({
242
+        url: `${pre}mer/upload/image/0/file`,
243
+        method: 'POST',
244
+        contentType: "application/x-www-form-urlencoded",
245
+        data: params,
246
+        apiType
247
+    })
249
 }
248
 }
250
 
249
 
251
 /**
250
 /**
@@ -311,7 +310,7 @@ export function productDetailApi(data) {
311
 
310
 
312
 /** 
311
 /** 
313
  * 在线选品 --- filter
312
  * 在线选品 --- filter
314
-*/
313
+ */
315
 
314
 
316
 export function statusFilterApi(data) {
315
 export function statusFilterApi(data) {
317
     return myRequestPhp({
316
     return myRequestPhp({
@@ -367,13 +366,28 @@ export function joinselectionlibraryApi(data) {
367
         apiType
366
         apiType
368
     })
367
     })
369
 }
368
 }
370
-export function Postjoinselectionlibrary(data) {
371
-    return request.post(``, data)
369
+
370
+/**
371
+ * @description 配置状态
372
+ */
373
+export function productConfigApi(data) {
374
+    return myRequestPhp({
375
+        url: `${pre}mer/store/product/config`,
376
+        method: 'GET',
377
+        data,
378
+        apiType
379
+    })
372
 }
380
 }
373
-// /**
374
-//  * @description 配置状态
375
-//  */
376
-// export function productConfigApi() {
377
-//     return request.get(`store/product/config`)
378
-// }
379
 
381
 
382
+/**
383
+ * @description 获取商户分润比例
384
+ * @param {Object} param params {Object} 传值参数
385
+ */
386
+export function getMerchantProfitApi(data) {
387
+    return myRequestPhp({
388
+        url: `${pre}mer/getConfig/base_commission`,
389
+        method: 'GET',
390
+        data,
391
+        apiType
392
+    })
393
+}

+ 377 - 121
shop/productManagementModule/addProduct.vue

@@ -3,22 +3,27 @@
3
     <view class="headers">
3
     <view class="headers">
4
       <headersVue headerTitle="添加商品" @headerJump="headerJump"></headersVue>
4
       <headersVue headerTitle="添加商品" @headerJump="headerJump"></headersVue>
5
       <view class="headers-title">
5
       <view class="headers-title">
6
-        <view class="content"> 该功能仅支持单规格商品快速添加,可在PC端编辑 </view>
6
+        <view class="content">
7
+          该功能仅支持单规格商品快速添加,可在PC端编辑
8
+        </view>
7
       </view>
9
       </view>
8
     </view>
10
     </view>
9
     <view class="content-wrrapper">
11
     <view class="content-wrrapper">
12
+      <!-- 商品封面 -->
10
       <uploadVue
13
       <uploadVue
11
         formItemTitle="商品封面"
14
         formItemTitle="商品封面"
12
         :maxLimit="1"
15
         :maxLimit="1"
13
         @changeFiles="changeFilesfengmian"
16
         @changeFiles="changeFilesfengmian"
14
       ></uploadVue>
17
       ></uploadVue>
18
+      <!-- 商品轮播图 -->
15
       <uploadVue
19
       <uploadVue
16
         formItemTitle="商品轮播图"
20
         formItemTitle="商品轮播图"
17
         @changeFiles="changeFileslunbotu"
21
         @changeFiles="changeFileslunbotu"
18
       ></uploadVue>
22
       ></uploadVue>
19
 
23
 
20
       <view class="form-box">
24
       <view class="form-box">
21
-        <view class="form-item-box">
25
+        <!-- 商户商品分类 -->
26
+        <!-- <view class="form-item-box">
22
           <view class="form-box-txt">商户商品分类</view>
27
           <view class="form-box-txt">商户商品分类</view>
23
           <view
28
           <view
24
             class="form-box--arae"
29
             class="form-box--arae"
@@ -33,7 +38,8 @@
33
             class="icon-boxx"
38
             class="icon-boxx"
34
             color="#333"
39
             color="#333"
35
           ></uni-icons>
40
           ></uni-icons>
36
-        </view>
41
+        </view> -->
42
+        <!-- 平台商品分类 -->
37
         <view class="form-item-box">
43
         <view class="form-item-box">
38
           <view class="form-box-txt">平台商品分类</view>
44
           <view class="form-box-txt">平台商品分类</view>
39
           <view
45
           <view
@@ -50,6 +56,7 @@
50
             color="#333"
56
             color="#333"
51
           ></uni-icons>
57
           ></uni-icons>
52
         </view>
58
         </view>
59
+        <!-- 商品名称 -->
53
         <view class="form-item-box">
60
         <view class="form-item-box">
54
           <view class="form-box-txt mustBox">商品名称</view>
61
           <view class="form-box-txt mustBox">商品名称</view>
55
           <view class="form-box--arae">
62
           <view class="form-box--arae">
@@ -62,6 +69,7 @@
62
             />
69
             />
63
           </view>
70
           </view>
64
         </view>
71
         </view>
72
+        <!-- 商品单位 -->
65
         <view class="form-item-box">
73
         <view class="form-item-box">
66
           <view class="form-box-txt mustBox">商品单位</view>
74
           <view class="form-box-txt mustBox">商品单位</view>
67
           <view class="form-box--arae">
75
           <view class="form-box--arae">
@@ -74,6 +82,7 @@
74
             />
82
             />
75
           </view>
83
           </view>
76
         </view>
84
         </view>
85
+        <!-- 品牌选择 -->
77
         <view class="form-item-box">
86
         <view class="form-item-box">
78
           <view class="form-box-txt">品牌选择</view>
87
           <view class="form-box-txt">品牌选择</view>
79
           <view class="form-box--arae">
88
           <view class="form-box--arae">
@@ -85,6 +94,7 @@
85
             ></uni-data-select>
94
             ></uni-data-select>
86
           </view>
95
           </view>
87
         </view>
96
         </view>
97
+        <!-- 运费模板 -->
88
         <view class="form-item-box">
98
         <view class="form-item-box">
89
           <view class="form-box-txt mustBox">运费模板</view>
99
           <view class="form-box-txt mustBox">运费模板</view>
90
           <view class="form-box--arae">
100
           <view class="form-box--arae">
@@ -96,7 +106,52 @@
96
             ></uni-data-select>
106
             ></uni-data-select>
97
           </view>
107
           </view>
98
         </view>
108
         </view>
99
-        <view v-if="shippingList.length == 0" class="tips-messge">运费模板为空,请在后台添加运费模板</view>
109
+        <view v-if="shippingList.length == 0" class="tips-messge"
110
+          >运费模板为空,请在后台添加运费模板</view
111
+        >
112
+      </view>
113
+      <!-- 商品类型 -->
114
+      <view class="form-box mr-t">
115
+        <view class="form-item-box">
116
+          <view class="form-box-txt mustBox">商品类型</view>
117
+          <view class="form-box--arae">
118
+            <uni-data-select
119
+              v-model="formData.type"
120
+              placeholder="请选择商品类型"
121
+              :localdata="shangpingleixing"
122
+              :clear="false"
123
+            ></uni-data-select>
124
+          </view>
125
+        </view>
126
+      </view>
127
+      <!-- 商品规格 -->
128
+      <view class="form-box mr-t">
129
+        <view class="form-item-box">
130
+          <view class="form-box-txt mustBox">商品规格</view>
131
+          <view class="form-box--arae">
132
+            <uni-data-select
133
+              v-model="formData.spec_type"
134
+              placeholder="请选择商品规格"
135
+              :localdata="guigelist"
136
+              :disabled="true"
137
+            ></uni-data-select>
138
+          </view>
139
+        </view>
140
+      </view>
141
+      <!-- 分润设置: -->
142
+      <view class="form-box mr-t">
143
+        <view class="form-item-box">
144
+          <view class="form-box-txt mustBox">分润设置</view>
145
+          <view class="form-box--arae">
146
+            <uni-data-select
147
+              v-model="formData.extension_type"
148
+              placeholder="请选择分润设置"
149
+              :localdata="fengrunList"
150
+              :clear="false"
151
+              @change="changeFengrun"
152
+            ></uni-data-select>
153
+          </view>
154
+        </view>
100
       </view>
155
       </view>
101
       <view
156
       <view
102
         class="form-box mr-t"
157
         class="form-box mr-t"
@@ -114,18 +169,29 @@
114
               its.title
169
               its.title
115
             }}</view>
170
             }}</view>
116
             <view class="form-box--arae">
171
             <view class="form-box--arae">
172
+              <view class="price-box" v-if="its.props == 'price'">
173
+                <view class="flex-price">{{ priceDefault }}</view>
174
+                <view class="price-box_tips" v-if="formData.extension_type == 1"
175
+                  >商品成本价×分润比例</view
176
+                >
177
+              </view>
178
+
117
               <input
179
               <input
118
-                v-if="its.form_type == 'input'"
180
+                v-if="its.form_type == 'input' && its.props != 'price'"
119
                 :type="its.type"
181
                 :type="its.type"
120
                 v-model="item.modules[idx].value"
182
                 v-model="item.modules[idx].value"
121
                 :adjust-position="false"
183
                 :adjust-position="false"
122
-                :placeholder="`请输入${its.title}`"
184
+                :placeholder="`${'请输入' + its.title}`"
123
                 class="placeholder-class"
185
                 class="placeholder-class"
186
+                :disabled="its.disabled"
187
+                @input="changeInputHandle($event, its, item, idx)"
124
               />
188
               />
189
+              <view class="view-unit-input" v-if="its.isUnit">%</view>
125
             </view>
190
             </view>
126
           </template>
191
           </template>
127
         </view>
192
         </view>
128
       </view>
193
       </view>
194
+      <!-- 商品简介 -->
129
       <view class="business-box pb15">
195
       <view class="business-box pb15">
130
         <view class="business-box-txt">商品简介 </view>
196
         <view class="business-box-txt">商品简介 </view>
131
         <view class="business-box--arae">
197
         <view class="business-box--arae">
@@ -140,9 +206,10 @@
140
           />
206
           />
141
         </view>
207
         </view>
142
       </view>
208
       </view>
209
+      <!-- 商品详情 -->
143
       <view class="business-box pb15">
210
       <view class="business-box pb15">
144
         <view class="business-box-txt">商品详情 </view>
211
         <view class="business-box-txt">商品详情 </view>
145
-        <customEditor :value="formData.content" @input="changeTextHandle"/>
212
+        <customEditor :value="formData.content" @input="changeTextHandle" />
146
       </view>
213
       </view>
147
     </view>
214
     </view>
148
     <view class="btn-list">
215
     <view class="btn-list">
@@ -180,7 +247,10 @@ import {
180
   getGoodsClassCategory,
247
   getGoodsClassCategory,
181
   uploadFile,
248
   uploadFile,
182
   addProduct,
249
   addProduct,
250
+  productConfigApi,
251
+  getMerchantProfitApi,
183
 } from "@/commit/product.js";
252
 } from "@/commit/product.js";
253
+import { getBaseInfo } from "@/commit/user.js";
184
 export default {
254
 export default {
185
   components: {
255
   components: {
186
     headersVue,
256
     headersVue,
@@ -190,8 +260,10 @@ export default {
190
   },
260
   },
191
   data() {
261
   data() {
192
     return {
262
     return {
263
+      base_commission: "", //商户分润比例
193
       cascadeData: [], //商户商品分类
264
       cascadeData: [], //商户商品分类
194
       pingtaifeiData: [], //平台商品分类:
265
       pingtaifeiData: [], //平台商品分类:
266
+      priceDefault: "0.00",
195
       cascadePicker: {
267
       cascadePicker: {
196
         title: "选择商户商品分类",
268
         title: "选择商户商品分类",
197
         layer: null,
269
         layer: null,
@@ -212,6 +284,11 @@ export default {
212
         name: "",
284
         name: "",
213
         id: "",
285
         id: "",
214
       },
286
       },
287
+      extensionStatus: "0", //是否单独设置:0默认设置 1单独设置
288
+      specialMerchant: "",
289
+      merInfo: {
290
+        mer_type: "0",
291
+      },
215
       formData: {
292
       formData: {
216
         store_name: "", //商品名称
293
         store_name: "", //商品名称
217
         mer_cate_id: [], //商户商品分类:
294
         mer_cate_id: [], //商户商品分类:
@@ -225,10 +302,10 @@ export default {
225
         slider_image: [], //商品轮播图:
302
         slider_image: [], //商品轮播图:
226
         couponData: [], //优惠券:
303
         couponData: [], //优惠券:
227
         content: "", //商品详情:
304
         content: "", //商品详情:
228
-        sort: 0, //排序:
229
-        extension_type: "0", //是否单独设置:
230
-        is_good: 0, //商品推荐:0 1
231
-        is_gift_bag: 0, //是否包邮:0 1
305
+        sort: "0", //排序:
306
+        extension_type: "0", //是否单独设置:0默认设置 1单独设置
307
+        is_good: "0", //商品推荐:0不推荐 1推荐
308
+        is_gift_bag: "0", //是否包邮:0 1
232
         give_coupon_ids: [], //优惠券:
309
         give_coupon_ids: [], //优惠券:
233
         // checkboxGroup: [], //商品推荐:0单规格 1 多规格
310
         // checkboxGroup: [], //商品推荐:0单规格 1 多规格
234
         stock_num: "", //商品库存
311
         stock_num: "", //商品库存
@@ -236,96 +313,25 @@ export default {
236
         share_num: "",
313
         share_num: "",
237
         shares_num: "",
314
         shares_num: "",
238
         share_is: "0",
315
         share_is: "0",
239
-        spec_type: "0",
240
-        type: 1,
316
+        spec_type: "0", //0单规格 1 多规格
317
+        type: "1", //商品类型:
241
         unit_name: "",
318
         unit_name: "",
242
         attr: [],
319
         attr: [],
243
         commission: "",
320
         commission: "",
244
         pension: "",
321
         pension: "",
245
         pension_is: "0",
322
         pension_is: "0",
246
         pension_num: "",
323
         pension_num: "",
324
+        proCoupon: "", //优惠券
247
       },
325
       },
248
       selectData: [],
326
       selectData: [],
249
       brandData: [],
327
       brandData: [],
250
       shippingList: [], //运费模板
328
       shippingList: [], //运费模板
251
-      attrValue: [
252
-        {
253
-          modules: [
254
-            {
255
-              title: "商品售价",
256
-              props: "price",
257
-              value: "",
258
-              type: "digit",
259
-              ismust: true,
260
-              form_type: "input",
261
-              isshow: true,
262
-            },
263
-            {
264
-              title: "商品成本价",
265
-              value: "",
266
-              props: "cost",
267
-              type: "digit",
268
-              ismust: true,
269
-              form_type: "input",
270
-              isshow: true,
271
-            },
272
-            {
273
-              title: "商品原价",
274
-              value: "",
275
-              props: "ot_price",
276
-              type: "digit",
277
-              ismust: true,
278
-              form_type: "input",
279
-              isshow: true,
280
-            },
281
-            {
282
-              title: "商品库存",
283
-              value: "",
284
-              props: "stock",
285
-              type: "number",
286
-              ismust: true,
287
-              form_type: "input",
288
-              isshow: true,
289
-            },
290
-            {
291
-              title: "商品编号",
292
-              value: "",
293
-              props: "bar_code",
294
-              type: "text",
295
-              ismust: false,
296
-              form_type: "input",
297
-              isshow: true,
298
-            },
299
-            {
300
-              title: "重量(KG)",
301
-              value: "",
302
-              props: "weight",
303
-              type: "digit",
304
-              ismust: false,
305
-              form_type: "input",
306
-              isshow: true,
307
-            },
308
-            {
309
-              title: "商品体积(m³)",
310
-              value: "",
311
-              props: "volume",
312
-              type: "digit",
313
-              ismust: false,
314
-              form_type: "input",
315
-              isshow: true,
316
-            },
317
-            {
318
-              title: "商品图片",
319
-              value: "",
320
-              props: "image",
321
-              type: "",
322
-              ismust: false,
323
-              form_type: "file",
324
-              isshow: false,
325
-            },
326
-          ],
327
-        },
328
-      ],
329
+      attrValueForm: {
330
+        gong_mer_profit: "",
331
+        gong_market_price: "",
332
+        plate_mer_profit: "",
333
+        extension_two: null,
334
+      },
329
     };
335
     };
330
   },
336
   },
331
   async onLoad() {
337
   async onLoad() {
@@ -338,6 +344,27 @@ export default {
338
       await this.getShippingListData();
344
       await this.getShippingListData();
339
       await this.getGoodsClassData();
345
       await this.getGoodsClassData();
340
       await this.getGoodsClassCategoryData();
346
       await this.getGoodsClassCategoryData();
347
+      await this.productCon();
348
+      await this.getMerInfo();
349
+      await this.getMerchantProfit();
350
+    },
351
+    productCon() {
352
+      productConfigApi()
353
+        .then((res) => {
354
+          let data = res.data.data || {};
355
+          this.extensionStatus = data.extension_status;
356
+          this.specialMerchant = data.special_merchant;
357
+        })
358
+        .catch((res) => {});
359
+    },
360
+    async getMerInfo() {
361
+      try {
362
+        const res = await getBaseInfo();
363
+        if (res.data.status == 200) {
364
+          const data = res.data.data || {};
365
+          this.merInfo = data;
366
+        }
367
+      } catch (error) {}
341
     },
368
     },
342
     async getGoodsClassData() {
369
     async getGoodsClassData() {
343
       try {
370
       try {
@@ -390,7 +417,16 @@ export default {
390
         }
417
         }
391
       } catch (error) {}
418
       } catch (error) {}
392
     },
419
     },
393
-
420
+    // 获取商户分润比例
421
+    getMerchantProfit() {
422
+      getMerchantProfitApi()
423
+        .then((res) => {
424
+          this.base_commission = res.data.message;
425
+        })
426
+        .catch((err) => {
427
+          console.log(err);
428
+        });
429
+    },
394
     headerJump() {
430
     headerJump() {
395
       uni.redirectTo({
431
       uni.redirectTo({
396
         url: "/shop/productManagementModule/productManagement",
432
         url: "/shop/productManagementModule/productManagement",
@@ -430,7 +466,7 @@ export default {
430
     bindTextAreaBlur(e) {
466
     bindTextAreaBlur(e) {
431
       console.log(e.detail.value);
467
       console.log(e.detail.value);
432
     },
468
     },
433
- async   handleSubmit() {
469
+    async handleSubmit() {
434
       if (this.formData.image == "") {
470
       if (this.formData.image == "") {
435
         uni.showToast({
471
         uni.showToast({
436
           title: "请上传商品封面图",
472
           title: "请上传商品封面图",
@@ -459,13 +495,12 @@ export default {
459
         });
495
         });
460
         return;
496
         return;
461
       }
497
       }
462
-      if(!this.formData.temp_id || this.formData.temp_id == ""){
498
+      if (!this.formData.temp_id || this.formData.temp_id == "") {
463
         uni.showToast({
499
         uni.showToast({
464
           title: "请选择运费模板",
500
           title: "请选择运费模板",
465
           icon: "none",
501
           icon: "none",
466
         });
502
         });
467
-        return
468
-
503
+        return;
469
       }
504
       }
470
       const dataList = (this.attrValue[0] && this.attrValue[0].modules) || [];
505
       const dataList = (this.attrValue[0] && this.attrValue[0].modules) || [];
471
       const dataNew = dataList.map((item, index) => {
506
       const dataNew = dataList.map((item, index) => {
@@ -510,33 +545,31 @@ export default {
510
       }, {});
545
       }, {});
511
 
546
 
512
       // 转换为包含合并后对象的数组
547
       // 转换为包含合并后对象的数组
513
-      const result = [mergedObject];
548
+      const result = [{ mergedObject, ...this.attrValueForm }];
514
       const newParams = { ...this.formData, attrValue: result };
549
       const newParams = { ...this.formData, attrValue: result };
515
       uni.showLoading({
550
       uni.showLoading({
516
         title: "数据提交中...",
551
         title: "数据提交中...",
517
-      })
552
+      });
518
       try {
553
       try {
519
-         const res = await addProduct(newParams);
520
-         if(res.data.status == 200){
521
-            uni.showToast({
522
-              title:  "数据提交成功",
523
-              icon: "none",
524
-            });
525
-            uni.redirectTo({
526
-              url:'./productManagement'
527
-            })
528
-         }else{
554
+        const res = await addProduct(newParams);
555
+        if (res.data.status == 200) {
529
           uni.showToast({
556
           uni.showToast({
530
-              title:  res.data.message,
531
-              icon: "none",
532
-            });
533
-
534
-         }
535
-         uni.hideLoading();
536
-         uni.hideToast()
557
+            title: "数据提交成功",
558
+            icon: "none",
559
+          });
560
+          uni.redirectTo({
561
+            url: "./productManagement",
562
+          });
563
+        } else {
564
+          uni.showToast({
565
+            title: res.data.message,
566
+            icon: "none",
567
+          });
568
+        }
569
+        uni.hideLoading();
570
+        uni.hideToast();
537
       } catch (error) {
571
       } catch (error) {
538
-        
539
-      }finally{
572
+      } finally {
540
         uni.hideLoading();
573
         uni.hideLoading();
541
       }
574
       }
542
     },
575
     },
@@ -552,10 +585,209 @@ export default {
552
         this.formData.slider_image.push(item.path);
585
         this.formData.slider_image.push(item.path);
553
       });
586
       });
554
     },
587
     },
555
-    changeTextHandle(data){
588
+    changeTextHandle(data) {
556
       // console.log(data)
589
       // console.log(data)
557
       this.formData.content = data;
590
       this.formData.content = data;
558
-    }
591
+    },
592
+    /**分润设置选择 */
593
+    changeFengrun(val) {
594
+      this.formData.extension_type = val;
595
+      const _this = this;
596
+      this.attrValue[0].modules.forEach((item) => {
597
+        _this.$set(item, "value", _this.base_commission);
598
+      });
599
+    },
600
+    changeInputHandle(ev, its, item, idx) {
601
+      if (its.props == "cost") {
602
+        let modulesData = item.modules[0];
603
+        let extension_one =
604
+          modulesData.props == "extension_one"
605
+            ? modulesData.value
606
+            : this.base_commission;
607
+        let bili = extension_one / 100; //比例
608
+        let gong_mer_profit = its.value * bili; //利润
609
+        let gong_market_price = Number(its.value) + Number(gong_mer_profit); //加入利润后的价格
610
+        let plate_mer_profit = gong_mer_profit;
611
+        let price = gong_market_price;
612
+        this.$set(its, "price", price);
613
+        this.priceDefault = price;
614
+        this.attrValueForm.gong_mer_profit = gong_mer_profit;
615
+        this.attrValueForm.gong_market_price = gong_market_price;
616
+        this.attrValueForm.plate_mer_profit = plate_mer_profit;
617
+      }
618
+      console.log(this.attrValueForm, "attrValueForm", its);
619
+    },
620
+  },
621
+  computed: {
622
+    shangpingleixing() {
623
+      let dataList = [
624
+        {
625
+          value: "1",
626
+          text: "普通商品",
627
+        },
628
+      ];
629
+      if (this.specialMerchant == "beishengtang") {
630
+        dataList.push({
631
+          value: "7",
632
+          text: "积分商品",
633
+        });
634
+      }
635
+      if (this.merInfo && this.merInfo.mer_type == "1") {
636
+        dataList.concat([
637
+          {
638
+            value: "8",
639
+            text: "会员商品",
640
+          },
641
+          {
642
+            value: "10",
643
+            text: "高级会员商品",
644
+          },
645
+          {
646
+            value: "14",
647
+            text: "合伙人商品",
648
+          },
649
+          {
650
+            value: "15",
651
+            text: "股权商品",
652
+          },
653
+          {
654
+            value: "16",
655
+            text: "合伙人+股权商品",
656
+          },
657
+        ]);
658
+      }
659
+      if (this.merInfo && this.merInfo.mer_type == "2") {
660
+        dataList.concat([
661
+          {
662
+            value: "17",
663
+            text: "合伙人商品",
664
+          },
665
+        ]);
666
+      }
667
+      return dataList;
668
+    },
669
+    guigelist() {
670
+      return [
671
+        {
672
+          value: "0",
673
+          text: "单规格",
674
+        },
675
+        {
676
+          value: "1",
677
+          text: "多规格",
678
+        },
679
+      ];
680
+    },
681
+    attrValue() {
682
+      return [
683
+        {
684
+          modules: [
685
+            {
686
+              title: "分润比例(%)",
687
+              value: this.base_commission,
688
+              props: "extension_one",
689
+              type: "digit",
690
+              ismust: false,
691
+              form_type: "input",
692
+              isshow: this.formData.extension_type == 1 ? true : false,
693
+              isUnit: true,
694
+            },
695
+
696
+            {
697
+              title: "商品成本价",
698
+              value: "",
699
+              props: "cost",
700
+              type: "digit",
701
+              ismust: true,
702
+              form_type: "input",
703
+              disabled: false,
704
+              isshow: true,
705
+            },
706
+            {
707
+              title: "商品售价",
708
+              props: "price",
709
+              value: "",
710
+              type: "digit",
711
+              ismust: true,
712
+              form_type: "input",
713
+              disabled: true,
714
+              isshow: true,
715
+            },
716
+            {
717
+              title: "商品原价",
718
+              value: "",
719
+              props: "ot_price",
720
+              type: "digit",
721
+              ismust: true,
722
+              form_type: "input",
723
+              disabled: false,
724
+              isshow: true,
725
+            },
726
+            {
727
+              title: "商品图片",
728
+              value: "",
729
+              props: "image",
730
+              type: "",
731
+              ismust: false,
732
+              form_type: "file",
733
+              isshow: false,
734
+            },
735
+            {
736
+              title: "商品库存",
737
+              value: "",
738
+              props: "stock",
739
+              type: "number",
740
+              ismust: true,
741
+              form_type: "input",
742
+              disabled: false,
743
+              isshow: true,
744
+            },
745
+            {
746
+              title: "商品编号",
747
+              value: "",
748
+              props: "bar_code",
749
+              type: "text",
750
+              ismust: false,
751
+              form_type: "input",
752
+              disabled: false,
753
+              isshow: true,
754
+            },
755
+            {
756
+              title: "重量(KG)",
757
+              value: "",
758
+              props: "weight",
759
+              type: "digit",
760
+              ismust: false,
761
+              form_type: "input",
762
+              disabled: false,
763
+              isshow: true,
764
+            },
765
+            {
766
+              title: "商品体积(m³)",
767
+              value: "",
768
+              props: "volume",
769
+              type: "digit",
770
+              ismust: false,
771
+              form_type: "input",
772
+              disabled: false,
773
+              isshow: true,
774
+            },
775
+          ],
776
+        },
777
+      ];
778
+    },
779
+    fengrunList() {
780
+      return [
781
+        {
782
+          value: "1",
783
+          text: "单独设置",
784
+        },
785
+        {
786
+          value: "0",
787
+          text: "默认设置",
788
+        },
789
+      ];
790
+    },
559
   },
791
   },
560
 };
792
 };
561
 </script>
793
 </script>
@@ -660,7 +892,7 @@ page {
660
   }
892
   }
661
 }
893
 }
662
 .form-box {
894
 .form-box {
663
-  min-height: 158rpx;
895
+  min-height: auto;
664
   background: #ffffff;
896
   background: #ffffff;
665
   //   border: 2rpx solid #f00;
897
   //   border: 2rpx solid #f00;
666
   padding: 0 32rpx;
898
   padding: 0 32rpx;
@@ -678,6 +910,13 @@ page {
678
       right: -26rpx;
910
       right: -26rpx;
679
       top: 28rpx;
911
       top: 28rpx;
680
     }
912
     }
913
+    .view-unit-input {
914
+      color: #999;
915
+      width: 15rpx;
916
+      text-align: center;
917
+      flex-shrink: 0;
918
+      word-break: break-all;
919
+    }
681
     .form-box-txt {
920
     .form-box-txt {
682
       font-family: PingFangSC, PingFang SC;
921
       font-family: PingFangSC, PingFang SC;
683
       font-weight: 400;
922
       font-weight: 400;
@@ -698,6 +937,23 @@ page {
698
       color: #333333;
937
       color: #333333;
699
       flex: 1;
938
       flex: 1;
700
       padding-right: 20rpx;
939
       padding-right: 20rpx;
940
+      .price-box {
941
+        display: flex;
942
+        flex-direction: column;
943
+        justify-content: center;
944
+        align-items: flex-end;
945
+        .flex-price {
946
+          color: #1f7cff;
947
+          font-size: 26rpx;
948
+          font-weight: 700;
949
+        }
950
+        .price-box_tips {
951
+          font-size: 20rpx;
952
+          font-weight: 700;
953
+          color: #f05107;
954
+          padding-top: 10rpx;
955
+        }
956
+      }
701
       &.classification {
957
       &.classification {
702
         color: #999;
958
         color: #999;
703
       }
959
       }
@@ -731,7 +987,7 @@ page {
731
 .pb15 {
987
 .pb15 {
732
   padding-bottom: 25rpx !important;
988
   padding-bottom: 25rpx !important;
733
 }
989
 }
734
-.tips-messge{
990
+.tips-messge {
735
   padding-bottom: 15rpx;
991
   padding-bottom: 15rpx;
736
   color: #ff6010;
992
   color: #ff6010;
737
 }
993
 }