Эх сурвалжийг харах

关联线下盲票商品、可选优惠券与券包

lsx 2 жил өмнө
parent
commit
68be7f0932

+ 8 - 13
src/views/business/ticket/components/AwardForm.vue

@@ -18,27 +18,27 @@
           </el-table-column>
           <el-table-column label="商品名称" prop="title" >
             <template slot-scope="{ row }">
-              <div v-if="row.prizeType == 'coin' && row.value >= 0">盲豆 x{{ row.value }}</div>
+              <div v-if="row.type == 'coin' && row.value >= 0">盲豆 x{{ row.value }}</div>
               <div v-else>{{ row.title }}</div>
             </template>
           </el-table-column>
           <el-table-column label="商品类型">
             <template slot-scope="scope">
-              <div v-if="scope.row.prizeType == 'goods'">商品</div>
-              <div v-if="scope.row.prizeType == 'coupon'">券</div>
-              <div v-if="scope.row.prizeType == 'coupon_pkg'">券包</div>
-              <div v-if="scope.row.prizeType == 'coin'">盲豆</div>
+              <div v-if="scope.row.type == 'goods'">商品</div>
+              <div v-if="scope.row.type == 'coupon'">券</div>
+              <div v-if="scope.row.type == 'coupon_pkg'">券包</div>
+              <div v-if="scope.row.type == 'coin'">盲豆</div>
             </template>
           </el-table-column>
           <el-table-column label="商品价格">
             <template slot-scope="scope">
-              <div v-if="scope.row.prizeType == 'goods'">¥{{ $numberFormat(scope.row.value) }}</div>
+              <div v-if="scope.row.type == 'goods'">¥{{ $numberFormat(scope.row.value) }}</div>
               <span v-else>--</span>
             </template>
           </el-table-column>
           <el-table-column label="商品成本">
             <template slot-scope="scope">
-              <div v-if="scope.row.prizeType == 'goods'">¥{{ $numberFormat(scope.row.cost) }}</div>
+              <div v-if="scope.row.type == 'goods'">¥{{ $numberFormat(scope.row.cost) }}</div>
               <span v-else>--</span>
             </template>
           </el-table-column>
