Просмотр исходного кода

Merge branch 'test' into 'master'

Test

See merge request quanshu/mp-ui-pc!271
zhong chunping 3 лет назад
Родитель
Сommit
bc4e1a2060
34 измененных файлов с 2205 добавлено и 147 удалено
  1. 12 1
      src/api/business/category.js
  2. 84 0
      src/api/business/marketing.js
  3. 21 0
      src/api/business/recovery.js
  4. 2 1
      src/api/business/supplier.js
  5. 1 1
      src/router/index.js
  6. 2 1
      src/views/business/banner/components/BannerCreate.vue
  7. 36 6
      src/views/business/category/components/CategoryCreate.vue
  8. 8 4
      src/views/business/category/index.vue
  9. 1 1
      src/views/business/channel/index.vue
  10. 2 2
      src/views/business/couponPkg/index.vue
  11. 36 15
      src/views/business/goods/add.vue
  12. 25 1
      src/views/business/goods/components/spec.vue
  13. 14 13
      src/views/business/goods/index.vue
  14. 356 5
      src/views/business/marketing/add.vue
  15. 143 0
      src/views/business/marketing/components/ActivityTable.vue
  16. 216 0
      src/views/business/marketing/components/AwardsList.vue
  17. 94 0
      src/views/business/marketing/components/CoinAdd.vue
  18. 183 0
      src/views/business/marketing/components/CouponAdd.vue
  19. 154 0
      src/views/business/marketing/components/CouponPkgAdd.vue
  20. 183 0
      src/views/business/marketing/components/GoodsAdd.vue
  21. 194 0
      src/views/business/marketing/detail.vue
  22. 55 40
      src/views/business/marketing/index.vue
  23. 200 0
      src/views/business/recovery/index.vue
  24. 1 1
      src/views/business/salesite/index.vue
  25. 1 6
      src/views/business/supplier/index.vue
  26. 58 18
      src/views/business/ticket/components/AwardsList.vue
  27. 2 2
      src/views/business/ticket/components/CoinAdd.vue
  28. 1 1
      src/views/business/ticket/components/CouponAdd.vue
  29. 1 1
      src/views/business/ticket/components/CouponPkgAdd.vue
  30. 1 1
      src/views/business/ticket/components/GoodsAdd.vue
  31. 62 15
      src/views/business/ticket/create.vue
  32. 31 9
      src/views/business/ticket/detail.vue
  33. 1 1
      src/views/business/ticket/index.vue
  34. 24 1
      src/views/order/deliver/index.vue

+ 12 - 1
src/api/business/category.js

@@ -10,6 +10,17 @@ export function goodsCategoryList(urlParams, data) {
   })
 }
 
+
+// 查询分类列表树状
+export function goodsCategoryListTree(urlParams, data) {
+  return request({
+    url: '/api/v1/mp/admin/goods/category/listTree',
+    method: 'post',
+    data,
+    urlParams
+  })
+}
+
 // 查询分类下拉列表, 不分页
 export function goodsCategoryItems(data) {
   return request({
@@ -53,4 +64,4 @@ export function goodsCategoryRemove(data) {
     method: 'post',
     data
   })
-}
+}

+ 84 - 0
src/api/business/marketing.js

@@ -0,0 +1,84 @@
+import request from '@/utils/request'
+
+//添加、修改
+export function addMarketing(data) {
+  return request({
+    url: `/api/v1/mp/admin/marketing/${data.id ? 'update' : 'create'}`,
+    method: 'post',
+    data
+  })
+}
+
+//查询列表
+export function getMarketingList(urlParams, data) {
+  return request({
+    url: '/api/v1/mp/admin/marketing/list',
+    method: 'post',
+    data,
+    urlParams
+  })
+}
+
+//查询列表
+export function ticketMarketingExport(data) {
+  return request({
+    url: '/api/v1/mp/admin/marketing/export',
+    method: 'post',
+    data,
+  })
+}
+
+//查询详情
+export function getMarketingDetail(id) {
+  return request({
+    url: `/api/v1/mp/admin/marketing/detail/${id}`,
+    method: 'post',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded'
+    },
+  })
+}
+
+//删除
+export function delMarketing(Id) {
+  return request({
+    url: `/api/v1/mp/admin/marketing/delete/${Id}`,
+    method: 'post',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded'
+    },
+  })
+}
+
+//开启活动
+export function setMarketingStatus(data) {
+  return request({
+    url: `/api/v1/mp/admin/marketing/on/${data}`,
+    method: 'post',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded'
+    },
+  })
+}
+
+//关闭活动
+export function setMarketingStatusOff(data) {
+  return request({
+    url: `/api/v1/mp/admin/marketing/off/${data}`,
+    method: 'post',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded'
+    },
+  })
+}
+
+//查询活动数据列表
+export function getMarketingData(id) {
+  return request({
+    url: `/api/v1/mp/admin/marketing/data/${id}`,
+    method: 'post',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded'
+    },
+  })
+}

+ 21 - 0
src/api/business/recovery.js

@@ -0,0 +1,21 @@
+import request from '@/utils/request'
+
+// 商品回收订单
+export function getRecoveryList(urlParams,data) {
+  return request({
+    url: '/api/v1/mp/admin/prize/recovery/list',
+    method: 'post',
+    urlParams,
+    data
+  })
+}
+
+// 商品回收订单导出
+export function exchangeRecoveryExport(data) {
+  return request({
+    url: '/api/v1/mp/admin/prize/recovery/export',
+    method: 'post',
+    timeout: 15 * 60 * 1000,
+    data
+  })
+}

+ 2 - 1
src/api/business/supplier.js

@@ -1,11 +1,12 @@
 import request from '@/utils/request'
 
 // 查询供应商列表
