Browse Source

feat:售后多件多折

chenjiaxin 3 months ago
parent
commit
6ea6b7bcde
31 changed files with 2188 additions and 2017 deletions
  1. 16 0
      src/api/oms/order/multiBuyDiscount.js
  2. 18 2
      src/api/oms/refund/refund.js
  3. 1 1
      src/lang/en.js
  4. 34 10
      src/lang/en/label.js
  5. 1 1
      src/lang/ja.js
  6. 26 3
      src/lang/ja/label.js
  7. 1 1
      src/lang/zh.js
  8. 29 6
      src/lang/zh/label.js
  9. 103 60
      src/utils/toolUtil.js
  10. 2 2
      src/views/oms/order/abnormalList.vue
  11. 6 4
      src/views/oms/order/components/discountInfoTab.vue
  12. 1 2
      src/views/oms/order/components/orderInfoDialog.vue
  13. 4 4
      src/views/oms/order/components/orderItemListTab.vue
  14. 2 2
      src/views/oms/order/orderList.vue
  15. 3 3
      src/views/oms/order/orderProcess.vue
  16. 425 0
      src/views/oms/promotion/amountOffProducts/index copy.vue
  17. 104 166
      src/views/oms/promotion/amountOffProducts/index.vue
  18. 477 255
      src/views/oms/promotion/amountOffProducts/promotionForm copy.vue
  19. 328 284
      src/views/oms/promotion/amountOffProducts/promotionForm.vue
  20. 0 91
      src/views/oms/promotion/amountOffProducts/promotionLogList.vue
  21. 30 97
      src/views/oms/promotion/buyXGetYDiscount/components/productCollectionDetail.vue
  22. 33 29
      src/views/oms/promotion/buyXGetYDiscount/index.vue
  23. 0 556
      src/views/oms/promotion/buyXGetYDiscount/promotionForm copy.vue
  24. 292 218
      src/views/oms/promotion/buyXGetYDiscount/promotionForm.vue
  25. 0 91
      src/views/oms/promotion/buyXGetYDiscount/promotionLogList.vue
  26. 6 6
      src/views/oms/promotion/multiBuyDiscount/index.vue
  27. 89 52
      src/views/oms/promotion/multiBuyDiscount/promotionForm.vue
  28. 20 27
      src/views/oms/promotion/multiBuyDiscount/promotionLogList.vue
  29. 110 33
      src/views/oms/refund/components/createRefundDialog.vue
  30. 15 9
      src/views/oms/refund/refundDetail.vue
  31. 12 2
      vue.config.js

+ 16 - 0
src/api/oms/order/multiBuyDiscount.js

@@ -48,3 +48,19 @@ export function updateStatusMutiDiscount(query) {
     params: query
   });
 }
+// 商品标签列表
+export function getProductTagList(query) {
+  return request({
+    url: "/product/tag/list",
+    method: "get",
+    params: query
+  });
+}
+// 根据标签查询货品
+export function getProductBuyTag(query) {
+  return request({
+    url: "/product/getListByTags",
+    method: "get",
+    params: query
+  });
+}

+ 18 - 2
src/api/oms/refund/refund.js

@@ -1,7 +1,7 @@
 import request from "@/utils/requestOms";
 
 //刷新物流轨迹
