Forráskód Böngészése

Merge branch 'dev' into 'test'

Dev

See merge request quanshu/mp-ui-pc!255
世轩 3 éve
szülő
commit
5a532f823c

+ 27 - 3
src/views/business/goods/add.vue

@@ -119,6 +119,20 @@
             </el-input>
           </el-form-item>
         </el-col>
+        <el-col :span="23">
+          <el-form-item label="回收折扣:" prop="discountRate">
+            <el-input v-model="addData.discountRate" type="number" placeholder="请输入回收折扣">
+              <template slot="append">%</template>
+            </el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="23">
+          <el-form-item label="盲豆划线价:" >
+            <el-input v-model="addData.originPrice" type="number" placeholder="请输入盲豆数量">
+              <template slot="append">盲豆</template>
+            </el-input>
+          </el-form-item>
+        </el-col>
         <el-col :span="23">
           <el-form-item label="采购价格:" prop="cost">
             <el-input v-model="addData.cost" type="number" placeholder="请输入商品采购价格">
@@ -192,7 +206,8 @@ export default {
       goodsTagItemsList: [],
       addData: {
         multiSku: 0,
-        description: ''
+        description: '',
+        originPrice: 0
       },
       createShow:false,
       rules: {
@@ -210,6 +225,15 @@ export default {
           { required: true,message:'请输入盲豆数量', trigger: 'blur' },
           { pattern: /^([1-9]\d*)$/, message: "请输入正确盲豆数量", trigger: ["blur", "change"] }
         ],
+        discountRate: [
+          { required: true,message:'请输入回收折扣', trigger: 'blur' },
+          {
+            pattern:
+              /^([1-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/,
+            message: "请输入合法的数字,最多两位小数",
+            trigger: ["blur", "change"],
+          },
+        ],
         cost: [
           { required: false, message: '请输入采购价格', trigger: 'blur' },
           { pattern: /^([1-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/, message: "请输入正确的金额,最多两位小数", trigger: ["blur", "change"] }
@@ -254,11 +278,11 @@ export default {
     this.getGoodsTagItems()
     if (this.id) {
       getGoodsDetail(this.id).then(res => {
-        const { goodsId, title, goodsCode, picUrl,merchantInfo, exchangeShow, multiSku, value, exchangePrice, cost, quantity, description, skuList, categoryId, supplierId, shoppingLink, tagIds } = res.data
+        const { goodsId, title, goodsCode, picUrl,merchantInfo, exchangeShow, multiSku, value, exchangePrice, originPrice, discountRate, cost, quantity, description, skuList, categoryId, supplierId, shoppingLink, tagIds } = res.data
         this.addData = {
           value: accDiv(value, 100),
           cost: cost == '' || cost == null ? '' : accDiv(cost, 100),
-          goodsId, title, goodsCode, picUrl,merchantInfo, exchangeShow, multiSku, exchangePrice, quantity, description, skuList, categoryId, supplierId, shoppingLink, tagIds
+          goodsId, title, goodsCode, picUrl,merchantInfo, exchangeShow, multiSku, exchangePrice, discountRate, originPrice, quantity, description, skuList, categoryId, supplierId, shoppingLink, tagIds
         }
         if(description) {
           this.$refs.editor.setContent(description)

+ 11 - 1
src/views/business/goods/components/spec.vue

@@ -40,6 +40,7 @@
           <th rowspan="2" class="required"><span>*</span>名称</th>
           <th rowspan="2" class="required"><span>*</span>价格(元)</th>
           <th rowspan="2" class="required"><span>*</span>兑换盲豆数量</th>
+          <th rowspan="2">盲豆划线价</th>
           <th rowspan="2">采购价格(元)</th>
           <th rowspan="2">SKU编码</th>
           <th rowspan="2" class="required"><span>*</span>库存</th>
@@ -74,6 +75,12 @@
               <el-input v-model="sku.exchange" />
             </el-form-item>
           </td>
+<!--          1111111111111111111111-->
+          <td class="pd">
+            <el-form-item :prop="`skuList.${index}.originPrice`">
+              <el-input v-model="sku.originPrice" />
+            </el-form-item>
+          </td>
           <td class="pd">
             <el-form-item :prop="`skuList.${index}.costY`" :rules="costYRules">
               <el-input v-model="sku.costY" />
@@ -169,6 +176,7 @@ export default {
       this.skuList = sku.map(item => {
         this.$set(item, 'valueY', accDiv(item.value, 100))
         this.$set(item, 'exchange', accDiv(item.exchangePrice,1))
+        this.$set(item, 'originPrice', accDiv(item.originPrice,1))
         this.$set(item, 'costY', item.cost == null ? '' : accDiv(item.cost, 100) )
         this.$set(item, 'picUrlArr', item.picUrl.split(',').map(item => { return { fileName: item }}))
         this.$set(item, 'status', !!item.quantity)
@@ -265,6 +273,7 @@ export default {
           valueY: 0.00,
           costY: '',
           skuCode:'',
+          originPrice: 0,
           quantity: 0,
           status: true,
           properties
@@ -300,9 +309,10 @@ export default {
       this.$refs.sku.validate((valid, items) => {
         if (valid) {
           this.skuList.forEach(item => {
-            const { valueY,exchange, costY } = item
+            const { valueY,exchange, costY, originPrice } = item
             item.value = accMul(valueY, 100)
             item.exchangePrice = accMul(exchange, 1)
+            item.originPrice = accMul(originPrice, 1)
             item.cost = costY == '' ? '' : accMul(costY, 100)
             item.picUrl = item.picUrlArr.map(item => { return item.fileName }).toString()
           })

+ 47 - 16
src/views/business/ticket/components/AwardsList.vue

@@ -5,6 +5,11 @@
           <div>奖级名称:{{ item.name }}</div>
           <div>奖级:{{ item.sort }}</div>
           <div>
+            关联奖级:<el-select v-model="item.awardsLabel" style="width: 120px;">
+            <el-option v-for="(item,index) in awardsLabelList"  :label="item.dictLabel" :value="item.dictLabel" :key="index"/>
+          </el-select>
+          </div>
+          <div v-if="ticketType == 'offline'">
             奖级数量:
             <el-input-number
               v-model="item.quantity"
@@ -15,6 +20,7 @@
               :disabled="item.isEdit"
             ></el-input-number>
           </div>
+          <div v-else>奖级数量:{{ item.quantity }}</div>
         </div>
         <div class="prize-table">
           <el-table :data="item.prizeList" class="el-table">
@@ -42,31 +48,32 @@
                 <div v-if="scope.row.prizeType == 'coin'">盲豆</div>
               </template>
             </el-table-column>
-            <el-table-column label="排序" prop="sortWeight">
+            <el-table-column label="奖品数量" prop="quantity" v-if="ticketType != 'offline'">
               <template slot-scope="scope">
                 <div>
                   <el-input-number
-                    v-model="scope.row.sortWeight"
+                    v-model="scope.row.quantity"
                     controls-position="right"
-                    :min="0"
+                    @change="handleChange($event, index)"
+                    :min="1"
                     size="small"
                   ></el-input-number>
                 </div>
               </template>
             </el-table-column>
-            <!-- <el-table-column label="奖品数量" prop="storeName">
+            <el-table-column label="排序" prop="sortWeight">
               <template slot-scope="scope">
                 <div>
                   <el-input-number
-                    v-model="scope.row.quantity"
+                    v-model="scope.row.sortWeight"
                     controls-position="right"
-                    @change="handleChange($event, index)"
-                    :min="1"
+                    :min="0"
                     size="small"
                   ></el-input-number>
                 </div>
               </template>
-            </el-table-column> -->
+            </el-table-column>
+
             <el-table-column label="操作" align="center">
               <template slot-scope="scope">
                 <el-button
@@ -106,7 +113,8 @@ export default {
   },
   data() {
     return {
-      prizeIndex: null, // 奖级下标
+      awardsLabelList: [],//关联奖级列表
+      prizeIndex: 0, // 奖级下标
       // 奖级列表
       awardsList: [
         {
@@ -182,9 +190,19 @@ export default {
           prizeList: [],
         },
       ],
+      ticketType: '',
     };
   },
+  created() {
+    this.getAwardsLabelList()
+  },
   methods: {
+    //获取关联奖级
+    getAwardsLabelList(){
+      this.getDicts('awards_label').then(res=>{
+        this.awardsLabelList = res.data
+      })
+    },
     // 添加奖品
     add(type, item) {
       if(type == 1) {
@@ -196,6 +214,13 @@ export default {
       }
       this.$emit('input', this.awardsList)
       this.$emit('close')
+      if (this.ticketType != 'offline') {
+        this.getQuantity();
+      }
+    },
+
+    changetype(e) {
+      this.ticketType = e
     },
 
     // 选择奖品种类
@@ -208,14 +233,18 @@ export default {
     handleChangeAll(e, item) {
       this.$set(item, "quantity", e);
       this.$forceUpdate();
-      // this.getQuantity();
+      if (this.ticketType != 'offline') {
+        this.getQuantity();
+      }
     },
 
     // 改变奖品数量
     handleChange(e, index) {
       this.prizeIndex = index;
       this.$forceUpdate();
-      // this.getQuantity();
+      if (this.ticketType != 'offline') {
+        this.getQuantity();
+      }
     },
 
     // 奖级商品删除
@@ -224,16 +253,18 @@ export default {
       let list = item.prizeList;
       list.splice(index, 1);
       this.$set(item, "prizeList", list);
-      // this.getQuantity();
+      if (this.ticketType != 'offline') {
+        this.getQuantity();
+      }
     },
 
     // 计算奖级数量
     getQuantity() {
       let num = 0;
-      this.awardsList[this.prizeIndex].prizeList.forEach((item) => {
-        num += item.quantity;
-      });
-      this.awardsList[this.prizeIndex].quantity = num;
+        this.awardsList[this.prizeIndex].prizeList.forEach((item) => {
+          num += item.quantity;
+        });
+        this.awardsList[this.prizeIndex].quantity = num;
     },
   },
 };

+ 2 - 2
src/views/business/ticket/components/CoinAdd.vue

@@ -61,7 +61,7 @@ export default {
     confirmCoin() {
       let coin = {
         prizeType: "coin",
-        // quantity: 1,
+        quantity: 1,
         title: `盲豆 x${this.coinForm.quantity}`,
         picUrl: publicFileGetUrl + "md.jpeg",
         coinValue: this.coinForm.quantity,
@@ -91,4 +91,4 @@ export default {
     width: 40px;
   }
 }
-</style>
+</style>

+ 1 - 1
src/views/business/ticket/components/CouponAdd.vue

@@ -142,7 +142,7 @@ export default {
       this.selectCouponList = e.map((item) => {
         return {
           prizeType: "coupon",
-          // quantity: 1,
+          quantity: 1,
           couponId: item.couponId,
           picUrl: item.picUrl,
           title: item.title,

+ 1 - 1
src/views/business/ticket/components/CouponPkgAdd.vue

@@ -113,7 +113,7 @@ export default {
       this.selectCouponPkgList = e.map((item) => {
         return {
           prizeType: "coupon_pkg",
-          // quantity: 1,
+          quantity: 1,
           id: item.id,
           picUrl: publicFileGetUrl + item.picUrl,
           title: item.title,

+ 1 - 1
src/views/business/ticket/components/GoodsAdd.vue

@@ -142,7 +142,7 @@ export default {
       this.selectGoodsList = e.map((item) => {
         return {
           prizeType: "goods",
-          // quantity: 1,
+          quantity: 1,
           goodsId: item.goodsId,
           picUrl: item.picUrl,
           title: item.title,

+ 45 - 3
src/views/business/ticket/create.vue

@@ -6,7 +6,7 @@
       <div class="base-info-form">
         <el-form :model="form" :rules="rules" ref="form" label-width="100px">
           <el-form-item label="盲票类型" prop="type">
-            <el-radio-group v-model="form.type" size="small" :disabled="form.disabled" @change="$refs['form'].clearValidate()">
+            <el-radio-group v-model="form.type" size="small" :disabled="form.disabled" @change="$refs['form'].clearValidate();changeType($event)">
               <el-radio label="online">线上盲票</el-radio>
               <el-radio label="offline">线下盲票</el-radio>
             </el-radio-group>
@@ -45,6 +45,20 @@
               <template slot="append">元</template>
             </el-input>
           </el-form-item>
+          <el-form-item
+            label="划线价"
+            prop="originPrice"
+            v-if="form.type != 'offline'"
+          >
+            <el-input
+              v-model="form.originPrice"
+              style="width: 240px"
+              size="small"
+              placeholder="请输入划线价"
+            >
+              <template slot="append">元</template>
+            </el-input>
+          </el-form-item>
           <el-form-item label="盲票总数" prop="quantity">
             <el-input
               v-model="form.quantity"
@@ -184,6 +198,7 @@ export default {
         pkgUnit: 200, // 张数
         pkgSalePrice: 0, // 单价
         saleCommRate: "", // 基数
+        originPrice: 0, //划线价
         disabled: false,
         saleChannelType: 1
       },
@@ -229,6 +244,11 @@ export default {
             trigger: ["blur", "change"],
           },
         ],
+        originPrice: [{
+          pattern: /^([0-9]\d*)$/,
+          message: "请输入合法的数字",
+          trigger: ["blur", "change"],
+        },],
         pkgUnit: [
           { required: true, message: "请输入每包张数", trigger: "blur" },
           {
@@ -297,7 +317,7 @@ export default {
         boxId: this.id
       }
       ticketBoxDetail(data).then(res => {
-        const { awardsList, type, title, picUrl, facePrice, salePrice, quantity, pkgUnit, pkgSalePrice, saleCommRate, saleChannelType, channelList } = res.data
+        const { awardsList, type, title, picUrl, facePrice, salePrice, quantity, originPrice, pkgUnit, pkgSalePrice, saleCommRate, saleChannelType, channelList } = res.data
         this.form = {
           disabled:true,
           title, picUrl, quantity, pkgUnit, saleCommRate, saleChannelType,
@@ -305,7 +325,8 @@ export default {
           type: JSON.parse(type).value,
           facePrice:accDiv(facePrice, 100),
           salePrice:accDiv(salePrice, 100),
-          pkgSalePrice:accDiv(pkgSalePrice, 100)
+          pkgSalePrice:accDiv(pkgSalePrice, 100),
+          originPrice:accDiv(originPrice, 100)
         }
         if(awardsList){
           awardsList.forEach((item) => {
@@ -317,6 +338,7 @@ export default {
           });
           this.$nextTick(() => {
             this.$refs.awards.add(3, awardsList)
+            this.$refs.awards.changetype(JSON.parse(type).value)
           })
           this.awardsList = awardsList
         }
@@ -402,11 +424,27 @@ export default {
             return item.quantity != 0;
           });
 
+          for (let i = 0; i < filterArr2.length; i++) {
+            if(filterArr2[i].awardsLabel == "" || filterArr2[i].awardsLabel == undefined){
+              this.$message.error("关联奖级不能为空");
+              return
+            }
+          }
+          if (this.form.type == "offline") {
+            this.form.originPrice = null
+            for (let i = 0; i < filterArr2.length; i++) {
+              for (let j = 0; j < filterArr2[i].prizeList; j++) {
+                filterArr2[i].prizeList[j].quantity = null
+              }
+            }
+          }
+
           let data = {
             ...this.form,
             facePrice: accMul(this.form.facePrice, 100),
             salePrice: accMul(this.form.salePrice, 100),
             pkgSalePrice: accMul(this.form.pkgSalePrice, 100),
+            originPrice: accMul(this.form.originPrice, 100),
             awardsList: filterArr2,
           };
 
@@ -450,6 +488,10 @@ export default {
       this.coinTableVisible = false;
     },
 
+    changeType(e) {
+      this.$refs.awards.changetype(e)
+    },
+
     // 添加奖品种类
     handleCommand(e) {
       if (e == "goods") {