Browse Source

Merge branch 'test' of maopiao/mp-ui-pc into master

kk 2 years ago
parent
commit
f414fb6b50

+ 10 - 0
src/api/business/ticket.js

@@ -92,6 +92,16 @@ export function ticketBoxPut(data) {
   })
   })
 }
 }
 
 
+
+// 线下票停售
+export function ticketBoxStop(data) {
+  return request({
+    url: '/api/v1/mp/admin/ticket/box/stop',
+    method: 'post',
+    data
+  })
+}
+
 // 删除
 // 删除
 export function ticketBoxRemove(data) {
 export function ticketBoxRemove(data) {
   return request({
   return request({

+ 94 - 6
src/views/business/ticket/create.vue

@@ -126,6 +126,35 @@
           <div class="tip">
           <div class="tip">
             例如:一张盲票用户支付10元,盲票佣金系数90%,门店佣金比例20%,那么门店佣金为10元*90%*20%=1.8元
             例如:一张盲票用户支付10元,盲票佣金系数90%,门店佣金比例20%,那么门店佣金为10元*90%*20%=1.8元
           </div>
           </div>
+          <el-form-item label="销售范围" prop="saleChannelType" v-if="form.type == 'online'">
+            <el-radio-group v-model="form.saleChannelType" :disabled="form.disabled" 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
+              multiple
+              :filter-method="dataFilter"
+            >
+              <el-option
+                v-for="(item) in siteList"
+                :key="item.channelId"
+                :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>
+          
           <el-form-item label="销售范围" prop="saleChannelType" v-if="form.type == 'offline'">
           <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-group v-model="form.saleChannelType" size="small" @change="$refs['form'].clearValidate()">
               <el-radio :label="1">所有渠道</el-radio>
               <el-radio :label="1">所有渠道</el-radio>
@@ -140,10 +169,11 @@
               filterable
               filterable
               clearable
               clearable
               multiple
               multiple
+              :filter-method="dataFilter2"
             >
             >
               <el-option
               <el-option
-                v-for="(item, index) in channelList"
-                :key="index"
+                v-for="(item) in channelList"
+                :key="item.channelId"
                 :label="item.name"
                 :label="item.name"
                 :value="item.channelId">
                 :value="item.channelId">
                 <div>
                 <div>
@@ -192,7 +222,8 @@ import Upload from '@/components/DragImageUpload'
 import { publicFileGetUrl } from "@/api/common";
 import { publicFileGetUrl } from "@/api/common";
 import CustomFieldsMixin from "@/mixins/CustomFields";
 import CustomFieldsMixin from "@/mixins/CustomFields";
 import { ticketBoxCreate, setListDetail, ticketBoxDetail} from "@/api/business/ticket";
 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 { accMul, accDiv } from "@/utils/util";
 import AwardsList from "./components/AwardsList"
 import AwardsList from "./components/AwardsList"
 import GoodsAdd from "./components/GoodsAdd"
 import GoodsAdd from "./components/GoodsAdd"
@@ -230,10 +261,14 @@ export default {
         saleCommRate: "", // 基数
         saleCommRate: "", // 基数
         originPrice: 0, //划线价
         originPrice: 0, //划线价
         disabled: false,
         disabled: false,
-        saleChannelType: 1
+        saleChannelType: 1,//销售范围类型
       },
       },
+      // 门店列表
+      siteList: [],
+      siteCopyList:[],
       // 上级渠道列表
       // 上级渠道列表
       channelList:[],
       channelList:[],
+      channelCopyList:[],
       rules: {
       rules: {
         type: [
         type: [
           { required: true, message: "请选择盲票类型", trigger: "change" },
           { required: true, message: "请选择盲票类型", trigger: "change" },
@@ -321,6 +356,9 @@ export default {
         channelIdList: [
         channelIdList: [
           { required: true, message: "请选择渠道", trigger: "change" },
           { required: true, message: "请选择渠道", trigger: "change" },
         ],
         ],
+        siteIdList: [
+          { required: true, message: "请选择门店", trigger: "change" }
+        ],
       },
       },
 
 
       // 奖级列表
       // 奖级列表
@@ -356,6 +394,7 @@ export default {
   },
   },
   created() {
   created() {
     this.getChannelList()
     this.getChannelList()
+    this.getSiteList()
     if (this.id) {
     if (this.id) {
       let data = {
       let data = {
         boxId: this.id
         boxId: this.id
@@ -365,7 +404,8 @@ export default {
         this.form = {
         this.form = {
           disabled:true,
           disabled:true,
           title, picUrl, quantity, pkgUnit, saleCommRate, saleChannelType,
           title, picUrl, quantity, pkgUnit, saleCommRate, saleChannelType,
-          channelIdList: channelList.map(item => item.channelId),
+          channelIdList: saleChannelType == 2 ? channelList.map(item => item.channelId) : [],
+          siteIdList: saleChannelType == 2 ? channelList.map(item => item.channelId) : [],
           type: JSON.parse(type).value,
           type: JSON.parse(type).value,
           facePrice:accDiv(facePrice, 100),
           facePrice:accDiv(facePrice, 100),
           salePrice:accDiv(salePrice, 100),
           salePrice:accDiv(salePrice, 100),
@@ -373,6 +413,12 @@ export default {
           pkgSalePrice:accDiv(pkgSalePrice, 100),
           pkgSalePrice:accDiv(pkgSalePrice, 100),
           originPrice:accDiv(originPrice, 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){
         if(awardsList){
           awardsList.forEach((item) => {
           awardsList.forEach((item) => {
               item.isEdit = true
               item.isEdit = true
@@ -409,8 +455,40 @@ export default {
     getChannelList(){
     getChannelList(){
       listAllChannel().then(response => {
       listAllChannel().then(response => {
          this.channelList = response.data || [];
          this.channelList = response.data || [];
+         this.channelCopyList = response.data || [];
+      });
+    },
+    dataFilter2(val) {
+      if (val) { //val存在
+        this.channelList = this.channelCopyList.filter((item) => {
+          if (!!~item.mobile.indexOf(val) || !!~item.mobile.toUpperCase().indexOf(val.toUpperCase())
+                 || !!~item.name.indexOf(val) || !!~item.name.indexOf(val)) {
+             return true
+          }
+        })
+      } else { //val为空时,还原数组
+        this.channelList = this.channelCopyList;
+      }
+    },
+    // 获取门店下拉列表
+    getSiteList() {
+      listAllSaleSite({}).then(response => {
+         this.siteList = response.data || [];
+         this.siteCopyList = response.data || [];
       });
       });
     },
     },
+    dataFilter(val) {
+      if (val) { //val存在
+        this.siteList = this.siteCopyList.filter((item) => {
+          if (!!~item.mobile.indexOf(val) || !!~item.mobile.toUpperCase().indexOf(val.toUpperCase())
+                 || !!~item.name.indexOf(val) || !!~item.name.indexOf(val)) {
+             return true
+          }
+        })
+      } else { //val为空时,还原数组
+        this.siteList = this.siteCopyList;
+      }
+    },
 
 
     // 保存
     // 保存
     submitForm() {
     submitForm() {
@@ -513,7 +591,17 @@ export default {
             awardsList: filterArr2,
             awardsList: filterArr2,
             goodsList: this.goodsList
             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){
           if (this.id){
             data.boxId = this.id
             data.boxId = this.id
           }
           }

+ 1 - 1
src/views/business/ticket/detail.vue

@@ -56,7 +56,7 @@
         </el-form-item>
         </el-form-item>
         <el-form-item label="销售范围:">
         <el-form-item label="销售范围:">
           <span :class="loading ? 'el-icon-loading' : ''"></span>
           <span :class="loading ? 'el-icon-loading' : ''"></span>
-          <span v-if="info.saleChannelType == 1">所有渠道</span>
+          <span v-if="info.saleChannelType == 1"> {{ info && info.type && info.type.value == 'online'? '首页售卖' : '所有渠道' }} </span>
           <span v-else>{{ info.channelTitle }}</span>
           <span v-else>{{ info.channelTitle }}</span>
         </el-form-item>
         </el-form-item>
       </el-form>
       </el-form>

+ 32 - 2
src/views/business/ticket/index.vue

@@ -45,6 +45,7 @@
           <el-option label="待上架" value="done" />
           <el-option label="待上架" value="done" />
           <el-option label="已上架" value="on" />
           <el-option label="已上架" value="on" />
           <el-option label="已下架" value="off" />
           <el-option label="已下架" value="off" />
+          <el-option label="已停售" value="stop" />
         </el-select>
         </el-select>
       </el-form-item>
       </el-form-item>
       <el-form-item>
       <el-form-item>
@@ -196,7 +197,7 @@
         align="center"
         align="center"
         show-overflow-tooltip
         show-overflow-tooltip
         class-name="small-padding  fixed-width"
         class-name="small-padding  fixed-width"
-        min-width="150"
+        min-width="170"
         fixed="right"
         fixed="right"
       >
       >
         <template slot-scope="scope">
         <template slot-scope="scope">
@@ -207,7 +208,7 @@
               @click="getDetail(scope.row)"
               @click="getDetail(scope.row)"
               >查看</el-button
               >查看</el-button
             >
             >
-            <el-button
+            <el-button v-show="scope.row.status.value != 'stop'"
               v-hasPermi="['business:ticket:edit']"
               v-hasPermi="['business:ticket:edit']"
               type="text"
               type="text"
               @click="setDetail(scope.row)"
               @click="setDetail(scope.row)"
@@ -230,6 +231,13 @@
               @click="setStatus(scope.row, 'off')"
               @click="setStatus(scope.row, 'off')"
               >下架</el-button
               >下架</el-button
             >
             >
+            <el-button
+              v-show="(scope.row.status.value === 'on' || scope.row.status.value === 'off') && scope.row.type.value === 'offline'"
+              v-hasPermi="['business:ticket:on']"
+              type="text"
+              @click="setStop(scope.row)"
+              >停售</el-button
+            >
             <el-button
             <el-button
               v-show="scope.row.status.value === 'done'"
               v-show="scope.row.status.value === 'done'"
               v-hasPermi="['business:ticket:remove']"
               v-hasPermi="['business:ticket:remove']"
@@ -265,6 +273,7 @@ import {
   exportTicket,
   exportTicket,
   exportDraw,
   exportDraw,
   ticketBoxPut,
   ticketBoxPut,
+  ticketBoxStop,
   ticketBoxRemove, setListData
   ticketBoxRemove, setListData
 } from "@/api/business/ticket";
 } from "@/api/business/ticket";
 import { publicFileGetUrl } from "@/api/common";
 import { publicFileGetUrl } from "@/api/common";
@@ -377,6 +386,27 @@ export default {
       });
       });
     },
     },
 
 
+    setStop(item) {
+      this.$confirm(
+        `确认停售盲票 “${item.title}” 吗?`,
+        `停售盲票`,
+        {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        }
+      ).then(() => {
+        ticketBoxStop({
+          boxId: item.boxId,
+        }).then((res) => {
+          if (res.code === 0) {
+            this.$message.success("操作已完成!");
+            this.getList();
+          }
+        });
+      });
+    },
+
     del(item) {
     del(item) {
       this.$confirm(`确认删除盲票 “${item.title}” 吗?`, "删除盲票", {
       this.$confirm(`确认删除盲票 “${item.title}” 吗?`, "删除盲票", {
         confirmButtonText: "确定",
         confirmButtonText: "确定",

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

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