-export function updateCargoTrack(query){
+export function updateCargoTrack(query) {
   return request({
     url: "/ordersRefund/updateCargoTrack",
     method: "get",
@@ -9,7 +9,7 @@ export function updateCargoTrack(query){
   });
 }
 //物流轨迹
-export function cargoTrackList(query){
+export function cargoTrackList(query) {
   return request({
     url: "/ordersRefund/getCargoTrack",
     method: "get",
@@ -211,3 +211,19 @@ export function validPromotionReq(data) {
     data
   });
 }
+// 客服提交售后申请版本查询
+export function checkRefundVersions(data) {
+  return request({
+    url: "/getRefundVersions",
+    method: "post",
+    data
+  });
+}
+// 客服提交售后申请预览
+export function checkSubmitRefund(data) {
+  return request({
+    url: "/checkSubmitRefund",
+    method: "post",
+    data
+  });
+}

+ 1 - 1
src/lang/en.js

@@ -46,7 +46,7 @@ export default {
   determine: "Determine",
 
   giftFlag: "Gift Exists",
-  baseMessage: "Base Message",
+  baseMessage: "Order Base Message",
   takeOrderTime: "Take Order Time",
   payways: "Payment Ways",
   goodsAmount: "Goods Amount",

+ 34 - 10
src/lang/en/label.js

@@ -1,3 +1,5 @@
+import label from "../zh/label";
+
 export default {
   userID: "User ID",
   username: "Username",
@@ -457,10 +459,11 @@ export default {
   product: "Product",
   discountStr: 'Discount',
   numberStr: "Quantity",
-  money: 'Amount',
-  productCollection: " product collections",
-  all: ", total ",
-  itemProduct: ' items',
+  money: 'Money',
+  productCollection: " Product Collections",
+  all: ", Total ",
+  itemProduct: ' Items',
+  viewProductDetaiL: 'View Product Details',
   specifyProductTag: "Specify Product Tag",
   setProductRange: "Set Product Range",
   mutiPromotionDetailTitle: "Promotion Details",
@@ -489,6 +492,7 @@ export default {
   specifyProductCollection: "Specify Product Collection",
   combinationLable: "This product discount can be combined with",
   oncePerOrder: 'Once Per Order',
+  oncePerOrderDesc: 'If not selected, this amount will be reduced for each eligible item in the order',
   viewVersion: 'View Version',
   updateTime: 'Update Time',
   deleteNotice: 'Do you want to delete this record?',
@@ -555,11 +559,11 @@ export default {
   fail: 'fail',
   ruleTypeList: [
     {
-      label: "Amount Off Order",
+      label: "Amount Off Products",
       value: 1
     },
     {
-      label: "Amount Off Products",
+      label: "Amount Off Order",
       value: 2
     },
     {
@@ -590,13 +594,13 @@ export default {
   customerQualificationList: [
     {
       label: "All customers",
-      value: "1"
+      value: 1
     }, {
       label: "Specific customer segments",
-      value: "2"
+      value: 2
     }, {
       label: "Specific customers",
-      value: "3"
+      value: 3
     }
   ],
   stackableTypesValue: [
@@ -701,7 +705,6 @@ export default {
       value: 2
     }
   ],
-
   // 促销赠品
   giftSku: "Sku Code",
   giftNum: "The number of gifts given at a time",
@@ -785,4 +788,25 @@ export default {
   SLFee: "ShippingLabel Shipping",
   flashPurchase: "Flash Sale",
   exchangePurchase: "Exchange",
+  needPayWithCustomers: "Customers need to pay the difference",
+  promotionBuyTyper: [{
+    label: 'One-time purchase',
+    value: 1
+  },
+  {
+    label: 'Subscription',
+    value: 2
+  },
+  {
+    label: 'Both',
+    value: 3
+  }],
+  promotionCustomerGetType: [{
+    label: 'Specific collections',
+    value: 1
+  },
+  {
+    label: 'Specific products',
+    value: 2
+  }]
 };

+ 1 - 1
src/lang/ja.js

@@ -44,7 +44,7 @@ export default {
   determine: "決定",
   giftFlag: "プレゼント品があるか",
   status: "ステータス",
-  baseMessage: "基本情報",
+  baseMessage: "注文基本情報",
   takeOrderTime: "注文時間",
   payways: "お支払い方法",
   goodsAmount: "商品合計",

+ 26 - 3
src/lang/ja/label.js

@@ -441,6 +441,7 @@ export default {
   productCollection: "製品コレクション",
   all: "一般",
   itemProduct: 'アイテム',
+  viewProductDetaiL: '製品の詳細を見る',
   viewVersion: 'バージョンを表示',
   updateTime: '更新時間',
   deleteNotice: 'このレコードを削除しますか?',
@@ -550,13 +551,13 @@ export default {
   customerQualificationList: [
     {
       label: "すべてのお客様",
-      value: "1"
+      value: 1
     }, {
       label: "特定の顧客セグメント",
-      value: "2"
+      value: 2
     }, {
       label: "特定の顧客",
-      value: "3"
+      value: 3
     }
   ],
   stackableTypesValue: [
@@ -763,6 +764,7 @@ export default {
     },
   ],
   oncePerOrder: '注文ごとに1回',
+  oncePerOrderDesc: '選択しない場合は、注文内の対象商品ごとにこの金額が減額されます',
   openShippingLabel: "shippingLabelを有効にするかどうか",
   useShippingLabel: "配送を有効にするかどうか",
   sumGiftCardRefundAmount: "ギフトカードの返金額",
@@ -778,4 +780,25 @@ export default {
   allCountries: 'すべての国',
   shippingRates: '貨物',
   shippingRatesValue: '一定額を超える送料を除外する',
+  needPayWithCustomers: "差額はお客様がお支払いいただきます",
+  promotionBuyTyper: [{
+    label: '一度限りの購入',
+    value: 1
+  },
+  {
+    label: 'サプスクリプション',
+    value: 2
+  },
+  {
+    label: '両方',
+    value: 3
+  }],
+  promotionCustomerGetType: [{
+    label: '特定の製品ライン',
+    value: 1
+  },
+  {
+    label: '特定の製品',
+    value: 2
+  }]
 };

+ 1 - 1
src/lang/zh.js

@@ -73,7 +73,7 @@ export default {
   mail: "收件人电子邮箱",
   phone: "收件人手机号",
   companyName: "收件公司名",
-  baseMessage: "基本信息",
+  baseMessage: "订单基本信息",
   orderStatus: "订单状态",
   orderType: "订单类型",
   exchangeFlag: "是否换货",

+ 29 - 6
src/lang/zh/label.js

@@ -490,8 +490,9 @@ export default {
   giftRelation: "赠品关系",
   applicationMethod: '应用方式',
   productCollection: "商品集合",
-  all: "",
+  all: "",
   itemProduct: '件商品',
+  viewProductDetaiL: '查看商品明细',
   applicationMethodList: [
     {
       label: "折扣码",
@@ -601,13 +602,13 @@ export default {
   customerQualificationList: [
     {
       label: "全部客户",
-      value: "1"
+      value: 1
     }, {
       label: "特定客户细分",
-      value: "2"
+      value: 2
     }, {
       label: "特定客户",
-      value: "3"
+      value: 3
     }
   ],
   stackableTypesValue: [
@@ -718,6 +719,7 @@ export default {
     minimunQuantity: "最低商品数量",
   },
   oncePerOrder: '每个订单一次',
+  oncePerOrderDesc: '如果未选择,订单中每件符合条件的商品都将减去此金额',
   // 促销赠品
   giftSku: "Sku Code",
   giftNum: "单次赠送数量",
@@ -727,6 +729,7 @@ export default {
   giftInventoryWarehouseName: "仓库名称",
   giftPriority: "优先级",
   giftCount: "已赠送数量",
+  needPayWithCustomers: "顾客需补差价",
   giftInventoryTypeArr: [
     {
       label: "指定仓库",
@@ -794,11 +797,11 @@ export default {
   ],
   ruleTypeList: [
     {
-      label: "订单降价金额",
+      label: "产品降价金额",
       value: 1
     },
     {
-      label: "产品降价金额",
+      label: "订单降价金额",
       value: 2
     },
     {
@@ -819,4 +822,24 @@ export default {
   allCountries: '所有国家/地区',
   shippingRates: '运费',
   shippingRatesValue: '排除超过特定金额的运费',
+  promotionBuyTyper: [{
+    label: '一次性购买',
+    value: 1
+  },
+  {
+    label: '订阅',
+    value: 2
+  },
+  {
+    label: '两者',
+    value: 3
+  }],
+  promotionCustomerGetType: [{
+    label: '特定产品系列',
+    value: 1
+  },
+  {
+    label: '特定产品',
+    value: 2
+  }]
 };

+ 103 - 60
src/utils/toolUtil.js

@@ -2,85 +2,128 @@
  * 小数相加
  */
 export function dcmAdd(arg1, arg2) {
-	if(!arg1||!arg2){
-		return;
-	}
-	var r1, r2, m;
-	try {
-		r1 = arg1.toString().split(".")[1].length;
-	} catch(e) {
-		r1 = 0;
-	}
-	try {
-		r2 = arg2.toString().split(".")[1].length;
-	} catch(e) {
-		r2 = 0;
-	}
-	m = Math.pow(10, Math.max(r1, r2));
-	return(accMul(arg1, m) + accMul(arg2, m)) / m;
+  if (!arg1 || !arg2) {
+    return;
+  }
+  var r1, r2, m;
+  try {
+    r1 = arg1.toString().split(".")[1].length;
+  } catch (e) {
+    r1 = 0;
+  }
+  try {
+    r2 = arg2.toString().split(".")[1].length;
+  } catch (e) {
+    r2 = 0;
+  }
+  m = Math.pow(10, Math.max(r1, r2));
+  return (accMul(arg1, m) + accMul(arg2, m)) / m;
 }
 
 /*
  * 相减
  */
 export function dcmSub(arg1, arg2) {
-	
-	if(!arg1||!arg2){
-		return;
-	}
-	return dcmAdd(arg1, -arg2);
+
+  if (!arg1 || !arg2) {
+    return;
+  }
+  return dcmAdd(arg1, -arg2);
 }
 
 /*
  * 除法
  */
 export function accDiv(arg1, arg2) {
-	if(!arg1||!arg2){
-		return;
-	}
-	
-	var t1 = 0,
-		t2 = 0,
-		r1, r2;
-	try {
-		t1 = arg1.toString().split(".")[1].length;
-	} catch(e) {}
-	try {
-		t2 = arg2.toString().split(".")[1].length;
-	} catch(e) {}
-	r1 = Number(arg1.toString().replace(".", ""));
-	r2 = Number(arg2.toString().replace(".", ""));
-	return(r1 / r2) * Math.pow(10, t2 - t1);
+  if (!arg1 || !arg2) {
+    return;
+  }
+
+  var t1 = 0,
+    t2 = 0,
+    r1, r2;
+  try {
+    t1 = arg1.toString().split(".")[1].length;
+  } catch (e) { }
+  try {
+    t2 = arg2.toString().split(".")[1].length;
+  } catch (e) { }
+  r1 = Number(arg1.toString().replace(".", ""));
+  r2 = Number(arg2.toString().replace(".", ""));
+  return (r1 / r2) * Math.pow(10, t2 - t1);
 }
 
 /*
  * 乘法
  */
 export function accMul(arg1, arg2) {
-	if(!arg1||!arg2){
-		return;
-	}
-	var m = 0,
-		s1 = arg1.toString(),
-		s2 = arg2.toString();
-	try {
-		m += s1.split(".")[1].length;
-	} catch(e) {}
-	try {
-		m += s2.split(".")[1].length;
-	} catch(e) {}
-	var v = Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
-	return toDecimal(v);
+  if (!arg1 || !arg2) {
+    return;
+  }
+  var m = 0,
+    s1 = arg1.toString(),
+    s2 = arg2.toString();
+  try {
+    m += s1.split(".")[1].length;
+  } catch (e) { }
+  try {
+    m += s2.split(".")[1].length;
+  } catch (e) { }
+  var v = Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
+  return toDecimal(v);
 }
 
-//保留两位小数    
-//功能:将浮点数四舍五入,取小数点后2位          
+//保留两位小数
+//功能:将浮点数四舍五入,取小数点后2位
 
 export function toDecimal(x) {
-	var f = parseFloat(x);
-	if(isNaN(f)) {
-		return;
-	}
-	f = Math.round(x * 100) / 100;
-	return f;
-}
+  var f = parseFloat(x);
+  if (isNaN(f)) {
+    return;
+  }
+  f = Math.round(x * 100) / 100;
+  return f;
+}
+/**
+ * 判断变量是否为空,
+ * @param  {[type]}  param 变量
+ * @return {Boolean}      为空返回true,否则返回false。
+ */
+export function isEmpty(param) {
+  if (param) {
+    let param_type = typeof (param);
+    if (param_type == 'object') {
+      //要判断的是【对象】或【数组】或【null】等
+      if (typeof (param.length) == 'undefined') {
+        if (JSON.stringify(param) == "{}") {
+          return true;//空值,空对象
+        }
+      } else if (param.length == 0) {
+        return true;//空值,空数组
+      }
+    } else if (param_type == 'string') {
+      //如果要过滤空格等字符
+      let new_param = param.trim();
+      if (new_param.length == 0) {
+        //空值,例如:带有空格的字符串" "。
+        return true;
+      }
+    } else if (param_type == 'boolean') {
+      if (!param) {
+        return true;
+      }
+    } else if (param_type == 'number') {
+      if (!param) {
+        return true;
+      }
+    }
+    return false;//非空值
+  } else {
+    //空值,例如:
+    //(1)null
+    //(2)可能使用了js的内置的名称,例如:var name=[],这个打印类型是字符串类型。
+    //(3)空字符串''、""。
+    //(4)数字0、00等,如果可以只输入0,则需要另外判断。
+    return true;
+  }
+}

+ 2 - 2
src/views/oms/order/abnormalList.vue

@@ -419,10 +419,10 @@
       <!-- 多件多件信息 -->
       <el-table-column
         v-has="'priceRule:list'"
-        :label="$t('discountInfo')"
+        :label="$t('multiBuyDiscount.promotionMessage')"
         min-width="200"
         align="center"
-        prop="discountInfo"
+        prop="discountTitle"
       />
 
       <el-table-column

+ 6 - 4
src/views/oms/order/components/discountInfoTab.vue

@@ -5,7 +5,9 @@
       ref="multipleTable"
       v-loading="listLoading"
       key="0"
-      :data="datas"
+      :data="[
+        { discountTitle: datas.discountTitle || '', payment: datas.payment }
+      ]"
       row-key="id"
       stripe
       border
@@ -14,17 +16,17 @@
       <el-table-column align="center" type="index"> </el-table-column>
 
       <el-table-column
-        :label="$t('discountInfo')"
+        :label="$t('multiBuyDiscount.promotionMessage')"
         width="300"
         align="center"
-        prop="payId"
+        prop="discountTitle"
       />
 
       <el-table-column
         :label="$t('multipleDiscountInfo.payMoneny')"
         width="300"
         align="center"
-        prop="authorization"
+        prop="payment"
       />
     </el-table>
   </div>

+ 1 - 2
src/views/oms/order/components/orderInfoDialog.vue

@@ -157,7 +157,7 @@
         >
           <el-collapse-item :title="$t('discountInfo')" name="2">
             <div class="ptitle">
-              <discountInfoTab :datas="orderGiftCards"></discountInfoTab>
+              <discountInfoTab :datas="orderInfo"></discountInfoTab>
             </div>
           </el-collapse-item>
         </el-collapse>
@@ -325,7 +325,6 @@ export default {
               this.orderDeatils[i].isGiftCheck = true;
             }
           }
-          console.log(this.orderDeatils);
           this.detailLoading = false;
         }
       });

+ 4 - 4
src/views/oms/order/components/orderItemListTab.vue

@@ -174,7 +174,7 @@
       </el-table-column>
       <el-table-column width="55" :label="$t('label.bag')" align="center">
         <template slot-scope="scope">
-          <el-checkbox v-model="scope.row.bagFlag == 1"></el-checkbox>
+          <el-checkbox :value="scope.row.bagFlag === 1"></el-checkbox>
         </template>
       </el-table-column>
       <el-table-column
@@ -183,7 +183,7 @@
         align="center"
       >
         <template slot-scope="scope">
-          <el-checkbox v-model="scope.row.flashPurchaseFlag == 1"></el-checkbox>
+          <el-checkbox :value="scope.row.flashPurchaseFlag == 1"></el-checkbox>
         </template>
       </el-table-column>
       <el-table-column
@@ -193,7 +193,7 @@
       >
         <template slot-scope="scope">
           <el-checkbox
-            v-model="scope.row.exchangePurchaseFlag == 1"
+            :value="scope.row.exchangePurchaseFlag === 1"
           ></el-checkbox>
         </template>
       </el-table-column>
@@ -205,7 +205,7 @@
         align="center"
       >
         <template slot-scope="scope">
-          <el-checkbox v-model="scope.row.manyfoldFlag == 1"></el-checkbox>
+          <el-checkbox :value="scope.row.manyFoldFlag === 1"></el-checkbox>
         </template>
       </el-table-column>
 

+ 2 - 2
src/views/oms/order/orderList.vue

@@ -441,10 +441,10 @@
       <!-- 多件多件信息 -->
       <el-table-column
         v-has="'priceRule:list'"
-        :label="$t('discountInfo')"
+        :label="$t('multiBuyDiscount.promotionMessage')"
         min-width="200"
         align="center"
-        prop="discountInfo"
+        prop="discountTitle"
       />
 
       <el-table-column

+ 3 - 3
src/views/oms/order/orderProcess.vue

@@ -449,11 +449,11 @@
       <!-- 多件多件信息 -->
       <el-table-column
         v-has="'priceRule:list'"
-        :label="$t('discountInfo')"
+        :label="$t('multiBuyDiscount.promotionMessage')"
         min-width="200"
         align="center"
-        prop="discountInfo"
-      ></el-table-column>
+        prop="discountTitle"
+      />
 
       <el-table-column
         :label="$t('sellerDiscount')"

+ 425 - 0
src/views/oms/promotion/amountOffProducts/index copy.vue

@@ -0,0 +1,425 @@
+<template>
+  <div class="app-container">
+    <el-container>
+      <el-main>
+        <div class="filter-container">
+          <el-input
+            :placeholder="$t('label.promotionName')"
+            style="width: 200px;"
+            clearable
+            class="filter-item"
+            v-model="listQuery.promotionName"
+            @keyup.enter.native="retPage"
+          />
+          <el-input
+            :placeholder="$t('label.minimumPurchaseRequirement')"
+            style="width: 200px;"
+            clearable
+            class="filter-item"
+            v-model="listQuery.minimumPurchaseRequirement"
+            @keyup.enter.native="retPage"
+          />
+          <el-select
+            v-model="listQuery.applicationMethod"
+            clearable
+            class="filter-item"
+            style="width: 200px;"
+            :placeholder="$t('label.applicationMethod')"
+            @keyup.enter.native="retPage"
+          >
+            <el-option
+              :key="index"
+              v-for="(item, index) in storeList"
+              :label="item.storeName"
+              :value="item.storeId"
+            />
+          </el-select>
+          <el-button
+            v-waves
+            v-has="'promotion:list'"
+            class="filter-item"
+            type="primary"
+            icon="el-icon-search"
+            @click="retPage"
+            >{{ $t("view.search") }}
+          </el-button>
+        </div>
+        <el-table
+          v-loading="listLoading"
+          :key="tableKey"
+          :data="list"
+          stripe
+          border
+          fit
+          highlight-current-row
+          style="width: 100%;"
+        >
+          <el-table-column type="index" width="40"></el-table-column>
+
+          <el-table-column
+            :label="$t('label.promotionEventName')"
+            width="220"
+            show-overflow-tooltip
+          >
+            <template v-slot="{ row }">
+              <span>{{ row.promotionName }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            :label="$t('label.promotionId')"
+            align="center"
+            width="220"
+            show-overflow-tooltip
+          >
+            <template v-slot="{ row }">
+              <span>{{ row.promotionInfo }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            :label="$t('label.participateType')"
+            align="center"
+            width="220"
+          >
+            <template v-slot="{ row }">
+              <span>{{
+                $t("label.participateTypeArr").find(
+                  item => item.value === row.participateType
+                )
+                  ? $t("label.participateTypeArr").find(
+                      item => item.value === row.participateType
+                    ).label
+                  : ""
+              }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            :label="$t('label.promotionLevel')"
+            align="center"
+            width="220"
+          >
+            <template v-slot="{ row }">
+              <span>{{ row.promotionStartTime }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            :label="$t('label.applicationMethod')"
+            align="center"
+            width="220"
+          >
+            <template v-slot="{ row }">
+              <span>{{ row.participateNum }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            :label="$t('label.minimumPurchaseRequirement')"
+            align="center"
+            width="160"
+          >
+            <template v-slot="{ row }">
+              <span>{{ row.participateWeight }}</span>
+            </template>
+          </el-table-column>
+
+          <el-table-column
+            :label="$t('label.discountValue')"
+            align="center"
+            width="220"
+          >
+            <template v-slot="{ row }">
+              <span>{{
+                $t("label.conditionTypeArr").find(
+                  item => item.value === row.conditionType
+                )
+                  ? $t("label.conditionTypeArr").find(
+                      item => item.value === row.conditionType
+                    ).label
+                  : ""
+              }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            :label="$t('label.priority')"
+            align="center"
+            width="120"
+          >
+            <template v-slot="{ row }">
+              <span>{{ row.participateWeight }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            :label="$t('label.stackableType')"
+            align="center"
+            width="150"
+          >
+            <template v-slot="{ row }">
+              <span>{{ row.participateWeight }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            :label="$t('label.promotionStartTime')"
+            align="center"
+            width="220"
+          >
+            <template v-slot="{ row }">
+              <span>{{ row.promotionStartTime }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            :label="$t('label.promotionEndTime')"
+            align="center"
+            width="220"
+          >
+            <template v-slot="{ row }">
+              <span>{{ row.promotionEndTime }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            :label="$t('label.version')"
+            align="center"
+            width="120"
+          >
+            <template v-slot="{ row }">
+              <span>{{ row.participateWeight }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            :label="$t('label.operation')"
+            min-width="180"
+            align="center"
+            fixed="right"
+          >
+            <template v-slot="{ row }">
+              <!-- <el-tooltip
+                class="item"
+                effect="dark"
+                :content="$t('view.edit')"
+                placement="top-start"
+              >
+                <el-button
+                  v-has="'promotion:update'"
+                  type="primary"
+                  size="mini"
+                  icon="el-icon-edit"
+                  circle
+                  @click="showDialog(row.id, false)"
+                >
+                </el-button>
+              </el-tooltip> -->
+
+              <el-tooltip
+                class="item"
+                effect="dark"
+                :content="$t('view.details')"
+                placement="top-start"
+              >
+                <el-button
+                  v-has="'promotion:list'"
+                  type="primary"
+                  size="mini"
+                  icon="el-icon-more"
+                  circle
+                  @click="showDialog(row.id, true)"
+                >
+                </el-button>
+              </el-tooltip>
+              <el-tooltip
+                class="item"
+                effect="dark"
+                :content="$t('view.delete')"
+                placement="top-start"
+              >
+                <el-button
+                  v-has="'promotion:delete'"
+                  type="danger"
+                  circle
+                  size="mini"
+                  icon="el-icon-delete"
+                  @click="handleDelete(row.id)"
+                >
+                </el-button>
+              </el-tooltip>
+              <el-tooltip
+                class="item"
+                effect="dark"
+                :content="$t('label.version')"
+                placement="top-start"
+              >
+                <el-button
+                  v-has="'promotion:status'"
+                  type="primary"
+                  circle
+                  size="mini"
+                  icon="el-icon-notebook-1"
+                  @click="handleLog(row.id)"
+                >
+                </el-button>
+              </el-tooltip>
+              <!-- <el-tooltip
+                class="item"
+                effect="dark"
+                :content="$t('title.operationLog')"
+                placement="top-start"
+              >
+                <el-button
+                  v-has="'promotionLog:list'"
+                  type="primary"
+                  circle
+                  size="mini"
+                  icon="el-icon-notebook-1"
+                  @click="handleLog(row.id)"
+                >
+                </el-button>
+              </el-tooltip> -->
+            </template>
+          </el-table-column>
+        </el-table>
+        <!-- 分页 -->
+        <swPage
+          v-if="total > 0"
+          key="2"
+          :listQuery="listQuery"
+          :total="total"
+          pos="btmRight"
+          @retPage="getList"
+        />
+      </el-main>
+    </el-container>
+
+    <promotion-form ref="promotionFormRef" @refresh-table="getList" />
+    <promotion-log-list ref="logListRef" @show="id => showDialog(id, true)" />
+  </div>
+</template>
+
+<script>
+import waves from "@/directive/waves"; // 水波纹指令
+import SwPage from "@/views/common/swPage.vue";
+import ElContainer from "element-ui/packages/container/src/main";
+import PromotionForm from "@/views/oms/promotion/amountOffProducts/promotionForm.vue";
+import PromotionLogList from "@/views/oms/promotion/amountOffProducts/promotionLogList.vue";
+import {
+  fetchList,
+  deleteById,
+  storeList,
+  checkPromotion,
+  changeStatus
+} from "@/api/oms/order/promotion";
+import { getToken } from "@/utils/auth";
+
+export default {
+  inject: ["reload"], //刷新
+  components: {
+    SwPage,
+    ElContainer,
+    PromotionForm,
+    PromotionLogList
+  },
+  name: "multiBuyDiscount",
+  directives: {
+    waves
+  },
+  data() {
+    return {
+      activeName: "productIndex",
+      iconSize: "mini",
+      //右侧列表
+      tableKey: 0,
+      list: null,
+      total: null,
+      listLoading: false,
+      listQuery: {
+        applicationMethod: null,
+        promotionName: null,
+        minimumPurchaseRequirement: null,
+        page: 1,
+        limit: 10
+      },
+      storeList: []
+    };
+  },
+  created() {
+    this.getList();
+    this.getStoreList();
+  },
+  computed: {
+    headers: function() {
+      return { "X-Token": getToken() };
+    }
+  },
+  methods: {
+    getStoreList() {
+      storeList().then(res => {
+        if (res.code === 200) {
+          this.storeList = res.data;
+        }
+      });
+    },
+    getList() {
+      this.listLoading = true;
+      fetchList(this.listQuery)
+        .then(response => {
+          if (response.code === 200) {
+            this.list = response.data.list;
+            this.total = response.data.total;
+            setTimeout(() => {
+              this.listLoading = false;
+            }, 0.5 * 1000);
+          }
+        })
+        .catch(() => {
+          setTimeout(() => {
+            this.listLoading = false;
+          }, 0.5 * 1000);
+        });
+    },
+    retPage() {
+      this.listQuery.page = 1;
+      this.getList();
+    },
+    handleDelete(id) {
+      this.$confirm("是否删除该记录?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        deleteById(id).then(res => {
+          if (res.code === 200) {
+            this.$message({
+              message: "操作成功",
+              type: "success"
+            });
+            this.getList();
+          }
+        });
+      });
+    },
+    showDialog(id, edit) {
+      this.$refs.promotionFormRef.showDialog(id, edit);
+    },
+    handleDetail(id) {
+      console.log(id, "detail");
+    },
+    // changePromotionStatus(id, status) {
+    //   this.$confirm(status ? "是否确认禁用?" : "是否确认启用?", "提示", {
+    //     confirmButtonText: "确定",
+    //     cancelButtonText: "取消",
+    //     type: "warning"
+    //   }).then(() => {
+    //     changeStatus(id).then(res => {
+    //       if (res.code === 200) {
+    //         this.$message({
+    //           message: "操作成功",
+    //           type: "success"
+    //         });
+    //         this.getList();
+    //       }
+    //     });
+    //   });
+    // },
+    handleLog(id) {
+      this.$refs.logListRef.handleOpen(id);
+    }
+  }
+};
+</script>
+
+<style scoped></style>

+ 104 - 166
src/views/oms/promotion/amountOffProducts/index.vue

@@ -8,19 +8,19 @@
             style="width: 200px;"
             clearable
             class="filter-item"
-            v-model="listQuery.promotionName"
+            v-model="listQuery.title"
             @keyup.enter.native="retPage"
           />
           <el-input
             :placeholder="$t('label.minimumPurchaseRequirement')"
-            style="width: 200px;"
+            style="width: 220px;"
             clearable
             class="filter-item"
-            v-model="listQuery.minimumPurchaseRequirement"
+            v-model="listQuery.requireValue"
             @keyup.enter.native="retPage"
           />
           <el-select
-            v-model="listQuery.applicationMethod"
+            v-model="listQuery.discountMethod"
             clearable
             class="filter-item"
             style="width: 200px;"
@@ -29,9 +29,9 @@
           >
             <el-option
               :key="index"
-              v-for="(item, index) in storeList"
-              :label="item.storeName"
-              :value="item.storeId"
+              v-for="(item, index) in $t('label.applicationMethodList')"
+              :label="item.label"
+              :value="item.value"
             />
           </el-select>
           <el-button
@@ -60,36 +60,22 @@
             :label="$t('label.promotionEventName')"
             width="220"
             show-overflow-tooltip
-          >
-            <template v-slot="{ row }">
-              <span>{{ row.promotionName }}</span>
-            </template>
-          </el-table-column>
+            prop="title"
+          />
           <el-table-column
             :label="$t('label.promotionId')"
             align="center"
             width="220"
             show-overflow-tooltip
-          >
-            <template v-slot="{ row }">
-              <span>{{ row.promotionInfo }}</span>
-            </template>
-          </el-table-column>
+            prop="id"
+          />
           <el-table-column
             :label="$t('label.participateType')"
             align="center"
             width="220"
           >
             <template v-slot="{ row }">
-              <span>{{
-                $t("label.participateTypeArr").find(
-                  item => item.value === row.participateType
-                )
-                  ? $t("label.participateTypeArr").find(
-                      item => item.value === row.participateType
-                    ).label
-                  : ""
-              }}</span>
+              <span>{{ ruleTypeLabel(row.ruleType) }}</span>
             </template>
           </el-table-column>
           <el-table-column
@@ -97,9 +83,7 @@
             align="center"
             width="220"
           >
-            <template v-slot="{ row }">
-              <span>{{ row.promotionStartTime }}</span>
-            </template>
+            <span>{{ $t("label.product") }}</span>
           </el-table-column>
           <el-table-column
             :label="$t('label.applicationMethod')"
@@ -107,7 +91,7 @@
             width="220"
           >
             <template v-slot="{ row }">
-              <span>{{ row.participateNum }}</span>
+              <span>{{ applicationMethod(row.discountMethod) }}</span>
             </template>
           </el-table-column>
           <el-table-column
@@ -116,7 +100,7 @@
             width="160"
           >
             <template v-slot="{ row }">
-              <span>{{ row.participateWeight }}</span>
+              <span>{{ purchaseRequire(row) }}</span>
             </template>
           </el-table-column>
 
@@ -126,18 +110,10 @@
             width="220"
           >
             <template v-slot="{ row }">
-              <span>{{
-                $t("label.conditionTypeArr").find(
-                  item => item.value === row.conditionType
-                )
-                  ? $t("label.conditionTypeArr").find(
-                      item => item.value === row.conditionType
-                    ).label
-                  : ""
-              }}</span>
+              {{ discountVal(row) }}
             </template>
           </el-table-column>
-          <el-table-column
+          <!-- <el-table-column
             :label="$t('label.priority')"
             align="center"
             width="120"
@@ -145,42 +121,44 @@
             <template v-slot="{ row }">
               <span>{{ row.participateWeight }}</span>
             </template>
-          </el-table-column>
+          </el-table-column> -->
           <el-table-column
             :label="$t('label.stackableType')"
             align="center"
             width="150"
           >
             <template v-slot="{ row }">
-              <span>{{ row.participateWeight }}</span>
+              <span>{{ stackableType(row) }}</span>
             </template>
           </el-table-column>
           <el-table-column
             :label="$t('label.promotionStartTime')"
             align="center"
+            prop="startTime"
             width="220"
-          >
-            <template v-slot="{ row }">
-              <span>{{ row.promotionStartTime }}</span>
-            </template>
-          </el-table-column>
+          />
           <el-table-column
             :label="$t('label.promotionEndTime')"
             align="center"
             width="220"
+            prop="endTime"
+          />
+          <!-- <el-table-column
+            :label="$t('label.status')"
+            align="center"
+            width="120"
+            prop="status"
           >
-            <template v-slot="{ row }">
-              <span>{{ row.promotionEndTime }}</span>
-            </template>
-          </el-table-column>
+            <template v-slot="{ row }">{{ statusVal(row.status) }}</template>
+          </el-table-column> -->
           <el-table-column
             :label="$t('label.version')"
             align="center"
             width="120"
           >
-            <template v-slot="{ row }">
-              <span>{{ row.participateWeight }}</span>
-            </template>
+            <template v-slot="{ row }">{{
+              row.version ? "V" + row.version : ""
+            }}</template>
           </el-table-column>
           <el-table-column
             :label="$t('label.operation')"
@@ -189,55 +167,6 @@
             fixed="right"
           >
             <template v-slot="{ row }">
-              <!-- <el-tooltip
-                class="item"
-                effect="dark"
-                :content="$t('view.edit')"
-                placement="top-start"
-              >
-                <el-button
-                  v-has="'promotion:update'"
-                  type="primary"
-                  size="mini"
-                  icon="el-icon-edit"
-                  circle
-                  @click="showDialog(row.id, false)"
-                >
-                </el-button>
-              </el-tooltip> -->
-
-              <el-tooltip
-                class="item"
-                effect="dark"
-                :content="$t('view.details')"
-                placement="top-start"
-              >
-                <el-button
-                  v-has="'promotion:list'"
-                  type="primary"
-                  size="mini"
-                  icon="el-icon-more"
-                  circle
-                  @click="showDialog(row.id, true)"
-                >
-                </el-button>
-              </el-tooltip>
-              <el-tooltip
-                class="item"
-                effect="dark"
-                :content="$t('view.delete')"
-                placement="top-start"
-              >
-                <el-button
-                  v-has="'promotion:delete'"
-                  type="danger"
-                  circle
-                  size="mini"
-                  icon="el-icon-delete"
-                  @click="handleDelete(row.id)"
-                >
-                </el-button>
-              </el-tooltip>
               <el-tooltip
                 class="item"
                 effect="dark"
@@ -245,31 +174,15 @@
                 placement="top-start"
               >
                 <el-button
-                  v-has="'promotion:status'"
+                  v-has="'priceRule:version'"
                   type="primary"
                   circle
                   size="mini"
-                  icon="el-icon-notebook-1"
+                  icon="el-icon-more"
                   @click="handleLog(row.id)"
                 >
                 </el-button>
               </el-tooltip>
-              <!-- <el-tooltip
-                class="item"
-                effect="dark"
-                :content="$t('title.operationLog')"
-                placement="top-start"
-              >
-                <el-button
-                  v-has="'promotionLog:list'"
-                  type="primary"
-                  circle
-                  size="mini"
-                  icon="el-icon-notebook-1"
-                  @click="handleLog(row.id)"
-                >
-                </el-button>
-              </el-tooltip> -->
             </template>
           </el-table-column>
         </el-table>
@@ -285,8 +198,11 @@
       </el-main>
     </el-container>
 
-    <promotion-form ref="promotionFormRef" @refresh-table="getList" />
-    <promotion-log-list ref="logListRef" @show="id => showDialog(id, true)" />
+    <promotion-form ref="promotionBuyXgetYFormRef" @refresh-table="getList" />
+    <promotion-log-list
+      ref="logListRef"
+      @show="({ id, version }) => showDialog(id, true, version)"
+    />
   </div>
 </template>
 
@@ -295,15 +211,10 @@ import waves from "@/directive/waves"; // 水波纹指令
 import SwPage from "@/views/common/swPage.vue";
 import ElContainer from "element-ui/packages/container/src/main";
 import PromotionForm from "@/views/oms/promotion/amountOffProducts/promotionForm.vue";
-import PromotionLogList from "@/views/oms/promotion/amountOffProducts/promotionLogList.vue";
-import {
-  fetchList,
-  deleteById,
-  storeList,
-  checkPromotion,
-  changeStatus
-} from "@/api/oms/order/promotion";
+import PromotionLogList from "@/views/oms/promotion/multiBuyDiscount/promotionLogList.vue";
+import { fetchList } from "@/api/oms/order/multiBuyDiscount";
 import { getToken } from "@/utils/auth";
+import i18n from "@/lang";
 
 export default {
   inject: ["reload"], //刷新
@@ -313,7 +224,7 @@ export default {
     PromotionForm,
     PromotionLogList
   },
-  name: "multiBuyDiscount",
+  name: "buyXgetYDiscount",
   directives: {
     waves
   },
@@ -327,18 +238,18 @@ export default {
       total: null,
       listLoading: false,
       listQuery: {
-        applicationMethod: null,
-        promotionName: null,
-        minimumPurchaseRequirement: null,
+        discountMethod: null,
+        title: null,
+        requireValue: null,
         page: 1,
-        limit: 10
+        limit: 10,
+        ruleType: 1 //折扣类型 1 产品降价 2 订单降价 3 买X得Y 4免运费 5 多件多扣'
       },
       storeList: []
     };
   },
   created() {
     this.getList();
-    this.getStoreList();
   },
   computed: {
     headers: function() {
@@ -346,13 +257,60 @@ export default {
     }
   },
   methods: {
-    getStoreList() {
-      storeList().then(res => {
-        if (res.code === 200) {
-          this.storeList = res.data;
-        }
-      });
+    // 可叠加类型
+    stackableType(row) {
+      const { combineWithOrder, combineWithProduct, combineWithShipping } = row;
+      let arr = [];
+      if (combineWithOrder) {
+        arr.push(i18n.t("label.combinationList")[1].label);
+      }
+      if (combineWithProduct) {
+        arr.push(i18n.t("label.combinationList")[0].label);
+      }
+      if (combineWithShipping) {
+        arr.push(i18n.t("label.combinationList")[2].label);
+      }
+      return arr.join(",");
+    },
+    // 折扣类型
+    applicationMethod(val) {
+      const data = i18n
+        .t("label.applicationMethodList")
+        .find(item => item.value === val);
+      return val && data ? data.label : "";
+    },
+    // 最低购买条件
+    purchaseRequire(row) {
+      let { purchaseRequire, requireValue } = row;
+      if (purchaseRequire === 2) {
+        return "$ " + requireValue;
+      } else if (purchaseRequire === 3) {
+        return requireValue + " " + i18n.t("label.item");
+      } else {
+        return i18n.t("label.noRequirement");
+      }
+    },
+    // 折扣内容
+    discountVal(row) {
+      let { valueType, numericValue } = row;
+      if (valueType === 1) {
+        return numericValue * 100 + "% off";
+      } else if (valueType === 2) {
+        return numericValue;
+      } else {
+        return i18n.t("label.free");
+      }
+    },
+    // 折扣类型
+    ruleTypeLabel(val) {
+      const obj = i18n.t("label.ruleTypeList").find(item => item.value === val);
+      return val && obj ? obj.label : "";
     },
+    // 状态
+    // statusVal(val) {
+    //   const data = i18n.t("label.statusList").find(item => item.value === val);
+    //   return val && data ? data.label : "";
+    // },
     getList() {
       this.listLoading = true;
       fetchList(this.listQuery)
@@ -375,28 +333,8 @@ export default {
       this.listQuery.page = 1;
       this.getList();
     },
-    handleDelete(id) {
-      this.$confirm("是否删除该记录?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning"
-      }).then(() => {
-        deleteById(id).then(res => {
-          if (res.code === 200) {
-            this.$message({
-              message: "操作成功",
-              type: "success"
-            });
-            this.getList();
-          }
-        });
-      });
-    },
-    showDialog(id, edit) {
-      this.$refs.promotionFormRef.showDialog(id, edit);
-    },
-    handleDetail(id) {
-      console.log(id, "detail");
+    showDialog(id, edit, version) {
+      this.$refs.promotionBuyXgetYFormRef.showDialog(id, edit, version);
     },
     // changePromotionStatus(id, status) {
     //   this.$confirm(status ? "是否确认禁用?" : "是否确认启用?", "提示", {

+ 477 - 255
src/views/oms/promotion/amountOffProducts/promotionForm copy.vue

@@ -1,181 +1,311 @@
 <template>
-  <el-dialog
-    v-loading="pageLoad"
-    element-loading-text="loading..."
-    :title="title"
-    top="0"
-    width="100%"
-    lock-scroll
-    custom-class="promotionform"
-    :close-on-click-modal="false"
-    :visible.sync="promotionFormVisible"
-    @open="handleOpenDialog"
-    @close="resetData"
-  >
-    <div class="dialog-body">
-      <el-form
-        ref="promotionFormRef"
-        :rules="baseRule"
-        :model="promotion"
-        label-width="auto"
-        size="medium"
-      >
-        <!-- 设置活动基本信息 -->
-        <div class="box">
-          <div class="title">
-            <span>{{ $t("label.setBasicEventInformation") }}</span>
-          </div>
-          <div class="info">
-            <!--促销名称-->
-            <el-form-item
-              :label="$t('label.promotionName') + ':'"
-              prop="promotionName"
-              style="width:418px"
-              required
-            >
-              <el-input
-                v-model.trim="promotion.promotionName"
-                :disabled="edit"
-              ></el-input>
-            </el-form-item>
-            <div class="item">
-              <!--促销开始时间-->
+  <div>
+    <el-dialog
+      v-loading="pageLoad"
+      element-loading-text="loading..."
+      :title="title"
+      top="0"
+      width="100%"
+      lock-scroll
+      custom-class="promotionform"
+      :close-on-click-modal="false"
+      :visible.sync="promotionFormVisible"
+      @open="handleOpenDialog"
+      @close="resetData"
+    >
+      <div class="dialog-body">
+        <el-form
+          ref="promotionFormRef"
+          :model="promotion"
+          label-width="210px"
+          size="medium"
+        >
+          <!-- 活动基本信息 -->
+          <div class="box base">
+            <div class="title">
+              <span>{{ $t("label.setBasicEventInformationDetail") }}</span>
+            </div>
+            <div class="info">
+              <!--促销名称-->
               <el-form-item
-                :label="$t('label.promotionStartTime') + ':'"
-                prop="promotionStartTime"
-                required
+                :label="$t('label.promotionName') + ':'"
+                prop="promotionName"
               >
-                <el-date-picker
+                <el-input
+                  v-model.trim="promotion.promotionName"
                   :disabled="edit"
-                  type="datetime"
-                  placeholder="选择日期"
-                  value-format="yyyy-MM-dd HH:mm:ss"
-                  v-model="promotion.promotionStartTime"
-                ></el-date-picker>
+                ></el-input>
               </el-form-item>
+              <div class="item row">
+                <!--促销开始时间-->
+                <el-form-item
+                  :label="$t('label.promotionStartTime') + ':'"
+                  prop="promotionStartTime"
+                >
+                  <el-date-picker
+                    :disabled="edit"
+                    type="datetime"
+                    placeholder="选择日期"
+                    value-format="yyyy-MM-dd HH:mm:ss"
+                    v-model="promotion.promotionStartTime"
+                  ></el-date-picker>
+                </el-form-item>
 
-              <!--促销失效时间-->
+                <!--促销失效时间-->
+                <el-form-item
+                  :label="$t('label.promotionEndTime') + ':'"
+                  prop="promotionEndTime"
+                >
+                  <el-date-picker
+                    :disabled="edit"
+                    type="datetime"
+                    placeholder="选择日期"
+                    value-format="yyyy-MM-dd HH:mm:ss"
+                    v-model="promotion.promotionEndTime"
+                  ></el-date-picker>
+                </el-form-item>
+              </div>
+              <!--应用方式-->
               <el-form-item
-                :label="$t('label.promotionEndTime') + ':'"
-                prop="promotionEndTime"
-                required
+                :label="$t('label.applicationMethod') + ':'"
+                prop="type"
               >
-                <el-date-picker
-                  :disabled="edit"
-                  type="datetime"
-                  placeholder="选择日期"
-                  value-format="yyyy-MM-dd HH:mm:ss"
-                  v-model="promotion.promotionEndTime"
-                ></el-date-picker>
+                <el-radio-group v-model="promotion.type" :disabled="edit">
+                  <div class="item row">
+                    <el-radio label="1">{{ $t("label.discount") }}</el-radio>
+                    <el-input
+                      class="codeinput"
+                      v-model.trim="promotion.promotionName"
+                      :disabled="edit"
+                    />
+                    <el-radio label="2">{{
+                      $t("label.autoDiscount")
+                    }}</el-radio>
+                  </div>
+                </el-radio-group>
               </el-form-item>
             </div>
-            <!--应用方式-->
-            <el-form-item
-              :label="$t('label.applicationMethod') + ':'"
-              prop="mutual"
-              required
-            >
-              <el-radio-group v-model="promotion.mutual" :disabled="edit">
+          </div>
+          <!-- 折扣设置 -->
+          <div class="box discount">
+            <!-- 折扣内容 -->
+            <div class="title">
+              <span>{{ $t("label.discountValue") }}</span>
+            </div>
+            <div class="info">
+              <!--折扣内容 数量&金额-->
+              <el-form-item :label="$t('label.discountValue') + ':'">
                 <div class="item row">
-                  <el-radio :label="true">{{ $t("label.discount") }}</el-radio>
                   <el-input
-                    class="codeinput"
-                    v-model.trim="promotion.promotionName"
+                    class="mininput"
+                    v-model.trim="promotion.minimumMoney"
                     :disabled="edit"
                   />
-                  <el-radio :label="false">{{
-                    $t("label.autoDiscount")
-                  }}</el-radio>
+                  <el-checkbox
+                    v-model="promotion.oncePerOrder"
+                    :disabled="edit"
+                    >{{ $t("label.oncePerOrder") }}</el-checkbox
+                  >
                 </div>
-              </el-radio-group>
-            </el-form-item>
-          </div>
-        </div>
-        <!-- 折扣设置 -->
-        <div class="box">
-          <div class="title">
-            <span>{{ $t("label.discountSetting") }}</span>
-          </div>
-          <div class="info">
-            <div class="item">
-              <!--最低购买要求-->
+                <!-- <div class="item-box">
+                    <span class="label">{{ $t("label.buyType") }}</span>
+                    <el-input
+                      class="mininput"
+                      v-model.trim="promotion.purchaseType"
+                      :disabled="edit"
+                    />
+                  </div> -->
+              </el-form-item>
+              <!--折扣内容 商品-->
+              <el-form-item :label="$t('label.product') + ':'">
+                <div class="item product">
+                  <div class="item-box">
+                    <el-input
+                      class="mininput"
+                      v-model.trim="promotion.productType"
+                      :disabled="edit"
+                    />
+                    <el-input
+                      class="collectioninput"
+                      v-model.trim="promotion.productCollection"
+                      :disabled="edit"
+                    >
+                      <template slot="append"
+                        ><span
+                          @click="
+                            handleProductDialog(promotion.productCollection)
+                          "
+                          >查看商品明细</span
+                        ></template
+                      >
+                    </el-input>
+                    <el-input
+                      class="collectioninput"
+                      v-model.trim="promotion.productCollection"
+                      :disabled="edit"
+                    >
+                      <template slot="append"
+                        ><span
+                          @click="
+                            handleProductDialog(promotion.productCollection)
+                          "
+                          >查看商品明细</span
+                        ></template
+                      >
+                    </el-input>
+                  </div>
+                </div>
+              </el-form-item>
+            </div>
+            <!-- 最低购买要求 -->
+            <div class="title">
+              <span>{{ $t("label.minimumPurchaseRequirement") }}</span>
+            </div>
+            <div class="info info-mini">
               <el-form-item
                 :label="$t('label.minimumPurchaseRequirement') + ':'"
-                prop="mutual"
-                required
+                prop="minimumPurchaseRequirement"
               >
-                <el-radio-group v-model="promotion.mutual" :disabled="edit">
+                <el-radio-group
+                  v-model="promotion.minimumPurchaseRequirement"
+                  :disabled="edit"
+                >
+                  <el-radio label="1">{{
+                    $t("label.minimunPurchaseObj.noMinimun")
+                  }}</el-radio>
+
                   <div class="item row">
-                    <el-radio :label="true">{{
-                      $t("label.discount")
+                    <el-radio label="2">{{
+                      $t("label.minimunPurchaseObj.minimunAmount")
                     }}</el-radio>
                     <el-input
+                      v-show="promotion.minimumPurchaseRequirement === '2'"
                       class="mininput"
-                      v-model.trim="promotion.promotionName"
+                      v-model.trim="promotion.minimumMoney"
                       :disabled="edit"
                     />
-                    <el-radio :label="false">{{
-                      $t("label.autoDiscount")
+                  </div>
+                  <div class="item row">
+                    <el-radio label="3">{{
+                      $t("label.minimunPurchaseObj.minimunQuantity")
                     }}</el-radio>
                     <el-input
+                      v-show="promotion.minimumPurchaseRequirement === '3'"
                       class="mininput"
-                      v-model.trim="promotion.promotionName"
+                      v-model.trim="promotion.minimumMoney"
                       :disabled="edit"
                     />
                   </div>
                 </el-radio-group>
               </el-form-item>
-
-              <!--促销级别-->
-              <el-form-item
-                :label="$t('label.promotionLevel') + ':'"
-                prop="mutual"
-                required
-              >
-                <el-radio-group v-model="promotion.mutual" :disabled="edit">
-                  <el-radio :label="true">{{ $t("label.order") }}</el-radio>
-                  <el-radio :label="false">{{ $t("label.product") }}</el-radio>
-                </el-radio-group>
-              </el-form-item>
             </div>
-            <div class="item">
-              <!--折扣内容-->
+            <!-- 客户获得条件 -->
+            <!-- <div class="title">
+              <span>{{ $t("label.customerGetConditions") }}</span>
+            </div>
+            <div class="info">
+              <el-form-item :label="$t('label.discountValue') + ':'">
+                <div class="item">
+                  <span class="label">{{ $t("label.numberStr") }}</span>
+                  <el-input
+                    class="mininput"
+                    v-model.trim="promotion.minimumMoney"
+                    :disabled="edit"
+                  />
+                </div>
+                <div class="item product">
+                  <div class="item-box">
+                    <span class="label">{{ $t("label.product") }}</span>
+                    <el-input
+                      class="mininput"
+                      v-model.trim="promotion.productType"
+                      :disabled="edit"
+                    />
+                    <el-input
+                      class="productinput"
+                      :placeholder="$t('label.productPlaceholder')"
+                      v-model.trim="productSku"
+                    />
+                    <el-button
+                      @click="handleProductSearch"
+                      v-waves
+                      type="primary"
+                      >{{ $t("view.search") }}
+                    </el-button>
+                    <div class="skucon">
+                      <span
+                        v-for="(item, i) in ProductList"
+                        :class="productKeys.includes(item) ? 'active' : ''"
+                        :key="i"
+                        >{{ item }},</span
+                      >
+                    </div>
+                  </div>
+                </div>
+              </el-form-item>
               <el-form-item
-                :label="$t('label.discountValue') + ':'"
-                prop="mutual"
-                required
+                :label="$t('label.discountPromotion') + ':'"
+                prop="discount"
+                class="discount"
               >
-                <el-radio-group v-model="promotion.mutual" :disabled="edit">
+                <el-radio-group v-model="promotion.discount" :disabled="edit">
                   <div class="item row">
-                    <el-radio :label="true">{{
-                      $t("label.discount")
-                    }}</el-radio>
+                    <el-radio label="1">{{ $t("label.percentage") }}</el-radio>
                     <el-input
+                      v-show="promotion.discount === '1'"
                       class="mininput"
                       v-model.trim="promotion.promotionName"
                       :disabled="edit"
                     />
-                    <el-radio :label="false">{{
-                      $t("label.autoDiscount")
+                  </div>
+                  <div class="item row">
+                    <el-radio label="2">{{
+                      $t("label.discountPerItem")
                     }}</el-radio>
                     <el-input
+                      v-show="promotion.discount === '2'"
                       class="mininput"
                       v-model.trim="promotion.promotionName"
                       :disabled="edit"
                     />
                   </div>
+                  <el-radio label="3">{{ $t("label.free") }}</el-radio>
                 </el-radio-group>
               </el-form-item>
-
-              <!--促销级别-->
-              <el-form-item
-                :label="$t('label.priority') + ':'"
-                prop="mutual"
-                required
-              >
-                <el-radio-group v-model="promotion.mutual" :disabled="edit">
+            </div> -->
+            <!-- 每个订单使用次数 -->
+            <!-- <div class="title">
+              <span>{{ $t("label.numberOfTimesUsedPerOrder") }}</span>
+            </div>
+            <div class="info">
+              <el-form-item>
+                <div class="item row">
+                  <el-checkbox v-model="checked" :disabled="edit">{{
+                    $t("label.maxNumberOfTimesUsedPerOrder")
+                  }}</el-checkbox>
+                  <el-input
+                    class="mininput checkboxinput"
+                    v-model.trim="promotion.number"
+                    :disabled="edit"
+                  />
+                </div>
+              </el-form-item>
+            </div> -->
+          </div>
+          <!-- 客户资格  折扣码才有-->
+          <div class="box" v-if="promotion.type === '1'">
+            <div class="title">
+              <span>{{ $t("label.customerQualification") }}</span>
+            </div>
+            <div class="info">
+              <el-form-item prop="customerQualification" required>
+                <el-radio-group
+                  class="customerqualification"
+                  v-model="promotion.customerQualification"
+                  :disabled="edit"
+                >
                   <el-radio
-                    v-for="(item, i) in $t('label.priorityValue')"
+                    v-for="(item, i) in $t('label.customerQualificationList')"
                     :key="i"
                     :label="item.value"
                     >{{ item.label }}</el-radio
@@ -183,152 +313,169 @@
                 </el-radio-group>
               </el-form-item>
             </div>
-            <!--可叠加类型-->
-            <el-form-item
-              :label="$t('label.stackableTypes') + ':'"
-              prop="stackableType"
-              required
-            >
-              <el-checkbox-group
-                v-model="promotion.stackableType"
-                :disabled="edit"
-              >
-                <el-checkbox
-                  v-for="(item, i) in $t('label.stackableTypesValue')"
-                  :key="i"
-                  :label="item.value"
-                  >{{ item.label }}</el-checkbox
-                >
-              </el-checkbox-group>
-            </el-form-item>
           </div>
-        </div>
-
-        <!-- 设置商品范围 -->
-        <div class="box productbox">
-          <div class="title">
-            <span>{{ $t("label.setProductRange") }}</span>
+          <!-- 最大折扣使用次数  折扣码才有-->
+          <div class="box" v-if="promotion.type === '1'">
+            <div class="title">
+              <span>{{ $t("label.maximumNumberOfDiscounts") }}</span>
+            </div>
+            <div class="info">
+              <!-- 指定商品标签 -->
+              <el-form-item>
+                <div class="item row">
+                  <el-checkbox v-model="checked" :disabled="edit">{{
+                    $t("label.limitDiscountCount")
+                  }}</el-checkbox>
+                  <el-input
+                    class="mininput checkboxinput"
+                    v-model.trim="promotion.number"
+                    :disabled="edit"
+                  />
+                </div>
+                <div class="item row">
+                  <el-checkbox v-model="checked" :disabled="edit">{{
+                    $t("label.customerCount")
+                  }}</el-checkbox>
+                </div>
+              </el-form-item>
+            </div>
           </div>
-          <div class="info">
-            <!-- 指定商品标签 -->
-            <el-form-item
-              :label="$t('label.product') + ':'"
-              prop="participateType"
-              required
-            >
-              <el-select
-                multiple
-                v-model="promotion.participateType"
-                @change="handleChangeParticipateType"
-                :disabled="edit"
-              >
-                <el-option
-                  :key="index"
-                  v-for="(item, index) in $t('label.participateTypeArr')"
-                  :label="item.label"
-                  :value="item.value"
-                />
-              </el-select>
-            </el-form-item>
-            <el-form-item
-              :label="$t('label.specifyProductTag') + ':'"
-              prop="mutual"
-            >
-              <el-input
-                class="mininput"
-                v-model.trim="promotion.promotionName"
-                :disabled="edit"
-              />
-              <div class="skucon">
-                121J0B04B,124C2B014,132J0B06V,121J0B04B,124C2B014,132J0B06V,,121J0B04B,124C2B014,132J0B06V,121J0B04B,124C2B014,132J0B06V,121J0B04B,124C2B014,132J0B06V,121J0B04B,124C2B014,132J0B06V,
-                121J0B04B,124C2B014,132J0B06V,121J0B04B,124C2B014,132J0B06V,,121J0B04B,124C2B014,132J0B06V,121J0B04B,124C2B014,132J0B06V,121J0B04B,124C2B014,132J0B06V,124C2B014,132J0B06V,121J0B04B,124C2B
-              </div>
-            </el-form-item>
+          <!-- 组合 自动折扣才有 -->
+          <div class="box" v-if="promotion.type === '2'">
+            <div class="title">
+              <span>{{ $t("label.combination") }}</span>
+            </div>
+            <div class="info">
+              <!-- 指定商品标签 -->
+              <el-form-item :label="$t('label.combinationLable') + ':'">
+                <el-checkbox-group v-model="promotion.combination">
+                  <el-checkbox
+                    v-for="(item, i) in $t('label.combinationList')"
+                    :key="i"
+                    :label="item.value"
+                    :disabled="edit"
+                    >{{ item.label }}
+                  </el-checkbox>
+                </el-checkbox-group>
+              </el-form-item>
+            </div>
           </div>
-        </div>
-      </el-form>
-    </div>
+        </el-form>
+      </div>
 
-    <template slot="footer">
-      <el-button
-        @click="
-          resetData();
-          promotionFormVisible = false;
-        "
-        >{{ $t("view.cancel") }}
-      </el-button>
-      <!-- 未审核时/审核驳回 状态可进行提交 -->
-      <el-button
-        type="primary"
-        @click="handleSaveOrUpdate"
-        v-if="promotion.promotionStatus !== 1"
-        :disabled="edit"
-        >{{ $t("view.confirm") }}
-      </el-button>
-    </template>
-  </el-dialog>
+      <template slot="footer">
+        <el-button
+          @click="
+            resetData();
+            promotionFormVisible = false;
+          "
+          >{{ $t("view.cancel") }}
+        </el-button>
+        <!-- 未审核时/审核驳回 状态可进行提交 -->
+        <el-button type="primary" @click="handleSaveOrUpdate" :disabled="edit"
+          >{{ $t("view.confirm") }}
+        </el-button>
+      </template>
+    </el-dialog>
+    <product-collection ref="productCollectionRef" />
+  </div>
 </template>
-
 <script>
 import waves from "@/directive/waves"; // 水波纹指令
 import { getById, save, storeList, update } from "@/api/oms/order/promotion";
+import { fetchDetailByIdAndVersion } from "@/api/oms/order/multiBuyDiscount";
 import i18n from "@/lang";
-import promotion from "@/views/oms/promotion/multiBuyDiscount/index.vue";
+import productCollection from "@/views/oms/promotion/buyXGetYDiscount/components/productCollectionDetail";
 
 export default {
   inject: ["reload"],
   directives: {
     waves
   },
-  components: {},
-  computed: {},
   name: "multiBuyDiscountForm",
-  filters: {},
+  components: {
+    productCollection
+  },
+  computed: {
+    discountContentValue() {
+      return this.promotion.minimum === "2"
+        ? i18n.t("label.money")
+        : i18n.t("label.numberStr");
+    },
+    checked() {
+      return !!this.promotion.number;
+    }
+  },
   data() {
     return {
       promotionFormVisible: false,
       title: "",
+      productSku: "",
+      productKeys: [],
+      ProductList: [
+        "121J0B04B",
+        "124C2B014",
+        "132J0B06V",
+        "121J0B04B",
+        "124C2B014",
+        "132J0B06V",
+        "121J0B04B",
+        "124C2B014",
+        "132J0B06V",
+        "121J0B04B",
+        "124C2B014",
+        "132J0B06V",
+        "121J0B04B",
+        "124C2B014",
+        "132J0B06V",
+        "121J0B04B",
+        "124C2B014",
+        "132J0B06V",
+        "121J0B04B",
+        "124C2B014",
+        "132J0B06V",
+        "121J0B04B",
+        "124C2B014",
+        "132J0B06V",
+        "121J0B04B",
+        "124C2B014",
+        "132J0B06V",
+        "121J0B04B",
+        "124C2B014",
+        "132J0B06V",
+        "121J0B04B",
+        "124C2B014",
+        "132J0B06V",
+        "124C2B014",
+        "132J0B06V",
+        "121J0B04B",
+        "124C2B"
+      ],
       promotion: {
         // 配置基本信息
         id: "",
         promotionName: "",
-        stackableType: [],
-        promotionInfo: "",
-        promotionStore: "",
         promotionStartTime: "",
         promotionEndTime: "",
+        type: 1,
         promotionStatus: "",
-        rejectCause: "",
-        participateNum: 1,
-        mutual: "",
-        isSuperposition: "",
-        participateWeight: 0,
+        priority: "",
         participateType: "",
         conditionType: "",
-        conditionValue: "",
-        goodsRelation: "",
-        goodsScope: "",
-        giftRelation: ""
+        stackableType: [],
+        minimum: "1",
+        discountValue: "1",
+        purchaseType: "",
+        productType: "",
+        discount: "",
+        number: 1,
+        combination: [],
+        minimumPurchaseRequirement: "1",
+        oncePerOrder: 1
       },
       edit: true,
       storeList: [],
       noDataText: "加载中",
-      baseRule: {
-        // 促销配置
-        promotionName: [
-          {
-            required: true,
-            message: "请输入促销名称",
-            trigger: ["change", "blur"]
-          },
-          {
-            min: 2,
-            max: 50,
-            message: "长度在 2 到 50 个字符",
-            trigger: ["change", "blur"]
-          }
-        ]
-      },
       pageLoad: false,
       conditionTypeArr: i18n.t("label.conditionTypeArr").map(item => {
         return {
@@ -338,7 +485,6 @@ export default {
       })
     };
   },
-  mounted() {},
   methods: {
     getStoreList() {
       storeList().then(res => {
@@ -354,31 +500,35 @@ export default {
         // 修改配置
         this.promotion.id = id;
         await this.getPromotionInfo();
+        this.title = this.edit
+          ? i18n.t("label.mutiPromotionDetailTitle")
+          : i18n.t("label.mutiPromotionUpdateTitle");
+      } else {
+        this.title = i18n.t("label.mutiPromotionCreateTitle");
       }
-      this.title = id
-        ? i18n.t("title.updateTitle")
-        : i18n.t("title.createTitle");
       this.promotionFormVisible = true;
     },
+    // 款号搜索
+    handleProductSearch() {
+      this.productKeys = this.productSku.split(",");
+    },
+    handleProductDialog(id) {
+      this.$refs.productCollectionRef.showDialog(id);
+    },
     resetData() {
       this.promotion = {
         id: "",
         promotionName: "",
-        promotionInfo: "",
         promotionStartTime: "",
         promotionEndTime: "",
+        type: 1,
         promotionStatus: "",
         rejectCause: "",
-        participateNum: "",
-        mutual: "",
-        participateWeight: "",
+        priority: "",
         participateType: "",
         conditionType: "",
-        conditionValue: "",
-        goodsRelation: "",
-        goodsScope: "",
-        giftRelation: "",
-        stackableType: []
+        stackableType: [],
+        minimum: "1"
       };
     },
     handleOpenDialog() {
@@ -466,6 +616,7 @@ export default {
   }
   .el-form-item__label {
     font-weight: 400;
+    font-size: 12px;
   }
   .el-dialog__body {
     padding: 30px 10px 30px 34px;
@@ -478,6 +629,9 @@ export default {
       font-weight: bold;
     }
   }
+  .el-input {
+    width: 220px !important;
+  }
 }
 </style>
 <style scoped rel="stylesheet/scss" lang="scss">
@@ -488,6 +642,16 @@ export default {
     border-bottom: 1px solid #d8d8d8;
     padding-bottom: 20px;
     margin-bottom: 42px;
+    &.base {
+      .info {
+        width: 25%;
+      }
+    }
+    &.discount {
+      .info {
+        margin-bottom: 60px;
+      }
+    }
     .title {
       color: #606266;
       font-size: 16px;
@@ -521,15 +685,24 @@ export default {
     overflow-y: auto;
     border-radius: 3px 3px 3px 3px;
     border: 1px solid #dcdfe6;
+    background: #f5f7fa;
     margin-top: 12px;
     padding: 10px;
     font-size: 12px;
     line-height: 16px;
+    .active {
+      color: #fd5959;
+    }
   }
   .productbox {
     border-bottom: none;
   }
   .info {
+    &.info-mini {
+      .item {
+        margin-top: 20px;
+      }
+    }
     .item {
       display: flex;
       flex-direction: row;
@@ -546,9 +719,58 @@ export default {
       }
       .mininput {
         margin-right: 30px;
-        .el-input__inner {
-          width: 142px;
+        width: 142px !important;
+      }
+      .checkboxinput {
+        margin-left: 20px;
+      }
+      .productinput {
+        width: 340px !important;
+      }
+      .label {
+        margin-right: 12px;
+      }
+      &.product {
+        .mininput {
+          margin-right: 20px;
+        }
+        .row {
+          flex-wrap: wrap !important;
         }
+        .mininput,
+        .value {
+          margin-bottom: 10px;
+        }
+        .collectioninput {
+          margin-right: 20px;
+          /deep/.el-input-group__append {
+            color: #ae8877;
+            border-left: none;
+            font-size: 12px;
+            padding: 0px 5px;
+            background: #f5f7fa;
+            span {
+              cursor: pointer;
+            }
+          }
+          /deep/.el-input__inner {
+            border-right: none;
+          }
+        }
+      }
+    }
+    .discount {
+      .item {
+        margin-bottom: 20px;
+        /deep/.el-radio {
+          min-width: 135px;
+        }
+      }
+    }
+    .customerqualification {
+      .el-radio {
+        display: block;
+        margin-bottom: 30px;
       }
     }
   }

+ 328 - 284
src/views/oms/promotion/amountOffProducts/promotionForm.vue

@@ -1,7 +1,6 @@
 <template>
-  <div>
+  <div v-loading="pageLoad">
     <el-dialog
-      v-loading="pageLoad"
       element-loading-text="loading..."
       :title="title"
       top="0"
@@ -13,9 +12,9 @@
       @open="handleOpenDialog"
       @close="resetData"
     >
-      <div class="dialog-body">
+      <div class="dialog-body" v-loading="pageLoad">
         <el-form
-          ref="promotionFormRef"
+          ref="promotionBuyXgetYDertailFormRef"
           :model="promotion"
           label-width="210px"
           size="medium"
@@ -32,7 +31,7 @@
                 prop="promotionName"
               >
                 <el-input
-                  v-model.trim="promotion.promotionName"
+                  v-model.trim="promotion.title"
                   :disabled="edit"
                 ></el-input>
               </el-form-item>
@@ -40,45 +39,49 @@
                 <!--促销开始时间-->
                 <el-form-item
                   :label="$t('label.promotionStartTime') + ':'"
-                  prop="promotionStartTime"
+                  prop="startTime"
                 >
                   <el-date-picker
                     :disabled="edit"
                     type="datetime"
                     placeholder="选择日期"
                     value-format="yyyy-MM-dd HH:mm:ss"
-                    v-model="promotion.promotionStartTime"
+                    v-model="promotion.startTime"
                   ></el-date-picker>
                 </el-form-item>
 
                 <!--促销失效时间-->
                 <el-form-item
                   :label="$t('label.promotionEndTime') + ':'"
-                  prop="promotionEndTime"
+                  prop="endTime"
                 >
                   <el-date-picker
                     :disabled="edit"
                     type="datetime"
                     placeholder="选择日期"
                     value-format="yyyy-MM-dd HH:mm:ss"
-                    v-model="promotion.promotionEndTime"
+                    v-model="promotion.endTime"
                   ></el-date-picker>
                 </el-form-item>
               </div>
               <!--应用方式-->
               <el-form-item
                 :label="$t('label.applicationMethod') + ':'"
-                prop="type"
+                prop="discountMethod"
               >
-                <el-radio-group v-model="promotion.type" :disabled="edit">
+                <el-radio-group
+                  v-model="promotion.discountMethod"
+                  :disabled="edit"
+                >
                   <div class="item row">
-                    <el-radio label="1">{{ $t("label.discount") }}</el-radio>
+                    <el-radio :label="1">{{ $t("label.discount") }}</el-radio>
                     <el-input
+                      v-show="promotion.discountMethod === 1"
                       class="codeinput"
-                      v-model.trim="promotion.promotionName"
+                      v-model.trim="promotion.discountCode"
                       :disabled="edit"
                     />
-                    <el-radio label="2">{{
+                    <el-radio :label="2">{{
                       $t("label.autoDiscount")
                     }}</el-radio>
                   </div>
@@ -88,128 +91,87 @@
           </div>
           <!-- 折扣设置 -->
           <div class="box discount">
-            <!-- 折扣内容 -->
+            <!-- 客户购买条件 -->
             <div class="title">
-              <span>{{ $t("label.discountValue") }}</span>
+              <span>{{ $t("label.customerPurchaseConditions") }}</span>
             </div>
             <div class="info">
+              <!--最低购买要求-->
+              <el-form-item
+                :label="$t('label.minimumPurchaseRequirement') + ':'"
+                prop="minimum"
+              >
+                <el-radio-group
+                  v-model="promotion.purchaseRequire"
+                  :disabled="edit"
+                >
+                  <div class="item row">
+                    <el-radio :label="3">{{ $t("label.numberStr") }}</el-radio>
+                    <el-radio :label="2">{{ $t("label.money") }}</el-radio>
+                    <el-radio :label="1">{{ $t("label.free") }}</el-radio>
+                  </div>
+                </el-radio-group>
+              </el-form-item>
               <!--折扣内容 数量&金额-->
               <el-form-item :label="$t('label.discountValue') + ':'">
-                <div class="item row">
-                  <el-input
-                    class="mininput"
-                    v-model.trim="promotion.minimumMoney"
-                    :disabled="edit"
-                  />
-                  <el-checkbox
-                    v-model="promotion.oncePerOrder"
-                    :disabled="edit"
-                    >{{ $t("label.oncePerOrder") }}</el-checkbox
-                  >
-                </div>
-                <!-- <div class="item-box">
-                    <span class="label">{{ $t("label.buyType") }}</span>
+                <div class="item">
+                  <!--最低要求 免费 不展示 -->
+                  <div class="item-box" v-if="promotion.purchaseRequire !== 1">
+                    <span class="label">{{ discountContentValue }}</span>
                     <el-input
                       class="mininput"
-                      v-model.trim="promotion.purchaseType"
+                      v-model.trim="promotion.requireValue"
                       :disabled="edit"
                     />
-                  </div> -->
-              </el-form-item>
-              <!--折扣内容 商品-->
-              <el-form-item :label="$t('label.product') + ':'">
-                <div class="item product">
+                  </div>
                   <div class="item-box">
+                    <span class="label">{{ $t("label.buyType") }}</span>
                     <el-input
                       class="mininput"
-                      v-model.trim="promotion.productType"
+                      v-model.trim="promotion.purchaseType"
                       :disabled="edit"
                     />
-                    <el-input
-                      class="collectioninput"
-                      v-model.trim="promotion.productCollection"
-                      :disabled="edit"
-                    >
-                      <template slot="append"
-                        ><span
-                          @click="
-                            handleProductDialog(promotion.productCollection)
-                          "
-                          >查看商品明细</span
-                        ></template
-                      >
-                    </el-input>
-                    <el-input
-                      class="collectioninput"
-                      v-model.trim="promotion.productCollection"
-                      :disabled="edit"
-                    >
-                      <template slot="append"
-                        ><span
-                          @click="
-                            handleProductDialog(promotion.productCollection)
-                          "
-                          >查看商品明细</span
-                        ></template
-                      >
-                    </el-input>
                   </div>
                 </div>
-              </el-form-item>
-            </div>
-            <!-- 最低购买要求 -->
-            <div class="title">
-              <span>{{ $t("label.minimumPurchaseRequirement") }}</span>
-            </div>
-            <div class="info info-mini">
-              <el-form-item
-                :label="$t('label.minimumPurchaseRequirement') + ':'"
-                prop="minimumPurchaseRequirement"
-              >
-                <el-radio-group
-                  v-model="promotion.minimumPurchaseRequirement"
-                  :disabled="edit"
-                >
-                  <el-radio label="1">{{
-                    $t("label.minimunPurchaseObj.noMinimun")
-                  }}</el-radio>
-
-                  <div class="item row">
-                    <el-radio label="2">{{
-                      $t("label.minimunPurchaseObj.minimunAmount")
-                    }}</el-radio>
-                    <el-input
-                      v-show="promotion.minimumPurchaseRequirement === '2'"
-                      class="mininput"
-                      v-model.trim="promotion.minimumMoney"
-                      :disabled="edit"
-                    />
-                  </div>
+                <div class="item product">
                   <div class="item row">
-                    <el-radio label="3">{{
-                      $t("label.minimunPurchaseObj.minimunQuantity")
-                    }}</el-radio>
+                    <span class="label">{{ $t("label.product") }}</span>
                     <el-input
-                      v-show="promotion.minimumPurchaseRequirement === '3'"
                       class="mininput"
-                      v-model.trim="promotion.minimumMoney"
+                      v-model.trim="promotion.productBuyType"
                       :disabled="edit"
                     />
+                    <div class="value" v-for="(data, j) in tagLists" :key="j">
+                      <p>{{ tagValue(data) }}</p>
+                      <a
+                        href="javascript:void();"
+                        @click="handleProductDialog(data)"
+                        >{{ $t("label.viewProductDetaiL") }}</a
+                      >
+                    </div>
                   </div>
-                </el-radio-group>
+                </div>
+              </el-form-item>
+              <el-form-item :label="$t('label.oncePerOrder') + ':'">
+                <el-checkbox
+                  v-model="promotion.oncePerOrder"
+                  :disabled="edit"
+                  >{{ $t("label.oncePerOrderDesc") }}</el-checkbox
+                >
               </el-form-item>
             </div>
             <!-- 客户获得条件 -->
-            <!-- <div class="title">
+            <div class="title">
               <span>{{ $t("label.customerGetConditions") }}</span>
             </div>
             <div class="info">
-              <el-form-item :label="$t('label.discountValue') + ':'">
+              <!--折扣内容 数量&金额-->
+              <!-- <el-form-item :label="$t('label.discountValue') + ':'">
                 <div class="item">
                   <span class="label">{{ $t("label.numberStr") }}</span>
                   <el-input
                     class="mininput"
-                    v-model.trim="promotion.minimumMoney"
+                    v-model.trim="promotion.requireValue"
                     :disabled="edit"
                   />
                 </div>
@@ -234,7 +196,7 @@
                     </el-button>
                     <div class="skucon">
                       <span
-                        v-for="(item, i) in ProductList"
+                        v-for="(item, i) in getTagList"
                         :class="productKeys.includes(item) ? 'active' : ''"
                         :key="i"
                         >{{ item }},</span
@@ -242,111 +204,141 @@
                     </div>
                   </div>
                 </div>
-              </el-form-item>
+              </el-form-item> -->
+              <!--折扣额-->
               <el-form-item
                 :label="$t('label.discountPromotion') + ':'"
                 prop="discount"
                 class="discount"
               >
-                <el-radio-group v-model="promotion.discount" :disabled="edit">
+                <el-radio-group v-model="promotion.valueType" :disabled="edit">
                   <div class="item row">
-                    <el-radio label="1">{{ $t("label.percentage") }}</el-radio>
+                    <el-radio :label="1">{{ $t("label.percentage") }}</el-radio>
                     <el-input
-                      v-show="promotion.discount === '1'"
+                      v-if="promotion.valueType === 1"
                       class="mininput"
-                      v-model.trim="promotion.promotionName"
+                      v-model.trim="promotion.discountNumber"
                       :disabled="edit"
                     />
                   </div>
                   <div class="item row">
-                    <el-radio label="2">{{
+                    <el-radio :label="2">{{
                       $t("label.discountPerItem")
                     }}</el-radio>
                     <el-input
-                      v-show="promotion.discount === '2'"
+                      v-if="promotion.valueType === 2"
                       class="mininput"
-                      v-model.trim="promotion.promotionName"
+                      v-model.trim="promotion.numericValue"
                       :disabled="edit"
                     />
                   </div>
-                  <el-radio label="3">{{ $t("label.free") }}</el-radio>
+                  <el-radio :label="3">{{ $t("label.free") }}</el-radio>
                 </el-radio-group>
               </el-form-item>
-            </div> -->
-            <!-- 每个订单使用次数 -->
-            <!-- <div class="title">
+            </div>
+            <!-- 每个订单使用次数 自动折扣才有-->
+            <div class="title" v-if="promotion.discountMethod === 2">
               <span>{{ $t("label.numberOfTimesUsedPerOrder") }}</span>
             </div>
             <div class="info">
               <el-form-item>
                 <div class="item row">
-                  <el-checkbox v-model="checked" :disabled="edit">{{
+                  <el-checkbox v-model="usageLimitchecked" :disabled="edit">{{
                     $t("label.maxNumberOfTimesUsedPerOrder")
                   }}</el-checkbox>
                   <el-input
                     class="mininput checkboxinput"
-                    v-model.trim="promotion.number"
+                    v-model.trim="promotion.customerGetOrderUsageLimit"
                     :disabled="edit"
                   />
                 </div>
               </el-form-item>
-            </div> -->
+            </div>
           </div>
           <!-- 客户资格  折扣码才有-->
-          <div class="box" v-if="promotion.type === '1'">
+          <div class="box" v-if="promotion.discountMethod === 1">
             <div class="title">
               <span>{{ $t("label.customerQualification") }}</span>
             </div>
-            <div class="info">
+            <div class="info customerQualification">
               <el-form-item prop="customerQualification" required>
                 <el-radio-group
                   class="customerqualification"
-                  v-model="promotion.customerQualification"
+                  v-model="promotion.targetCustomerType"
                   :disabled="edit"
                 >
-                  <el-radio
+                  <el-radio :label="1">{{
+                    $t("label.customerQualificationList")[0].label
+                  }}</el-radio>
+                  <div class="item row">
+                    <el-radio :label="2">{{
+                      $t("label.customerQualificationList")[1].label
+                    }}</el-radio>
+                    <el-input
+                      v-if="promotion.targetCustomerType === 2"
+                      class="mininput"
+                      v-model.trim="promotion.targetCustomer"
+                      :disabled="edit"
+                    />
+                  </div>
+                  <div class="item row">
+                    <el-radio :label="3">{{
+                      $t("label.customerQualificationList")[2].label
+                    }}</el-radio>
+                    <el-input
+                      v-if="promotion.targetCustomerType === 3"
+                      class="mininput"
+                      v-model.trim="promotion.targetCustomer"
+                      :disabled="edit"
+                    />
+                  </div>
+                  <!-- <el-radio
                     v-for="(item, i) in $t('label.customerQualificationList')"
                     :key="i"
                     :label="item.value"
                     >{{ item.label }}</el-radio
-                  >
+                  > -->
                 </el-radio-group>
               </el-form-item>
             </div>
           </div>
           <!-- 最大折扣使用次数  折扣码才有-->
-          <div class="box" v-if="promotion.type === '1'">
+          <div class="box" v-if="promotion.discountMethod === 1">
             <div class="title">
               <span>{{ $t("label.maximumNumberOfDiscounts") }}</span>
             </div>
             <div class="info">
-              <!-- 指定商品标签 -->
               <el-form-item>
+                <!-- <el-checkbox-group v-model="promotion.startTime"> -->
                 <div class="item row">
-                  <el-checkbox v-model="checked" :disabled="edit">{{
-                    $t("label.limitDiscountCount")
-                  }}</el-checkbox>
+                  <el-checkbox
+                    :checked="codeUsageLimitchecked"
+                    :disabled="edit"
+                    >{{ $t("label.limitDiscountCount") }}</el-checkbox
+                  >
                   <el-input
                     class="mininput checkboxinput"
-                    v-model.trim="promotion.number"
+                    v-model.trim="promotion.codeUsageLimit"
                     :disabled="edit"
                   />
                 </div>
                 <div class="item row">
-                  <el-checkbox v-model="checked" :disabled="edit">{{
-                    $t("label.customerCount")
-                  }}</el-checkbox>
+                  <el-checkbox
+                    :checked="promotion.codeCustomerUsageType === 1"
+                    :disabled="edit"
+                    >{{ $t("label.customerCount") }}</el-checkbox
+                  >
                 </div>
+                <!-- </el-checkbox-group> -->
               </el-form-item>
             </div>
           </div>
           <!-- 组合 自动折扣才有 -->
-          <div class="box" v-if="promotion.type === '2'">
+          <div class="box" v-if="promotion.discountMethod === 2">
             <div class="title">
               <span>{{ $t("label.combination") }}</span>
             </div>
             <div class="info">
-              <!-- 指定商品标签 -->
               <el-form-item :label="$t('label.combinationLable') + ':'">
                 <el-checkbox-group v-model="promotion.combination">
                   <el-checkbox
@@ -372,9 +364,9 @@
           >{{ $t("view.cancel") }}
         </el-button>
         <!-- 未审核时/审核驳回 状态可进行提交 -->
-        <el-button type="primary" @click="handleSaveOrUpdate" :disabled="edit"
+        <!-- <el-button type="primary" @click="handleSaveOrUpdate" :disabled="edit"
           >{{ $t("view.confirm") }}
-        </el-button>
+        </el-button> -->
       </template>
     </el-dialog>
     <product-collection ref="productCollectionRef" />
@@ -382,8 +374,9 @@
 </template>
 <script>
 import waves from "@/directive/waves"; // 水波纹指令
-import { getById, save, storeList, update } from "@/api/oms/order/promotion";
+import { fetchDetailByIdAndVersion } from "@/api/oms/order/multiBuyDiscount";
 import i18n from "@/lang";
+import { isEmpty } from "@/utils/toolUtil";
 import productCollection from "@/views/oms/promotion/buyXGetYDiscount/components/productCollectionDetail";
 
 export default {
@@ -391,18 +384,15 @@ export default {
   directives: {
     waves
   },
-  name: "multiBuyDiscountForm",
+  name: "buyXgetYbuyDiscountForm",
   components: {
     productCollection
   },
   computed: {
     discountContentValue() {
-      return this.promotion.minimum === "2"
+      return this.promotion.purchaseRequire === 2
         ? i18n.t("label.money")
         : i18n.t("label.numberStr");
-    },
-    checked() {
-      return !!this.promotion.number;
     }
   },
   data() {
@@ -411,93 +401,47 @@ export default {
       title: "",
       productSku: "",
       productKeys: [],
-      ProductList: [
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B"
-      ],
+      usageLimitchecked: false,
+      codeUsageLimitchecked: false,
+      tagLists: [],
+      getTagList: [],
       promotion: {
         // 配置基本信息
         id: "",
-        promotionName: "",
-        promotionStartTime: "",
-        promotionEndTime: "",
-        type: 1,
-        promotionStatus: "",
-        priority: "",
-        participateType: "",
-        conditionType: "",
-        stackableType: [],
-        minimum: "1",
-        discountValue: "1",
+        title: "",
+        startTime: "",
+        endTime: "",
+        discountMethod: null,
+        discountNumber: null,
+        purchaseRequire: null,
         purchaseType: "",
         productType: "",
+        productBuyType: "",
         discount: "",
-        number: 1,
-        combination: [],
-        minimumPurchaseRequirement: "1",
-        oncePerOrder: 1
+        combination: []
       },
       edit: true,
-      storeList: [],
       noDataText: "加载中",
       pageLoad: false,
-      conditionTypeArr: i18n.t("label.conditionTypeArr").map(item => {
-        return {
-          ...item,
-          disabled: false
-        };
-      })
+      isEmpty
     };
   },
   methods: {
-    getStoreList() {
-      storeList().then(res => {
-        if (res.code === 200) {
-          this.storeList = res.data;
-        }
-      });
+    tagValue(data) {
+      return (
+        data.title +
+        i18n.t("label.productCollection") +
+        i18n.t("label.all") +
+        data.spus.length +
+        i18n.t("label.itemProduct")
+      );
     },
-    async showDialog(id, edit) {
-      this.edit = !edit;
-      await this.getStoreList();
+    async showDialog(id, edit, version) {
+      this.edit = edit;
       if (id) {
         // 修改配置
         this.promotion.id = id;
+        this.promotion.version = version;
         await this.getPromotionInfo();
         this.title = this.edit
           ? i18n.t("label.mutiPromotionDetailTitle")
@@ -505,94 +449,156 @@ export default {
       } else {
         this.title = i18n.t("label.mutiPromotionCreateTitle");
       }
+      let str = this.promotion.id ? "Detail" : "";
+      this.discountSettingTitle = i18n.t("label.discountSetting" + str);
+      this.productRangeTitle = i18n.t("label.setProductRange" + str);
       this.promotionFormVisible = true;
     },
     // 款号搜索
     handleProductSearch() {
       this.productKeys = this.productSku.split(",");
     },
-    handleProductDialog(id) {
-      this.$refs.productCollectionRef.showDialog(id);
+    handleProductDialog(data) {
+      this.$refs.productCollectionRef.showDialog(data);
     },
     resetData() {
       this.promotion = {
         id: "",
-        promotionName: "",
-        promotionStartTime: "",
-        promotionEndTime: "",
-        type: 1,
-        promotionStatus: "",
-        rejectCause: "",
-        priority: "",
-        participateType: "",
-        conditionType: "",
-        stackableType: [],
-        minimum: "1"
+        title: "",
+        startTime: "",
+        endTime: "",
+        discountMethod: null,
+        discountNumber: null,
+        purchaseRequire: null,
+        purchaseType: "",
+        productType: "",
+        productBuyType: "",
+        discount: "",
+        combination: []
       };
     },
     handleOpenDialog() {
       this.resetData();
-      if (this.$refs.promotionFormRef) {
-        this.$refs.promotionFormRef.clearValidate();
+      if (this.$refs.promotionBuyXgetYDertailFormRef) {
+        this.$refs.promotionBuyXgetYDertailFormRef.clearValidate();
       }
     },
     getPromotionInfo() {
       this.pageLoad = true;
-      getById(this.promotion.id).then(res => {
-        // 促销配置信息
-        this.promotion = res.data;
-        this.pageLoad = false;
-      });
-    },
-    handleSaveOrUpdate() {
-      //创建商品
-      this.$refs["promotionFormRef"].validate(valid => {
-        //通用属性验证成功
-        if (valid) {
-          // 如果需要在促销类型买就送的情况下将条件类型和条件值改为 "0" 则可在此修改 暂时默认为空字符
-          const data = {
-            ...this.promotion
-          };
-          if (!data.id) {
-            save(data).then(res => {
-              if (res.code === 200) {
-                this.$message({
-                  message: "操作成功",
-                  type: "success"
-                });
-                this.$emit("refresh-table");
-                this.promotionFormVisible = false;
+      let { id, version } = this.promotion;
+      fetchDetailByIdAndVersion({ id, version })
+        .then(res => {
+          // 促销配置信息
+          const { priceRule, productTags, giveProductCollects } = res.data;
+          this.promotion = { ...priceRule, productTags };
+          if (priceRule.valueType === 1) {
+            let number = priceRule.numericValue * 100;
+            // this.promotion.discountNumber = number;
+            this.$set(this.promotion, "discountNumber", number);
+          }
+          if (priceRule.purchaseRequire === 3) {
+            // this.promotion.quantity = priceRule.requireValue;
+            this.$set(this.promotion, "quantity", priceRule.requireValue);
+          } else if (priceRule.purchaseRequire === 2) {
+            // this.promotion.miniAmount = priceRule.requireValue;
+            this.$set(this.promotion, "miniAmount", priceRule.requireValue);
+          }
+          // 购买类型
+          const targetType = i18n
+            .t("label.promotionBuyTyper")
+            .find(item => item.value === priceRule.targetType);
+          if (targetType && targetType.label) {
+            this.$set(this.promotion, "purchaseType", targetType.label);
+          }
+          // 顾客购买商品类型
+          const productBuyType = i18n
+            .t("label.promotionCustomerGetType")
+            .find(item => item.value === priceRule.targetSelectionType);
+          if (productBuyType && productBuyType.label) {
+            this.$set(this.promotion, "productBuyType", productBuyType.label);
+          }
+          // 顾客得到商品类型
+          const productType = i18n
+            .t("label.promotionCustomerGetType")
+            .find(item => item.value === priceRule.customerGetType);
+          if (productType && productType.label) {
+            this.$set(this.promotion, "productType", productType.label);
+          }
+          // 组合
+          const {
+            combineWithOrder,
+            combineWithProduct,
+            combineWithShipping,
+            targetShopifyProductSpu,
+            targetShopifySku,
+            targetSelectionType,
+            customerGetType,
+            getTargetShopifyProductSpu,
+            getTargetShopifySku,
+            customerGetOrderUsageLimit,
+            codeUsageLimit
+          } = priceRule;
+          let combinationArr = [];
+          if (combineWithOrder) {
+            combinationArr.push(i18n.t("label.combinationList")[1].value);
+          }
+          if (combineWithProduct) {
+            combinationArr.push(i18n.t("label.combinationList")[0].value);
+          }
+          if (combineWithShipping) {
+            combinationArr.push(i18n.t("label.combinationList")[2].value);
+          }
+          this.usageLimitchecked = !!customerGetOrderUsageLimit;
+          this.codeUsageLimitchecked = !!codeUsageLimit;
+          this.$set(this.promotion, "combination", combinationArr);
+          // 折扣适用  1特定系列  其他2,3 特定商品
+          let tagLists = [];
+          if (targetSelectionType === 1) {
+            tagLists = productTags.map(item => {
+              let data = [];
+              if (item.spu) {
+                data = item.spu.split(",");
               }
+              item.spus = data;
+              return item;
             });
           } else {
-            update(data).then(res => {
-              if (res.code === 200) {
-                this.$message({
-                  message: "操作成功",
-                  type: "success"
-                });
-                this.$emit("refresh-table");
-                this.promotionFormVisible = false;
+            // 特地商品
+            if (targetShopifySku) {
+              const spusSKU = targetShopifySku.split(",");
+              tagLists.push({ title: "", spus: spusSKU });
+            }
+            if (targetShopifyProductSpu) {
+              const spusId = targetShopifyProductSpu.split(",");
+              tagLists.push({ title: "", spus: spusId });
+            }
+          }
+          this.tagLists = tagLists;
+          // 折扣得到条件   1 特定系列  2 特定商品
+          let getTagList = [];
+          if (customerGetType === 1) {
+            giveProductCollects.forEach(item => {
+              if (item.spu) {
+                const arr = item.spu.split(",");
+                getTagList.push.apply(getTagList, arr);
               }
             });
+          } else {
+            // 特地商品
+            if (getTargetShopifySku) {
+              const skus = getTargetShopifySku.split(",");
+              getTagList.push.apply(getTagList, skus);
+            }
+            if (getTargetShopifyProductSpu) {
+              const spus = getTargetShopifyProductSpu.split(",");
+              getTagList.push.apply(getTagList, spus);
+            }
           }
-        }
-      });
-    },
-    handleChangeParticipateType(e) {
-      this.conditionTypeArr.forEach(item => {
-        item.disabled = false;
-      });
-      this.promotion.conditionType = "";
-      this.promotion.conditionValue = "";
-      if (e === "gift_money" || e === "gift_qty") {
-        this.conditionTypeArr[2].disabled = true;
-      } else if (e === "gift_consumer") {
-        // gift_consumer
-        this.conditionTypeArr[0].disabled = true;
-        this.conditionTypeArr[1].disabled = true;
-        this.promotion.conditionType = this.conditionTypeArr[2].value;
-      }
+          this.getTagList = getTagList;
+        })
+        .finally(() => {
+          this.pageLoad = false;
+        });
     }
   }
 };
@@ -697,11 +703,6 @@ export default {
     border-bottom: none;
   }
   .info {
-    &.info-mini {
-      .item {
-        margin-top: 20px;
-      }
-    }
     .item {
       display: flex;
       flex-direction: row;
@@ -718,7 +719,7 @@ export default {
       }
       .mininput {
         margin-right: 30px;
-        width: 142px !important;
+        width: 180px !important;
       }
       .checkboxinput {
         margin-left: 20px;
@@ -730,11 +731,21 @@ export default {
         margin-right: 12px;
       }
       &.product {
+        margin-top: 26px;
+        .label {
+          margin-bottom: 10px;
+        }
         .mininput {
           margin-right: 20px;
+          margin-bottom: 10px;
+        }
+        .row {
+          flex-wrap: wrap;
         }
         .collectioninput {
           margin-right: 20px;
+          min-width: 220px !important;
+          width: auto !important;
           /deep/.el-input-group__append {
             color: #ae8877;
             border-left: none;
@@ -749,6 +760,9 @@ export default {
             border-right: none;
           }
         }
+        .value {
+          margin-bottom: 10px;
+        }
       }
     }
     .discount {
@@ -766,5 +780,35 @@ export default {
       }
     }
   }
+  .value {
+    position: relative;
+    min-width: 300px;
+    height: 36px;
+    padding: 0px 6px;
+    font-size: 12px;
+    margin-right: 13px;
+    color: #c0c4cc;
+    background: #f5f7fa;
+    border-radius: 3px;
+    border: 1px solid #dcdfe6;
+    p {
+      line-height: 12px;
+      padding-right: 130px;
+      overflow: hidden;
+      text-overflow: ellipsis;
+      white-space: nowrap;
+    }
+    a {
+      position: absolute;
+      right: 10px;
+      top: 0%;
+      color: #ae8877;
+    }
+  }
+  .customerQualification {
+    .mininput {
+      margin-bottom: 30px;
+    }
+  }
 }
 </style>

+ 0 - 91
src/views/oms/promotion/amountOffProducts/promotionLogList.vue

@@ -1,91 +0,0 @@
-<template>
-  <div>
-    <el-dialog append-to-body width="355px" :visible.sync="dialogFormVisible">
-      <div class="box">
-        <p>
-          <a href="javascript:void(0)" @click="handleDetail"> 查看版本V2</a>
-          更新时间 2025-01-24
-        </p>
-      </div>
-      <template slot="footer">
-        <el-button @click="dialogFormVisible = false"
-          >{{ $t("tagsView.close") }}
-        </el-button>
-      </template>
-    </el-dialog>
-  </div>
-</template>
-
-<script>
-import waves from "@/directive/waves"; // 水波纹指令
-import ElContainer from "element-ui/packages/container/src/main";
-import { promotionLogs } from "@/api/oms/order/promotion";
-
-export default {
-  inject: ["reload"], //刷新
-  components: {
-    ElContainer
-  },
-  name: "promotionLogList",
-  directives: {
-    waves
-  },
-  data() {
-    return {
-      dialogFormVisible: false,
-      list: [],
-      listLoading: false,
-      listQuery: {}
-    };
-  },
-  created() {},
-  computed: {},
-  methods: {
-    handleOpen(id) {
-      this.listQuery.promotionId = id;
-      this.dialogFormVisible = true;
-      this.retPage();
-    },
-    getList() {
-      this.listLoading = true;
-      promotionLogs(this.listQuery)
-        .then(response => {
-          if (response.code === 200) {
-            this.list = response.data.list;
-            setTimeout(() => {
-              this.listLoading = false;
-            }, 0.5 * 1000);
-          }
-        })
-        .catch(() => {
-          setTimeout(() => {
-            this.listLoading = false;
-          }, 0.5 * 1000);
-        });
-    },
-    handleDetail(t) {
-      let id = this.listQuery.promotionId;
-      this.$emit("show", id);
-    },
-    retPage() {
-      this.getList();
-    }
-  }
-};
-</script>
-
-<style scoped lang="scss">
-.box {
-  max-height: 350px;
-  overflow-y: auto;
-  p {
-    margin-left: 23px;
-    color: #9f9f9f;
-    line-height: 24px;
-    a {
-      color: #ae8877;
-      margin-right: 20px;
-    }
-  }
-}
-</style>

+ 30 - 97
src/views/oms/promotion/buyXGetYDiscount/components/productCollectionDetail.vue

@@ -24,15 +24,11 @@
         <span class="label">{{
           $t("label.specifyProductCollection") + ":"
         }}</span>
-        <el-input
-          class="mininput"
-          :value="productCollection"
-          :disabled="true"
-        />
+        <div class="value">{{ tagValue() }}</div>
       </div>
       <div class="skucon">
         <span
-          v-for="(item, i) in ProductList"
+          v-for="(item, i) in productCollection.spus"
           :class="productKeys.includes(item) ? 'active' : ''"
           :key="i"
           >{{ item }},</span
@@ -44,7 +40,6 @@
 
 <script>
 import waves from "@/directive/waves"; // 水波纹指令
-import { getById, save, storeList, update } from "@/api/oms/order/promotion";
 import i18n from "@/lang";
 
 export default {
@@ -57,110 +52,36 @@ export default {
     return {
       promotionFormVisible: false,
       productSku: "",
-      productCollection: "买5送1商品集合   共1322件商品",
-      productKeys: [],
-      ProductList: [
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B"
-      ],
-      promotion: {
-        // 配置基本信息
-        id: "",
-        promotionName: "",
-        promotionStartTime: "",
-        promotionEndTime: "",
-        type: 1,
-        promotionStatus: "",
-        priority: "",
-        participateType: "",
-        conditionType: "",
-        stackableType: [],
-        minimum: "1",
-        purchaseType: "",
-        productCollection: "",
-        discount: "",
-        number: 1,
-        combination: []
+      productCollection: {
+        title: "",
+        spus: []
       },
-      storeList: [],
+      productKeys: [],
       noDataText: "加载中",
       pageLoad: false
     };
   },
   methods: {
-    async showDialog(id) {
-      if (id) {
-        // 修改配置
-        this.promotion.id = id;
-        await this.getPromotionInfo();
-      }
+    tagValue() {
+      const str =
+        this.productCollection.title +
+        i18n.t("label.productCollection") +
+        i18n.t("label.all") +
+        this.productCollection.spus.length +
+        i18n.t("label.itemProduct");
+      return str;
+    },
+    async showDialog(data) {
       this.promotionFormVisible = true;
+      this.productCollection = data;
     },
     // 款号搜索
     handleProductSearch() {
       this.productKeys = this.productSku.split(",");
     },
-    resetData() {
-      this.promotion = {
-        id: "",
-        promotionName: "",
-        promotionStartTime: "",
-        promotionEndTime: "",
-        type: 1,
-        promotionStatus: "",
-        rejectCause: "",
-        priority: "",
-        participateType: "",
-        conditionType: "",
-        stackableType: [],
-        minimum: "1"
-      };
-    },
+    resetData() {},
     handleOpenDialog() {
       this.resetData();
-    },
-    getPromotionInfo() {
-      this.pageLoad = true;
-      getById(this.promotion.id).then(res => {
-        // 促销配置信息
-        this.promotion = res.data;
-        this.pageLoad = false;
-      });
     }
   }
 };
@@ -202,6 +123,8 @@ export default {
   }
   .collection {
     margin: 18px 0px;
+    display: flex;
+    align-items: center;
   }
   .productinput {
     width: 340px !important;
@@ -210,5 +133,15 @@ export default {
   .mininput {
     width: 280px !important;
   }
+  .value {
+    min-width: 259px;
+    padding: 10px;
+    line-height: 20px;
+    font-size: 12px;
+    color: #ababab;
+    background: #f5f7fa;
+    border-radius: 3px;
+    border: 1px solid #dcdfe6;
+  }
 }
 </style>

+ 33 - 29
src/views/oms/promotion/buyXGetYDiscount/index.vue

@@ -43,15 +43,6 @@
             @click="retPage"
             >{{ $t("view.search") }}
           </el-button>
-          <el-button
-            v-waves
-            v-has="'promotion:update'"
-            class="filter-item"
-            type="primary"
-            icon="el-icon-circle-plus-outline"
-            @click="showDialog('', false)"
-            >{{ $t("view.create") }}
-          </el-button>
         </div>
         <el-table
           v-loading="listLoading"
@@ -92,9 +83,7 @@
             align="center"
             width="220"
           >
-            <template v-slot="{ row }">
-              <span>{{ row.promotionStartTime }}</span>
-            </template>
+            <span>{{ $t("label.product") }}</span>
           </el-table-column>
           <el-table-column
             :label="$t('label.applicationMethod')"
@@ -124,7 +113,7 @@
               {{ discountVal(row) }}
             </template>
           </el-table-column>
-          <el-table-column
+          <!-- <el-table-column
             :label="$t('label.priority')"
             align="center"
             width="120"
@@ -132,14 +121,14 @@
             <template v-slot="{ row }">
               <span>{{ row.participateWeight }}</span>
             </template>
-          </el-table-column>
+          </el-table-column> -->
           <el-table-column
             :label="$t('label.stackableType')"
             align="center"
             width="150"
           >
             <template v-slot="{ row }">
-              <span>{{ row.participateWeight }}</span>
+              <span>{{ stackableType(row) }}</span>
             </template>
           </el-table-column>
           <el-table-column
@@ -154,14 +143,14 @@
             width="220"
             prop="endTime"
           />
-          <el-table-column
+          <!-- <el-table-column
             :label="$t('label.status')"
             align="center"
             width="120"
             prop="status"
           >
             <template v-slot="{ row }">{{ statusVal(row.status) }}</template>
-          </el-table-column>
+          </el-table-column> -->
           <el-table-column
             :label="$t('label.version')"
             align="center"
@@ -209,7 +198,7 @@
       </el-main>
     </el-container>
 
-    <promotion-form ref="promotionFormRef" @refresh-table="getList" />
+    <promotion-form ref="promotionBuyXgetYFormRef" @refresh-table="getList" />
     <promotion-log-list
       ref="logListRef"
       @show="({ id, version }) => showDialog(id, true, version)"
@@ -222,10 +211,10 @@ import waves from "@/directive/waves"; // 水波纹指令
 import SwPage from "@/views/common/swPage.vue";
 import ElContainer from "element-ui/packages/container/src/main";
 import PromotionForm from "@/views/oms/promotion/buyXGetYDiscount/promotionForm.vue";
-import PromotionLogList from "@/views/oms/promotion/buyXGetYDiscount/promotionLogList.vue";
+import PromotionLogList from "@/views/oms/promotion/multiBuyDiscount/promotionLogList.vue";
 import { fetchList } from "@/api/oms/order/multiBuyDiscount";
-import { deleteById } from "@/api/oms/order/promotion";
 import { getToken } from "@/utils/auth";
+import i18n from "@/lang";
 
 export default {
   inject: ["reload"], //刷新
@@ -235,7 +224,7 @@ export default {
     PromotionForm,
     PromotionLogList
   },
-  name: "multiBuyDiscount",
+  name: "buyXgetYDiscount",
   directives: {
     waves
   },
@@ -268,6 +257,21 @@ export default {
     }
   },
   methods: {
+    // 可叠加类型
+    stackableType(row) {
+      const { combineWithOrder, combineWithProduct, combineWithShipping } = row;
+      let arr = [];
+      if (combineWithOrder) {
+        arr.push(i18n.t("label.combinationList")[1].label);
+      }
+      if (combineWithProduct) {
+        arr.push(i18n.t("label.combinationList")[0].label);
+      }
+      if (combineWithShipping) {
+        arr.push(i18n.t("label.combinationList")[2].label);
+      }
+      return arr.join(",");
+    },
     // 折扣类型
     applicationMethod(val) {
       const data = i18n
@@ -279,9 +283,9 @@ export default {
     purchaseRequire(row) {
       let { purchaseRequire, requireValue } = row;
       if (purchaseRequire === 2) {
-        return "$" + requireValue;
+        return "$ " + requireValue;
       } else if (purchaseRequire === 3) {
-        return requireValue + i18n.t("label.item");
+        return requireValue + " " + i18n.t("label.item");
       } else {
         return i18n.t("label.noRequirement");
       }
@@ -303,10 +307,10 @@ export default {
       return val && obj ? obj.label : "";
     },
     // 状态
-    statusVal(val) {
-      const data = i18n.t("label.statusList").find(item => item.value === val);
-      return val && data ? data.label : "";
-    },
+    // statusVal(val) {
+    //   const data = i18n.t("label.statusList").find(item => item.value === val);
+    //   return val && data ? data.label : "";
+    // },
     getList() {
       this.listLoading = true;
       fetchList(this.listQuery)
@@ -329,8 +333,8 @@ export default {
       this.listQuery.page = 1;
       this.getList();
     },
-    showDialog(id, edit) {
-      this.$refs.promotionFormRef.showDialog(id, edit);
+    showDialog(id, edit, version) {
+      this.$refs.promotionBuyXgetYFormRef.showDialog(id, edit, version);
     },
     // changePromotionStatus(id, status) {
     //   this.$confirm(status ? "是否确认禁用?" : "是否确认启用?", "提示", {

+ 0 - 556
src/views/oms/promotion/buyXGetYDiscount/promotionForm copy.vue

@@ -1,556 +0,0 @@
-<template>
-  <el-dialog
-    v-loading="pageLoad"
-    element-loading-text="loading..."
-    :title="title"
-    top="0"
-    width="100%"
-    lock-scroll
-    custom-class="promotionform"
-    :close-on-click-modal="false"
-    :visible.sync="promotionFormVisible"
-    @open="handleOpenDialog"
-    @close="resetData"
-  >
-    <div class="dialog-body">
-      <el-form
-        ref="promotionFormRef"
-        :rules="baseRule"
-        :model="promotion"
-        label-width="auto"
-        size="medium"
-      >
-        <!-- 设置活动基本信息 -->
-        <div class="box">
-          <div class="title">
-            <span>{{ $t("label.setBasicEventInformation") }}</span>
-          </div>
-          <div class="info">
-            <!--促销名称-->
-            <el-form-item
-              :label="$t('label.promotionName') + ':'"
-              prop="promotionName"
-              style="width:418px"
-              required
-            >
-              <el-input
-                v-model.trim="promotion.promotionName"
-                :disabled="edit"
-              ></el-input>
-            </el-form-item>
-            <div class="item">
-              <!--促销开始时间-->
-              <el-form-item
-                :label="$t('label.promotionStartTime') + ':'"
-                prop="promotionStartTime"
-                required
-              >
-                <el-date-picker
-                  :disabled="edit"
-                  type="datetime"
-                  placeholder="选择日期"
-                  value-format="yyyy-MM-dd HH:mm:ss"
-                  v-model="promotion.promotionStartTime"
-                ></el-date-picker>
-              </el-form-item>
-
-              <!--促销失效时间-->
-              <el-form-item
-                :label="$t('label.promotionEndTime') + ':'"
-                prop="promotionEndTime"
-                required
-              >
-                <el-date-picker
-                  :disabled="edit"
-                  type="datetime"
-                  placeholder="选择日期"
-                  value-format="yyyy-MM-dd HH:mm:ss"
-                  v-model="promotion.promotionEndTime"
-                ></el-date-picker>
-              </el-form-item>
-            </div>
-            <!--应用方式-->
-            <el-form-item
-              :label="$t('label.applicationMethod') + ':'"
-              prop="mutual"
-              required
-            >
-              <el-radio-group v-model="promotion.mutual" :disabled="edit">
-                <div class="item row">
-                  <el-radio :label="true">{{ $t("label.discount") }}</el-radio>
-                  <el-input
-                    class="codeinput"
-                    v-model.trim="promotion.promotionName"
-                    :disabled="edit"
-                  />
-                  <el-radio :label="false">{{
-                    $t("label.autoDiscount")
-                  }}</el-radio>
-                </div>
-              </el-radio-group>
-            </el-form-item>
-          </div>
-        </div>
-        <!-- 折扣设置 -->
-        <div class="box">
-          <div class="title">
-            <span>{{ $t("label.discountSetting") }}</span>
-          </div>
-          <div class="info">
-            <div class="item">
-              <!--最低购买要求-->
-              <el-form-item
-                :label="$t('label.minimumPurchaseRequirement') + ':'"
-                prop="mutual"
-                required
-              >
-                <el-radio-group v-model="promotion.mutual" :disabled="edit">
-                  <div class="item row">
-                    <el-radio :label="true">{{
-                      $t("label.discount")
-                    }}</el-radio>
-                    <el-input
-                      class="mininput"
-                      v-model.trim="promotion.promotionName"
-                      :disabled="edit"
-                    />
-                    <el-radio :label="false">{{
-                      $t("label.autoDiscount")
-                    }}</el-radio>
-                    <el-input
-                      class="mininput"
-                      v-model.trim="promotion.promotionName"
-                      :disabled="edit"
-                    />
-                  </div>
-                </el-radio-group>
-              </el-form-item>
-
-              <!--促销级别-->
-              <el-form-item
-                :label="$t('label.promotionLevel') + ':'"
-                prop="mutual"
-                required
-              >
-                <el-radio-group v-model="promotion.mutual" :disabled="edit">
-                  <el-radio :label="true">{{ $t("label.order") }}</el-radio>
-                  <el-radio :label="false">{{ $t("label.product") }}</el-radio>
-                </el-radio-group>
-              </el-form-item>
-            </div>
-            <div class="item">
-              <!--折扣内容-->
-              <el-form-item
-                :label="$t('label.discountValue') + ':'"
-                prop="mutual"
-                required
-              >
-                <el-radio-group v-model="promotion.mutual" :disabled="edit">
-                  <div class="item row">
-                    <el-radio :label="true">{{
-                      $t("label.discount")
-                    }}</el-radio>
-                    <el-input
-                      class="mininput"
-                      v-model.trim="promotion.promotionName"
-                      :disabled="edit"
-                    />
-                    <el-radio :label="false">{{
-                      $t("label.autoDiscount")
-                    }}</el-radio>
-                    <el-input
-                      class="mininput"
-                      v-model.trim="promotion.promotionName"
-                      :disabled="edit"
-                    />
-                  </div>
-                </el-radio-group>
-              </el-form-item>
-
-              <!--促销级别-->
-              <el-form-item
-                :label="$t('label.priority') + ':'"
-                prop="mutual"
-                required
-              >
-                <el-radio-group v-model="promotion.mutual" :disabled="edit">
-                  <el-radio
-                    v-for="(item, i) in $t('label.priorityValue')"
-                    :key="i"
-                    :label="item.value"
-                    >{{ item.label }}</el-radio
-                  >
-                </el-radio-group>
-              </el-form-item>
-            </div>
-            <!--可叠加类型-->
-            <el-form-item
-              :label="$t('label.stackableTypes') + ':'"
-              prop="stackableType"
-              required
-            >
-              <el-checkbox-group
-                v-model="promotion.stackableType"
-                :disabled="edit"
-              >
-                <el-checkbox
-                  v-for="(item, i) in $t('label.stackableTypesValue')"
-                  :key="i"
-                  :label="item.value"
-                  >{{ item.label }}</el-checkbox
-                >
-              </el-checkbox-group>
-            </el-form-item>
-          </div>
-        </div>
-
-        <!-- 设置商品范围 -->
-        <div class="box productbox">
-          <div class="title">
-            <span>{{ $t("label.setProductRange") }}</span>
-          </div>
-          <div class="info">
-            <!-- 指定商品标签 -->
-            <el-form-item
-              :label="$t('label.product') + ':'"
-              prop="participateType"
-              required
-            >
-              <el-select
-                multiple
-                v-model="promotion.participateType"
-                @change="handleChangeParticipateType"
-                :disabled="edit"
-              >
-                <el-option
-                  :key="index"
-                  v-for="(item, index) in $t('label.participateTypeArr')"
-                  :label="item.label"
-                  :value="item.value"
-                />
-              </el-select>
-            </el-form-item>
-            <el-form-item
-              :label="$t('label.specifyProductTag') + ':'"
-              prop="mutual"
-            >
-              <el-input
-                class="mininput"
-                v-model.trim="promotion.promotionName"
-                :disabled="edit"
-              />
-              <div class="skucon">
-                121J0B04B,124C2B014,132J0B06V,121J0B04B,124C2B014,132J0B06V,,121J0B04B,124C2B014,132J0B06V,121J0B04B,124C2B014,132J0B06V,121J0B04B,124C2B014,132J0B06V,121J0B04B,124C2B014,132J0B06V,
-                121J0B04B,124C2B014,132J0B06V,121J0B04B,124C2B014,132J0B06V,,121J0B04B,124C2B014,132J0B06V,121J0B04B,124C2B014,132J0B06V,121J0B04B,124C2B014,132J0B06V,124C2B014,132J0B06V,121J0B04B,124C2B
-              </div>
-            </el-form-item>
-          </div>
-        </div>
-      </el-form>
-    </div>
-
-    <template slot="footer">
-      <el-button
-        @click="
-          resetData();
-          promotionFormVisible = false;
-        "
-        >{{ $t("view.cancel") }}
-      </el-button>
-      <!-- 未审核时/审核驳回 状态可进行提交 -->
-      <el-button
-        type="primary"
-        @click="handleSaveOrUpdate"
-        v-if="promotion.promotionStatus !== 1"
-        :disabled="edit"
-        >{{ $t("view.confirm") }}
-      </el-button>
-    </template>
-  </el-dialog>
-</template>
-
-<script>
-import waves from "@/directive/waves"; // 水波纹指令
-import { getById, save, storeList, update } from "@/api/oms/order/promotion";
-import i18n from "@/lang";
-import promotion from "@/views/oms/promotion/multiBuyDiscount/index.vue";
-
-export default {
-  inject: ["reload"],
-  directives: {
-    waves
-  },
-  components: {},
-  computed: {},
-  name: "multiBuyDiscountForm",
-  filters: {},
-  data() {
-    return {
-      promotionFormVisible: false,
-      title: "",
-      promotion: {
-        // 配置基本信息
-        id: "",
-        promotionName: "",
-        stackableType: [],
-        promotionInfo: "",
-        promotionStore: "",
-        promotionStartTime: "",
-        promotionEndTime: "",
-        promotionStatus: "",
-        rejectCause: "",
-        participateNum: 1,
-        mutual: "",
-        isSuperposition: "",
-        participateWeight: 0,
-        participateType: "",
-        conditionType: "",
-        conditionValue: "",
-        goodsRelation: "",
-        goodsScope: "",
-        giftRelation: ""
-      },
-      edit: true,
-      storeList: [],
-      noDataText: "加载中",
-      baseRule: {
-        // 促销配置
-        promotionName: [
-          {
-            required: true,
-            message: "请输入促销名称",
-            trigger: ["change", "blur"]
-          },
-          {
-            min: 2,
-            max: 50,
-            message: "长度在 2 到 50 个字符",
-            trigger: ["change", "blur"]
-          }
-        ]
-      },
-      pageLoad: false,
-      conditionTypeArr: i18n.t("label.conditionTypeArr").map(item => {
-        return {
-          ...item,
-          disabled: false
-        };
-      })
-    };
-  },
-  mounted() {},
-  methods: {
-    getStoreList() {
-      storeList().then(res => {
-        if (res.code === 200) {
-          this.storeList = res.data;
-        }
-      });
-    },
-    async showDialog(id, edit) {
-      this.edit = !edit;
-      await this.getStoreList();
-      if (id) {
-        // 修改配置
-        this.promotion.id = id;
-        await this.getPromotionInfo();
-      }
-      this.title = id
-        ? i18n.t("title.updateTitle")
-        : i18n.t("title.createTitle");
-      this.promotionFormVisible = true;
-    },
-    resetData() {
-      this.promotion = {
-        id: "",
-        promotionName: "",
-        promotionInfo: "",
-        promotionStartTime: "",
-        promotionEndTime: "",
-        promotionStatus: "",
-        rejectCause: "",
-        participateNum: "",
-        mutual: "",
-        participateWeight: "",
-        participateType: "",
-        conditionType: "",
-        conditionValue: "",
-        goodsRelation: "",
-        goodsScope: "",
-        giftRelation: "",
-        stackableType: []
-      };
-    },
-    handleOpenDialog() {
-      this.resetData();
-      if (this.$refs.promotionFormRef) {
-        this.$refs.promotionFormRef.clearValidate();
-      }
-    },
-    getPromotionInfo() {
-      this.pageLoad = true;
-      getById(this.promotion.id).then(res => {
-        // 促销配置信息
-        this.promotion = res.data;
-        this.pageLoad = false;
-      });
-    },
-    handleSaveOrUpdate() {
-      //创建商品
-      this.$refs["promotionFormRef"].validate(valid => {
-        //通用属性验证成功
-        if (valid) {
-          // 如果需要在促销类型买就送的情况下将条件类型和条件值改为 "0" 则可在此修改 暂时默认为空字符
-          const data = {
-            ...this.promotion
-          };
-          if (!data.id) {
-            save(data).then(res => {
-              if (res.code === 200) {
-                this.$message({
-                  message: "操作成功",
-                  type: "success"
-                });
-                this.$emit("refresh-table");
-                this.promotionFormVisible = false;
-              }
-            });
-          } else {
-            update(data).then(res => {
-              if (res.code === 200) {
-                this.$message({
-                  message: "操作成功",
-                  type: "success"
-                });
-                this.$emit("refresh-table");
-                this.promotionFormVisible = false;
-              }
-            });
-          }
-        }
-      });
-    },
-    handleChangeParticipateType(e) {
-      this.conditionTypeArr.forEach(item => {
-        item.disabled = false;
-      });
-      this.promotion.conditionType = "";
-      this.promotion.conditionValue = "";
-      if (e === "gift_money" || e === "gift_qty") {
-        this.conditionTypeArr[2].disabled = true;
-      } else if (e === "gift_consumer") {
-        // gift_consumer
-        this.conditionTypeArr[0].disabled = true;
-        this.conditionTypeArr[1].disabled = true;
-        this.promotion.conditionType = this.conditionTypeArr[2].value;
-      }
-    }
-  }
-};
-</script>
-<style lang="scss">
-.promotionform {
-  width: 100%;
-  height: 100%;
-  position: fixed;
-  top: 0px;
-  left: 0px;
-  .el-dialog__header {
-    padding: 36px 21px 0px 34px;
-    .el-dialog__title {
-      font-size: 18px;
-      font-weight: bold;
-      color: #ae8877;
-      line-height: 22px;
-    }
-  }
-  .el-form-item__label {
-    font-weight: 400;
-  }
-  .el-dialog__body {
-    padding: 30px 10px 30px 34px;
-  }
-  .el-dialog__headerbtn {
-    top: 14px;
-    right: 14px;
-    font-weight: bold;
-    .el-icon-close {
-      font-weight: bold;
-    }
-  }
-}
-</style>
-<style scoped rel="stylesheet/scss" lang="scss">
-.dialog-body {
-  height: 80vh;
-  overflow: auto;
-  .box {
-    border-bottom: 1px solid #d8d8d8;
-    padding-bottom: 20px;
-    margin-bottom: 42px;
-    .title {
-      color: #606266;
-      font-size: 16px;
-      line-height: 16px;
-      position: relative;
-      font-weight: bold;
-      padding-left: 6px;
-      margin-bottom: 23px;
-      &:before {
-        position: absolute;
-        left: 0px;
-        top: 0px;
-        content: "";
-        display: inline-block;
-        width: 3px;
-        height: 13px;
-        background: #ae8877;
-        border-radius: 0px 0px 0px 0px;
-      }
-    }
-  }
-  // /deep/.el-form-item__label-wrap {
-  //   margin-left: 0px !important;
-  //   .el-form-item__label {
-  //     text-align: right;
-  //   }
-  // }
-  .skucon {
-    width: 90%;
-    height: 139px;
-    overflow-y: auto;
-    border-radius: 3px 3px 3px 3px;
-    border: 1px solid #dcdfe6;
-    margin-top: 12px;
-    padding: 10px;
-    font-size: 12px;
-    line-height: 16px;
-  }
-  .productbox {
-    border-bottom: none;
-  }
-  .info {
-    .item {
-      display: flex;
-      flex-direction: row;
-      flex-wrap: wrap;
-      align-items: center;
-      &.row {
-        flex-wrap: nowrap;
-      }
-      .el-form-item {
-        margin-right: 42px !important;
-      }
-      .codeinput {
-        margin-right: 36px;
-      }
-      .mininput {
-        margin-right: 30px;
-        .el-input__inner {
-          width: 142px;
-        }
-      }
-    }
-  }
-}
-</style>

+ 292 - 218
src/views/oms/promotion/buyXGetYDiscount/promotionForm.vue

@@ -1,7 +1,6 @@
 <template>
-  <div>
+  <div v-loading="pageLoad">
     <el-dialog
-      v-loading="pageLoad"
       element-loading-text="loading..."
       :title="title"
       top="0"
@@ -13,9 +12,9 @@
       @open="handleOpenDialog"
       @close="resetData"
     >
-      <div class="dialog-body">
+      <div class="dialog-body" v-loading="pageLoad">
         <el-form
-          ref="promotionFormRef"
+          ref="promotionBuyXgetYDertailFormRef"
           :model="promotion"
           label-width="210px"
           size="medium"
@@ -32,7 +31,7 @@
                 prop="promotionName"
               >
                 <el-input
-                  v-model.trim="promotion.promotionName"
+                  v-model.trim="promotion.title"
                   :disabled="edit"
                 ></el-input>
               </el-form-item>
@@ -40,45 +39,49 @@
                 <!--促销开始时间-->
                 <el-form-item
                   :label="$t('label.promotionStartTime') + ':'"
-                  prop="promotionStartTime"
+                  prop="startTime"
                 >
                   <el-date-picker
                     :disabled="edit"
                     type="datetime"
                     placeholder="选择日期"
                     value-format="yyyy-MM-dd HH:mm:ss"
-                    v-model="promotion.promotionStartTime"
+                    v-model="promotion.startTime"
                   ></el-date-picker>
                 </el-form-item>
 
                 <!--促销失效时间-->
                 <el-form-item
                   :label="$t('label.promotionEndTime') + ':'"
-                  prop="promotionEndTime"
+                  prop="endTime"
                 >
                   <el-date-picker
                     :disabled="edit"
                     type="datetime"
                     placeholder="选择日期"
                     value-format="yyyy-MM-dd HH:mm:ss"
-                    v-model="promotion.promotionEndTime"
+                    v-model="promotion.endTime"
                   ></el-date-picker>
                 </el-form-item>
               </div>
               <!--应用方式-->
               <el-form-item
                 :label="$t('label.applicationMethod') + ':'"
-                prop="type"
+                prop="discountMethod"
               >
-                <el-radio-group v-model="promotion.type" :disabled="edit">
+                <el-radio-group
+                  v-model="promotion.discountMethod"
+                  :disabled="edit"
+                >
                   <div class="item row">
-                    <el-radio label="1">{{ $t("label.discount") }}</el-radio>
+                    <el-radio :label="1">{{ $t("label.discount") }}</el-radio>
                     <el-input
+                      v-show="promotion.discountMethod === 1"
                       class="codeinput"
-                      v-model.trim="promotion.promotionName"
+                      v-model.trim="promotion.discountCode"
                       :disabled="edit"
                     />
-                    <el-radio label="2">{{
+                    <el-radio :label="2">{{
                       $t("label.autoDiscount")
                     }}</el-radio>
                   </div>
@@ -98,10 +101,14 @@
                 :label="$t('label.minimumPurchaseRequirement') + ':'"
                 prop="minimum"
               >
-                <el-radio-group v-model="promotion.minimum" :disabled="edit">
+                <el-radio-group
+                  v-model="promotion.purchaseRequire"
+                  :disabled="edit"
+                >
                   <div class="item row">
-                    <el-radio label="1">{{ $t("label.numberStr") }}</el-radio>
-                    <el-radio label="2">{{ $t("label.money") }}</el-radio>
+                    <el-radio :label="3">{{ $t("label.numberStr") }}</el-radio>
+                    <el-radio :label="2">{{ $t("label.money") }}</el-radio>
+                    <el-radio :label="1">{{ $t("label.free") }}</el-radio>
                   </div>
                 </el-radio-group>
               </el-form-item>
@@ -112,55 +119,35 @@
                     <span class="label">{{ discountContentValue }}</span>
                     <el-input
                       class="mininput"
-                      v-model.trim="promotion.minimumMoney"
+                      v-model.trim="promotion.requireValue"
                       :disabled="edit"
                     />
                   </div>
-                  <!-- <div class="item-box">
+                  <div class="item-box">
                     <span class="label">{{ $t("label.buyType") }}</span>
                     <el-input
                       class="mininput"
                       v-model.trim="promotion.purchaseType"
                       :disabled="edit"
                     />
-                  </div> -->
+                  </div>
                 </div>
                 <div class="item product">
-                  <div class="item-box">
+                  <div class="item row">
                     <span class="label">{{ $t("label.product") }}</span>
                     <el-input
                       class="mininput"
-                      v-model.trim="promotion.productType"
+                      v-model.trim="promotion.productBuyType"
                       :disabled="edit"
                     />
-                    <el-input
-                      class="collectioninput"
-                      v-model.trim="promotion.productCollection"
-                      :disabled="edit"
-                    >
-                      <template slot="append"
-                        ><span
-                          @click="
-                            handleProductDialog(promotion.productCollection)
-                          "
-                          >查看商品明细</span
-                        ></template
-                      >
-                    </el-input>
-                    <el-input
-                      class="collectioninput"
-                      v-model.trim="promotion.productCollection"
-                      :disabled="edit"
-                    >
-                      <template slot="append"
-                        ><span
-                          @click="
-                            handleProductDialog(promotion.productCollection)
-                          "
-                          >查看商品明细</span
-                        ></template
+                    <div class="value" v-for="(data, j) in tagLists" :key="j">
+                      <p>{{ tagValue(data) }}</p>
+                      <a
+                        href="javascript:void();"
+                        @click="handleProductDialog(data)"
+                        >{{ $t("label.viewProductDetaiL") }}</a
                       >
-                    </el-input>
+                    </div>
                   </div>
                 </div>
               </el-form-item>
@@ -176,7 +163,7 @@
                   <span class="label">{{ $t("label.numberStr") }}</span>
                   <el-input
                     class="mininput"
-                    v-model.trim="promotion.minimumMoney"
+                    v-model.trim="promotion.customerGetNumber"
                     :disabled="edit"
                   />
                 </div>
@@ -201,7 +188,7 @@
                     </el-button>
                     <div class="skucon">
                       <span
-                        v-for="(item, i) in ProductList"
+                        v-for="(item, i) in getTagList"
                         :class="productKeys.includes(item) ? 'active' : ''"
                         :key="i"
                         >{{ item }},</span
@@ -216,45 +203,44 @@
                 prop="discount"
                 class="discount"
               >
-                <el-radio-group v-model="promotion.discount" :disabled="edit">
+                <el-radio-group v-model="promotion.valueType" :disabled="edit">
                   <div class="item row">
-                    <el-radio label="1">{{ $t("label.percentage") }}</el-radio>
+                    <el-radio :label="1">{{ $t("label.percentage") }}</el-radio>
                     <el-input
-                      v-show="promotion.discount === '1'"
+                      v-if="promotion.valueType === 1"
                       class="mininput"
-                      v-model.trim="promotion.promotionName"
+                      v-model.trim="promotion.discountNumber"
                       :disabled="edit"
                     />
                   </div>
                   <div class="item row">
-                    <el-radio label="2">{{
+                    <el-radio :label="2">{{
                       $t("label.discountPerItem")
                     }}</el-radio>
                     <el-input
-                      v-show="promotion.discount === '2'"
+                      v-if="promotion.valueType === 2"
                       class="mininput"
-                      v-model.trim="promotion.promotionName"
+                      v-model.trim="promotion.numericValue"
                       :disabled="edit"
                     />
                   </div>
-                  <el-radio label="3">{{ $t("label.free") }}</el-radio>
+                  <el-radio :label="3">{{ $t("label.free") }}</el-radio>
                 </el-radio-group>
               </el-form-item>
             </div>
-            <!-- 每个订单使用次数 -->
-            <div class="title">
+            <!-- 每个订单使用次数 自动折扣才有-->
+            <div class="title" v-if="promotion.discountMethod === 2">
               <span>{{ $t("label.numberOfTimesUsedPerOrder") }}</span>
             </div>
             <div class="info">
-              <!-- 指定商品标签 -->
               <el-form-item>
                 <div class="item row">
-                  <el-checkbox v-model="checked" :disabled="edit">{{
+                  <el-checkbox v-model="usageLimitchecked" :disabled="edit">{{
                     $t("label.maxNumberOfTimesUsedPerOrder")
                   }}</el-checkbox>
                   <el-input
                     class="mininput checkboxinput"
-                    v-model.trim="promotion.number"
+                    v-model.trim="promotion.customerGetOrderUsageLimit"
                     :disabled="edit"
                   />
                 </div>
@@ -262,60 +248,89 @@
             </div>
           </div>
           <!-- 客户资格  折扣码才有-->
-          <div class="box" v-if="promotion.type === '1'">
+          <div class="box" v-if="promotion.discountMethod === 1">
             <div class="title">
               <span>{{ $t("label.customerQualification") }}</span>
             </div>
-            <div class="info">
+            <div class="info customerQualification">
               <el-form-item prop="customerQualification" required>
                 <el-radio-group
                   class="customerqualification"
-                  v-model="promotion.customerQualification"
+                  v-model="promotion.targetCustomerType"
                   :disabled="edit"
                 >
-                  <el-radio
+                  <el-radio :label="1">{{
+                    $t("label.customerQualificationList")[0].label
+                  }}</el-radio>
+                  <div class="item row">
+                    <el-radio :label="2">{{
+                      $t("label.customerQualificationList")[1].label
+                    }}</el-radio>
+                    <el-input
+                      v-if="promotion.targetCustomerType === 2"
+                      class="mininput"
+                      v-model.trim="promotion.targetCustomer"
+                      :disabled="edit"
+                    />
+                  </div>
+                  <div class="item row">
+                    <el-radio :label="3">{{
+                      $t("label.customerQualificationList")[2].label
+                    }}</el-radio>
+                    <el-input
+                      v-if="promotion.targetCustomerType === 3"
+                      class="mininput"
+                      v-model.trim="promotion.targetCustomer"
+                      :disabled="edit"
+                    />
+                  </div>
+                  <!-- <el-radio
                     v-for="(item, i) in $t('label.customerQualificationList')"
                     :key="i"
                     :label="item.value"
                     >{{ item.label }}</el-radio
-                  >
+                  > -->
                 </el-radio-group>
               </el-form-item>
             </div>
           </div>
           <!-- 最大折扣使用次数  折扣码才有-->
-          <div class="box" v-if="promotion.type === '1'">
+          <div class="box" v-if="promotion.discountMethod === 1">
             <div class="title">
               <span>{{ $t("label.maximumNumberOfDiscounts") }}</span>
             </div>
             <div class="info">
-              <!-- 指定商品标签 -->
               <el-form-item>
+                <!-- <el-checkbox-group v-model="promotion.startTime"> -->
                 <div class="item row">
-                  <el-checkbox v-model="checked" :disabled="edit">{{
-                    $t("label.limitDiscountCount")
-                  }}</el-checkbox>
+                  <el-checkbox
+                    :checked="codeUsageLimitchecked"
+                    :disabled="edit"
+                    >{{ $t("label.limitDiscountCount") }}</el-checkbox
+                  >
                   <el-input
                     class="mininput checkboxinput"
-                    v-model.trim="promotion.number"
+                    v-model.trim="promotion.codeUsageLimit"
                     :disabled="edit"
                   />
                 </div>
                 <div class="item row">
-                  <el-checkbox v-model="checked" :disabled="edit">{{
-                    $t("label.customerCount")
-                  }}</el-checkbox>
+                  <el-checkbox
+                    :checked="promotion.codeCustomerUsageType === 1"
+                    :disabled="edit"
+                    >{{ $t("label.customerCount") }}</el-checkbox
+                  >
                 </div>
+                <!-- </el-checkbox-group> -->
               </el-form-item>
             </div>
           </div>
           <!-- 组合 自动折扣才有 -->
-          <div class="box" v-if="promotion.type === '2'">
+          <div class="box" v-if="promotion.discountMethod === 2">
             <div class="title">
               <span>{{ $t("label.combination") }}</span>
             </div>
             <div class="info">
-              <!-- 指定商品标签 -->
               <el-form-item :label="$t('label.combinationLable') + ':'">
                 <el-checkbox-group v-model="promotion.combination">
                   <el-checkbox
@@ -341,9 +356,9 @@
           >{{ $t("view.cancel") }}
         </el-button>
         <!-- 未审核时/审核驳回 状态可进行提交 -->
-        <el-button type="primary" @click="handleSaveOrUpdate" :disabled="edit"
+        <!-- <el-button type="primary" @click="handleSaveOrUpdate" :disabled="edit"
           >{{ $t("view.confirm") }}
-        </el-button>
+        </el-button> -->
       </template>
     </el-dialog>
     <product-collection ref="productCollectionRef" />
@@ -351,8 +366,9 @@
 </template>
 <script>
 import waves from "@/directive/waves"; // 水波纹指令
-import { getById, save, storeList, update } from "@/api/oms/order/promotion";
+import { fetchDetailByIdAndVersion } from "@/api/oms/order/multiBuyDiscount";
 import i18n from "@/lang";
+import { isEmpty } from "@/utils/toolUtil";
 import productCollection from "@/views/oms/promotion/buyXGetYDiscount/components/productCollectionDetail";
 
 export default {
@@ -360,18 +376,15 @@ export default {
   directives: {
     waves
   },
-  name: "multiBuyDiscountForm",
+  name: "buyXgetYbuyDiscountForm",
   components: {
     productCollection
   },
   computed: {
     discountContentValue() {
-      return this.promotion.minimum === "2"
+      return this.promotion.purchaseRequire === 2
         ? i18n.t("label.money")
         : i18n.t("label.numberStr");
-    },
-    checked() {
-      return !!this.promotion.number;
     }
   },
   data() {
@@ -380,90 +393,47 @@ export default {
       title: "",
       productSku: "",
       productKeys: [],
-      ProductList: [
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B014",
-        "132J0B06V",
-        "124C2B014",
-        "132J0B06V",
-        "121J0B04B",
-        "124C2B"
-      ],
+      usageLimitchecked: false,
+      codeUsageLimitchecked: false,
+      tagLists: [],
+      getTagList: [],
       promotion: {
         // 配置基本信息
         id: "",
-        promotionName: "",
-        promotionStartTime: "",
-        promotionEndTime: "",
-        type: 1,
-        promotionStatus: "",
-        priority: "",
-        participateType: "",
-        conditionType: "",
-        stackableType: [],
-        minimum: "1",
+        title: "",
+        startTime: "",
+        endTime: "",
+        discountMethod: null,
+        discountNumber: null,
+        purchaseRequire: null,
         purchaseType: "",
         productType: "",
+        productBuyType: "",
         discount: "",
-        number: 1,
         combination: []
       },
       edit: true,
-      storeList: [],
       noDataText: "加载中",
       pageLoad: false,
-      conditionTypeArr: i18n.t("label.conditionTypeArr").map(item => {
-        return {
-          ...item,
-          disabled: false
-        };
-      })
+      isEmpty
     };
   },
   methods: {
-    getStoreList() {
-      storeList().then(res => {
-        if (res.code === 200) {
-          this.storeList = res.data;
-        }
-      });
+    tagValue(data) {
+      return (
+        data.title +
+        i18n.t("label.productCollection") +
+        i18n.t("label.all") +
+        data.spus.length +
+        i18n.t("label.itemProduct")
+      );
     },
-    async showDialog(id, edit) {
+    async showDialog(id, edit, version) {
       this.edit = edit;
-      await this.getStoreList();
       if (id) {
         // 修改配置
         this.promotion.id = id;
+        this.promotion.version = version;
         await this.getPromotionInfo();
         this.title = this.edit
           ? i18n.t("label.mutiPromotionDetailTitle")
@@ -471,94 +441,156 @@ export default {
       } else {
         this.title = i18n.t("label.mutiPromotionCreateTitle");
       }
+      let str = this.promotion.id ? "Detail" : "";
+      this.discountSettingTitle = i18n.t("label.discountSetting" + str);
+      this.productRangeTitle = i18n.t("label.setProductRange" + str);
       this.promotionFormVisible = true;
     },
     // 款号搜索
     handleProductSearch() {
       this.productKeys = this.productSku.split(",");
     },
-    handleProductDialog(id) {
-      this.$refs.productCollectionRef.showDialog(id);
+    handleProductDialog(data) {
+      this.$refs.productCollectionRef.showDialog(data);
     },
     resetData() {
       this.promotion = {
         id: "",
-        promotionName: "",
-        promotionStartTime: "",
-        promotionEndTime: "",
-        type: 1,
-        promotionStatus: "",
-        rejectCause: "",
-        priority: "",
-        participateType: "",
-        conditionType: "",
-        stackableType: [],
-        minimum: "1"
+        title: "",
+        startTime: "",
+        endTime: "",
+        discountMethod: null,
+        discountNumber: null,
+        purchaseRequire: null,
+        purchaseType: "",
+        productType: "",
+        productBuyType: "",
+        discount: "",
+        combination: []
       };
     },
     handleOpenDialog() {
       this.resetData();
-      if (this.$refs.promotionFormRef) {
-        this.$refs.promotionFormRef.clearValidate();
+      if (this.$refs.promotionBuyXgetYDertailFormRef) {
+        this.$refs.promotionBuyXgetYDertailFormRef.clearValidate();
       }
     },
     getPromotionInfo() {
       this.pageLoad = true;
-      getById(this.promotion.id).then(res => {
-        // 促销配置信息
-        this.promotion = res.data;
-        this.pageLoad = false;
-      });
-    },
-    handleSaveOrUpdate() {
-      //创建商品
-      this.$refs["promotionFormRef"].validate(valid => {
-        //通用属性验证成功
-        if (valid) {
-          // 如果需要在促销类型买就送的情况下将条件类型和条件值改为 "0" 则可在此修改 暂时默认为空字符
-          const data = {
-            ...this.promotion
-          };
-          if (!data.id) {
-            save(data).then(res => {
-              if (res.code === 200) {
-                this.$message({
-                  message: "操作成功",
-                  type: "success"
-                });
-                this.$emit("refresh-table");
-                this.promotionFormVisible = false;
+      let { id, version } = this.promotion;
+      fetchDetailByIdAndVersion({ id, version })
+        .then(res => {
+          // 促销配置信息
+          const { priceRule, productTags, giveProductCollects } = res.data;
+          this.promotion = { ...priceRule, productTags };
+          if (priceRule.valueType === 1) {
+            let number = priceRule.numericValue * 100;
+            // this.promotion.discountNumber = number;
+            this.$set(this.promotion, "discountNumber", number);
+          }
+          if (priceRule.purchaseRequire === 3) {
+            // this.promotion.quantity = priceRule.requireValue;
+            this.$set(this.promotion, "quantity", priceRule.requireValue);
+          } else if (priceRule.purchaseRequire === 2) {
+            // this.promotion.miniAmount = priceRule.requireValue;
+            this.$set(this.promotion, "miniAmount", priceRule.requireValue);
+          }
+          // 购买类型
+          const targetType = i18n
+            .t("label.promotionBuyTyper")
+            .find(item => item.value === priceRule.targetType);
+          if (targetType && targetType.label) {
+            this.$set(this.promotion, "purchaseType", targetType.label);
+          }
+          // 顾客购买商品类型
+          const productBuyType = i18n
+            .t("label.promotionCustomerGetType")
+            .find(item => item.value === priceRule.targetSelectionType);
+          if (productBuyType && productBuyType.label) {
+            this.$set(this.promotion, "productBuyType", productBuyType.label);
+          }
+          // 顾客得到商品类型
+          const productType = i18n
+            .t("label.promotionCustomerGetType")
+            .find(item => item.value === priceRule.customerGetType);
+          if (productType && productType.label) {
+            this.$set(this.promotion, "productType", productType.label);
+          }
+          // 组合
+          const {
+            combineWithOrder,
+            combineWithProduct,
+            combineWithShipping,
+            targetShopifyProductSpu,
+            targetShopifySku,
+            targetSelectionType,
+            customerGetType,
+            getTargetShopifyProductSpu,
+            getTargetShopifySku,
+            customerGetOrderUsageLimit,
+            codeUsageLimit
+          } = priceRule;
+          let combinationArr = [];
+          if (combineWithOrder) {
+            combinationArr.push(i18n.t("label.combinationList")[1].value);
+          }
+          if (combineWithProduct) {
+            combinationArr.push(i18n.t("label.combinationList")[0].value);
+          }
+          if (combineWithShipping) {
+            combinationArr.push(i18n.t("label.combinationList")[2].value);
+          }
+          this.usageLimitchecked = !!customerGetOrderUsageLimit;
+          this.codeUsageLimitchecked = !!codeUsageLimit;
+          this.$set(this.promotion, "combination", combinationArr);
+          // 折扣适用  1特定系列  其他2,3 特定商品
+          let tagLists = [];
+          if (targetSelectionType === 1) {
+            tagLists = productTags.map(item => {
+              let data = [];
+              if (item.spu) {
+                data = item.spu.split(",");
               }
+              item.spus = data;
+              return item;
             });
           } else {
-            update(data).then(res => {
-              if (res.code === 200) {
-                this.$message({
-                  message: "操作成功",
-                  type: "success"
-                });
-                this.$emit("refresh-table");
-                this.promotionFormVisible = false;
+            // 特地商品
+            if (targetShopifySku) {
+              const spusSKU = targetShopifySku.split(",");
+              tagLists.push({ title: "", spus: spusSKU });
+            }
+            if (targetShopifyProductSpu) {
+              const spusId = targetShopifyProductSpu.split(",");
+              tagLists.push({ title: "", spus: spusId });
+            }
+          }
+          this.tagLists = tagLists;
+          // 折扣得到条件   1 特定系列  2 特定商品
+          let getTagList = [];
+          if (customerGetType === 1) {
+            giveProductCollects.forEach(item => {
+              if (item.spu) {
+                const arr = item.spu.split(",");
+                getTagList.push.apply(getTagList, arr);
               }
             });
+          } else {
+            // 特地商品
+            if (getTargetShopifySku) {
+              const skus = getTargetShopifySku.split(",");
+              getTagList.push.apply(getTagList, skus);
+            }
+            if (getTargetShopifyProductSpu) {
+              const spus = getTargetShopifyProductSpu.split(",");
+              getTagList.push.apply(getTagList, spus);
+            }
           }
-        }
-      });
-    },
-    handleChangeParticipateType(e) {
-      this.conditionTypeArr.forEach(item => {
-        item.disabled = false;
-      });
-      this.promotion.conditionType = "";
-      this.promotion.conditionValue = "";
-      if (e === "gift_money" || e === "gift_qty") {
-        this.conditionTypeArr[2].disabled = true;
-      } else if (e === "gift_consumer") {
-        // gift_consumer
-        this.conditionTypeArr[0].disabled = true;
-        this.conditionTypeArr[1].disabled = true;
-        this.promotion.conditionType = this.conditionTypeArr[2].value;
-      }
+          this.getTagList = getTagList;
+        })
+        .finally(() => {
+          this.pageLoad = false;
+        });
     }
   }
 };
@@ -679,7 +711,7 @@ export default {
       }
       .mininput {
         margin-right: 30px;
-        width: 142px !important;
+        width: 180px !important;
       }
       .checkboxinput {
         margin-left: 20px;
@@ -692,11 +724,20 @@ export default {
       }
       &.product {
         margin-top: 26px;
+        .label {
+          margin-bottom: 10px;
+        }
         .mininput {
           margin-right: 20px;
+          margin-bottom: 10px;
+        }
+        .row {
+          flex-wrap: wrap;
         }
         .collectioninput {
           margin-right: 20px;
+          min-width: 220px !important;
+          width: auto !important;
           /deep/.el-input-group__append {
             color: #ae8877;
             border-left: none;
@@ -711,6 +752,9 @@ export default {
             border-right: none;
           }
         }
+        .value {
+          margin-bottom: 10px;
+        }
       }
     }
     .discount {
@@ -728,5 +772,35 @@ export default {
       }
     }
   }
+  .value {
+    position: relative;
+    min-width: 300px;
+    height: 36px;
+    padding: 0px 6px;
+    font-size: 12px;
+    margin-right: 13px;
+    color: #c0c4cc;
+    background: #f5f7fa;
+    border-radius: 3px;
+    border: 1px solid #dcdfe6;
+    p {
+      line-height: 12px;
+      padding-right: 130px;
+      overflow: hidden;
+      text-overflow: ellipsis;
+      white-space: nowrap;
+    }
+    a {
+      position: absolute;
+      right: 10px;
+      top: 0%;
+      color: #ae8877;
+    }
+  }
+  .customerQualification {
+    .mininput {
+      margin-bottom: 30px;
+    }
+  }
 }
 </style>

+ 0 - 91
src/views/oms/promotion/buyXGetYDiscount/promotionLogList.vue

@@ -1,91 +0,0 @@
-<template>
-  <div>
-    <el-dialog append-to-body width="355px" :visible.sync="dialogFormVisible">
-      <div class="box">
-        <p>
-          <a href="javascript:void(0)" @click="handleDetail"> 查看版本V2</a>
-          更新时间 2025-01-24
-        </p>
-      </div>
-      <template slot="footer">
-        <el-button @click="dialogFormVisible = false"
-          >{{ $t("tagsView.close") }}
-        </el-button>
-      </template>
-    </el-dialog>
-  </div>
-</template>
-
-<script>
-import waves from "@/directive/waves"; // 水波纹指令
-import ElContainer from "element-ui/packages/container/src/main";
-import { promotionLogs } from "@/api/oms/order/promotion";
-
-export default {
-  inject: ["reload"], //刷新
-  components: {
-    ElContainer
-  },
-  name: "promotionLogList",
-  directives: {
-    waves
-  },
-  data() {
-    return {
-      dialogFormVisible: false,
-      list: [],
-      listLoading: false,
-      listQuery: {}
-    };
-  },
-  created() {},
-  computed: {},
-  methods: {
-    handleOpen(id) {
-      this.listQuery.promotionId = id;
-      this.dialogFormVisible = true;
-      this.retPage();
-    },
-    getList() {
-      this.listLoading = true;
-      promotionLogs(this.listQuery)
-        .then(response => {
-          if (response.code === 200) {
-            this.list = response.data.list;
-            setTimeout(() => {
-              this.listLoading = false;
-            }, 0.5 * 1000);
-          }
-        })
-        .catch(() => {
-          setTimeout(() => {
-            this.listLoading = false;
-          }, 0.5 * 1000);
-        });
-    },
-    handleDetail(t) {
-      let id = this.listQuery.promotionId;
-      this.$emit("show", id);
-    },
-    retPage() {
-      this.getList();
-    }
-  }
-};
-</script>
-
-<style scoped lang="scss">
-.box {
-  max-height: 350px;
-  overflow-y: auto;
-  p {
-    margin-left: 23px;
-    color: #9f9f9f;
-    line-height: 24px;
-    a {
-      color: #ae8877;
-      margin-right: 20px;
-    }
-  }
-}
-</style>

+ 6 - 6
src/views/oms/promotion/multiBuyDiscount/index.vue

@@ -19,7 +19,7 @@
             v-model="listQuery.requireValue"
             @keyup.enter.native="retPage"
           />
-          <el-select
+          <!-- <el-select
             v-model="listQuery.discountMethod"
             clearable
             class="filter-item"
@@ -33,7 +33,7 @@
               :label="item.label"
               :value="item.value"
             />
-          </el-select>
+          </el-select> -->
           <el-button
             v-waves
             v-has="'promotion:list'"
@@ -45,7 +45,7 @@
           </el-button>
           <el-button
             v-waves
-            v-has="'promotion:update'"
+            v-has="'priceRule:edit'"
             class="filter-item"
             type="primary"
             icon="el-icon-circle-plus-outline"
@@ -353,7 +353,7 @@ export default {
       total: null,
       listLoading: false,
       listQuery: {
-        discountMethod: null,
+        // discountMethod: null,
         title: null,
         requireValue: null,
         page: 1,
@@ -382,9 +382,9 @@ export default {
     purchaseRequire(row) {
       let { purchaseRequire, requireValue } = row;
       if (purchaseRequire === 2) {
-        return "$" + requireValue;
+        return "$ " + requireValue;
       } else if (purchaseRequire === 3) {
-        return requireValue + i18n.t("label.item");
+        return requireValue + " " + i18n.t("label.item");
       } else {
         return i18n.t("label.noRequirement");
       }

+ 89 - 52
src/views/oms/promotion/multiBuyDiscount/promotionForm.vue

@@ -18,6 +18,7 @@
           :model="promotion"
           label-width="210px"
           size="medium"
+          :rules="rules"
         >
           <!-- 设置活动基本信息 -->
           <div class="box base">
@@ -105,8 +106,6 @@
                   <el-radio-group
                     v-model="promotion.purchaseRequire"
                     :disabled="edit"
-                    @change="$forceUpdate()"
-                    @input="radioChange(['miniAmount', 'quantity'])"
                   >
                     <div class="item row">
                       <el-radio :label="3">{{
@@ -115,13 +114,11 @@
                       <el-form-item
                         v-if="promotion.purchaseRequire === 3"
                         prop="quantity"
-                        required
                       >
                         <el-input
                           class="mininput"
                           v-model.number="promotion.quantity"
                           :disabled="edit"
-                          @input="changeInput($event)"
                         >
                           <span slot="append">{{ $t("label.item") }}</span>
                         </el-input>
@@ -130,13 +127,11 @@
                       <el-form-item
                         v-if="promotion.purchaseRequire === 2"
                         prop="miniAmount"
-                        :rules="rules.miniAmount"
                       >
                         <el-input
                           class="mininput"
                           v-model.number="promotion.miniAmount"
                           :disabled="edit"
-                          @input="changeInput($event)"
                       /></el-form-item>
                     </div>
                   </el-radio-group>
@@ -152,8 +147,6 @@
                   <el-radio-group
                     v-model="promotion.valueType"
                     :disabled="edit"
-                    @change="$forceUpdate()"
-                    @input="radioChange(['discountNumber', 'discountMoney'])"
                   >
                     <div class="item row">
                       <el-radio :label="1">{{
@@ -162,13 +155,11 @@
                       <el-form-item
                         v-if="promotion.valueType === 1"
                         prop="discountNumber"
-                        :rules="rules.discountNumber"
                       >
                         <el-input
                           class="mininput"
                           v-model.number="promotion.discountNumber"
                           :disabled="edit"
-                          @input="changeInput($event)"
                         >
                           <span slot="append"> % OFF </span>
                         </el-input>
@@ -177,13 +168,11 @@
                       <el-form-item
                         v-if="promotion.valueType === 2"
                         prop="discountMoney"
-                        :rules="rules.discountMoney"
                       >
                         <el-input
                           class="mininput"
                           v-model.number="promotion.discountMoney"
                           :disabled="edit"
-                          @input="changeInput($event)"
                         />
                       </el-form-item>
                       <!-- <el-radio :label="3">{{ $t("label.free") }}</el-radio> -->
@@ -207,21 +196,25 @@
                 prop="tags"
                 required
                 label-width="140px"
+                class="productinfo"
               >
                 <el-checkbox class="productcheckbox" v-model="checked">{{
                   $t("label.specifyProductTag")
                 }}</el-checkbox>
                 <el-select
                   multiple
+                  filterable
+                  clearable
+                  size="medium"
                   v-model="promotion.tags"
                   @change="handleChangeProductRange"
                   :disabled="edit"
                 >
                   <el-option
                     :key="index"
-                    v-for="(item, index) in $t('label.participateTypeArr')"
-                    :label="item.label"
-                    :value="item.value"
+                    v-for="(item, index) in productTagList"
+                    :label="item"
+                    :value="item"
                   />
                 </el-select>
               </el-form-item>
@@ -260,30 +253,33 @@
           </div>
         </el-form>
       </div>
-      <template slot="footer">
-        <el-button
-          @click="
-            resetData();
-            promotionFormVisible = false;
-          "
-          >{{ $t("view.cancel") }}
-        </el-button>
-        <!-- 未审核时/审核驳回 状态可进行提交 -->
-        <el-button
-          type="primary"
-          :loading="submitLoading"
-          @click="handleSaveOrUpdate"
-          :disabled="edit"
-          >{{ $t("view.confirm") }}
-        </el-button>
-      </template>
     </div>
+    <template slot="footer">
+      <el-button
+        @click="
+          resetData();
+          promotionFormVisible = false;
+        "
+        >{{ $t("view.cancel") }}
+      </el-button>
+      <!-- 未审核时/审核驳回 状态可进行提交 -->
+      <el-button
+        type="primary"
+        :loading="submitLoading"
+        @click="handleSaveOrUpdate"
+        :disabled="edit"
+        >{{ $t("view.confirm") }}
+      </el-button>
+    </template>
   </el-dialog>
 </template>
 
 <script>
 import waves from "@/directive/waves"; // 水波纹指令
-import { getById, save, storeList, update } from "@/api/oms/order/promotion";
+import {
+  getProductTagList,
+  getProductBuyTag
+} from "@/api/oms/order/multiBuyDiscount";
 import {
   fetchDetailByIdAndVersion,
   updateMutiDiscount
@@ -314,6 +310,10 @@ export default {
         quantity: [
           {
             required: true,
+            message: "quantity is require"
+          },
+          {
+            pattern: /^[1-9]\d*$/,
             message: "quantity is the number"
           }
         ],
@@ -321,18 +321,30 @@ export default {
           {
             required: true,
             message: "amount is require"
+          },
+          {
+            pattern: /^[1-9]\d*$/,
+            message: "amount is the number"
           }
         ],
         discountNumber: [
           {
             required: true,
-            message: "discount is require"
+            message: "discount is greater than 0 and less than 100"
+          },
+          {
+            pattern: /^(100|[1-9]?[0-9])$/,
+            message: "quantity is greater than 0 and less than 100"
           }
         ],
         discountMoney: [
           {
             required: true,
             message: "amount is require"
+          },
+          {
+            pattern: /^[1-9]\d*$/,
+            message: "amount is the number"
           }
         ]
       },
@@ -344,7 +356,7 @@ export default {
         startTime: "",
         endTime: "",
         discountMethod: 2,
-        purchaseRequire: null,
+        purchaseRequire: "",
         quantity: null,
         miniAmount: null,
         discountMoney: null,
@@ -352,29 +364,23 @@ export default {
         tags: []
       },
       edit: true,
-      storeList: [],
+      productTagList: [],
       noDataText: "加载中",
       pageLoad: false,
       checked: true
     };
   },
   methods: {
-    radioChange(key) {
-      this.$refs.promotionFormRef.clearValidate(key);
-    },
-    changeInput(e) {
-      this.$forceUpdate();
-    },
-    getStoreList() {
-      storeList().then(res => {
+    getProductTagList() {
+      getProductTagList().then(res => {
         if (res.code === 200) {
-          this.storeList = res.data;
+          this.productTagList = res.tagList;
         }
       });
     },
     async showDialog(id, edit, version) {
       this.edit = edit;
-      await this.getStoreList();
+      await this.getProductTagList();
       if (id) {
         // 修改配置
         this.promotion.id = id;
@@ -433,16 +439,21 @@ export default {
           this.promotion = { ...priceRule, productTags };
           if (priceRule.valueType === 1) {
             let number = priceRule.numericValue * 100;
-            this.promotion.discountNumber = number;
+            // this.promotion.discountNumber = number;
+            this.$set(this.promotion, "discountNumber", number);
           } else if (priceRule.valueType === 2) {
-            this.promotion.discountMoney = priceRule.numericValue;
+            // this.promotion.discountMoney = priceRule.numericValue;
+            this.$set(this.promotion, "discountMoney", priceRule.numericValue);
           }
           if (priceRule.purchaseRequire === 3) {
-            this.promotion.quantity = priceRule.requireValue;
+            // this.promotion.quantity = priceRule.requireValue;
+            this.$set(this.promotion, "quantity", priceRule.requireValue);
           } else if (priceRule.purchaseRequire === 2) {
-            this.promotion.miniAmount = priceRule.requireValue;
+            // this.promotion.miniAmount = priceRule.requireValue;
+            this.$set(this.promotion, "miniAmount", priceRule.requireValue);
           }
-          this.promotion.tags = productTags.map(item => item.title);
+          const tags = productTags.map(item => item.title);
+          this.$set(this.promotion, "tags", tags);
           this.tagLists = productTags.map(item => {
             let data = [];
             if (item.spu) {
@@ -501,8 +512,23 @@ export default {
         }
       });
     },
+    // 选择商品标签 获取商品sku
     handleChangeProductRange(e) {
-      console.log(e);
+      if (e.length > 0) {
+        const query = e.join(",");
+        getProductBuyTag({ tags: query }).then(res => {
+          let data = [];
+          if (res.code === 200) {
+            for (let key in res.result) {
+              data.push({
+                title: key,
+                spus: res.result[key]
+              });
+            }
+          }
+          this.tagLists = data;
+        });
+      }
     }
   }
 };
@@ -586,6 +612,17 @@ export default {
   .productcheckbox {
     margin-right: 10px;
   }
+  .productinfo {
+    // display: flex;
+    // align-items: flex-start;
+    /deep/.el-form-item__content {
+      display: flex;
+      align-items: flex-start;
+    }
+    /deep/.el-select__tags {
+      max-width: 300px !important;
+    }
+  }
   .skutitle {
     min-width: 300px;
     max-width: 400px;

+ 20 - 27
src/views/oms/promotion/multiBuyDiscount/promotionLogList.vue

@@ -1,21 +1,19 @@
 <template>
-  <div>
-    <el-dialog append-to-body width="420px" :visible.sync="dialogFormVisible">
-      <div class="box" v-loading="listLoading" v-has="'priceRule:detail'">
-        <p v-for="(data, i) in list" :key="i">
-          <a href="javascript:void(0)" @click="handleDetail(data)">
-            {{ $t("label.viewVersion") }} V{{ data.version }}</a
-          >
-          {{ $t("label.updateTime") }} {{ data.updateTime }}
-        </p>
-      </div>
-      <template slot="footer">
-        <el-button @click="dialogFormVisible = false"
-          >{{ $t("tagsView.close") }}
-        </el-button>
-      </template>
-    </el-dialog>
-  </div>
+  <el-dialog append-to-body width="420px" :visible.sync="dialogFormVisible">
+    <div class="box" v-loading="listLoading" v-has="'priceRule:detail'">
+      <p v-for="(data, i) in list" :key="i">
+        <a href="javascript:void(0)" @click="handleDetail(data)">
+          {{ $t("label.viewVersion") }} V{{ data.version }}</a
+        >
+        {{ $t("label.updateTime") }} {{ data.updateTime }}
+      </p>
+    </div>
+    <template slot="footer">
+      <el-button @click="dialogFormVisible = false"
+        >{{ $t("tagsView.close") }}
+      </el-button>
+    </template>
+  </el-dialog>
 </template>
 
 <script>
@@ -37,11 +35,11 @@ export default {
       dialogFormVisible: false,
       list: [],
       listLoading: false,
-      listQuery: {}
+      listQuery: {
+        promotionId: null
+      }
     };
   },
-  created() {},
-  computed: {},
   methods: {
     handleOpen(id) {
       this.listQuery.promotionId = id;
@@ -54,15 +52,10 @@ export default {
         .then(response => {
           if (response.code === 200) {
             this.list = response.data;
-            setTimeout(() => {
-              this.listLoading = false;
-            }, 0.5 * 1000);
           }
         })
-        .catch(() => {
-          setTimeout(() => {
-            this.listLoading = false;
-          }, 0.5 * 1000);
+        .finally(() => {
+          this.listLoading = false;
         });
     },
     handleDetail(data) {

+ 110 - 33
src/views/oms/refund/components/createRefundDialog.vue

@@ -583,6 +583,25 @@
                   </div>
                 </template>
               </el-table-column>
+              <el-table-column
+                :label="$t('label.needPayWithCustomers')"
+                width="150"
+                align="center"
+              >
+                <template slot-scope="scope">
+                  <div v-if="multipleSelection.indexOf(scope.row) == -1">
+                    <div>0</div>
+                  </div>
+                  <div v-else>
+                    <el-input-number
+                      v-model="scope.row.paidAmount"
+                      size="mini"
+                      :min="0.0"
+                      :max="scope.row.totalFee"
+                    ></el-input-number>
+                  </div>
+                </template>
+              </el-table-column>
               <el-table-column
                 :label="$t('label.refundReason')"
                 width="150"
@@ -700,45 +719,40 @@
           <div>
             <el-table
               :key="tableKey"
-              :data="tableOrderDeatils"
+              :data="returnPreviewDatas"
               row-key="id"
               stripe
               border
               fit
               highlight-current-row
             >
-              <el-table-column type="index" width="40"></el-table-column>
+              <el-table-column type="index" width="40" />
               <el-table-column
                 :label="$t('multipleDiscountInfo.OriginalDiscount')"
                 align="center"
-                prop="OriginalDiscount"
-              >
-              </el-table-column>
+                prop="originTip"
+              />
               <el-table-column
                 :label="$t('multipleDiscountInfo.OriginalMoneny')"
                 align="center"
-                prop="OriginalMoneny"
+                prop="originalOrderAmount"
               >
                 <template slot-scope="scope">
-                  {{ scope.row.OriginalMoneny }}
+                  {{ scope.row.currency }} {{ scope.row.originalOrderAmount }}
                 </template>
               </el-table-column>
               <el-table-column
                 :label="$t('multipleDiscountInfo.afterReturnDiscount')"
                 align="center"
-                prop="afterReturnDiscount"
-              >
-                <template slot-scope="scope">
-                  {{ scope.row.afterReturnDiscount }}
-                </template>
-              </el-table-column>
+                prop="currentTip"
+              />
               <el-table-column
                 :label="$t('multipleDiscountInfo.afterReturnMoney')"
                 align="center"
-                prop="afterReturnMoney"
+                prop="CurrentOrderAmount"
               >
                 <template slot-scope="scope">
-                  {{ scope.row.afterReturnMoney }}
+                  {{ scope.row.currency }} {{ scope.row.CurrentOrderAmount }}
                 </template>
               </el-table-column>
               <el-table-column
@@ -747,7 +761,7 @@
                 prop="returnMoney"
               >
                 <template slot-scope="scope">
-                  {{ scope.row.returnMoney }}
+                  {{ returnAmount(scope.row) }}
                 </template>
               </el-table-column>
               <el-table-column
@@ -756,7 +770,7 @@
                 prop="needPayMoney"
               >
                 <template slot-scope="scope">
-                  {{ scope.row.needPayMoney }}
+                  {{ needPayMoney(scope.row) }}
                 </template>
               </el-table-column>
             </el-table>
@@ -797,11 +811,12 @@ import { getDetailListForRefund, statusKeyValue } from "@/api/oms/order/order";
 import {
   saveRefundNew,
   validPromotionReq,
-  warehouseList
+  warehouseList,
+  checkRefundVersions,
+  checkSubmitRefund
 } from "@/api/oms/refund/refund";
 import { BigNumber } from "bignumber.js";
 import { write } from "xlsx";
-
 import tableEdit from "./tableEdit";
 
 export default {
@@ -841,6 +856,7 @@ export default {
       show: false,
       tableOrderDeatils: [],
       multipleSelection: [],
+      returnPreviewDatas: [], // 勾选后,退款预览数据
       addRefundForm: {
         refundMethod: "system",
         refundAccountType: "PayPal",
@@ -876,7 +892,8 @@ export default {
       refundReasonAss: "",
       refundOtherReasonAss: "",
       otherReasonFlag: "",
-      tableKey: Math.random()
+      tableKey: Math.random(),
+      refundVersion: 1 //默认新版本
     };
   },
   created() {
@@ -889,11 +906,30 @@ export default {
       return {
         "X-Token": getToken()
       };
+    },
+    returnAmount(row) {
+      const { originalOrderAmount, CurrentOrderAmount } = row;
+      const val = originalOrderAmount - CurrentOrderAmount;
+      return val > 0 ? val : 0;
+    },
+    needPayMoney(row) {
+      const { originalOrderAmount, CurrentOrderAmount } = row;
+      const val = originalOrderAmount - CurrentOrderAmount;
+      return val < 0 ? Math.abs(val) : 0;
     }
   },
   methods: {
+    // 获取退款版本
+    getRefundVersion() {
+      checkRefundVersions().then(res => {
+        if (res.code === 200) {
+          this.refundVersion = res.data.RefundVersionsEntity.versions;
+        }
+      });
+    },
     getDetail(idList) {
       this.ShippingLabelOption();
+      this.getRefundVersion();
       //非空判断
       if (!this.listQuery.ormorder && !this.listQuery.shopify) {
         this.$message.error("网店单号和shopify单号不能同时为空");
@@ -1011,24 +1047,61 @@ export default {
         .toNumber()
         .toFixed(2);
     },
+    // 重新计算退款的金额
+    reCalReturn(data) {
+      const formData = {
+        ormOrderId: this.queryOrmorder,
+        promotionRefundDetails: data.map(item => {
+          return {
+            soOrderId: item.ordersId,
+            orderItemId: item.orderitemld,
+            ormOrderItemId: item.ormOrderItemId,
+            quantity: item.quantity
+          };
+        })
+      };
+      checkSubmitRefund(formData).then(res => {
+        if (res.code == 200) {
+          const { OrderPreview, OrderItemPreview } = res.data;
+          this.returnPreviewDatas = OrderPreview;
+          for (let k in this.multipleSelection) {
+            let row = this.multipleSelection[k];
+            let data = OrderItemPreview.find(
+              item => item.ormOrderItemId === row.ormOrderItemId
+            );
+            row.refundAmount = data.refundAmount;
+            row.paidAmount = data.paidAmount;
+          }
+        } else {
+          this.$message.error(res.msg);
+        }
+      });
+    },
+    // 当前选中的 退款金额
     handleSelectionChange(val) {
-      console.log("handleSelectionChange", val);
       this.refundAmount = 0;
       this.multipleSelection = val;
       if (this.multipleSelection && this.multipleSelection.length > 0) {
-        for (let uy in this.multipleSelection) {
-          var row = this.multipleSelection[uy];
-          row.refundAmount = BigNumber(row.totalFee)
-            .div(BigNumber(row.oldQuantity))
-            .multipliedBy(BigNumber(row.quantity))
-            .multipliedBy(BigNumber(row.refundSales))
-            .toNumber()
-            .toFixed(2);
+        // 如果是退款新版本,包含多件多折 需要重算退款金额
+        if (this.refundVersion === 1) {
+          this.reCalReturn(val);
+        } else {
+          // 老版本是前端计算
+          for (let uy in this.multipleSelection) {
+            var row = this.multipleSelection[uy];
+            row.refundAmount = BigNumber(row.totalFee)
+              .div(BigNumber(row.oldQuantity))
+              .multipliedBy(BigNumber(row.quantity))
+              .multipliedBy(BigNumber(row.refundSales))
+              .toNumber()
+              .toFixed(2);
+          }
         }
       } else {
         this.refundAmount = 0;
         this.addRefundForm.refundAmount = this.refundAmount;
       }
+
       this.jisuan();
     },
     refundAmountChange() {
@@ -1056,11 +1129,15 @@ export default {
           .toNumber()
           .toFixed(2)
       );
-      console.log(this.addRefundForm.refundTotalAmount, "总退款金额");
+      console.log(
+        this.taxAndShippingAmount,
+        this.addRefundForm.refundTotalAmount,
+        "总退款金额"
+      );
     },
-    // 重新计算退款的金额
-    reCalReturn() {},
     checkSelectable(row) {
+      // 虚拟商品不可选
+      // if (row.skuCode === "108C4G1V000BXS") return false;
       if (row.refundQuantity > 0) {
         var refcount = dcmSub(row.oldQuantity, row.refundQuantity);
         //发生退款
@@ -1071,6 +1148,7 @@ export default {
       } else {
         row["maxq"] = row.oldQuantity;
       }
+
       // if( row.status == "delivery" && (row.exchangePurchaseFlag == 1)){
       //   return false; //不可选择
       // }
@@ -1275,7 +1353,6 @@ export default {
           this.addRefundForm.items = items;
           //这里默认客服发起
           this.addRefundForm.originatorFlag = 1;
-          console.log(this.addRefundForm, "newobj");
           const saveRefund = () => {
             saveRefundNew(this.addRefundForm).then(
               res => {

+ 15 - 9
src/views/oms/refund/refundDetail.vue

@@ -488,26 +488,28 @@
       >
         <el-descriptions-item
           :label="$t('multipleDiscountInfo.OriginalDiscount')"
-          >2件9折</el-descriptions-item
+          >{{ refundInfo.originTip }}</el-descriptions-item
         >
         <el-descriptions-item
           :label="$t('multipleDiscountInfo.OriginalMoneny')"
-          >{{ addressInfo.receiverState }}</el-descriptions-item
+          >{{ refundInfo.originalOrderAmount }}</el-descriptions-item
         >
         <el-descriptions-item
           :label="$t('multipleDiscountInfo.afterReturnDiscount')"
-          >{{ addressInfo.receiverCity }}</el-descriptions-item
+          >{{ refundInfo.currentTip }}</el-descriptions-item
         >
         <el-descriptions-item
           :label="$t('multipleDiscountInfo.afterReturnMoney')"
-          >{{ addressInfo.receiverCity }}</el-descriptions-item
+          >{{ refundInfo.CurrentOrderAmount }}</el-descriptions-item
+        >
+        <el-descriptions-item :label="$t('multipleDiscountInfo.returnMoney')">
+          {{ returnAmount > 0 ? returnAmount : 0 }}</el-descriptions-item
         >
-        <el-descriptions-item :label="$t('multipleDiscountInfo.returnMoney')">{{
-          addressInfo.receiverCity
-        }}</el-descriptions-item>
         <el-descriptions-item
           :label="$t('multipleDiscountInfo.needPayMoney')"
-          >{{ addressInfo.receiverCity }}</el-descriptions-item
+          >{{
+            returnAmount < 0 ? Math.abs(returnAmount) : 0
+          }}</el-descriptions-item
         >
       </el-descriptions>
     </el-card>
@@ -679,7 +681,8 @@ export default {
       refundReasons: [],
       slUseAble: "0",
       shippingLabelMessage: "",
-      showSlChooseLabel: 0 //是否展示选择使用sl标签 0 否 1 是
+      showSlChooseLabel: 0, //是否展示选择使用sl标签 0 否 1 是
+      returnAmount: 0 //应退款金额
     };
   },
   filters: {
@@ -880,6 +883,9 @@ export default {
             this.refundInfo = res.data;
             this.orderItemInfo = res.data.items;
             this.logs = res.data.logItems;
+            // 计算需要
+            const { originalOrderAmount, CurrentOrderAmount } = res.data;
+            this.returnAmount = originalOrderAmount - CurrentOrderAmount;
 
             //获取收退货仓库列表
             this.getShippingLabelAmount(this.refundInfo, "");

+ 12 - 2
vue.config.js

@@ -55,6 +55,7 @@ module.exports = {
       //   target: "https://testfoms.gloria.com.cn",
       //   changeOrigin: true
       // },
+      //http://10.41.3.152:18081  http://10.41.3.65:19090
       // [process.env.VUE_APP_OAUTH_API]: {
       //   target: `http://10.41.3.65:19090/sso`,
       //   changeOrigin: true,
@@ -64,7 +65,7 @@ module.exports = {
       //   }
       // },
       // [process.env.VUE_APP_PIM_API]: {
-      //   target: `http://10.41.3.65:18080/pim`,
+      //   target: `http://10.41.3.65:18081/pim`,
       //   changeOrigin: true,
       //   // logLevel: 'debug', //打印日志
       //   pathRewrite: {
@@ -78,7 +79,16 @@ module.exports = {
       //   pathRewrite: {
       //     ['^' + process.env.VUE_APP_OMS_API]: ''
       //   }
-      // }
+      // },
+      // [process.env.VUE_APP_OMS_API]: {   廖望
+      //   target: `http://10.41.3.152:18081/oms`,
+      //   changeOrigin: true,
+      //   // logLevel: 'debug', //打印日志
+      //   pathRewrite: {
+      //     ['^' + process.env.VUE_APP_OMS_API]: ''
+      //   }
+      // },
+
     }
   },
   // webpack配置