@@ -102,12 +102,7 @@ export default {
   methods: {
     // 添加奖品
     add(type,item) {
-      if(type == 1) {
-        // this.goodsList[this.prizeIndex] = this.goodsList[this.prizeIndex].concat(item);
-        this.goodsList = item
-      } else if (type == 3) {
-        this.goodsList = item
-      }
+      this.goodsList = item
       this.$emit('input', this.goodsList)
       this.$emit('close')
     },

+ 20 - 9
src/views/business/ticket/components/CouponAdd.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <el-dialog
-      title="添加券奖品"
+      :title="iconic === 'couponForm'?'添加关联卡券':'添加券奖品'"
       width="1000px"
       :visible.sync="dialogVisible"
       :before-close="close"
@@ -151,14 +151,25 @@ export default {
     // 选中卡券
     handleSelectionCoupon(e) {
       this.selectCouponList = e.map((item) => {
-        return {
-          prizeType: "coupon",
-          quantity: 1,
-          couponId: item.couponId,
-          picUrl: item.picUrl,
-          title: item.title,
-          sortWeight: 100
-        };
+        if(this.iconic === 'couponForm'){
+          return {
+            type: "coupon",
+            quantity: 1,
+            refId: item.couponId,
+            picUrl: item.picUrl,
+            title: item.title,
+            sortWeight: 100
+          };
+        }else {
+          return {
+            prizeType: "coupon",
+            quantity: 1,
+            couponId: item.couponId,
+            picUrl: item.picUrl,
+            title: item.title,
+            sortWeight: 100
+          }
+        }
       });
     },
 

+ 21 - 9
src/views/business/ticket/components/CouponPkgAdd.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <el-dialog
-      title="添加券包奖品"
+      :title="iconic === 'couponPkgForm'?'添加关联券包':'添加券包奖品'"
       width="1000px"
       :visible.sync="dialogVisible"
       :before-close="close"
@@ -117,14 +117,26 @@ export default {
     // 选中券包
     handleSelectionCouponPkg(e) {
       this.selectCouponPkgList = e.map((item) => {
-        return {
-          prizeType: "coupon_pkg",
-          quantity: 1,
-          id: item.id,
-          picUrl: publicFileGetUrl + item.picUrl,
-          title: item.title,
-          sortWeight: 100
-        };
+        if(this.iconic === 'couponPkgForm') {
+          return {
+            type: "coupon_pkg",
+            quantity: 1,
+            refId: item.id,
+            picUrl: publicFileGetUrl + item.picUrl,
+            title: item.title,
+            sortWeight: 100
+          }
+        }else {
+          return {
+            prizeType: "coupon_pkg",
+            quantity: 1,
+            id: item.id,
+            picUrl: publicFileGetUrl + item.picUrl,
+            title: item.title,
+            sortWeight: 100
+          }
+        }
+
       });
     },
 

+ 35 - 12
src/views/business/ticket/components/GoodsAdd.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <el-dialog
-      title="添加实物奖品"
+      :title="iconic == 'goodsForm'?'添加关联商品':'添加实物奖品'"
       width="1000px"
       :visible.sync="dialogVisible"
       :before-close="close"
@@ -133,6 +133,10 @@ export default {
       type: Boolean,
       default: false,
     },
+    iconic: {
+      type: String,
+      default: '',
+    },
   },
   data() {
     return {
@@ -195,16 +199,27 @@ export default {
     // 选中商品
     handleSelectionGoods(e) {
       this.selectGoodsList = e.map((item) => {
-        return {
-          prizeType: "goods",
-          quantity: 1,
-          goodsId: item.goodsId,
-          picUrl: item.picUrl,
-          title: item.title,
-          sortWeight: 100,
-          value: item.value,
-          cost: item.cost
-        };
+        if(this.iconic === 'goodsForm') {
+          return {
+            type: "goods",
+            refId: item.goodsId,
+            picUrl: item.picUrl,
+            title: item.title,
+            value: item.value,
+            cost: item.cost
+          };
+        }else {
+          return {
+            prizeType: "goods",
+            quantity: 1,
+            goodsId: item.goodsId,
+            picUrl: item.picUrl,
+            title: item.title,
+            sortWeight: 100,
+            value: item.value,
+            cost: item.cost
+          };
+        }
       });
     },
 
@@ -214,7 +229,15 @@ export default {
         this.msgInfo('请选择商品')
         return
       }
-      this.$emit("confirmGoods", this.selectGoodsList);
+      if(this.iconic == 'goodsForm'){
+        if(this.selectGoodsList.length > 1) {
+          this.msgInfo('只能选择一个商品')
+          return
+        }
+        this.$emit("confirmGoodsForm", this.selectGoodsList);
+      }else {
+        this.$emit("confirmGoods", this.selectGoodsList);
+      }
     },
 
     close() {

+ 0 - 239
src/views/business/ticket/components/GoodsAddForm.vue

@@ -1,239 +0,0 @@
-<template>
-  <div>
-    <el-dialog
-      title="添加关联商品"
-      width="1000px"
-      :visible.sync="dialogVisible"
-      :before-close="close"
-    >
-      <div class="dialog-search">
-        <div style="margin:0 0 10px 20px">商品名称:</div>
-        <el-input
-          v-model="goodsTitle"
-          placeholder="请输入商品名称"
-          clearable
-          size="small"
-          style="width: 220px" @clear="pageParams.pageNum = 1;getGoodsList()"
-          @keyup.enter.native="pageParams.pageNum = 1;getGoodsList()"
-        />
-        <div style="margin-left: 20px">商品价格:</div>
-        <el-input type="number" style="width: 220px" v-model="queryParams.minValue" @clear="pageParams.pageNum = 1;getGoodsList()"
-                  placeholder="最低价格" clearable @keyup.enter.native="pageParams.pageNum = 1;getGoodsList()"/>
-        <div style="width: 20px;text-align: center">-</div>
-        <el-input type="number" style="width: 220px" v-model="queryParams.maxValue" @clear="pageParams.pageNum = 1;getGoodsList()"
-                  placeholder="最高价格" clearable @keyup.enter.native="pageParams.pageNum = 1;getGoodsList()"/>
-        <br>
-        <div style="margin:0 0 10px 20px">盲豆兑换数量:</div>
-        <el-input type="number" style="width: 220px" v-model="queryParams.minExchange" @clear="pageParams.pageNum = 1;getGoodsList()"
-                  placeholder="最低盲豆数量" clearable @keyup.enter.native="pageParams.pageNum = 1;getGoodsList()"/>
-        <div style="width: 20px;text-align: center">-</div>
-        <el-input type="number" style="width: 220px" v-model="queryParams.maxExchange" @clear="pageParams.pageNum = 1;getGoodsList()"
-                  placeholder="最高盲豆数量" clearable @keyup.enter.native="pageParams.pageNum = 1;getGoodsList()"/>
-        <br>
-        <div style="margin:0 0 10px 20px">商品成本:</div>
-        <el-input type="number" style="width: 220px" v-model="queryParams.minCost" @clear="pageParams.pageNum = 1;getGoodsList()"
-                  placeholder="最低成本" clearable @keyup.enter.native="pageParams.pageNum = 1;getGoodsList()"/>
-        <div style="width: 20px;text-align: center">-</div>
-        <el-input type="number" style="width: 220px" v-model="queryParams.maxCost" @clear="pageParams.pageNum = 1;getGoodsList()"
-                  placeholder="最高成本" clearable @keyup.enter.native="pageParams.pageNum = 1;getGoodsList()"/>
-
-        <div class="ge"></div>
-        <el-button
-          type="primary"
-          icon="el-icon-search"
-          size="mini"
-          @click="pageParams.pageNum = 1;getGoodsList()"
-        >查询
-        </el-button
-        >
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery()">重置</el-button>
-      </div>
-      <el-table
-        v-loading="loading"
-        :data="goodsList"
-        row-key="goodsId"
-        @selection-change="handleSelectionGoods"
-        class="el-table"
-      >
-        <el-table-column
-          type="selection"
-          width="55"
-          align="center"
-          fixed="left"
-          :reserve-selection="true"
-        />
-        <el-table-column label="商品ID" prop="goodsId"/>
-        <el-table-column label="商品图片">
-          <template slot-scope="{ row }">
-            <div v-if="row.picUrl">
-              <el-image
-                style="width: 100px; height: 100px"
-                :src="row.picUrl.split(',')[0]"
-                :preview-src-list="row.picUrl.split(',')"
-              >
-              </el-image>
-            </div>
-            <p v-else>-</p>
-          </template>
-        </el-table-column>
-        <el-table-column label="商品名称" prop="title" min-width="85"/>
-
-        <el-table-column label="商品价格" min-width="85">
-          <template slot-scope="scope">
-            <div>¥{{ $numberFormat(scope.row.value) }}</div>
-          </template>
-        </el-table-column>
-
-        <el-table-column label="盲豆兑换数量" prop="exchangePrice" min-width="85"/>
-
-        <el-table-column label="商品成本" min-width="85">
-          <template slot-scope="scope">
-            <div>¥{{ $numberFormat(scope.row.cost) }}</div>
-          </template>
-        </el-table-column>
-
-        <el-table-column label="是否支持兑换" prop="exchangeShow" min-width="85">
-          <template slot-scope="scope">
-            <div v-if="scope.row.exchangeShow == 1">支持兑换</div>
-            <div v-else-if="scope.row.exchangeShow == 0">不支持兑换</div>
-            <div v-else-if="scope.row.exchangeShow == 2">盲票商品</div>
-          </template>
-        </el-table-column>
-
-        <el-table-column label="商品库存" prop="quantity" width="80"/>
-      </el-table>
-      <div style="width: 700px;"></div>
-      <pagination
-        v-show="goodsTotal > 0"
-        :total="goodsTotal"
-        :page.sync="pageParams.pageNum"
-        :limit.sync="pageParams.pageSize"
-        @pagination="getGoodsList"
-      />
-      <div class="dialog-btn">
-        <div style="width: 20px;"></div>
-        <el-button size="small" @click="close"> 取 消</el-button>
-        <div style="width: 20px;"></div>
-        <el-button type="primary" size="small" @click="confirmGoods">
-          确 认
-        </el-button>
-      </div>
-    </el-dialog>
-  </div>
-</template>
-<script>
-import {publicFileGetUrl} from "@/api/common";
-import {getGoodsList} from "@/api/business/goods";
-import {accMul} from '@/utils/util'
-import log from "../../../monitor/job/log";
-
-export default {
-  name: "GoodsAddForm",
-  props: {
-    dialogVisible: {
-      type: Boolean,
-      default: false,
-    },
-  },
-  data() {
-    return {
-      loading: false,
-      goodsTitle: "", // 商品名称
-      queryParams: {},
-
-      goodsList: [], // 商品列表
-      goodsTotal: 0, // 商品总数
-      selectGoodsList: [], // 选中商品
-      pageParams: {
-        pageNum: 1,
-        pageSize: 10,
-      },
-    };
-  },
-  created() {
-    this.getGoodsList();
-  },
-  methods: {
-    // 商品列表
-    getGoodsList() {
-      this.loading = true;
-
-      getGoodsList(
-        "pageNum=" + this.pageParams.pageNum + "&pageSize=" + this.pageParams.pageSize + "&", {
-          title: this.goodsTitle,
-          status: "on",
-          exchangeShow: 2,
-          minValue: this.queryParams.minValue ? accMul(this.queryParams.minValue, 100) : this.queryParams.minValue,
-          maxValue: this.queryParams.maxValue ? accMul(this.queryParams.maxValue, 100) : this.queryParams.maxValue,
-          minExchange:this.queryParams.minExchange,
-          maxExchange:this.queryParams.maxExchange,
-          minCost: this.queryParams.minCost ? accMul(this.queryParams.minCost, 100) : this.queryParams.minCost,
-          maxCost: this.queryParams.maxCost ? accMul(this.queryParams.maxCost, 100) : this.queryParams.maxCost,
-        }
-      ).then((res) => {
-        this.goodsList = res.rows.map((item) => {
-          return {
-            ...item,
-            picUrl: publicFileGetUrl + item.picUrl.split(",")[0],
-          };
-        });
-        this.goodsTotal = res.total;
-        this.loading = false;
-      });
-    },
-    //重置
-    resetQuery(){
-      this.goodsTitle = ''
-      this.queryParams = {}
-      this.pageParams.pageNum = 1
-      this.getGoodsList();
-    },
-
-    // 选中商品
-    handleSelectionGoods(e) {
-      this.selectGoodsList = e.map((item) => {
-        return {
-          prizeType: "goods",
-          refId: item.goodsId,
-          picUrl: item.picUrl,
-          title: item.title,
-          value: item.value,
-          cost: item.cost
-        };
-      });
-    },
-
-    // 确认选中商品
-    confirmGoods() {
-      if(!this.selectGoodsList.length) {
-        this.msgInfo('请选择商品')
-        return
-      }
-      if(this.selectGoodsList.length > 1) {
-        this.msgInfo('只能选择一个商品')
-        return
-      }
-      this.$emit("confirmGoodsForm", this.selectGoodsList);
-    },
-
-    close() {
-      this.$emit("close");
-    },
-  },
-};
-</script>
-<style lang="scss" scoped>
-div {
-  display: inline-block;
-}
-.dialog-search {
-  //display: flex;
-  line-height: 32px;
-  margin-bottom: 20px;
-
-  .ge {
-    width: 20px;
-  }
-}
-
-</style>

+ 5 - 9
src/views/business/ticket/create.vue

@@ -176,16 +176,14 @@
     </div>
 
     <!-- 添加商品 -->
-    <goods-add :dialog-visible="goodsTableVisible" @close="close" @confirmGoods="confirmGoods" v-if="goodsTableVisible" />
+    <goods-add :dialog-visible="goodsTableVisible" @close="close" :iconic="iconic" @confirmGoodsForm="confirmGoodsForm" @confirmGoods="confirmGoods" v-if="goodsTableVisible" />
     <!-- 添加券 -->
     <coupon-add :dialog-visible="couponTableVisible" :iconic="iconic" @close="close" @confirmCouponForm="confirmCouponForm" @confirmCoupon="confirmCoupon" v-if="couponTableVisible" />
     <!-- 添加券包 -->
     <coupon-pkg-add :dialog-visible="couponPkgTableVisible" :iconic="iconic" @close="close" @confirmCouponPkgForm="confirmCouponPkgForm" @confirmCouponPkg="confirmCouponPkg" v-if="couponPkgTableVisible" />
     <!-- 添加盲豆 -->
     <coin-add :dialog-visible="coinTableVisible" @close="close" @confirmCoin="confirmCoin" v-if="coinTableVisible" />
-    <!-- 添加商品 -->
-    <goods-add-form :dialog-visible="goodsVisibleForm" @close="close" @confirmGoodsForm="confirmGoodsForm" v-if="goodsVisibleForm" ></goods-add-form>
-  </div>
+   </div>
 </template>
 <script>
 import Upload from '@/components/DragImageUpload'
@@ -200,7 +198,6 @@ import CouponAdd from "./components/CouponAdd"
 import CouponPkgAdd from "./components/CouponPkgAdd"
 import CoinAdd from "./components/CoinAdd"
 import AwardForm from "./components/AwardForm"
-import GoodsAddForm from "./components/GoodsAddForm"
 export default {
   name: "TicketCreate",
   mixins: [CustomFieldsMixin],
@@ -212,7 +209,6 @@ export default {
     CoinAdd,
     Upload,
     AwardForm,
-    GoodsAddForm
   },
   data() {
     return {
@@ -338,7 +334,6 @@ export default {
         pageNum: 1,
         pageSize: 10,
       },
-      goodsVisibleForm: false, //添加关联商品弹框
       iconic: '',//区分添加的是关联商品还是奖品
     };
   },
@@ -553,7 +548,6 @@ export default {
       this.couponTableVisible = false;
       this.couponPkgTableVisible = false;
       this.coinTableVisible = false;
-      this.goodsVisibleForm = false;
     },
 
     changeType(e) {
@@ -563,6 +557,7 @@ export default {
     // 添加奖品种类
     handleCommand(e) {
       if (e == "goods") {
+        this.iconic = 'goods'
         this.goodsTableVisible = true;
       } else if (e == "coupon") {
         this.iconic = 'coupon'
@@ -576,7 +571,8 @@ export default {
     },
     goodsCommand(e) {
       if (e == "goods") {
-        this.goodsVisibleForm = true;
+        this.iconic = 'goodsForm'
+        this.goodsTableVisible = true;
       } else if (e == "coupon") {
         this.iconic = 'couponForm'
         this.couponTableVisible = true;