ソースを参照

线上票 销售范围绑定门店

lsx 2 年 前
コミット
60d260b065
2 ファイル変更62 行追加5 行削除
  1. 61 4
      src/views/business/ticket/create.vue
  2. 1 1
      src/views/order/channel/index.vue

+ 61 - 4
src/views/business/ticket/create.vue

@@ -126,6 +126,33 @@
           <div class="tip">
             例如:一张盲票用户支付10元,盲票佣金系数90%,门店佣金比例20%,那么门店佣金为10元*90%*20%=1.8元
           </div>
+          <el-form-item label="销售范围" prop="saleChannelType" v-if="form.type == 'online'">
+            <el-radio-group v-model="form.saleChannelType" size="small" @change="$refs['form'].clearValidate()">
+              <el-radio :label="1">首页售卖</el-radio>
+              <el-radio :label="2">指定门店</el-radio>
+            </el-radio-group>
+          </el-form-item>
+          <el-form-item label="门店" prop="siteIdList" v-if="form.type == 'online' && form.saleChannelType == 2">
+            <el-select
+              v-model="form.siteIdList"
+              placeholder="请选择门店"
+              style="width: 240px;"
+              filterable
+              clearable
+            >
+              <el-option
+                v-for="(item, index) in siteList"
+                :key="index"
+                :label="item.name"
+                :value="item.channelId">
+                <div>
+                  <span style="float: left;">{{item.name}} </span>
+                  <span style="float: right;">{{item.mobile}}</span>
+                </div>
+              </el-option>
+            </el-select>
+          </el-form-item>
+          <div class="tip" v-if="form.type == 'online'">注:盲票指定门店后只在该门店扫码时展示该盲票</div>
           <el-form-item label="销售范围" prop="saleChannelType" v-if="form.type == 'offline'">
             <el-radio-group v-model="form.saleChannelType" size="small" @change="$refs['form'].clearValidate()">
               <el-radio :label="1">所有渠道</el-radio>
@@ -192,7 +219,8 @@ import Upload from '@/components/DragImageUpload'
 import { publicFileGetUrl } from "@/api/common";
 import CustomFieldsMixin from "@/mixins/CustomFields";
 import { ticketBoxCreate, setListDetail, ticketBoxDetail} from "@/api/business/ticket";
-import { listAllChannel} from "@/api/admin/channel";
+import { listAllChannel } from "@/api/admin/channel";
+import { listAllSaleSite } from "@/api/admin/salesite";
 import { accMul, accDiv } from "@/utils/util";
 import AwardsList from "./components/AwardsList"
 import GoodsAdd from "./components/GoodsAdd"
@@ -230,8 +258,10 @@ export default {
         saleCommRate: "", // 基数
         originPrice: 0, //划线价
         disabled: false,
-        saleChannelType: 1
+        saleChannelType: 1,//销售范围类型
       },
+      // 门店列表
+      siteList: [],
       // 上级渠道列表
       channelList:[],
       rules: {
@@ -321,6 +351,9 @@ export default {
         channelIdList: [
           { required: true, message: "请选择渠道", trigger: "change" },
         ],
+        siteIdList: [
+          { required: true, message: "请选择门店", trigger: "change" }
+        ],
       },
 
       // 奖级列表
@@ -356,6 +389,7 @@ export default {
   },
   created() {
     this.getChannelList()
+    this.getSiteList()
     if (this.id) {
       let data = {
         boxId: this.id
@@ -365,7 +399,8 @@ export default {
         this.form = {
           disabled:true,
           title, picUrl, quantity, pkgUnit, saleCommRate, saleChannelType,
-          channelIdList: channelList.map(item => item.channelId),
+          channelIdList: saleChannelType == 2 ? channelList.map(item => item.channelId) : [],
+          siteIdList: saleChannelType == 2 ? channelList[0].channelId : [],
           type: JSON.parse(type).value,
           facePrice:accDiv(facePrice, 100),
           salePrice:accDiv(salePrice, 100),
@@ -373,6 +408,12 @@ export default {
           pkgSalePrice:accDiv(pkgSalePrice, 100),
           originPrice:accDiv(originPrice, 100)
         }
+        // if(JSON.parse(type).value == 'online' && saleChannelType == 2){
+        //   this.form.siteIdList = channelList[0].channelId
+        // }
+        // if(JSON.parse(type).value == 'offline' && saleChannelType == 2){
+        //   this.form.channelIdList = channelList.map(item => item.channelId)
+        // }
         if(awardsList){
           awardsList.forEach((item) => {
               item.isEdit = true
@@ -411,6 +452,12 @@ export default {
          this.channelList = response.data || [];
       });
     },
+    // 获取门店下拉列表
+    getSiteList() {
+      listAllSaleSite({}).then(response => {
+         this.siteList = response.data || [];
+      });
+    },
 
     // 保存
     submitForm() {
@@ -513,7 +560,17 @@ export default {
             awardsList: filterArr2,
             goodsList: this.goodsList
           };
-
+          if( data.type == 'online' && data.saleChannelType == 1 ){
+            data.siteIdList = []
+            data.channelIdList = []
+          }
+          if( data.type == 'online' && data.saleChannelType == 2 ) {
+            data.channelIdList = [data.siteIdList]
+          }
+          if( data.type == 'offline' && data.saleChannelType == 1 ){
+            data.siteIdList = []
+            data.channelIdList = []
+          }
           if (this.id){
             data.boxId = this.id
           }

+ 1 - 1
src/views/order/channel/index.vue

@@ -46,7 +46,7 @@
           @change="pageParams.pageNum = 1;handleQuery()"
         >
           <el-option
-            v-for="(item, index) in siteList"
+            v-for="(item) in siteList"
             :key="item.channelId"
             :label="item.name"
             :value="item.channelId">