-export function getSupplierList(data) {
+export function getSupplierList(urlParams,data) {
   return request({
     url: '/api/v1/mp/admin/supplier/list',
     method: 'post',
     data,
+    urlParams
   })
 }
 

+ 1 - 1
src/router/index.js

@@ -274,7 +274,7 @@ export const constantRoutes = [
       },
       {
         path: 'query',
-        component: (resolve) => require(['@/views/business/marketing/add'], resolve),
+        component: (resolve) => require(['@/views/business/marketing/detail'], resolve),
         name: 'MarketingQuery',
         meta: { title: '抽奖活动详情' , activeMenu: '/marketing/marketing', noCache: true }
       }

+ 2 - 1
src/views/business/banner/components/BannerCreate.vue

@@ -49,6 +49,7 @@
           <el-radio-group v-model="form.type" size="small" @change="changeType">
             <el-radio label="link">自定义链接</el-radio>
             <el-radio label="tag">商品标签</el-radio>
+            <el-radio label="show">仅展示</el-radio>
           </el-radio-group>
         </el-form-item>
         <el-form-item label="链接地址" prop="linkUrl" v-if="form.type == 'link'">
@@ -252,4 +253,4 @@ export default {
     font-size: 12px;
     color: #999;
   }
-</style>
+</style>

+ 36 - 6
src/views/business/category/components/CategoryCreate.vue

@@ -7,6 +7,16 @@
       :before-close="close"
     >
       <el-form :model="form" ref="form" :rules="rules" label-width="100px">
+        <el-form-item label="上级分类" prop="parentId">
+          <el-select
+            v-model="form.parentId"
+            placeholder="请选择上级分类"
+            filterable
+            clearable
+          >
+            <el-option :label="item.name" :value="item.categoryId" v-for="(item, index) in parentList" :key="index" />
+          </el-select>
+        </el-form-item>
         <el-form-item label="分类名称" prop="name">
           <el-input
             v-model="form.name"
@@ -50,7 +60,7 @@
 </template>
 <script>
 import CustomFieldsMixin from "@/mixins/CustomFields";
-import { goodsCategoryCreate, goodsCategoryDetail, goodsCategoryUpdate } from "@/api/business/category";
+import { goodsCategoryCreate, goodsCategoryDetail, goodsCategoryUpdate, goodsCategoryListTree } from "@/api/business/category";
 export default {
   mixins: [CustomFieldsMixin],
   props: {
@@ -63,14 +73,20 @@ export default {
     categoryId: {
       type: [String, Number],
       default: null
-    }
+    },
   },
   data() {
     return {
+      //一级分类列表
+      parentList: [{
+        name:'',
+        categoryId:'',
+      }],
       loading: false,
       form: {
         isShow: 1,
-        sort: 0
+        sort: 0,
+        parentId: '',
       },
       rules: {
         name: [
@@ -97,6 +113,7 @@ export default {
       },
     };
   },
+
   computed: {
     title() {
       return this.categoryId ? '编辑分类' : '添加分类';
@@ -117,14 +134,24 @@ export default {
   created() {
     if(this.categoryId){
       goodsCategoryDetail({ categoryId: this.categoryId }).then(res => {
-        const { name, sort, picUrl, isShow } = res && res.data
+        const { name, sort, picUrl, isShow, parentId } = res && res.data
         this.form = {
-          name, sort, picUrl, isShow
+          name, sort, picUrl, isShow, parentId:parentId == 0?"":parentId
         }
+
       })
     }
+    this.getParentList()
   },
   methods: {
+    //获取一级列表
+    getParentList(){
+      goodsCategoryListTree( "pageNum=1&",{}).then((res) => {
+          if (res.code == 0) {
+            this.parentList = res.rows;
+          }
+        })
+    },
     // 关闭弹框
     close() {
       this.$emit("close");
@@ -135,6 +162,9 @@ export default {
     // 确认
     saveClick() {
       this.loading = true;
+      if(this.form.parentId == ""){
+        this.form.parentId = 0
+      }
       const subForm = this.$refs["form"];
       subForm.validate((valid) => {
         if (valid) {
@@ -174,4 +204,4 @@ export default {
   align-items: center;
   justify-content: space-between;
 }
-</style>
+</style>

+ 8 - 4
src/views/business/category/index.vue

@@ -52,7 +52,7 @@
       ></right-toolbar>
     </el-row>
     <!-- 列表 -->
-    <el-table ref="table" v-loading="loading" :data="list">
+    <el-table ref="table" v-loading="loading" :data="list" row-key="categoryId" :tree-props="{children: 'goodsCategoryList', hasChildren: 'hasChildren'}">
       <el-table-column label="分类名称" prop="name" />
       <el-table-column label="分类图片">
         <div slot-scope="{ row }">
@@ -116,7 +116,7 @@
 <script>
 import { publicFileGetUrl } from "@/api/common";
 import {
-  goodsCategoryList,
+  goodsCategoryListTree,
   goodsCategoryRemove,
 } from "@/api/business/category";
 import CategoryCreate from "./components/CategoryCreate";
@@ -147,7 +147,7 @@ export default {
   methods: {
     getList() {
       this.loading = true;
-      goodsCategoryList(
+      goodsCategoryListTree(
         "pageNum=" +
           this.pageParams.pageNum +
           "&pageSize=" +
@@ -160,7 +160,11 @@ export default {
           if (res.code == 0) {
             res.rows.forEach((item) => {
               item.picUrl = publicFileGetUrl + item.picUrl.split(",")[0];
+              item.goodsCategoryList.forEach(item1 => {
+                item1.picUrl = publicFileGetUrl + item1.picUrl.split(",")[0];
+              })
             });
+
             this.total = res.total;
             this.list = res.rows;
           }
@@ -210,4 +214,4 @@ export default {
 };
 </script>
 <style>
-</style>
+</style>

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

@@ -169,7 +169,7 @@
                   size="mini"
                   type="text"
                   @click="handleStatusChange(scope.row)"
-                  v-hasPermi="['admin:channel:edit']"
+                  v-hasPermi="['business:channel:edit']"
                 >
                   <span v-if="getValue(scope.row.status) == 1" > 停用</span>
                   <span v-if="getValue(scope.row.status) == 2" > 启用</span>

+ 2 - 2
src/views/business/couponPkg/index.vue

@@ -114,8 +114,8 @@
     </el-table>
     <pagination
       :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
+      :page.sync="pageParams.pageNum"
+      :limit.sync="pageParams.pageSize"
       @pagination="getList()"
     />
   </div>

+ 36 - 15
src/views/business/goods/add.vue

@@ -30,13 +30,9 @@
       <el-row :gutter="40" style="width: 500px">
         <el-col :span="23">
           <el-form-item label="商品分类:" prop="categoryId">
-            <el-select
-              v-model="addData.categoryId"
-              placeholder="请选择商品分类"
-              clearable
-            >
-              <el-option :label="item.name" :value="item.categoryId" v-for="(item, index) in goodsCategoryItemsList" :key="index" />
-            </el-select>
+            <el-cascader
+              v-model="addData.categoryId" clearable
+              :options="goodsCategoryItemsList" :props="{ expandTrigger: 'hover', value: 'categoryId',label: 'name', children: 'goodsCategoryList', }"></el-cascader>
           </el-form-item>
         </el-col>
       </el-row>
@@ -119,6 +115,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="请输入商品采购价格">
@@ -169,7 +179,7 @@ import WangEditor from '@/components/WangEditor'
 import Spec from './components/spec'
 import TinyEditor from '@/components/TinyEditor'
 import { getGoodsDetail, addGoods } from '@/api/business/goods'
-import { goodsCategoryItems } from '@/api/business/category'
+import { goodsCategoryListTree } from '@/api/business/category'
 import { getSupplierList } from '@/api/business/supplier'
 import { goodsTagItems } from '@/api/business/tag'
 import { publicFileGetUrl } from "@/api/common"
@@ -192,7 +202,8 @@ export default {
       goodsTagItemsList: [],
       addData: {
         multiSku: 0,
-        description: ''
+        description: '',
+        originPrice: 0
       },
       createShow:false,
       rules: {
@@ -210,6 +221,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 +274,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)
@@ -273,8 +293,8 @@ export default {
   },
   methods: {
     getGoodsCategoryItems(){
-      goodsCategoryItems({}).then(res => {
-        this.goodsCategoryItemsList = res && res.data
+      goodsCategoryListTree("",{}).then(res => {
+        this.goodsCategoryItemsList = res && res.rows
       })
     },
     //获取供应商
@@ -306,12 +326,13 @@ export default {
       this.$refs.addItem.validate((valid, items) => {
         if (valid) {
           this.addData.skuList = skuList
-          const { value, cost,exchangePrice, description, ...rest } = this.addData
+          const { value, categoryId, cost,exchangePrice, description, ...rest } = this.addData
           addGoods({...rest, ...{
             value: accMul(value, 100),
             cost: cost == '' || cost == null ? '' : accMul(cost, 100),
             exchangePrice: accMul(exchangePrice, 1),
-            description: encodeURI(description)
+            description: encodeURI(description),
+            categoryId:categoryId[1],
           }}).then(res => {
             if (res.code === 0) {
               this.$message({

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

@@ -40,6 +40,8 @@
           <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" 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 +76,18 @@
               <el-input v-model="sku.exchange" />
             </el-form-item>
           </td>
+<!--          1111111111111111111111-->
+          <td>
+            <el-form-item :prop="`skuList.${index}.discountRate`" :rules="discountRateRules">
+              <!--              <p>{{ (sku.valueY * 10).toFixed(0) }}</p>-->
+              <el-input v-model="sku.discountRate" />
+            </el-form-item>
+          </td>
+          <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" />
@@ -133,6 +147,10 @@ export default {
       exchangeRules: [
         { required: true,message:'请输入盲豆数量', trigger: 'blur' },
         { pattern: /^([1-9]\d*)$/, message: "请输入正确的盲豆数量", trigger: ["blur", "change"] }
+      ],
+      discountRateRules: [
+        { 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"] }
       ]
     }
   },
@@ -169,6 +187,8 @@ 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, 'discountRate', accDiv(item.discountRate,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 +285,8 @@ export default {
           valueY: 0.00,
           costY: '',
           skuCode:'',
+          originPrice: 0,
+          discountRate: '',
           quantity: 0,
           status: true,
           properties
@@ -300,9 +322,11 @@ export default {
       this.$refs.sku.validate((valid, items) => {
         if (valid) {
           this.skuList.forEach(item => {
-            const { valueY,exchange, costY } = item
+            const { valueY,exchange, costY, originPrice, discountRate } = item
             item.value = accMul(valueY, 100)
             item.exchangePrice = accMul(exchange, 1)
+            item.originPrice = accMul(originPrice, 1)
+            item.discountRate = accMul(discountRate, 1)
             item.cost = costY == '' ? '' : accMul(costY, 100)
             item.picUrl = item.picUrlArr.map(item => { return item.fileName }).toString()
           })

+ 14 - 13
src/views/business/goods/index.vue

@@ -19,15 +19,11 @@
           @keyup.enter.native="queryParams.pageNum = 1;getList()"
         />
       </el-form-item>
-      <el-form-item label="商品分类" prop="categoryId">
-       <el-select
-          v-model="queryParams.categoryId"
-          placeholder="请选择商品分类"
-          clearable
-          @change="queryParams.pageNum = 1;getList()"
-        >
-          <el-option :label="item.name" :value="item.categoryId" v-for="(item, index) in goodsCategoryItemsList" :key="index" />
-        </el-select>
+      <el-form-item label="商品分类" prop="categoryIdList">
+        <el-cascader
+          v-model="queryParams.categoryIdList" collapse-tags clearable
+          :options="goodsCategoryItemsList" :props="{ expandTrigger: 'hover', value: 'categoryId',label: 'name', children: 'goodsCategoryList', multiple: true, }"
+          @change="queryParams.pageNum = 1;getList()"></el-cascader>
       </el-form-item>
       <el-form-item label="商品标签" prop="tagId">
         <el-select
@@ -147,7 +143,7 @@
 <script>
 import { publicFileGetUrl } from "@/api/common"
 import { getGoodsList, delGoods, setGoodsStatus, setTableData} from '@/api/business/goods'
-import { goodsCategoryItems } from '@/api/business/category'
+import { goodsCategoryListTree } from '@/api/business/category'
 import { goodsTagItems } from '@/api/business/tag'
 import { accMul } from '@/utils/util'
 import { getSupplierList } from '@/api/business/supplier'
@@ -201,8 +197,8 @@ export default {
     },
 
     getGoodsCategoryItems(){
-      goodsCategoryItems({}).then(res => {
-        this.goodsCategoryItemsList = res && res.data
+      goodsCategoryListTree("",{}).then(res => {
+        this.goodsCategoryItemsList = res && res.rows
       })
     },
 
@@ -220,10 +216,15 @@ export default {
       // if (reset) {
       //   this.queryParams = { pageNum: 1, pageSize: 20, orderByColumn: '', isAsc: '', }
       // }
+      if(this.queryParams.categoryIdList){
+        for (let i = 0; i < this.queryParams.categoryIdList.length; i++) {
+          this.queryParams.categoryIdList[i] = this.queryParams.categoryIdList[i][1]
+        }
+      }
       getGoodsList('pageNum='+this.queryParams.pageNum + '&pageSize='+this.queryParams.pageSize+'&orderByColumn='+ this.queryParams.orderByColumn +'&isAsc='+ this.queryParams.isAsc +'&', {
         title: this.queryParams.title,
         goodsId: this.queryParams.goodsId,
-        categoryId: this.queryParams.categoryId,
+        categoryIdList: this.queryParams.categoryIdList,
         tagId: this.queryParams.tagId,
         status: this.queryParams.status,
         exchangeShow: this.queryParams.exchangeShow, supplierId: this.queryParams.supplierId,

+ 356 - 5
src/views/business/marketing/add.vue

@@ -1,17 +1,368 @@
 <template>
-  <div>1111
+  <div class="app-container goods-add">
+    <el-divider content-position="left">基础信息</el-divider>
+    <el-form ref="addItem" :rules="rules" :model="addData" label-width="120px">
+      <el-row :gutter="40" style="width: 600px">
+        <el-col :span="23">
+          <el-form-item label="活动名称:" prop="title">
+            <el-input v-model="addData.title" placeholder="输入活动名称"/>
+          </el-form-item>
+        </el-col>
+        <el-col :span="23">
+          <el-form-item label="活动封面:" prop="picUrl">
+            <image-upload
+              v-model="marketingPicUrl"
+              :limit="1"
+              :file-size="0.2"
+              @change="$refs.addItem.validateField(['picUrl'])"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col>
+          <el-form-item label="活动日期:" prop="dateValue">
+            <el-date-picker value-format="timestamp" v-model="addData.dateValue" :picker-options="setYearDisabled" type="datetimerange"
+                            range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"/>
+          </el-form-item>
+        </el-col>
+        <el-col :span="16">
+          <el-form-item label="初始用户数:" prop="fakeNum">
+            <el-input v-model="addData.fakeNum"/>
+          </el-form-item>
+        </el-col>
+        <el-col :span="23">
+          <el-form-item label="抽奖码获取方式:" prop="type">
+            <el-col>邀请用户助力</el-col>
+            <el-col>用户助力条件:
+              <el-radio-group v-model="labelRadio" >
+                <el-radio :label="1">每个账号终身仅助力一次</el-radio>
+                <el-radio :label="2" disabled>无</el-radio>
+              </el-radio-group>
+            </el-col>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-divider content-position="left">奖品设置</el-divider>
+      <el-row>
+        <el-col :span="22">
+          <el-form-item label="" prop="awardsList">
+            <!-- 奖级列表 -->
+            <awards-list ref="awards" v-model="awardsList"  @handleCommand="handleCommand" @close="close"/>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-divider content-position="left">活动详情</el-divider>
+      <el-row>
+        <el-col :span="22">
+          <el-form-item label="" prop="description">
+            <wang-editor ref="editor" v-model="addData.description"/>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
 
-  222
-  </div>
+    <el-row>
+      <el-col :span="24" style="text-align: center">
+        <el-button type="info" @click="$router.replace('/marketing/marketing')">取消</el-button>
+        <el-button type="primary" @click="update()">保存</el-button>
+      </el-col>
+    </el-row>
 
+    <!-- 添加商品 -->
+    <goods-add :dialog-visible="goodsTableVisible" @close="close" @confirmGoods="confirmGoods"
+               v-if="goodsTableVisible"/>
+    <!-- 添加券 -->
+    <coupon-add :dialog-visible="couponTableVisible" @close="close" @confirmCoupon="confirmCoupon"
+                v-if="couponTableVisible"/>
+    <!-- 添加券包 -->
+    <coupon-pkg-add :dialog-visible="couponPkgTableVisible" @close="close" @confirmCouponPkg="confirmCouponPkg"
+                    v-if="couponPkgTableVisible"/>
+    <!-- 添加盲豆 -->
+    <coin-add :dialog-visible="coinTableVisible" @close="close" @confirmCoin="confirmCoin" v-if="coinTableVisible"/>
+  </div>
 </template>
 
 <script>
+import { publicFileGetUrl } from "@/api/common";
+import {getMarketingDetail, addMarketing} from '@/api/business/marketing'
+import Upload from '@/components/DragImageUpload'
+import WangEditor from '@/components/WangEditor'
+import AwardsList from "./components/AwardsList"
+import GoodsAdd from "./components/GoodsAdd"
+import CouponAdd from "./components/CouponAdd"
+import CouponPkgAdd from "./components/CouponPkgAdd"
+import CoinAdd from "./components/CoinAdd"
+
 export default {
-  name: "add"
+  name: "add",
+  components: {
+    Upload,
+    WangEditor,
+    AwardsList,
+    GoodsAdd,
+    CouponAdd,
+    CouponPkgAdd,
+    CoinAdd,
+  },
+  data() {
+    return {
+      //禁止选择当前今天之前的日期
+      setYearDisabled: {
+        disabledDate(time) {
+          return time.getTime() < Date.now() - 8.64e7
+        }
+      },
+      id: this.$route.query.id,
+      addData: {
+        picUrl: '',//活动主图
+        startTime: '',//开始时间
+        endTime: '',//结束时间
+        fakeNum: 0,//初始用户数
+        description: '',//活动详情
+        awardsList: [],//奖级列表
+      },
+      labelRadio: 1,//单选框
+      rules: {
+        title: [{required: true, message: '请输入活动名称', trigger: 'blur'}],
+        picUrl: [{required: true, message: '请上传活动封面', trigger: 'change'}],
+        dateValue: [{required: true, message: '请设置活动日期', trigger: 'change'}],
+        fakeNum:[{ pattern: /^([0-9]\d*)$/, message: "请输入正确的数字", trigger: ["blur", "change"]}]
+      },
+      // 奖级列表
+      awardsList: [
+        {
+          name: "一等奖",
+          sort: 1,
+          quantity: 0,
+          prizeList: [],
+          insideNum: 0,
+        },
+        {
+          name: "二等奖",
+          sort: 2,
+          quantity: 0,
+          prizeList: [],
+          insideNum: 0,
+        },
+        {
+          name: "三等奖",
+          sort: 3,
+          quantity: 0,
+          prizeList: [],
+          insideNum: 0,
+        },
+        {
+          name: "四等奖",
+          sort: 4,
+          quantity: 0,
+          prizeList: [],
+          insideNum: 0,
+        },
+        {
+          name: "五等奖",
+          sort: 5,
+          quantity: 0,//名额数量
+          prizeList: [],//列表
+          insideNum: 0,//内定数量
+        }
+      ],
+      goodsTableVisible: false, // 添加商品弹框
+      couponTitle: "", // 券名称
+      couponTableVisible: false, // 添加卡券弹框
+      couponPkgTableVisible: false, // 添加券包弹框
+      coinTableVisible: false, // 添加盲豆弹框
+      pageParams: {
+        pageNum: 1,
+        pageSize: 10,
+      },
+      dateValue: [],//开始与结束日期
+    }
+  },
+  computed: {
+    marketingPicUrl: {
+      get() {
+        return this.addData.picUrl ? this.addData.picUrl.split(',').map(item => {
+          return {
+            fileName: item
+          }
+        }) : []
+      },
+      set(val) {
+        this.$set(this.addData, 'picUrl', val.map(item => {
+          return item.fileName
+        }).toString())
+      }
+    },
+  },
+  created() {
+    if (this.id) {
+      getMarketingDetail(this.id).then(res => {
+        const { startTime, endTime, description, fakeNum,picUrl, realNum, title, awardsList, id } = res.data
+        this.addData = { title, dateValue:[startTime,endTime], picUrl, fakeNum, realNum, description, awardsList, id }
+        if(description) {
+          this.$refs.editor.setContent(description)
+        }
+        if(awardsList){
+          awardsList.forEach((item) => {
+              item.prizeList.forEach((ele) => {
+                (ele.picUrl = publicFileGetUrl + ele.picUrl.split(',')[0]),
+                  (ele.prizeType = JSON.parse(ele.prizeType).value);
+              });
+          });
+          this.$nextTick(() => {
+            this.$refs.awards.add(3, awardsList)
+          })
+          this.awardsList = awardsList
+        }
+      })
+    }
+  },
+
+  methods: {
+    // 保存
+    update() {
+      this.$refs.addItem.validate((valid, items) => {
+        if (valid) {
+          if(this.addData.dateValue[0] == this.addData.dateValue[1]){
+            this.msgError('活动开始时间与结束时间不能相等!')
+            return;
+          }
+          if(this.awardsList.length < 1) {
+            this.msgError('请至少设置一个奖级的的奖品!')
+            return;
+          }
+          // 判断没有设置奖品的奖级
+          let prizeIndex = this.awardsList.findIndex((item) => {
+            return !item.prizeList.length;
+          });
+          if (prizeIndex != -1) {
+            this.$message.error(
+              `请至少设置一个奖级的的奖品!`
+            );
+            return;
+          }
+          // 判断内定名额大于奖品名额
+          let quantityIndex = this.awardsList.findIndex((item) => {
+            return item.insideNum > item.quantity;
+          });
+          if (quantityIndex != -1) {
+            this.$message.error(
+              `${this.awardsList[quantityIndex].name}的内定名额大于奖品名额,请重新设置!`
+            );
+            return;
+          }
+          let quantityIndexTwo = this.awardsList.findIndex((item) => {
+            return item.prizeList.length != 0 && item.quantity == 0;
+          });
+          if (quantityIndexTwo != -1) {
+            this.$message.error(
+              `${this.awardsList[quantityIndexTwo].name}的名额不能为0,请重新设置!`
+            );
+            return;
+          }
+
+          this.awardsList.forEach((item) => {
+            item.prizeList = item.prizeList.map((ele) => {
+              return {
+                ...ele,
+                refId: ele.refId || ele.goodsId || ele.couponId || ele.id ,
+                prizeType: ele.prizeType,
+                quantity: ele.quantity,
+                value: Number(ele.value),
+              };
+            });
+          });
+
+          const { fakeNum, description, title, picUrl } = this.addData
+          addMarketing({
+            title,
+            description: encodeURI(description),
+            fakeNum,
+            startTime: this.addData.dateValue[0],
+            endTime: this.addData.dateValue[1],
+            awardsList: this.awardsList,
+            picUrl, id:this.addData.id?this.addData.id:"",
+          }).then(res => {
+            if (res.code === 0) {
+              this.$message({
+                message: this.addData.id ? '修改成功!' : '添加成功!',
+                type: 'success'
+              })
+              this.$store.dispatch('tagsView/delView', this.$route)
+              this.$router.go(-1)
+            }
+          })
+        } else {
+          if (items && Object.keys(items).length > 0) {
+            this.$message({
+              message: items[Object.keys(items)[0]][0].message,
+              type: 'warning'
+            })
+          }
+        }
+      })
+    },
+
+    // 添加奖品种类
+    handleCommand(e) {
+      if (e == "goods") {
+        this.goodsTableVisible = true;
+      } else if (e == "coupon") {
+        this.couponTableVisible = true;
+      } else if (e == "coupon_pkg") {
+        this.couponPkgTableVisible = true;
+      } else if (e == "coin") {
+        this.coinTableVisible = true;
+      }
+    },
+
+    // 关闭弹框
+    close() {
+      this.goodsTableVisible = false;
+      this.couponTableVisible = false;
+      this.couponPkgTableVisible = false;
+      this.coinTableVisible = false;
+    },
+
+    // 确认选中商品
+    confirmGoods(arr) {
+      this.$refs.awards.add(1, arr)
+    },
+
+    // 确认选中卡券
+    confirmCoupon(arr) {
+      ;
+      this.$refs.awards.add(1, arr)
+    },
+
+    // 确认选中券包
+    confirmCouponPkg(arr) {
+      ;
+      this.$refs.awards.add(1, arr)
+    },
+
+    // 确认输入盲豆
+    confirmCoin(obj) {
+      this.$refs.awards.add(2, obj)
+    },
+
+  }
 }
 </script>
 
-<style scoped>
+<style scoped lang="scss">
+.goods-add {
+  .tip {
+    font-size: 12px;
+    color: #999;
+  }
 
+  .el-divider {
+    .is-left {
+      color: #409EFF;
+      font-size: 20px;
+      font-weight: bolder;
+      left: 10px;
+    }
+  }
+}
 </style>

+ 143 - 0
src/views/business/marketing/components/ActivityTable.vue

@@ -0,0 +1,143 @@
+<template>
+  <div>
+    <el-dialog
+      :title="this.ids.title"
+      width="1000px"
+      :visible.sync="dialogVisible"
+      :before-close="close"
+    >
+      <div class="dialog-search">
+        <div>参与用户数量:{{this.ids.realNum}}</div>
+        <div class="ge"></div>
+        <div>抽奖码数量:{{marketingTotal}}</div>
+      </div>
+      <el-table
+        v-loading="loading"
+        :data="marketingList"
+        @selection-change="handleSelectionCoupon"
+        class="el-table"
+      >
+        <el-table-column label="用户编号" prop="userId" min-width="80" />
+        <el-table-column label="用户昵称" prop="nickName" min-width="80" />
+        <el-table-column label="抽奖码" prop="code" min-width="80" />
+        <el-table-column label="抽奖码获取时间" prop="createdTime" min-width="85">
+          <template slot-scope="scope">
+            <div>{{ parseTime(scope.row.createdTime) }}</div>
+          </template>
+        </el-table-column>
+        <el-table-column label="奖级" prop="awardsName" min-width="50" >
+          <template slot-scope="scope">
+            <div v-if="scope.row.prizeName != ''">{{ scope.row.awardsName }}</div>
+            <div v-else> -- </div>
+          </template>
+        </el-table-column>
+        <el-table-column label="奖品名称" prop="prizeName" min-width="85" >
+          <template slot-scope="scope">
+            <div v-if="scope.row.prizeType == 'COIN'">盲豆 x{{scope.row.value}}</div>
+            <div v-else-if="scope.row.prizeName != ''">{{ scope.row.prizeName }}</div>
+            <div v-else> -- </div>
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination
+        v-show="marketingTotal > 0"
+        :total="marketingTotal"
+        :page.sync="pageParams.pageNum"
+        :limit.sync="pageParams.pageSize"
+        @pagination="getMarketingData"
+      />
+      <div class="dialog-btn">
+        <el-button size="small" @click="close"> 关 闭 </el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+<script>
+import { publicFileGetUrl } from "@/api/common";
+import { getMarketingData } from '@/api/business/marketing'
+export default {
+  name: "CouponAdd",
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false,
+    },
+    ids: {
+      type: Object,
+      default: () => []
+    }
+  },
+  data() {
+    return {
+      loading: false,
+      marketingTitle: "", // 券名称
+      marketingList: [], // 卡券列表
+      marketingTotal: 0, // 卡券总数
+      selectCouponList: [], // 选中卡券
+      pageParams: {
+        pageNum: 1,
+        pageSize: 10,
+      },
+    };
+  },
+  created() {
+    this.getMarketingData();
+  },
+  methods: {
+    // 卡券列表
+    getMarketingData() {
+      this.loading = true;
+      getMarketingData(this.ids.id ).then((res) => {
+        this.marketingList = res.rows
+        this.marketingTotal = res.total;
+        this.loading = false;
+      });
+    },
+
+    // 选中卡券
+    handleSelectionCoupon(e) {
+      this.selectCouponList = e.map((item) => {
+        return {
+          couponNum: 1,
+          couponId: item.couponId,
+          title: item.title,
+          createdTime: item.createdTime,
+          updatedTime: item.updatedTime,
+          type: item.type,
+          discount: item.discount,
+          dueDays: item.dueDays
+        };
+      });
+    },
+
+    // 确认选中卡券
+    confirmCoupon() {
+      this.$emit("confirmCoupon", this.selectCouponList);
+      this.close()
+    },
+
+    close() {
+      this.$emit("close");
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.dialog-search {
+  display: flex;
+  line-height: 32px;
+  margin-bottom: 20px;
+  .ge {
+    width: 40px;
+  }
+}
+.dialog-btn {
+  display: flex;
+  align-content: center;
+  justify-content: flex-end;
+  padding: 40px 0 0;
+  .ge {
+    width: 40px;
+  }
+}
+</style>

+ 216 - 0
src/views/business/marketing/components/AwardsList.vue

@@ -0,0 +1,216 @@
+<template>
+  <div>
+    <div class="prize" v-for="(item, index) in awardsList" :key="index">
+        <div class="prize-top">
+          <div>奖级:{{ item.name }}</div>
+          <div>名额:
+            <el-input-number
+              v-model="item.quantity"
+              controls-position="right"
+              @change="handleChangeAllTwo($event, item)"
+              :min="0"
+              size="small"
+              :disabled="item.isEdit"
+            ></el-input-number>
+          </div>
+          <div>
+            内部名额:
+            <el-input-number
+              v-model="item.insideNum"
+              controls-position="right"
+              @change="handleChangeAll($event, item)"
+              :min="0"
+              size="small"
+              :disabled="item.isEdit"
+            ></el-input-number>
+          </div>
+        </div>
+        <div class="prize-table">
+          <el-table :data="item.prizeList" class="el-table">
+            <el-table-column label="奖品图片">
+              <template slot-scope="scope">
+                <el-image
+                  style="width: 70px; height: 70px"
+                  :src="scope.row.picUrl"
+                  :preview-src-list="[scope.row.picUrl]"
+                >
+                </el-image>
+              </template>
+            </el-table-column>
+            <el-table-column label="奖品名称" prop="title" >
+              <template slot-scope="scope">
+                <div v-if="scope.row.prizeType == 'coin' && scope.row.value >= 0">盲豆 x{{scope.row.value}}</div>
+                <div v-else>{{scope.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>
+              </template>
+            </el-table-column>
+            <el-table-column label="操作" align="center">
+              <template slot-scope="scope">
+                <el-button
+                  size="mini"
+                  type="text"
+                  @click="handleDel(scope.$index, item)"
+                  >删除</el-button
+                >
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+        <div class="prize-btn">
+          <el-dropdown @command="handleCommand($event, index)">
+            <el-button type="primary" size="small" >
+              添加奖品<i class="el-icon-arrow-down el-icon--right"></i>
+            </el-button>
+            <el-dropdown-menu slot="dropdown">
+              <el-dropdown-item command="goods">商品</el-dropdown-item>
+              <el-dropdown-item command="coupon">券</el-dropdown-item>
+              <el-dropdown-item command="coupon_pkg">券包</el-dropdown-item>
+              <el-dropdown-item command="coin">盲豆</el-dropdown-item>
+            </el-dropdown-menu>
+          </el-dropdown>
+        </div>
+      </div>
+  </div>
+</template>
+<script>
+export default {
+  name: "AwardList",
+  props: {
+    value: {
+      type: Array,
+      default: () => []
+    },
+  },
+  data() {
+    return {
+      prizeIndex: null, // 奖级下标
+      // 奖级列表
+      awardsList: [
+        {
+          name: "一等奖",
+          sort: 1,
+          quantity: 0,
+          prizeList: [],
+          insideNum: 0,
+        },
+        {
+          name: "二等奖",
+          sort: 2,
+          quantity: 0,
+          prizeList: [],
+          insideNum: 0,
+        },
+        {
+          name: "三等奖",
+          sort: 3,
+          quantity: 0,
+          prizeList: [],
+          insideNum: 0,
+        },
+        {
+          name: "四等奖",
+          sort: 4,
+          quantity: 0,
+          prizeList: [],
+          insideNum: 0,
+        },
+        {
+          name: "五等奖",
+          sort: 5,
+          quantity: 0,//名额数量
+          prizeList: [],//列表
+          insideNum: 0,//内定数量
+        }
+      ],
+    };
+  },
+  methods: {
+    // 添加奖品
+    add(type, item) {
+      if(type == 1) {
+        this.awardsList[this.prizeIndex].prizeList = this.awardsList[this.prizeIndex].prizeList.concat(item);
+      } else if (type == 2) {
+        this.awardsList[this.prizeIndex].prizeList.push(item);
+      } else if (type == 3) {
+        this.awardsList = item
+      }
+      let filterArr = this.awardsList.filter((item) => {
+        return item.prizeList.length != 0;
+      });
+      this.$emit('input', filterArr)
+      this.$emit('close')
+    },
+    // 选择奖品种类
+    handleCommand(e, index) {
+      this.prizeIndex = index;
+      this.$emit('handleCommand', e)
+    },
+
+    // 改变奖级数量
+    handleChangeAll(e, item) {
+      this.$set(item, "insideNum", e);
+      this.$forceUpdate();
+    },
+    handleChangeAllTwo(e, item){
+      this.$set(item, "quantity", e);
+      this.$forceUpdate();
+    },
+
+    // 改变奖品数量
+    handleChange(e, index) {
+      this.prizeIndex = index;
+      this.$forceUpdate();
+      // this.getQuantity();
+    },
+
+    // 奖级商品删除
+    handleDel(index, item) {
+      this.prizeIndex = item.sort - 1;
+      let list = item.prizeList;
+      list.splice(index, 1);
+      this.$set(item, "prizeList", list);
+      // this.getQuantity();
+    },
+
+    // 计算奖级数量
+    getQuantity() {
+      let num = 0;
+      this.awardsList[this.prizeIndex].prizeList.forEach((item) => {
+        num += item.quantity;
+      });
+      this.awardsList[this.prizeIndex].quantity = num;
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.prize {
+  width: 1000px;
+  margin-bottom: 50px;
+  background: #f9f9f9;
+  border: 1px solid #bbbbbb;
+  font-size: 14px;
+  &-top {
+    padding: 10px 20px;
+    margin-bottom: 10px;
+    display: flex;
+    align-content: center;
+    justify-content: space-around;
+    border-bottom: 1px solid #bbbbbb;
+    div {
+      line-height: 36px;
+    }
+  }
+  &-btn {
+    border-top: 1px solid #bbbbbb;
+    padding: 10px;
+  }
+}
+</style>

+ 94 - 0
src/views/business/marketing/components/CoinAdd.vue

@@ -0,0 +1,94 @@
+<template>
+  <div>
+    <el-dialog
+      title="添加盲豆奖品"
+      :visible.sync="dialogVisible"
+      :before-close="close"
+      width="500px"
+    >
+      <el-form
+        :model="coinForm"
+        :rules="coinRules"
+        ref="coinForm"
+        label-width="100px"
+      >
+        <el-form-item label="盲豆数量" prop="quantity">
+          <el-input
+            v-model="coinForm.quantity"
+            size="small"
+            placeholder="请输入盲豆数量"
+            style="width: 200px"
+          />
+        </el-form-item>
+      </el-form>
+      <div class="dialog-btn">
+        <el-button size="small" @click="close"> 取 消 </el-button>
+        <div class="ge"></div>
+        <el-button type="primary" size="small" @click="confirmCoin">
+          确 认
+        </el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+<script>
+import { publicFileGetUrl } from "@/api/common";
+export default {
+  name: "CoinAdd",
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false,
+    },
+  },
+  data() {
+    return {
+      coinForm: { quantity: "" },
+      coinRules: {
+        quantity: [
+          { required: true, message: "请输入数量", trigger: "blur" },
+          {
+            pattern: /^([1-9]\d*)$/,
+            message: "请输入合法的数字",
+            trigger: ["blur", "change"],
+          },
+        ],
+      },
+    };
+  },
+  methods: {
+    // 确认输入盲豆
+    confirmCoin() {
+      let coin = {
+        prizeType: "coin",
+        // quantity: 1,
+        title: `盲豆 x${this.coinForm.quantity}`,
+        picUrl: publicFileGetUrl + "md.jpeg",
+        value: this.coinForm.quantity,
+        sortWeight: 100
+      };
+      this.$refs["coinForm"].validate((valid) => {
+        if (valid) {
+          this.$emit("confirmCoin", coin);
+        } else {
+          return false;
+        }
+      });
+    },
+    close() {
+      this.$emit("close");
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.dialog-btn {
+  display: flex;
+  align-content: center;
+  justify-content: flex-end;
+  padding: 40px 0 0;
+  .ge {
+    width: 40px;
+  }
+}
+</style>

+ 183 - 0
src/views/business/marketing/components/CouponAdd.vue

@@ -0,0 +1,183 @@
+<template>
+  <div>
+    <el-dialog
+      title="添加券奖品"
+      width="1000px"
+      :visible.sync="dialogVisible"
+      :before-close="close"
+    >
+      <div class="dialog-search">
+        <div>券名称:</div>
+        <el-input
+          v-model="couponTitle"
+          placeholder="请输入券名称"
+          clearable
+          size="small"
+          style="width: 240px"
+          @keyup.enter.native="getCouponList"
+        />
+        <div class="ge"></div>
+        <el-button
+          type="primary"
+          icon="el-icon-search"
+          size="mini"
+          @click="getCouponList"
+          >查询</el-button
+        >
+      </div>
+      <el-table
+        v-loading="loading"
+        :data="couponList"
+        @selection-change="handleSelectionCoupon"
+        class="el-table"
+      >
+        <el-table-column
+          type="selection"
+          width="55"
+          align="center"
+          fixed="left"
+        />
+        <!--  -->
+        <el-table-column label="券ID" prop="couponId" />
+        <el-table-column label="券图片">
+          <template slot-scope="scope">
+            <div>
+              <el-image
+                style="width: 100px; height: 100px"
+                :src="scope.row.picUrl"
+                :preview-src-list="[scope.row.picUrl]"
+              >
+              </el-image>
+            </div>
+          </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>{{ scope.row.type.desc }}</div>
+          </template>
+        </el-table-column>
+        <el-table-column label="券价格" min-width="85">
+          <template slot-scope="scope">
+            <div>¥{{ $numberFormat(scope.row.discount) }}</div>
+          </template>
+        </el-table-column>
+        <el-table-column label="有效期限" min-width="85">
+          <template slot-scope="scope">
+            <div>领取后{{ scope.row.dueDays }}天有效</div>
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination
+        v-show="couponTotal > 0"
+        :total="couponTotal"
+        :page.sync="pageParams.pageNum"
+        :limit.sync="pageParams.pageSize"
+        @pagination="getCouponList"
+      />
+      <div class="dialog-btn">
+        <el-button size="small" @click="close"> 取 消 </el-button>
+        <div class="ge"></div>
+        <el-button type="primary" size="small" @click="confirmCoupon">
+          确 认
+        </el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+<script>
+import { publicFileGetUrl } from "@/api/common";
+import { getCouponList } from "@/api/business/coupon";
+export default {
+  name: "CouponAdd",
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false,
+    },
+  },
+  data() {
+    return {
+      loading: false,
+      couponTitle: "", // 券名称
+      couponList: [], // 卡券列表
+      couponTotal: 0, // 卡券总数
+      selectCouponList: [], // 选中卡券
+      pageParams: {
+        pageNum: 1,
+        pageSize: 10,
+      },
+    };
+  },
+  created() {
+    this.getCouponList();
+  },
+  methods: {
+    // 卡券列表
+    getCouponList() {
+      this.loading = true;
+      getCouponList(
+        "pageNum=" +
+          this.pageParams.pageNum +
+          "&pageSize=" +
+          this.pageParams.pageSize +
+          "&",
+        { title: this.couponTitle, status: "on" }
+      ).then((res) => {
+        this.couponList = res.rows.map((item) => {
+          return {
+            ...item,
+            type: JSON.parse(item.type),
+            useArea: JSON.parse(item.useArea),
+            picUrl: publicFileGetUrl + item.picUrl,
+          };
+        });
+        this.couponTotal = res.total;
+        this.loading = false;
+      });
+    },
+
+    // 选中卡券
+    handleSelectionCoupon(e) {
+      this.selectCouponList = e.map((item) => {
+        return {
+          prizeType: "coupon",
+          // quantity: 1,
+          couponId: item.couponId,
+          picUrl: item.picUrl,
+          title: item.title,
+          sortWeight: 100
+        };
+      });
+    },
+
+    // 确认选中卡券
+    confirmCoupon() {
+      this.$emit("confirmCoupon", this.selectCouponList);
+    },
+
+    close() {
+      this.$emit("close");
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.dialog-search {
+  display: flex;
+  line-height: 32px;
+  margin-bottom: 20px;
+  .ge {
+    width: 40px;
+  }
+}
+.dialog-btn {
+  display: flex;
+  align-content: center;
+  justify-content: flex-end;
+  padding: 40px 0 0;
+  .ge {
+    width: 40px;
+  }
+}
+</style>

+ 154 - 0
src/views/business/marketing/components/CouponPkgAdd.vue

@@ -0,0 +1,154 @@
+<template>
+  <div>
+    <el-dialog
+      title="添加券包奖品"
+      width="1000px"
+      :visible.sync="dialogVisible"
+      :before-close="close"
+    >
+      <div class="dialog-search">
+        <div>券名称:</div>
+        <el-input
+          v-model="title"
+          placeholder="请输入券包名称"
+          clearable
+          size="small"
+          style="width: 240px"
+          @keyup.enter.native="getCouponList"
+        />
+        <div class="ge"></div>
+        <el-button
+          type="primary"
+          icon="el-icon-search"
+          size="mini"
+          @click="getCouponList"
+          >查询</el-button
+        >
+      </div>
+      <el-table
+        v-loading="loading"
+        :data="couponList"
+        @selection-change="handleSelectionCouponPkg"
+        class="el-table"
+      >
+        <el-table-column
+          type="selection"
+          width="55"
+          align="center"
+          fixed="left"
+        />
+        <el-table-column label="券包编号" prop="id" />
+        <el-table-column label="券包名称" prop="title" min-width="85" />
+        <el-table-column label="优惠券数量" prop="couponNum" />
+        <el-table-column label="总面值" min-width="85">
+          <template slot-scope="scope">
+            <div>¥{{ $numberFormat(scope.row.facePrice) }}</div>
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination
+        v-show="couponPkgTotal > 0"
+        :total="couponPkgTotal"
+        :page.sync="pageParams.pageNum"
+        :limit.sync="pageParams.pageSize"
+        @pagination="getCouponList"
+      />
+      <div class="dialog-btn">
+        <el-button size="small" @click="close"> 取 消 </el-button>
+        <div class="ge"></div>
+        <el-button type="primary" size="small" @click="confirmCouponPkg">
+          确 认
+        </el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+<script>
+import { publicFileGetUrl } from "@/api/common";
+import { getCouponList } from "@/api/business/couponPkg";
+export default {
+  name: "CouponAdd",
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false,
+    },
+  },
+  data() {
+    return {
+      loading: false,
+      title: "", // 券包名称
+      couponList: [], // 券包列表
+      couponPkgTotal: 0, // 券包总数
+      selectCouponPkgList: [], // 选中券包
+      pageParams: {
+        pageNum: 1,
+        pageSize: 10,
+      },
+    };
+  },
+  created() {
+    this.getCouponList();
+  },
+  methods: {
+    // 券包列表
+    getCouponList() {
+      this.loading = true;
+      getCouponList(
+        "pageNum=" +
+          this.pageParams.pageNum +
+          "&pageSize=" +
+          this.pageParams.pageSize +
+          "&",
+        { title: this.title, status: 1 }
+      ).then((res) => {
+        this.couponList = res.rows
+        this.couponPkgTotal = res.total;
+        this.loading = false;
+      });
+    },
+
+    // 选中券包
+    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
+        };
+      });
+    },
+
+    // 确认选中券包
+    confirmCouponPkg() {
+      this.$emit("confirmCouponPkg", this.selectCouponPkgList);
+    },
+
+    close() {
+      this.$emit("close");
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.dialog-search {
+  display: flex;
+  line-height: 32px;
+  margin-bottom: 20px;
+  .ge {
+    width: 40px;
+  }
+}
+.dialog-btn {
+  display: flex;
+  align-content: center;
+  justify-content: flex-end;
+  padding: 40px 0 0;
+  .ge {
+    width: 40px;
+  }
+}
+</style>

+ 183 - 0
src/views/business/marketing/components/GoodsAdd.vue

@@ -0,0 +1,183 @@
+<template>
+  <div>
+    <el-dialog
+      title="添加实物奖品"
+      width="1000px"
+      :visible.sync="dialogVisible"
+      :before-close="close"
+    >
+      <div class="dialog-search">
+        <div>商品名称:</div>
+        <el-input
+          v-model="goodsTitle"
+          placeholder="请输入商品名称"
+          clearable
+          size="small"
+          style="width: 220px" @clear="queryParams.pageNum = 1;getGoodsList()"
+          @keyup.enter.native="queryParams.pageNum = 1;getGoodsList()"
+        />
+        <div style="margin-left: 20px">商品价格:</div>
+<!--        <el-input v-model="minValue" placeholder="最低价格" clearable @keyup.enter.native="pageParams.pageNum = 1;getList()" />-->
+        <el-input style="width: 220px" v-model="queryParams.minValue"  @clear="queryParams.pageNum = 1;getGoodsList()" placeholder="最低价格" clearable @keyup.enter.native="queryParams.pageNum = 1;getGoodsList()"/>
+        <div style="width: 20px;text-align: center">-</div>
+<!--        <el-input v-model="maxValue" placeholder="最高价格" clearable @keyup.enter.native="pageParams.pageNum = 1;getList()" />-->
+        <el-input style="width: 220px" v-model="queryParams.maxValue"  @clear="queryParams.pageNum = 1;getGoodsList()" placeholder="最高价格" clearable @keyup.enter.native="queryParams.pageNum = 1;getGoodsList()"/>
+
+        <div class="ge"></div>
+        <el-button
+          type="primary"
+          icon="el-icon-search"
+          size="mini"
+          @click="getGoodsList()"
+          >查询</el-button
+        >
+      </div>
+      <el-table
+        v-loading="loading"
+        :data="goodsList"
+        @selection-change="handleSelectionGoods"
+        class="el-table"
+      >
+        <el-table-column
+          type="selection"
+          width="55"
+          align="center"
+          fixed="left"
+        />
+        <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="quantity" width="80" />
+      </el-table>
+      <pagination
+        v-show="goodsTotal > 0"
+        :total="goodsTotal"
+        :page.sync="pageParams.pageNum"
+        :limit.sync="pageParams.pageSize"
+        @pagination="getGoodsList"
+      />
+      <div class="dialog-btn">
+        <el-button size="small" @click="close"> 取 消 </el-button>
+        <div class="ge"></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'
+export default {
+  name: "GoodsAdd",
+  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", minValue: this.queryParams.minValue?accMul(this.queryParams.minValue, 100):this.queryParams.minValue, maxValue: this.queryParams.maxValue?accMul(this.queryParams.maxValue, 100):this.queryParams.maxValue,}
+      ).then((res) => {
+        this.goodsList = res.rows.map((item) => {
+          return {
+            ...item,
+            picUrl: publicFileGetUrl + item.picUrl.split(",")[0],
+          };
+        });
+        this.goodsTotal = res.total;
+        this.loading = false;
+      });
+    },
+
+    // 选中商品
+    handleSelectionGoods(e) {
+      this.selectGoodsList = e.map((item) => {
+        return {
+          prizeType: "goods",
+          // quantity: 1,
+          goodsId: item.goodsId,
+          picUrl: item.picUrl,
+          title: item.title,
+          sortWeight: 100
+        };
+      });
+    },
+
+    // 确认选中商品
+    confirmGoods() {
+      this.$emit("confirmGoods", this.selectGoodsList);
+    },
+
+    close() {
+      this.$emit("close");
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.dialog-search {
+  display: flex;
+  line-height: 32px;
+  margin-bottom: 20px;
+  .ge {
+    width: 20px;
+  }
+}
+.dialog-btn {
+  display: flex;
+  align-content: center;
+  justify-content: flex-end;
+  padding: 40px 0 0;
+  .ge {
+    width: 20px;
+  }
+}
+</style>

+ 194 - 0
src/views/business/marketing/detail.vue

@@ -0,0 +1,194 @@
+<template>
+  <div class="app-container goods-add">
+    <el-divider content-position="left">基础信息</el-divider>
+    <el-form ref="addItem"  :model="addData" label-width="120px">
+      <el-row :gutter="40" style="width: 600px">
+        <el-col :span="23">
+          <el-form-item label="活动名称:" prop="title">
+            <el-input v-model="addData.title" placeholder="输入活动名称" readonly />
+          </el-form-item>
+        </el-col>
+        <el-col :span="23">
+          <el-form-item label="活动封面:" >
+            <el-image
+              style="width: 110px;"
+              :src="addData && addData.picUrl"
+              :preview-src-list="[addData && addData.picUrl]"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col>
+          <el-form-item label="活动日期:" prop="dateValue">
+            <el-date-picker value-format="timestamp" v-model="addData.dateValue" type="datetimerange" readonly
+                            range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"/>
+          </el-form-item>
+        </el-col>
+        <el-col :span="16">
+          <el-form-item label="初始用户数:">
+            <el-input v-model="addData.fakeNum" readonly />
+          </el-form-item>
+        </el-col>
+        <el-col :span="23">
+          <el-form-item label="抽奖码获取方式:" prop="type">
+            <el-col>邀请用户助力</el-col>
+            <el-col>用户助力条件:
+              <el-radio-group v-model="labelRadio" >
+                <el-radio :label="1">每个账号终身仅助力一次</el-radio>
+                <el-radio :label="2" disabled>无</el-radio>
+              </el-radio-group>
+            </el-col>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-divider content-position="left">奖品设置</el-divider>
+      <el-row>
+        <el-col :span="22">
+          <el-form-item label="">
+            <!-- 奖级列表 -->
+            <div class="prize" v-for="(item, index) in awardsList" :key="index">
+              <div class="prize-top">
+                <div>奖级:{{ item.name }}</div>
+                <div>名额:{{item.quantity}}</div>
+                <div>内部名额:{{item.insideNum}}</div>
+              </div>
+              <div class="prize-table">
+                <el-table :data="item.prizeList" class="el-table">
+                  <el-table-column label="奖品图片" align="center">
+                    <template slot-scope="scope">
+                      <el-image
+                        style="width: 70px; height: 70px"
+                        :src="scope.row.picUrl"
+                        :preview-src-list="[scope.row.picUrl]"
+                      >
+                      </el-image>
+                    </template>
+                  </el-table-column>
+                  <el-table-column label="奖品名称" prop="title" align="center" >
+                    <template slot-scope="scope">
+                      <div v-if="scope.row.prizeType == 'coin'">盲豆 x{{scope.row.value}}</div>
+                      <div v-else>{{scope.row.title}}</div>
+                    </template>
+                  </el-table-column>
+                  <el-table-column label="奖品类型" align="center">
+                    <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>
+                    </template>
+                  </el-table-column>
+                </el-table>
+              </div>
+            </div>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-divider content-position="left">活动详情</el-divider>
+      <el-row>
+        <el-col :span="22">
+          <el-form-item label="" prop="description">
+            <div v-html="addData.description"></div>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+
+    <el-row>
+      <el-col :span="24" style="text-align: center">
+        <el-button type="info" @click="$router.replace('/marketing/marketing')">取消</el-button>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { publicFileGetUrl } from "@/api/common";
+import {getMarketingDetail, addMarketing} from '@/api/business/marketing'
+import Upload from '@/components/DragImageUpload'
+import WangEditor from '@/components/WangEditor'
+
+export default {
+  name: "add",
+  components: {
+    Upload,
+    WangEditor,
+  },
+  data() {
+    return {
+      id: this.$route.query.id,
+      addData: {
+        picUrl: '',//活动主图
+        startTime: '',//开始时间
+        endTime: '',//结束时间
+        fakeNum: 0,//初始用户数
+        description: '',//活动详情
+        awardsList: [],//奖级列表
+      },
+      labelRadio: 1,//单选框
+
+      // 奖级列表
+      awardsList: [],
+      dateValue: [],//开始与结束日期
+    }
+  },
+  computed: {
+  },
+  created() {
+    if (this.id) {
+      getMarketingDetail(this.id).then(res => {
+        const { startTime, endTime, description, fakeNum,picUrl, realNum, title, awardsList, id } = res.data
+        this.addData = { title, dateValue:[startTime,endTime], picUrl: publicFileGetUrl + picUrl, fakeNum, realNum, description, awardsList, id }
+        if(awardsList){
+          awardsList.forEach((item) => {
+            item.prizeList.forEach((ele) => {
+              (ele.picUrl = publicFileGetUrl + ele.picUrl.split(',')[0]),
+                (ele.prizeType = JSON.parse(ele.prizeType).value);
+            });
+          });
+          this.awardsList = awardsList
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style scoped lang="scss">
+.goods-add {
+  .tip {
+    font-size: 12px;
+    color: #999;
+  }
+
+  .el-divider {
+    .is-left {
+      color: #409EFF;
+      font-size: 20px;
+      font-weight: bolder;
+      left: 10px;
+    }
+  }
+}
+.prize {
+  width: 1000px;
+  margin-bottom: 50px;
+  background: #f9f9f9;
+  border: 1px solid #bbbbbb;
+  font-size: 14px;
+  &-top {
+    padding: 10px 20px;
+    margin-bottom: 10px;
+    display: flex;
+    align-content: center;
+    justify-content: space-around;
+    border-bottom: 1px solid #bbbbbb;
+    div {
+      line-height: 36px;
+    }
+  }
+  &-btn {
+    border-top: 1px solid #bbbbbb;
+    padding: 10px;
+  }
+}
+</style>

+ 55 - 40
src/views/business/marketing/index.vue

@@ -12,10 +12,7 @@
       <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-option v-for="(item,index) in marketingStatusList"  :label="item.dictLabel" :value="Number(item.dictValue)" :key="index"/>
         </el-select>
       </el-form-item>
       <el-form-item>
@@ -31,68 +28,75 @@
           size="mini"
           @click="$router.push({ name: 'MarketingAdd' })"
           v-hasPermi="['business:marketing:add']"
-        >创建活动</el-button>
+        >创建抽奖活动</el-button>
         <el-button
           type="infor"
           plain
           icon="el-icon-download"
           size="small"
           @click="handleExportDraw"
-          v-hasPermi="['order:userTicket:export']"
+          v-hasPermi="['business:marketing: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="id" width="80" />
       <el-table-column label="活动名称" prop="title" />
-      <el-table-column label="参与人数" prop="discount"/>
-      <el-table-column label="开始时间" prop="type" >
+      <el-table-column label="参与人数" prop="realNum"/>
+      <el-table-column label="开始时间" prop="startTime" >
         <template slot-scope="{row}">
-          {{ JSON.parse(row.type).desc }}
+          {{ parseTime(row.startTime) }}
         </template>
       </el-table-column>
-      <el-table-column label="结束时间" prop="type" >
+      <el-table-column label="结束时间" prop="endTime" >
         <template slot-scope="{row}">
-          {{ JSON.parse(row.type).desc }}
+          {{ parseTime(row.endTime) }}
         </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>
-
+          <el-tag :type="JSON.parse(row.status).value === 4 || JSON.parse(row.status).value === -1 ? 'info' : 'success'">{{ 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>
+          <el-button v-hasPermi="['business:marketing:query']" type="text" @click="$router.push({ name: 'MarketingQuery', query: { id: row.id } })">查看</el-button>
+          <el-button v-if=" JSON.parse(row.status).value === 3 || JSON.parse(row.status).value === 0 || JSON.parse(row.status).value === 2 " v-hasPermi="['business:marketing:edit']" type="text" @click="$router.push({ name: 'MarketingEdit', query: { id: row.id } })">编辑</el-button>
+          <el-button v-if=" JSON.parse(row.status).value === 3 || JSON.parse(row.status).value === 4 || JSON.parse(row.status).value === -1 " v-hasPermi="['business:marketing:queryData']" type="text"  @click="activityTableVisible = true, ids = { id:row.id, title:row.title, realNum:row.realNum }">活动数据</el-button>
+          <el-button v-if=" JSON.parse(row.status).value === 0 " v-hasPermi="['business:marketing:on']" type="text" @click="setStatus(row, 'on')">开启</el-button>
+          <el-button v-if=" JSON.parse(row.status).value === 3 || JSON.parse(row.status).value === 2 " v-hasPermi="['business:marketing:off']" type="text" @click="setStatus(row, 'off')">关闭</el-button>
+          <el-button v-if=" JSON.parse(row.status).value === 0 " v-hasPermi="['business:marketing: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()" />
+    <activity-table :dialog-visible="activityTableVisible" :ids="ids" @close="activityTableVisible = false" v-if="activityTableVisible"></activity-table>
   </div>
 </template>
 <script>
-import { getCouponList, delCoupon, setCouponStatus } from '@/api/business/coupon'
-import { accDiv } from '@/utils/util'
+import { getMarketingList, delMarketing, setMarketingStatus, setMarketingStatusOff, ticketMarketingExport } from '@/api/business/marketing'
+import ActivityTable from "./components/ActivityTable";
 export default {
   name: 'CouponList',
+  components:{
+    ActivityTable,
+  },
   data() {
     return {
       loading: false,
       showSearch: true,
       tableData: [],
       queryParams: {},
-      total: 0
+      total: 0,
+      ids: {},
+      activityTableVisible: false,
+      marketingStatusList: []
     }
   },
   created() {
     this.getList(true)
+    this.getMarketingStatus()
   },
   methods: {
     getList(reset) {
@@ -101,9 +105,9 @@ export default {
       }
       this.loading = true
       if (reset) {
-        this.queryParams = { pageNum: 1, pageSize: 20 }
+        this.queryParams = { pageNum: 1, pageSize: 10 }
       }
-      getCouponList('pageNum='+this.queryParams.pageNum + '&pageSize='+this.queryParams.pageSize+'&', this.queryParams).then(res => {
+      getMarketingList('pageNum='+this.queryParams.pageNum + '&pageSize='+this.queryParams.pageSize+'&', this.queryParams).then(res => {
         this.loading = false
         if (res.code === 0) {
           this.tableData = res.rows
@@ -113,30 +117,41 @@ export default {
         this.loading = false
       })
     },
+    getMarketingStatus(){
+      this.getDicts('marketing_status').then(res=>{
+        this.marketingStatusList = res.data
+      })
+    },
     setStatus(item, status) {
-      this.$confirm(`确认${status === 'on' ? '上架' : '下架'}券 “${item.title}” 吗?`, `${status === 'on' ? '上架' : '下架'}券`, {
+      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()
-          }
-        })
+        if (status === 'on'){
+          setMarketingStatus(item.id).then(res => {
+            if (res.code === 0) {
+              this.$message.success('开启已完成!')
+              this.getList()
+            }
+          })
+        }else{
+          setMarketingStatusOff(item.id).then(res => {
+            if (res.code === 0) {
+              this.$message.success('关闭已完成!')
+              this.getList()
+            }
+          })
+        }
       })
     },
     del(item) {
-      this.$confirm(`确认删除券 “${item.title}” 吗?`, '删除券', {
+      this.$confirm(`确认删除活动 “${item.title}” 吗?`, '删除活动', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
-        delCoupon(item.couponId).then(res => {
+        delMarketing(item.id).then(res => {
           if (res.code === 0) {
             this.$message.success('操作已完成!')
             this.getList()
@@ -147,7 +162,7 @@ export default {
 
     // 导出订单
     handleExportDraw() {
-      this.$confirm("是否确认导出订单?", "提示", {
+      this.$confirm("是否确认导出活动数据?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
@@ -155,10 +170,10 @@ export default {
         .then(() => {
           this.vloading = this.$loading({
             lock: true,
-            text: "正在导出订单.....",
+            text: "正在导出活动数据.....",
             background: "rgba(0, 0, 0, 0.7)",
           });
-          return ticketOrderExport(this.queryParams);
+          return ticketMarketingExport(this.queryParams);
         })
         .then((response) => {
           this.vloading.close();

+ 200 - 0
src/views/business/recovery/index.vue

@@ -0,0 +1,200 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="90px" >
+      <el-form-item label="商品名称" prop="title">
+        <el-input v-model="queryParams.title"  placeholder="请输入商品名称" clearable size="small" style="width: 240px" @clear="queryParams.pageNum = 1;handleQuery()" @keyup.enter.native="handleQuery" />
+      </el-form-item>
+
+      <el-form-item label="用户手机号" prop="userPhone">
+        <el-input v-model="queryParams.userPhone" placeholder="请输入用户手机号" clearable size="small" style="width: 240px" @clear="queryParams.pageNum = 1;handleQuery()" @keyup.enter.native="handleQuery" />
+      </el-form-item>
+
+      <el-form-item label="下单时间">
+        <el-date-picker @clear="queryParams.pageNum = 1;handleQuery()" v-model="tradeTimeArr" type="datetimerange" size="small" value-format="timestamp" range-separator="至" start-placeholder="时间选择" end-placeholder="时间选择" @change="tardeTime">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" >搜索</el-button >
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" >重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <!-- 导出、刷新 -->
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="infor"
+          plain
+          icon="el-icon-download"
+          size="small"
+          @click="handleExportDraw"
+          v-hasPermi="['order:exchange:export']"
+        >导出订单</el-button
+        >
+      </el-col>
+      <right-toolbar
+        :showSearch.sync="showSearch"
+        @queryTable="getList"
+      ></right-toolbar>
+    </el-row>
+
+    <!-- 列表 -->
+    <el-table ref="table" v-loading="loading" :data="list">
+      <el-table-column label="回收时间" min-width="100" align="center">
+        <template slot-scope="{ row }">
+          <div>{{ parseTime(row.createdTime) }}</div>
+        </template>
+      </el-table-column>
+      <el-table-column label="商品主图" prop="picUrl" min-width="95" align="center">
+        <template slot-scope="{row}">
+          <div v-if="row.picUrl">
+            <el-image
+              style="width: 100px; height: 100px"
+              :src="IMG_URL + row.picUrl.split(',')[0]"
+              :preview-src-list="row.picUrl.split(',').map(item => { return IMG_URL + item })"
+            />
+          </div>
+          <span v-else>-</span>
+        </template>
+      </el-table-column>>
+      <el-table-column label="商品名称" prop="title" min-width="95" align="center" />
+      <el-table-column label="商品规格" prop="properties" min-width="95" align="center" >
+        <template slot-scope="{row}">
+          <div v-if="row.properties">{{row.properties}}</div>
+          <div v-else>--</div>
+        </template>
+
+      </el-table-column>
+      <el-table-column label="单价(盲豆)" prop="exchangePrice" min-width="95" align="center"/>
+      <el-table-column label="回收数量" prop="num" min-width="60" align="num" />
+      <el-table-column label="回收折扣(%)" prop="discountRate" min-width="95" align="center"/>
+      <el-table-column label="返还盲豆数" prop="returnCoin" min-width="95" align="center"/>
+      <el-table-column label="用户昵称/手机号" min-width="120" align="center">
+        <template slot-scope="{ row }">
+          <div>{{ row.nickName }}/{{ row.userPhone }}</div>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <!-- 分页 -->
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="pageParams.pageNum"
+      :limit.sync="pageParams.pageSize"
+      @pagination="getList"
+    />
+  </div>
+</template>
+<script>
+import { publicFileGetUrl } from "@/api/common"
+import { getRecoveryList, exchangeRecoveryExport } from "@/api/business/recovery";
+export default {
+  name: "exchange",
+  data() {
+    return {
+      IMG_URL: publicFileGetUrl,
+      loading: false,
+      showSearch: true,
+      // 筛选
+      queryParams: {
+        endTime: "",
+        startTime: "",
+        title: "",
+        userPhone: ""
+      },
+      // 分页
+      pageParams: {
+        pageNum: 1,
+        pageSize: 10,
+      },
+      // 总条数
+      total: 0,
+      list: [],
+      // 下单时间
+      tradeTimeArr: [],
+      // 订单列表状态
+      state: "null",
+    };
+  },
+  created() {
+    this.getList()
+  },
+  methods: {
+    // 订单列表
+    getList() {
+      this.loading = true;
+      getRecoveryList( "pageNum=" + this.pageParams.pageNum + "&pageSize=" + this.pageParams.pageSize + "&",this.queryParams)
+        .then((res) => {
+          this.loading = false;
+          if (res.code == 0) {
+            this.total = res.total;
+            this.list = res.rows;
+          }
+        })
+        .catch(() => {
+          this.loading = false;
+        });
+    },
+
+    //搜索
+    handleQuery() {
+      this.pageParams.pageNum = 1;
+      this.getList();
+    },
+
+    // 重置
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.tradeTimeArr = [];
+      this.pageParams.pageNum = 1;
+      this.queryParams.startTime = "";
+      this.queryParams.endTime = "";
+
+      this.getList();
+    },
+
+    // 选择下单时间
+    tardeTime(e) {
+      if (e) {
+        this.queryParams.startTime = e[0];
+        this.queryParams.endTime = e[1];
+        this.handleQuery();
+      } else {
+        this.queryParams.startTime = "";
+        this.queryParams.endTime = "";
+        this.handleQuery();
+      }
+    },
+
+    // 导出订单
+    handleExportDraw() {
+      this.$confirm("是否确认导出订单?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.vloading = this.$loading({
+            lock: true,
+            text: "正在导出订单.....",
+            background: "rgba(0, 0, 0, 0.7)",
+          });
+          return exchangeRecoveryExport(this.queryParams);
+        })
+        .then((response) => {
+          this.vloading.close();
+          this.download(response.msg);
+        })
+        .catch(() => {
+          this.vloading.close();
+        });
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+::v-deep .el-tabs--border-card > .el-tabs__content {
+  padding: 0;
+}
+</style>

+ 1 - 1
src/views/business/salesite/index.vue

@@ -169,7 +169,7 @@
             size="mini"
             type="text"
             @click="handleStatusChange(scope.row)"
-            v-hasPermi="['admin:salesite:edit']"
+            v-hasPermi="['business:salesite:edit']"
           >
             <span v-if="getValue(scope.row.status) == 1"> 停用</span>
             <span v-if="getValue(scope.row.status) == 2"> 启用</span>

+ 1 - 6
src/views/business/supplier/index.vue

@@ -136,12 +136,7 @@ export default {
       let data = {
         name:this.queryParams.name
       }
-      getSupplierList(data,
-        "pageNum=" +
-        this.pageParams.pageNum +
-        "&pageSize=" +
-        this.pageParams.pageSize
-      )
+      getSupplierList( "pageNum=" + this.pageParams.pageNum + "&pageSize=" + this.pageParams.pageSize+'&', data )
         .then((res) => {
           this.loading = false;
           if (res.code == 0) {

+ 58 - 18
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">
@@ -28,7 +34,12 @@
                 </el-image>
               </template>
             </el-table-column>
-            <el-table-column label="奖品名称" prop="title" />
+            <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-else>{{ row.title }}</div>
+              </template>
+            </el-table-column>
             <el-table-column label="奖品类型">
               <template slot-scope="scope">
                 <div v-if="scope.row.prizeType == 'goods'">商品</div>
@@ -37,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
@@ -98,10 +110,15 @@ export default {
       type: Array,
       default: () => []
     },
+    id: {
+      type: [String,Number],
+      default: false,
+    },
   },
   data() {
     return {
-      prizeIndex: null, // 奖级下标
+      awardsLabelList: [],//关联奖级列表
+      prizeIndex: 0, // 奖级下标
       // 奖级列表
       awardsList: [
         {
@@ -177,9 +194,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) {
@@ -191,6 +218,13 @@ export default {
       }
       this.$emit('input', this.awardsList)
       this.$emit('close')
+      if (this.ticketType != 'offline' && this.id == 0) {
+        this.getQuantity();
+      }
+    },
+
+    changetype(e) {
+      this.ticketType = e
     },
 
     // 选择奖品种类
@@ -198,19 +232,23 @@ export default {
       this.prizeIndex = index;
       this.$emit('handleCommand', e)
     },
-    
+
     // 改变奖级数量
     handleChangeAll(e, item) {
       this.$set(item, "quantity", e);
       this.$forceUpdate();
-      // this.getQuantity();
+      if (this.ticketType != 'offline' && this.id == 0) {
+        this.getQuantity();
+      }
     },
 
     // 改变奖品数量
     handleChange(e, index) {
       this.prizeIndex = index;
       this.$forceUpdate();
-      // this.getQuantity();
+      if (this.ticketType != 'offline' && this.id == 0) {
+        this.getQuantity();
+      }
     },
 
     // 奖级商品删除
@@ -219,16 +257,18 @@ export default {
       let list = item.prizeList;
       list.splice(index, 1);
       this.$set(item, "prizeList", list);
-      // this.getQuantity();
+      if (this.ticketType != 'offline' && this.id == 0) {
+        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,

+ 62 - 15
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>
@@ -20,15 +20,13 @@
             ></el-input>
           </el-form-item>
           <el-form-item label="图片" prop="picUrl">
-            <image-upload
-              v-model="ticketPicUrl"
-              :limit="1"
-              :file-size="0.2"
-              @change="$refs.form.validateField(['picUrl'])"
-            />
+            <Upload v-model="ticketPicUrl" :limit="3" :fileSize="0.5" @change="$refs.form.validateField(['picUrl'])"/>
           </el-form-item>
-          <div class="tip">
-            上传1张图片,支持jpg、png格式上传,大小不超过200k;
+          <div class="tip" v-if="form.type != 'offline'">
+            请上传图片,jpg、png格式;线上盲票第1张为封面图,第2张为奖品图,第3张为主题图;大小不超过500k
+          </div>
+          <div class="tip" v-else>
+            上传1张图片,支持jpg、png格式上传,大小不超过500k;
           </div>
           <el-form-item label="面值" prop="facePrice">
             <el-input
@@ -50,6 +48,23 @@
               <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>
+          <div class="tip" v-if="form.type != 'offline'">
+            划线价为0或不填,则不显示划线价
+          </div>
           <el-form-item label="盲票总数" prop="quantity">
             <el-input
               v-model="form.quantity"
@@ -131,7 +146,7 @@
       <!-- 奖级设置 -->
 
       <!-- 奖级列表 -->
-      <awards-list ref="awards" v-model="awardsList" @handleCommand="handleCommand" @close="close" />
+      <awards-list ref="awards" :id="ids" v-model="awardsList" @handleCommand="handleCommand" @close="close" />
       <!-- 保存 -->
       <div class="save-btn">
         <el-button size="small" @click="back"> 取 消 </el-button>
@@ -153,6 +168,7 @@
   </div>
 </template>
 <script>
+import Upload from '@/components/DragImageUpload'
 import { publicFileGetUrl } from "@/api/common";
 import CustomFieldsMixin from "@/mixins/CustomFields";
 import { ticketBoxCreate, setListDetail, ticketBoxDetail} from "@/api/business/ticket";
@@ -172,11 +188,13 @@ export default {
     CouponAdd,
     CouponPkgAdd,
     CoinAdd,
+    Upload
   },
   data() {
     return {
       loading: false,
       id: this.$route.query.id,
+      ids: this.$route.query.id?this.$route.query.id:0,
       form: {
         type: "online", //盲票类型
         title: "", // 盲票名称
@@ -187,6 +205,7 @@ export default {
         pkgUnit: 200, // 张数
         pkgSalePrice: 0, // 单价
         saleCommRate: "", // 基数
+        originPrice: 0, //划线价
         disabled: false,
         saleChannelType: 1
       },
@@ -232,6 +251,12 @@ export default {
             trigger: ["blur", "change"],
           },
         ],
+        originPrice: [{
+          pattern:
+            /^([0-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/,
+          message: "请输入合法的金额数字,最多两位小数",
+          trigger: ["blur", "change"],
+        },],
         pkgUnit: [
           { required: true, message: "请输入每包张数", trigger: "blur" },
           {
@@ -300,15 +325,16 @@ export default {
         boxId: this.id
       }
       ticketBoxDetail(data).then(res => {
-        const { awardsList, type, title, picUrl, facePrice, salePrice, quantity, pkgUnit, pkgSalePrice, saleCommRate, saleChannelType, channelList } = res.data
-        this.form = { 
+        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,
           channelIdList: channelList.map(item => item.channelId),
           type: JSON.parse(type).value,
-          facePrice:accDiv(facePrice, 100), 
-          salePrice:accDiv(salePrice, 100),  
-          pkgSalePrice:accDiv(pkgSalePrice, 100) 
+          facePrice:accDiv(facePrice, 100),
+          salePrice:accDiv(salePrice, 100),
+          pkgSalePrice:accDiv(pkgSalePrice, 100),
+          originPrice:accDiv(originPrice, 100)
         }
         if(awardsList){
           awardsList.forEach((item) => {
@@ -320,6 +346,7 @@ export default {
           });
           this.$nextTick(() => {
             this.$refs.awards.add(3, awardsList)
+            this.$refs.awards.changetype(JSON.parse(type).value)
           })
           this.awardsList = awardsList
         }
@@ -405,11 +432,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,
           };
 
@@ -453,6 +496,10 @@ export default {
       this.coinTableVisible = false;
     },
 
+    changeType(e) {
+      this.$refs.awards.changetype(e)
+    },
+
     // 添加奖品种类
     handleCommand(e) {
       if (e == "goods") {

+ 31 - 9
src/views/business/ticket/detail.vue

@@ -12,11 +12,11 @@
           {{ info && info.title }}
         </el-form-item>
         <el-form-item label="图片:">
-          <el-image
-            style="width: 110px; height: 150px"
-            :src="info && info.picUrl"
-            :preview-src-list="[info && info.picUrl]"
-          />
+          <div class="picUrl">
+            <div class="picUrl-item" v-for="(item,index) in info.picUrl" :key="index">
+              <el-image style="width: 70px; height: 80px" :src="item" :preview-src-list="info.picUrl"/>
+            </div>
+          </div>
         </el-form-item>
         <el-form-item label="面值:">
           <span :class="loading ? 'el-icon-loading' : ''"></span>
@@ -26,6 +26,10 @@
           <span :class="loading ? 'el-icon-loading' : ''"></span>
           {{ info && info.salePrice && $numberFormat(info.salePrice) }}元
         </el-form-item>
+        <el-form-item label="划线价:" v-if="info.type == 'online'">
+          <span :class="loading ? 'el-icon-loading' : ''"></span>
+          {{ info && info.originPrice && $numberFormat(info.originPrice) }}元
+        </el-form-item>
         <el-form-item label="盲票总数:">
           <span :class="loading ? 'el-icon-loading' : ''"></span>
           {{ info && info.quantity }}张
@@ -58,6 +62,7 @@
         <div class="prize-top">
           <div>奖级名称:{{ item.name }}</div>
           <div>奖级:{{ item.sort }}</div>
+          <div v-if="info.type == 'online'" >关联奖级:{{ item.awardsLabel }}</div>
           <div>奖级数量:{{ item.quantity }}</div>
         </div>
         <div class="prize-table">
@@ -86,7 +91,12 @@
                 <div v-if="row.prizeType.value == 'coin'">盲豆</div>
               </template>
             </el-table-column>
-            <el-table-column label="排序" prop="title" align="center">
+            <el-table-column v-if="info.type == 'online'" label="奖品数量" prop="quantity" align="center">
+              <template slot-scope="{ row }">
+                <div>{{ row.quantity }}</div>
+              </template>
+            </el-table-column>
+            <el-table-column label="排序" prop="sortWeight" align="center">
               <template slot-scope="{ row }">
                 <div>{{ row.sortWeight }}</div>
               </template>
@@ -127,10 +137,15 @@ export default {
           this.loading = false;
           if (res.code == 0) {
             let data = res.data;
+
+            let picUrl = []
+            data.picUrl.split(",").forEach(res=>{
+              picUrl.push(publicFileGetUrl + res)
+            })
             this.info = {
               ...data,
-              type: JSON.parse(data.type),
-              picUrl: publicFileGetUrl + data.picUrl,
+              type: JSON.parse(data.type).value,
+              picUrl: picUrl,
               channelTitle: data.channelList.map(item => item.name).join(',')
             };
             data.awardsList.forEach((item) => {
@@ -189,4 +204,11 @@ export default {
     }
   }
 }
-</style>
+
+.picUrl {
+  display: flex;
+  &-item {
+    margin-right: 40px;
+  }
+}
+</style>

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

@@ -133,7 +133,7 @@
         <template slot-scope="scope">
           <div>
             <el-image
-              style="width: 110px; height: 150px"
+              style="width: 70px; height: 80px"
               :src="scope.row.picUrl"
               :preview-src-list="[scope.row.picUrl]"
             />

+ 24 - 1
src/views/order/deliver/index.vue

@@ -27,6 +27,21 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
+      <el-form-item label="订单类型">
+        <el-select
+          v-model="queryParams.resource"
+          placeholder="请选择订单类型"
+          style="width: 240px"
+          size="small"
+          filterable
+          clearable
+          @change="handleQuery"
+        >
+          <el-option label="全部" value=""></el-option>
+          <el-option label="提货订单" value="1"></el-option>
+          <el-option label="现金购买" value="2"></el-option>
+        </el-select>
+      </el-form-item>
       <el-form-item label="订单号">
         <el-input
           v-model="queryParams.orderId"
@@ -159,6 +174,11 @@
           </div>
         </template>
       </el-table-column>
+      <el-table-column label="订单类型" prop="resource" min-width="70" align="center">
+        <template slot-scope="{ row }">
+          <div>{{ JSON.parse(row.resource).desc }}</div>
+        </template>
+      </el-table-column>
       <el-table-column label="订单状态" align="center">
         <template slot-scope="{ row }">
           <div>
@@ -255,6 +275,9 @@ export default {
   methods: {
     // 订单列表
     getList() {
+      let data = {...this.queryParams,
+        resource:Number(this.queryParams.resource)
+      }
       this.loading = true;
       getDeliverList(
         "pageNum=" +
@@ -262,7 +285,7 @@ export default {
           "&pageSize=" +
           this.pageParams.pageSize +
           "&",
-        this.queryParams
+        data
       )
         .then((res) => {
           this.loading = false;