Explorar el Código

Merge branch 'test' into 'master'

Test

See merge request quanshu/mp-ui-pc!239
zhong chunping hace 3 años
padre
commit
bff103d743

+ 9 - 0
src/api/admin/salesite.js

@@ -19,6 +19,15 @@ export function listAllSaleSite() {
   })
 }
 
+// 导出经销商信息
+export function salesiteOrderExport( data) {
+  return request({
+    url: '/api/v1/mp/admin/salesite/export',
+    method: 'post',
+    data: data,
+  })
+}
+
 export function getSaleSiteDetail(channelId) {
   return request({
     url: '/api/v1/mp/admin/salesite/detail',

+ 17 - 1
src/api/business/order.js

@@ -9,6 +9,14 @@ export function getOrderList(urlParams, data) {
         urlParams
     })
 }
+// 经销商列表
+export function listSite( data) {
+  return request({
+    url: '/api/v1/mp/admin/salesite/list',
+    method: 'post',
+    data,
+  })
+}
 
 // 快递下拉
 export function companyList(data) {
@@ -117,6 +125,14 @@ export function deliverOrderExport(data) {
     data
   })
 }
+// 用户盲票订单导出
+export function deliverOrderDrawExport(data) {
+  return request({
+    url: '/api/v1/mp/admin/ticket/order/ticket/export',
+    method: 'post',
+    data
+  })
+}
 
 
 // 经销商订单导出
@@ -164,4 +180,4 @@ export function ticketOrderDetail(orderId) {
     url: `/api/v1/mp/admin/ticket/order/detail/${ orderId }`,
     method: 'post',
   })
-}
+}

+ 25 - 0
src/router/index.js

@@ -255,6 +255,31 @@ export const constantRoutes = [
       }
     ]
   },
+  {
+    path: '/marketing',
+    component: Layout,
+    hidden: true,
+    children: [
+      {
+        path: 'add',
+        component: (resolve) => require(['@/views/business/marketing/add'], resolve),
+        name: 'MarketingAdd',
+        meta: { title: '创建抽奖活动' , activeMenu: '/marketing/marketing', noCache: true }
+      },
+      {
+        path: 'edit',
+        component: (resolve) => require(['@/views/business/marketing/add'], resolve),
+        name: 'MarketingEdit',
+        meta: { title: '修改抽奖活动' , activeMenu: '/marketing/marketing', noCache: true }
+      },
+      {
+        path: 'query',
+        component: (resolve) => require(['@/views/business/marketing/add'], resolve),
+        name: 'MarketingQuery',
+        meta: { title: '抽奖活动详情' , activeMenu: '/marketing/marketing', noCache: true }
+      }
+    ]
+  },
   {
     path: '/order',
     component: Layout,

+ 1 - 1
src/views/business/coupon/add.vue

@@ -39,7 +39,7 @@
             <div class="tip">最低消费金额为0则为无门槛优惠券</div>
           </el-form-item>
           <el-form-item label="有效期限:" prop="dueDays">
-            <el-select v-model="addData.dueDays" clearable placeholder="请选择有效期限">
+            <el-select v-model="addData.dueDays" clearable placeholder="请选择有效期限" :disabled="readonly">
               <el-option label="30天" :value="30"></el-option>
               <el-option label="60天" :value="60"></el-option>
               <el-option label="90天" :value="90"></el-option>

+ 18 - 3
src/views/business/goods/index.vue

@@ -39,6 +39,7 @@
           <el-option :label="item.name" :value="item.tagId" v-for="(item, index) in goodsTagItemsList" :key="index" />
         </el-select>
       </el-form-item>
+      <br>
       <el-form-item label="上架状态" prop="status">
         <el-select v-model="queryParams.status" placeholder="请选择商品状态" clearable @change="queryParams.pageNum = 1;getList()">
           <el-option label="全部" value="" />
@@ -54,6 +55,12 @@
           <el-option label="不支持兑换" value="0" />
         </el-select>
       </el-form-item>
+      <el-form-item label="供应商" prop="supplierId">
+        <el-select v-model="queryParams.supplierId" placeholder="请选择供应商" filterable clearable  @clear="queryParams.pageNum = 1;getList()" @change="queryParams.pageNum = 1;getList()">
+          <el-option :label="item.name" :value="item.id" v-for="(item, index) in SupplierList" :key="index" />
+        </el-select>
+      </el-form-item>
+      <br>
       <el-form-item label="采购价格" prop="minCost">
         <el-input v-model="queryParams.minCost" placeholder="最低采购价格" clearable @keyup.enter.native="queryParams.pageNum = 1;getList()" />
       </el-form-item>
@@ -143,6 +150,7 @@ import { getGoodsList, delGoods, setGoodsStatus, setTableData} from '@/api/busin
 import { goodsCategoryItems } from '@/api/business/category'
 import { goodsTagItems } from '@/api/business/tag'
 import { accMul } from '@/utils/util'
+import { getSupplierList } from '@/api/business/supplier'
 export default {
   name: 'List',
   data() {
@@ -155,14 +163,23 @@ export default {
       total: 0,
       goodsCategoryItemsList: [],
       goodsTagItemsList: [],
+      SupplierList: [],
     }
   },
   created() {
     this.getList(true)
     this.getGoodsCategoryItems()
     this.getGoodsTagItems()
+    this.getSupplierItems()
   },
   methods: {
+    //获取供应商
+    getSupplierItems(){
+      getSupplierList({name:""}).then(res => {
+        this.SupplierList = res && res.rows
+      })
+    },
+
     //切换排序
     sortChannelId(row){
       if (row){
@@ -200,8 +217,6 @@ export default {
         return
       }
       this.loading = true
-      console.log(this.queryParams.minCost)
-
       // if (reset) {
       //   this.queryParams = { pageNum: 1, pageSize: 20, orderByColumn: '', isAsc: '', }
       // }
@@ -211,7 +226,7 @@ export default {
         categoryId: this.queryParams.categoryId,
         tagId: this.queryParams.tagId,
         status: this.queryParams.status,
-        exchangeShow: this.queryParams.exchangeShow,
+        exchangeShow: this.queryParams.exchangeShow, supplierId: this.queryParams.supplierId,
         minCost: this.queryParams.minCost?accMul(this.queryParams.minCost, 100):this.queryParams.minCost,
         maxCost: this.queryParams.maxCost?accMul(this.queryParams.maxCost, 100):this.queryParams.maxCost,
         minValue: this.queryParams.minValue?accMul(this.queryParams.minValue, 100):this.queryParams.minValue,

+ 17 - 0
src/views/business/marketing/add.vue

@@ -0,0 +1,17 @@
+<template>
+  <div>1111
+
+  222
+  </div>
+
+</template>
+
+<script>
+export default {
+  name: "add"
+}
+</script>
+
+<style scoped>
+
+</style>

+ 173 - 0
src/views/business/marketing/index.vue

@@ -0,0 +1,173 @@
+<template>
+  <div class="app-container coupon-list">
+    <el-form v-show="showSearch" :model="queryParams" ref="queryForm" :inline="true" size="small">
+      <el-form-item label="活动名称">
+        <el-input
+          v-model="queryParams.title"
+          placeholder="请输入活动名称"
+          clearable @clear="queryParams.pageNum = 1;getList()"
+          @keyup.enter.native="queryParams.pageNum = 1;getList()"
+        />
+      </el-form-item>
+      <el-form-item label="活动状态">
+        <el-select v-model="queryParams.status" placeholder="请选择活动状态" clearable @change="queryParams.pageNum = 1;getList()">
+          <el-option label="全部" value="" />
+          <el-option label="进行中" value="init" />
+          <el-option label="已结束" value="on" />
+          <el-option label="草稿" value="off" />
+          <el-option label="未开始" value="off" />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" @click="queryParams.pageNum = 1;getList()">搜索</el-button>
+        <el-button icon="el-icon-refresh" @click="getList(true)">重置</el-button>
+      </el-form-item>
+    </el-form>
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="10">
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
+          size="mini"
+          @click="$router.push({ name: 'MarketingAdd' })"
+          v-hasPermi="['business:marketing:add']"
+        >创建活动</el-button>
+        <el-button
+          type="infor"
+          plain
+          icon="el-icon-download"
+          size="small"
+          @click="handleExportDraw"
+          v-hasPermi="['order:userTicket:export']"
+        >导出中奖数据</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+    <el-table v-loading="loading" :data="tableData">
+      <el-table-column label="活动编号" prop="couponId" width="80" />
+      <el-table-column label="活动名称" prop="title" />
+      <el-table-column label="参与人数" prop="discount"/>
+      <el-table-column label="开始时间" prop="type" >
+        <template slot-scope="{row}">
+          {{ JSON.parse(row.type).desc }}
+        </template>
+      </el-table-column>
+      <el-table-column label="结束时间" prop="type" >
+        <template slot-scope="{row}">
+          {{ JSON.parse(row.type).desc }}
+        </template>
+      </el-table-column>
+      <el-table-column label="状态" prop="status">
+        <template slot-scope="{row}">
+          <el-tag :type="JSON.parse(row.status).value === 'on' ? 'success' : 'info'">{{ JSON.parse(row.status).desc }}</el-tag>
+
+        </template>
+      </el-table-column>
+      <el-table-column fixed="right" align="right" label="操作" width="240">
+        <template slot-scope="{row}">
+          <el-button v-hasPermi="['business:marketing:query']" type="text" @click="$router.push({ name: 'MarketingQuery', query: { id: row.couponId } })">查看</el-button>
+          <el-button v-if="JSON.parse(row.status).value === 'init'" v-hasPermi="['business:marketing:edit']" type="text" @click="$router.push({ name: 'MarketingEdit', query: { id: row.couponId } })">编辑</el-button>
+          <el-button v-if="JSON.parse(row.status).value === 'init'" v-hasPermi="['business:marketing:edit']" type="text" @click="$router.push({ name: 'MarketingEdit', query: { id: row.couponId } })">活动数据</el-button>
+          <el-button v-if="JSON.parse(row.status).value === 'off' || JSON.parse(row.status).value === 'init'" v-hasPermi="['business:coupon:on']" type="text" @click="setStatus(row, 'on')">上架</el-button>
+          <el-button v-if="JSON.parse(row.status).value === 'on'" v-hasPermi="['business:coupon:off']" type="text" @click="setStatus(row, 'off')">下架</el-button>
+          <el-button v-if="JSON.parse(row.status).value === 'init'" v-hasPermi="['business:coupon:remove']" class="del" type="text" @click="del(row)">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList()" />
+  </div>
+</template>
+<script>
+import { getCouponList, delCoupon, setCouponStatus } from '@/api/business/coupon'
+import { accDiv } from '@/utils/util'
+export default {
+  name: 'CouponList',
+  data() {
+    return {
+      loading: false,
+      showSearch: true,
+      tableData: [],
+      queryParams: {},
+      total: 0
+    }
+  },
+  created() {
+    this.getList(true)
+  },
+  methods: {
+    getList(reset) {
+      if (this.loading) {
+        return
+      }
+      this.loading = true
+      if (reset) {
+        this.queryParams = { pageNum: 1, pageSize: 20 }
+      }
+      getCouponList('pageNum='+this.queryParams.pageNum + '&pageSize='+this.queryParams.pageSize+'&', this.queryParams).then(res => {
+        this.loading = false
+        if (res.code === 0) {
+          this.tableData = res.rows
+          this.total = res.total
+        }
+      }).catch(() => {
+        this.loading = false
+      })
+    },
+    setStatus(item, status) {
+      this.$confirm(`确认${status === 'on' ? '上架' : '下架'}券 “${item.title}” 吗?`, `${status === 'on' ? '上架' : '下架'}券`, {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        setCouponStatus({
+          couponId: item.couponId,
+          status
+        }).then(res => {
+          if (res.code === 0) {
+            this.$message.success('操作已完成!')
+            this.getList()
+          }
+        })
+      })
+    },
+    del(item) {
+      this.$confirm(`确认删除券 “${item.title}” 吗?`, '删除券', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        delCoupon(item.couponId).then(res => {
+          if (res.code === 0) {
+            this.$message.success('操作已完成!')
+            this.getList()
+          }
+        })
+      })
+    },
+
+    // 导出订单
+    handleExportDraw() {
+      this.$confirm("是否确认导出订单?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.vloading = this.$loading({
+            lock: true,
+            text: "正在导出订单.....",
+            background: "rgba(0, 0, 0, 0.7)",
+          });
+          return ticketOrderExport(this.queryParams);
+        })
+        .then((response) => {
+          this.vloading.close();
+          this.download(response.msg);
+        })
+        .catch(() => {
+          this.vloading.close();
+        });
+    },
+  }
+}
+</script>

+ 36 - 6
src/views/business/salesite/index.vue

@@ -101,6 +101,17 @@
           v-hasPermi="['system:post:add']"
         >添加经销商</el-button>
       </el-col> -->
+      <el-col :span="1.5">
+        <el-button
+          type="infor"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          @click="handleOrderExport"
+          v-hasPermi="['business:salesite:export']"
+        >导出订单</el-button
+        >
+      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -205,7 +216,7 @@
 <script>
 import { listAllChannel} from "@/api/admin/channel";
 import { listAreaByPid} from "@/api/admin/area";
-import { listSaleSite, updateSaleSiteStatus} from "@/api/admin/salesite";
+import { listSaleSite, updateSaleSiteStatus,salesiteOrderExport } from "@/api/admin/salesite";
 import SiteCreate from './components/Create'
 import SiteDetail from './components/Detail'
 export default {
@@ -319,11 +330,34 @@ export default {
       this.queryParams.cityId = ""
       this.queryParams.areaId = ""
       listAreaByPid(0).then(response => {
-        // console.log("getProvinceList"+JSON.stringify(response))
          this.provinceList = response || [];
       });
     },
 
+    // 导出订单
+    handleOrderExport() {
+      this.$confirm("是否确认导出订单?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.vloading = this.$loading({
+            lock: true,
+            text: "正在导出订单.....",
+            background: "rgba(0, 0, 0, 0.7)",
+          });
+          return salesiteOrderExport(this.queryParams);
+        })
+        .then((response) => {
+          this.vloading.close();
+          this.download(response.msg);
+        })
+        .catch(() => {
+          this.vloading.close();
+        });
+    },
+
     getCityList(){
       this.cityList = []
       this.areaList = []
@@ -331,7 +365,6 @@ export default {
       this.queryParams.areaId = ""
       var provinceId = this.queryParams.provinceId
       listAreaByPid(provinceId).then(response => {
-        // console.log("getCityList"+JSON.stringify(response))
          this.cityList = response || [];
       });
     },
@@ -339,7 +372,6 @@ export default {
     getAreaList(){
       var cityId = this.queryParams.cityId
       listAreaByPid(cityId).then(response => {
-        // console.log("getAreaList"+JSON.stringify(response))
          this.areaList = response || [];
       });
     },
@@ -356,8 +388,6 @@ export default {
       } else { //val为空时,还原数组
         this.channelList = this.channelCopyList;
       }
-      console.log("this.channelList == "+JSON.stringify(this.channelList))
-      console.log("this.channelCopyList == "+JSON.stringify(this.channelCopyList))
     },
 
 

+ 5 - 4
src/views/order/userTicket/detail.vue

@@ -47,10 +47,6 @@
             <div class="title">手机号:</div>
             <div class="txt">{{ info.phone }}</div>
           </div>
-          <div class="info-item-content-one">
-            <div class="title">上级经销商:</div>
-            <div class="txt">{{ info.channelName }}</div>
-          </div>
         </div>
       </div>
     </div>
@@ -81,6 +77,11 @@
             <div class="title">盲票售价:</div>
             <div class="txt">{{ $numberFormat(info.salePrice) }}元</div>
           </div>
+          <div class="info-item-content-one">
+            <div class="title">经销商:</div>
+            <div class="txt" v-if="info.channelName">{{ info.channelName }}</div>
+            <div class="txt" v-else>--</div>
+          </div>
         </div>
       </div>
     </div>

+ 89 - 4
src/views/order/userTicket/index.vue

@@ -54,6 +54,28 @@
         >
         </el-date-picker>
       </el-form-item>
+      <el-form-item label="经销商" prop="parentId">
+        <el-select
+          v-model="queryParams.channelId"
+          placeholder="输入经销商名称或手机号码"
+          style="width: 100%;"
+          filterable
+          clearable
+          :filter-method="dataFilter"
+          @change="handleQuery"
+        >
+          <el-option
+            v-for="(item, index) in channelList"
+            :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>
         <el-button
           type="primary"
@@ -77,8 +99,16 @@
           icon="el-icon-download"
           size="small"
           @click="handleExportDraw"
-          v-hasPermi="['order:deliver:export']"
-          >导出订单</el-button
+          v-hasPermi="['order:userTicket:export']"
+          >导出订单</el-button>
+        <el-button
+          type="infor"
+          plain
+          icon="el-icon-download"
+          size="small"
+          @click="handleExportDrawExport"
+          v-hasPermi="['order:userTicket:ticketExport']"
+        >导出订单盲票</el-button
         >
       </el-col>
       <right-toolbar
@@ -127,6 +157,12 @@
           <div>{{ row.nickName }}/{{ row.phone }}</div>
         </template>
       </el-table-column>
+      <el-table-column label="经销商" prop="channelName" min-width="95" >
+        <template slot-scope="{ row }">
+          <div v-if="row.channelName">{{ row.channelName }}</div>
+          <div v-else>--</div>
+        </template>
+      </el-table-column>>
       <el-table-column label="操作" fixed="right" align="center" width="80">
         <template slot-scope="{ row }">
           <div>
@@ -152,7 +188,8 @@
   </div>
 </template>
 <script>
-import { ticketOrderList, ticketOrderExport } from "@/api/business/order";
+import { ticketOrderList, ticketOrderExport, listSite, deliverOrderDrawExport } from "@/api/business/order";
+
 export default {
   name: "UserTicket",
   data() {
@@ -166,8 +203,12 @@ export default {
         startTime: "",
         endTime: "",
         phone: "",
-        status: ""
+        status: "",
+        channelId: "",
       },
+      // 上级渠道列表
+      channelList:[],
+      channelCopyList:[],
       // 分页
       pageParams: {
         pageNum: 1,
@@ -184,6 +225,7 @@ export default {
   },
   created() {
     this.getList()
+    this.getChannelList()
   },
   methods: {
     // 订单列表
@@ -237,10 +279,31 @@ export default {
       this.queryParams.startTime = "";
       this.queryParams.endTime = "";
       this.queryParams.status = "";
+      this.queryParams.channelId = "";
       this.state = "null"
       this.getList();
     },
 
+    // 获取上级渠道下拉列表
+    getChannelList(){
+      listSite({}).then(response => {
+        this.channelList = response.rows || [];
+        this.channelCopyList = response.rows || [];
+      });
+    },
+    dataFilter(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;
+      }
+    },
+
     // 选择下单时间
     tardeTime(e) {
       if (e) {
@@ -294,6 +357,28 @@ export default {
           this.vloading.close();
         });
     },
+    handleExportDrawExport(){
+      this.$confirm("是否确认导出订单盲票?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.vloading = this.$loading({
+            lock: true,
+            text: "正在导出订单.....",
+            background: "rgba(0, 0, 0, 0.7)",
+          });
+          return deliverOrderDrawExport(this.queryParams);
+        })
+        .then((response) => {
+          this.vloading.close();
+          this.download(response.msg);
+        })
+        .catch(() => {
+          this.vloading.close();
+        });
+    }
   },
 };
 </script>