소스 검색

Merge branch 'deploy_hy1.0' of chelingzhu-web/zxyj-admin-html into master

lilei 4 년 전
부모
커밋
453a8c0190

+ 71 - 0
src/api/luckyDraw.js

@@ -0,0 +1,71 @@
+import { axios } from '@/utils/request'
+// 保存抽奖设置
+export const saveLuckyDrawConfig = (params) => {
+  return axios({
+    url: 'luckyDraw/save',
+    data: params,
+    method: 'post'
+  })
+}
+// 抽奖活动列表
+export const getLuckyDrawList = (params) => {
+  const url = `luckyDraw/query/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 查询抽奖明细
+export const getLuckyDrawDetail = (params) => {
+  return axios({
+    url: `luckyDraw/findById/${params.id}`,
+    data: {},
+    method: 'get'
+  })
+}
+// 启用禁用
+export const enableLuckyDraw = (params) => {
+  return axios({
+    url: 'luckyDraw/updateState',
+    data: params,
+    method: 'post'
+  })
+}
+// 删除
+export const deleteLuckyDraw = (params) => {
+  return axios({
+    url: `luckyDraw/delete/${params.id}`,
+    data: {},
+    method: 'get'
+  })
+}
+// 查询中奖记录
+export const getLuckyWinList = (params) => {
+  const url = `luckyDrawWin/query/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 发送快递
+export const sendExpress = (params) => {
+  return axios({
+    url: 'luckyDrawWin/sendExpress',
+    data: params,
+    method: 'post'
+  })
+}
+// 查获奖用户明细
+export const getLuckyDrawWinDetail = (params) => {
+  return axios({
+    url: `luckyDrawWin/findById/${params.id}`,
+    data: {},
+    method: 'get'
+  })
+}

+ 4 - 10
src/components/Select/index.js

@@ -29,19 +29,13 @@ export default {
   }),
   created () {
     const _this = this
-    console.log(_this.code, '_this.code')
-    Promise.all([listLookUp({ code: '' }), getLookUpData({
+    getLookUpData({
       pageNo: 1,
       pageSize: 1000,
       lookupCode: _this.code
-    })]).then(results => {
-      const _all = results[0]
-      const _data = results[1]
-      if (_all.status + '' === '200' && _data.status + '' === '200') {
-        _this.dataList = _data.data.list
-        const a = _.find(_all.data, ['code', _this.code])
-        console.log(a)
-        _this.placeholderText = '请选择' + (a != undefined ? a.name : '')
+    }).then(res => {
+      if (res.status == 200) {
+        _this.dataList = res.data.list
       }
     })
   },

+ 6 - 4
src/components/UploadFile/index.vue

@@ -4,6 +4,7 @@
       :action="action"
       :listType="listType"
       :fileList="fileList"
+      :disabled="disabled"
       @preview="handlePreview"
       @change="handleChange"
       :beforeUpload="beforeUpload"
@@ -68,11 +69,14 @@ export default {
           savePathType: 'web' // 存储类型 local 服务器本地,ali 阿里云, web
         }
       }
+    },
+    disabled: {
+      type: Boolean,
+      default: false
     }
   },
   watch: {
     value (a, b) {
-      console.log(a, '=--====')
       this.comVal = a || ''
       if (a == undefined) {
         this.fileList = []
@@ -115,9 +119,7 @@ export default {
       if (this.listType == 'text') {
         return
       }
-      console.log(file, '8888888888')
       this.previewImage = file.url || file.thumbUrl
-      // this.previewImage = file.response.data
       this.previewVisible = true
     },
     handleChange ({ file, fileList }) {
@@ -127,6 +129,7 @@ export default {
       }
       this.fileList = this.validaFile(file, fileList)
       this.$emit('change', this.formatFile())
+      this.$emit('input', this.formatFile())
     },
     // 格式化文件列表数据,给表单
     formatFile () {
@@ -146,7 +149,6 @@ export default {
       if (filesList.length == 0) {
         return []
       }
-
       console.log(file, filesList, this.beforeUpload(file, 0))
       if (!this.beforeUpload(file, 0) && file.status != 'removed') {
         const index = filesList.findIndex(item => item.uid == file.uid)

+ 32 - 32
src/config/router.config.js

@@ -241,38 +241,38 @@ export const asyncRouterMap = [{
       }
     ]
   },
-  // {
-  //   path: '/market',
-  //   redirect: '/market/winingRecord',
-  //   component: PageView,
-  //   meta: {
-  //     title: '营销',
-  //     icon: 'gift'
-  //     // permission: 'M_winingRecord_list'
-  //   },
-  //   children: [
-  //     {
-  //       path: '/market/winingRecord',
-  //       name: 'winingRecord',
-  //       component: () => import(/* webpackChunkName: "market" */ '@/views/market/winingRecord.vue'),
-  //       meta: {
-  //         title: '中奖记录',
-  //         icon: 'file-done'
-  //         // permission: 'M_winingRecord_list'
-  //       }
-  //     },
-  //     {
-  //       path: '/market/lotterySettings',
-  //       name: 'lotterySettings',
-  //       component: () => import(/* webpackChunkName: "market" */ '@/views/market/lotterySettings.vue'),
-  //       meta: {
-  //         title: '大转盘设置',
-  //         icon: 'edit'
-  //         // permission: 'M_lotterySettings'
-  //       }
-  //     }
-  //   ]
-  // },
+  {
+    path: '/market',
+    redirect: '/market/winingRecord',
+    component: PageView,
+    meta: {
+      title: '营销',
+      icon: 'gift',
+      permission: 'M_market'
+    },
+    children: [
+      {
+        path: '/market/winingRecord',
+        name: 'winingRecord',
+        component: () => import(/* webpackChunkName: "market" */ '@/views/market/winingRecord.vue'),
+        meta: {
+          title: '中奖记录',
+          icon: 'file-done',
+          permission: 'M_winingRecord'
+        }
+      },
+      {
+        path: '/market/lotterySettings',
+        name: 'lotterySettings',
+        component: () => import(/* webpackChunkName: "market" */ '@/views/market/lotterySettings.vue'),
+        meta: {
+          title: '大转盘设置',
+          icon: 'edit',
+          permission: 'M_lottery_list'
+        }
+      }
+    ]
+  },
   {
     path: '/shopSetting',
     redirect: '/shopSetting/bannerSetting',

+ 35 - 98
src/views/market/GoodsLogistics.vue

@@ -48,8 +48,8 @@
           id="network-edit-name"
           :maxLength="30"
           v-decorator="[
-            'formData.name',
-            { initialValue: formData.name, getValueFromEvent: $filterEmpty, rules: [{ required: true, message: '请输入收货人姓名' }] }
+            'formData.receiverName',
+            { initialValue: formData.receiverName, getValueFromEvent: $filterEmpty, rules: [{ required: true, message: '请输入收货人姓名' }] }
           ]"
           placeholder="请输入收货人姓名(最多30个字符)"
           allowClear />
@@ -57,49 +57,26 @@
       <a-form-item label="收货人电话" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
         <a-input
           id="network-edit-name"
-          :maxLength="30"
+          :maxLength="11"
+          type="number"
           v-decorator="[
-            'formData.name',
-            { initialValue: formData.name, getValueFromEvent: $filterEmpty, rules: [{ required: true, message: '请输入收货人电话' }] }
+            'formData.receiverPhone',
+            { initialValue: formData.receiverPhone, getValueFromEvent: $filterEmpty, rules: [
+              { required: true, message: '请输入收货人电话' },
+              {pattern: /^[1][0-9]{10}$/, message: '请输入正确的收货人电话' }] }
           ]"
           placeholder="请输入收货人电话"
           allowClear />
       </a-form-item>
-      <a-form-item label="省市区" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" required style="margin: 0;">
-        <a-row :gutter="20">
-          <!-- 地址 -->
-          <a-col span="8">
-            <a-form-item>
-              <a-select id="network-edit-provinceCode" @change="getCityList" v-decorator="['formData.provinceCode', { initialValue: formData.provinceCode, rules: [{ required: true, message: '请选择省' }] }]" placeholder="请选择省">
-                <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-          <a-col span="8">
-            <a-form-item prop="cityCode">
-              <a-select id="network-edit-cityCode" v-decorator="['formData.cityCode', { initialValue: formData.cityCode, rules: [{ required: true, message: '请选择市' }] }]" @change="getAreaList" placeholder="请选择市">
-                <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-          <a-col span="8">
-            <a-form-item prop="districtCode">
-              <a-select id="network-edit-districtCode" v-decorator="['formData.districtCode', { initialValue: formData.districtCode, rules: [{ required: true, message: '请选择区' }] }]" @change="areaCharged" placeholder="请选择区/县">
-                <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-        </a-row>
-      </a-form-item>
-      <a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="详细地址">
+      <a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="收货人地址">
         <a-input
           id="network-edit-address"
-          :maxLength="30"
+          :maxLength="100"
           v-decorator="[
-            'formData.address',
-            { initialValue: formData.address, getValueFromEvent: $filterEmpty, rules: [{ required: true, message: '请输入详细地址' }] }
+            'formData.receiveAddress',
+            { initialValue: formData.receiveAddress, getValueFromEvent: $filterEmpty, rules: [{ required: true, message: '请输入详细地址' }] }
           ]"
-          placeholder="请输入详细地址(最多30个字符)"
+          placeholder="请输入详细地址(最多100个字符)"
           allowClear />
       </a-form-item>
       <a-form-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;">
@@ -112,8 +89,8 @@
 
 <script>
 import { VSelect } from '@/components'
-import { stationSave, stationFind, getProvince, getCityByPro, getDistrictByCity } from '@/api/station'
-import { expressCompanyQuery } from '@/api/order'
+import { getLuckyDrawWinDetail } from '@/api/luckyDraw.js'
+import { expressCompanyQuery } from '@/api/order.js'
 export default {
   name: 'GoodsLogistics',
   components: { VSelect },
@@ -121,6 +98,11 @@ export default {
     openModal: { //  弹框显示状态
       type: Boolean,
       default: false
+    },
+    // 列id
+    itemId: {
+      type: String || Number,
+      default: ''
     }
   },
   data () {
@@ -133,13 +115,9 @@ export default {
       formData: {
         expressName: undefined, //  快递公司
         expressNum: '', //  运单编号
-        provinceCode: undefined, //  省
-        provinceName: '',
-        cityCode: undefined, // 市
-        cityName: '',
-        districtCode: undefined, // 区
-        districtName: '',
-        address: '' //  详细地址
+        receiverName: '', // 收货人名称
+        receiverPhone: '', // 收货人电话
+        receiveAddress: '' //  详细地址
       },
       addrProvinceList: [], //  省下拉
       addrCityList: [], //  市下拉
@@ -152,58 +130,6 @@ export default {
     this.getExpressCompany()
   },
   methods: {
-    // 获取省列表'
-    getProvinceList () {
-      getProvince().then(res => {
-        if (res.status == 200) {
-          this.addrProvinceList = res.data || []
-        } else {
-          this.addrProvinceList = []
-        }
-      })
-    },
-    // 获取城市列表
-    getCityList (val) {
-      this.addrCityList = []
-      this.addrDistrictList = []
-      this.form.setFieldsValue({ 'formData.cityCode': undefined })
-      this.form.setFieldsValue({ 'formData.districtCode': undefined })
-      this.form.setFieldsValue({ 'formData.address': '' })
-      this.getCityListRequest(val)
-    },
-    getCityListRequest (val) {
-      getCityByPro({
-        id: val
-      }).then(res => {
-        if (res.status == 200) {
-          this.addrCityList = res.data || []
-        } else {
-          this.addrCityList = []
-        }
-      })
-    },
-    // 获取区县列表
-    getAreaList (val) {
-      this.addrDistrictList = []
-      this.form.setFieldsValue({ 'formData.districtCode': undefined })
-      this.form.setFieldsValue({ 'formData.address': '' })
-      this.getAreaListRequest(val)
-    },
-    getAreaListRequest (val) {
-      getDistrictByCity({
-        id: val
-      }).then(res => {
-        if (res.status == 200) {
-          this.addrDistrictList = res.data || []
-        } else {
-          this.addrDistrictList = []
-        }
-      })
-    },
-    // 区县变更
-    areaCharged (val) {
-      this.form.setFieldsValue({ 'formData.address': '' })
-    },
     //  物流信息  保存
     handleSubmit (e) {
       e.preventDefault()
@@ -222,6 +148,15 @@ export default {
           this.expressCompany = []
         }
       })
+    },
+    // 获取获奖用户信息
+    getCustomerInfo () {
+      getLuckyDrawWinDetail({ id: this.itemId }).then(res => {
+        if (res.status == 200) {
+          // console.log(res, 'rrrrrr')
+		  this.formData = Object.assign({}, res.data)
+        }
+      })
     }
   },
   watch: {
@@ -234,8 +169,10 @@ export default {
       if (!val) {
         this.$emit('close')
       } else {
-        this.getProvinceList()
         this.form.resetFields()
+        if (this.itemId) {
+          this.getCustomerInfo()
+        }
       }
     }
   }

+ 131 - 0
src/views/market/GoodsLogisticsDetail.vue

@@ -0,0 +1,131 @@
+<template>
+  <a-modal
+    centered
+    class="modalBox"
+    :footer="null"
+    :maskClosable="false"
+    title="发货"
+    v-model="isShow"
+    @cancle="isShow=false"
+    :width="1000">
+    <a-form
+      id="logistics-form"
+      :form="form"
+      ref="form"
+      v-bind="formItemLayout"
+      @submit="handleSubmit">
+      <h4>物流信息:</h4>
+      <a-form-item label="快递公司" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+        <span>{{ formData.expressName }}</span>
+      </a-form-item>
+      <a-form-item label="运单编号" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+        <span>{{ formData.expressNum }}</span>
+      </a-form-item>
+      <h4>收货人信息:</h4>
+      <a-form-item label="收货人姓名" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+        <span>{{ formData.receiverName }}</span>
+      </a-form-item>
+      <a-form-item label="收货人电话" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+        <span>{{ formData.receiverPhone }}</span>
+      </a-form-item>
+      <a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="收货人地址">
+        <span>{{ formData.receiveAddress }}</span>
+      </a-form-item>
+    </a-form>
+  </a-modal>
+</template>
+
+<script>
+import { VSelect } from '@/components'
+import { getLuckyDrawWinDetail } from '@/api/luckyDraw.js'
+import { expressCompanyQuery } from '@/api/order.js'
+export default {
+  name: 'GoodsLogistics',
+  components: { VSelect },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    // 列id
+    itemId: {
+      type: String || Number,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      form: this.$form.createForm(this),
+      formItemLayout: {
+        labelCol: { span: 4 },
+        wrapperCol: { span: 16 }
+      },
+      formData: {
+        expressName: undefined, //  快递公司
+        expressNum: '', //  运单编号
+        receiverName: '', // 收货人名称
+        receiverPhone: '', // 收货人电话
+        receiveAddress: '' //  详细地址
+      },
+      addrProvinceList: [], //  省下拉
+      addrCityList: [], //  市下拉
+      addrDistrictList: [], //  区下拉
+      isShow: this.openModal, //  是否填写物流信息
+      expressCompany: [] //  快递公司
+    }
+  },
+  mounted () {
+    this.getExpressCompany()
+  },
+  methods: {
+    //  物流信息  保存
+    handleSubmit (e) {
+      e.preventDefault()
+      this.form.validateFields((err, values) => {
+        if (!err) {
+          this.$emit('submit', values.formData)
+        }
+      })
+    },
+    //  获取快递公司
+    getExpressCompany () {
+      expressCompanyQuery({}).then(res => {
+        if (res.status == 200) {
+          this.expressCompany = res.data
+        } else {
+          this.expressCompany = []
+        }
+      })
+    },
+    // 获取获奖用户信息
+    getCustomerInfo () {
+      getLuckyDrawWinDetail({ id: this.itemId }).then(res => {
+        if (res.status == 200) {
+          this.formData = res.data
+		  // console.log(this.formData, 'lkllllllll')
+        }
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (val) {
+      if (!val) {
+        this.$emit('close')
+        this.form.resetFields()
+      } else {
+        if (this.itemId) {
+          this.getCustomerInfo()
+        }
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+</style>

+ 574 - 160
src/views/market/addlotterySetModal.vue

@@ -1,8 +1,30 @@
 <template>
   <div>
+    <!-- 奖品类型 -->
+    <v-select
+      ref="jpType"
+      code="LUCKY_DRAW_PRIZE_TYPE"
+      v-show="false"
+    >
+    </v-select>
+    <!-- 中奖限制 -->
+    <v-select
+      ref="zjXzType"
+      code="LUCKY_DRAW_WIN_LIMIT_RULE"
+      v-show="false"
+    >
+    </v-select>
+    <!-- 赠送规则 -->
+    <v-select
+      ref="zsGzType"
+      code="LUCKY_DRAW_GIVE_TIMES_RULE"
+      v-show="false"
+    >
+    </v-select>
+
     <a-modal
       v-model="isShow"
-      @cancle="isShow = false"
+      @cancel="cansel"
       :footer="null"
       width="80%"
       :centered="true"
@@ -18,47 +40,66 @@
       >
         <h3 class="form-titles">基础设置</h3>
         <a-row :gutter="48">
-          <a-col :span="6">
-            <a-form-model-item ref="name" label="活动名称" prop="name">
-              <a-input id="addLottery-time" v-model="form.name" allowClear :maxLength="15" placeholder="15个字以内"/>
+          <a-col :span="12">
+            <!-- participantsNum>0 有参与人数时不可编辑 -->
+            <a-form-model-item ref="activeName" label="活动名称" prop="activeName">
+              <a-input
+                id="addLottery-time"
+                :disabled="participantsNum>0||state==1"
+                v-model="form.activeName"
+                allowClear
+                :maxLength="15"
+                placeholder="15个字以内"/>
             </a-form-model-item>
           </a-col>
-          <a-col :span="6">
+          <a-col :span="12">
             <a-form-model-item ref="time" label="活动时间" prop="time">
               <a-range-picker
+                :disabled="participantsNum>0||state==1"
                 id="addLottery-time"
                 v-model="form.time"
+                :disabledDate="disabledDate"
                 allowClear
                 format="YYYY-MM-DD"
                 :placeholder="['开始时间','结束时间']"
               />
             </a-form-model-item>
           </a-col>
-          <a-col :span="6">
-            <a-form-model-item ref="cjRc" label="抽奖人次" prop="cjRc">
+          <a-col :span="12">
+            <a-form-model-item
+              ref="peopleLimitCount"
+              label="抽奖人次"
+              prop="peopleLimitCount"
+              :rules="{
+                required: !(state==1) && !form.isPeopleLimit,
+                message: '请输入抽奖人次',
+                trigger: ['blur','change'],
+              }"
+            >
               <a-input-number
                 id="addLottery-cjRc"
                 style="width: 50%;margin-right: 20px;"
-                v-model="form.cjRc"
-                :disabled="form.bxCjRc"
+                v-model="form.peopleLimitCount"
+                :disabled="form.isPeopleLimit==1||participantsNum>0||state==1"
                 :min="0"
                 :max="999999"
                 :precision="0"
                 placeholder="请输入抽奖人次(0~999999)"
                 allowClear />
-              <a-checkbox @change="bxCjRcChange" v-model="form.bxCjRc">
+              <a-checkbox :disabled="state==1||participantsNum>0" @change="bxCjRcChange" v-model="form.isPeopleLimit">
                 不限
               </a-checkbox>
             </a-form-model-item>
           </a-col>
-          <a-col :span="6">
-            <a-form-model-item ref="price" label="付费抽奖规则" prop="price">
+          <a-col :span="12">
+            <a-form-model-item ref="purchaseTimesGold" label="付费抽奖规则" prop="purchaseTimesGold">
               每次抽奖需要支付
               <a-input-number
                 id="addLottery-cjgz"
+                :disabled="state==1||participantsNum>0"
                 style="width: 30%;margin-right: 5px;"
-                v-model="form.price"
-                :min="0"
+                v-model="form.purchaseTimesGold"
+                :min="1"
                 :max="999999"
                 :precision="0"
                 placeholder="请输入乐豆数(0~999999)"
@@ -69,143 +110,332 @@
         </a-row>
 
         <a-row :gutter="48">
-          <a-col :span="8">
-            <a-form-model-item ref="jpDesc" label="奖品说明" prop="jpDesc">
-              <a-input v-model="form.jpDesc" allowClear :maxLength="100" placeholder="请输入奖品说明,100字以内" type="textarea" />
+          <a-col :span="12">
+            <a-form-model-item ref="prizeDesc" label="奖品说明" prop="prizeDesc">
+              <a-input
+                :disabled="state==1"
+                v-model="form.prizeDesc"
+                allowClear
+                :maxLength="100"
+                placeholder="请输入奖品说明,100字以内"
+                type="textarea" />
             </a-form-model-item>
           </a-col>
-          <a-col :span="8">
-            <a-form-model-item ref="jpTj" label="抽奖条件" prop="jpTj">
-              <a-input v-model="form.jpTj" allowClear :maxLength="100" placeholder="请输入抽奖条件,100字以内" type="textarea" />
+          <a-col :span="12">
+            <a-form-model-item ref="activeLimitDesc" label="抽奖条件" prop="activeLimitDesc">
+              <a-input
+                :disabled="state==1"
+                v-model="form.activeLimitDesc"
+                allowClear
+                :maxLength="100"
+                placeholder="请输入抽奖条件,100字以内"
+                type="textarea" />
             </a-form-model-item>
           </a-col>
-          <a-col :span="8">
-            <a-form-model-item ref="cjDesc" label="抽奖说明" prop="cjDesc">
-              <a-input v-model="form.cjDesc" allowClear :maxLength="100" placeholder="请输入抽奖说明,100字以内" type="textarea" />
+          <a-col :span="12">
+            <a-form-model-item ref="activeDesc" label="抽奖说明" prop="activeDesc">
+              <a-input
+                :disabled="state==1"
+                v-model="form.activeDesc"
+                allowClear
+                :maxLength="100"
+                placeholder="请输入抽奖说明,100字以内"
+                type="textarea" />
             </a-form-model-item>
           </a-col>
         </a-row>
 
         <h3 class="form-titles">奖品设置</h3>
         <a-row :gutter="48">
-          <a-col :span="24">
-            <div class="form-item">
-              <div style="margin-right: 10px;"><span class="red">*</span>请选择转盘类型</div>
-              <a-select style="width: 300px;" @change="zpTypeChange" v-model="form.zpType" placeholder="请选择转盘类型">
-                <a-select-option value="5">
-                  五等分
-                </a-select-option>
-                <a-select-option value="6">
+          <a-col :span="12">
+            <a-form-model-item ref="prizeClsNum" label="转盘类型" prop="prizeClsNum">
+              <a-select style="width: 300px;" :disabled="participantsNum>0||state==1" @change="zpTypeChange" v-model="form.prizeClsNum" placeholder="请选择转盘类型">
+                <a-select-option :key="6" :value="6">
                   六等分
                 </a-select-option>
               </a-select>
-            </div>
-            <div class="form-item" v-for="(item, index) in form.jpList" :key="index">
-              <div style="margin-right: 10px;"><span class="red">*</span> 奖品{{ index+1 }}</div>
-              <a-select style="width: 120px;margin-right: 5px;" v-model="item.jpType" placeholder="请选择奖品类型">
-                <a-select-option value="0">
-                  送实物
-                </a-select-option>
-                <a-select-option value="1">
-                  送乐豆
-                </a-select-option>
-                <a-select-option value="2">
-                  未中奖
-                </a-select-option>
-              </a-select>
-              <a-input style="width: 200px;margin-right: 5px;" v-model="item.name" placeholder="请输入奖品名称,10个字以内"/>
-              <a-select style="width: 120px;margin-right: 5px;" v-model="item.isZj" placeholder="是否中奖">
-                <a-select-option value="1">
-                  是
-                </a-select-option>
-                <a-select-option value="0">
-                  否
-                </a-select-option>
-              </a-select>
-              <a-input-number
-                style="width: 150px;margin-right: 5px;"
-                v-model="item.glv"
-                :min="0"
-                :max="100"
-                :precision="2"
-                placeholder="请输入中奖概率(%)"
-                allowClear />
-              <a-input-number
-                style="width: 150px;margin-right: 5px;"
-                v-model="item.nums"
-                :min="0"
-                :max="999999"
-                :precision="0"
-                placeholder="请输入奖品数量"
-                allowClear />
-              <Upload
-                class="upload"
-                v-model="item.image"
-                ref="homeImage"
-                :fileSize="0.25"
-                listType="picture-card">
-              </Upload>
-              <span class="upload-desc">请上传奖品图片,300*300px,0.25MB 以内。</span>
-            </div>
+            </a-form-model-item>
           </a-col>
         </a-row>
+        <div style="padding: 0 35px;">
+          <a-row
+            type="flex"
+            align="middle"
+            :gutter="10"
+          >
+            <a-col span="1">
+              序号
+            </a-col>
+            <a-col span="3">
+              奖品类型
+            </a-col>
+            <a-col span="3">
+              奖品描述
+            </a-col>
+            <a-col span="3">
+              概率
+            </a-col>
+            <a-col span="3">
+              数量
+            </a-col>
+            <a-col span="8">
+              奖品图片
+            </a-col>
+          </a-row>
+          <div v-if="form.luckyDrawPrizeList.length" style="height: 1px;background-color: #eee;margin: 10px 0 20px;" ></div>
+          <a-row
+            type="flex"
+            align="middle"
+            v-for="(item, index) in form.luckyDrawPrizeList"
+            :key="index"
+            v-if="form.luckyDrawPrizeList.length"
+            :gutter="10"
+          >
+            <a-col span="1">
+              <a-form-model-item
+                :label-col=" { span: 0 }"
+                :wrapper-col=" { span: 24 }"
+              >
+                <span class="red" v-if="state==0">*</span> 奖品{{ index+1 }}
+              </a-form-model-item>
+            </a-col>
+            <a-col span="3">
+              <a-form-model-item
+                :label="''"
+                :required="true"
+                :label-col=" { span: 0 }"
+                :wrapper-col=" { span: 24 }"
+                :prop="'luckyDrawPrizeList.' + index + '.prizeType'"
+                :rules="{
+                  required: true,
+                  message: '请选择奖品类型',
+                  trigger: ['blur','change'],
+                }"
+              >
+                <a-select
+                  :disabled="participantsNum>0||state==1"
+                  :id="'jpList-prizeType'+index"
+                  style="width: 100%;"
+                  v-model="item.prizeType"
+                  @change="res => {
+                    item.prizeDesc = ''
+                    item.isPrizeLimit = item.prizeType == 'NONE' ? 0 : undefined
+                  }"
+                  placeholder="请选择奖品类型">
+                  <a-select-option
+                    v-for="item in $refs.jpType.getOptionDatas()"
+                    :key="item.code"
+                    :value="item.code">{{ item.dispName }}</a-select-option>
+                </a-select>
+              </a-form-model-item>
+            </a-col>
+            <a-col span="3">
+              <a-form-model-item
+                :label="''"
+                :required="true"
+                :label-col=" { span: 0 }"
+                :wrapper-col=" { span: 24 }"
+                :prop="'luckyDrawPrizeList.' + index + '.prizeDesc'"
+                :rules="{
+                  required: true,
+                  message: '请输入奖品名称',
+                  trigger: ['blur','change'],
+                }"
+              >
+                <a-input
+                  :disabled="participantsNum>0||state==1"
+                  v-if="item.prizeType !== 'GOLD'"
+                  :id="'jpList-name'+index"
+                  style="width: 100%;"
+                  v-model="item.prizeDesc"
+                  :maxLength="10"
+                  placeholder="请输入奖品名称,10个字以内"/>
 
-        <a-row :gutter="48">
-          <a-col :span="12">
+                <a-input-number
+                  v-else
+                  :disabled="participantsNum>0||state==1"
+                  style="width: 100%;"
+                  :id="'jpList-name'+index"
+                  v-model="item.prizeDesc"
+                  :min="0"
+                  :max="999999"
+                  :precision="0"
+                  placeholder="请输入乐豆数量"
+                  allowClear />
+              </a-form-model-item>
+            </a-col>
+            <a-col span="3">
+              <a-form-model-item
+                :label="''"
+                :required="true"
+                :label-col=" { span: 0 }"
+                :wrapper-col=" { span: 24 }"
+                :prop="'luckyDrawPrizeList.' + index + '.prizeRate'"
+                :rules="{
+                  required: true,
+                  message: '请输入中奖概率',
+                  trigger: ['blur','change'],
+                }"
+              >
+                <a-input-number
+                  style="width: 100%;"
+                  :disabled="state==1"
+                  :id="'jpList-prizeRate'+index"
+                  v-model="item.prizeRate"
+                  :min="0"
+                  :max="100"
+                  :precision="4"
+                  placeholder="请输入中奖概率(%)"
+                  allowClear />
+              </a-form-model-item>
+            </a-col>
+            <a-col span="3" v-if="item.prizeType!='NONE'">
+              <a-form-model-item
+                :label="''"
+                :required="true"
+                :label-col=" { span: 0 }"
+                :wrapper-col=" { span: 24 }"
+                :prop="'luckyDrawPrizeList.' + index + '.prizeNum'"
+                :rules="{
+                  required: true,
+                  message: '请输入奖品数量',
+                  trigger: ['blur','change'],
+                }"
+              >
+                <a-input-number
+                  style="width: 100%;"
+                  :disabled="state==1"
+                  :id="'jpList-prizeNum'+index"
+                  v-model="item.prizeNum"
+                  :min="0"
+                  :max="999999"
+                  :precision="0"
+                  placeholder="请输入奖品数量"
+                  allowClear />
+              </a-form-model-item>
+            </a-col>
+            <a-col span="8">
+              <a-form-model-item
+                :label="''"
+                :label-col=" { span: 0 }"
+                :wrapper-col=" { span: 24 }"
+                :prop="'luckyDrawPrizeList.' + index + '.prizeImage'"
+              >
+                <Upload
+                  :ref="'prizeImage'+index"
+                  :disabled="state==1"
+                  :id="'jpList-prizeImage'+index"
+                  v-model="item.prizeImage"
+                  :fileSize="0.25"
+                  listType="picture-card">
+                </Upload>
+                <span class="upload-desc">请上传奖品图片,300*300px,0.25MB 以内。</span>
+              </a-form-model-item>
+            </a-col>
+          </a-row>
+        </div>
+        <div v-if="form.luckyDrawPrizeList.length" style="height: 1px;background-color: #eee;margin-bottom: 20px;" ></div>
+        <a-row :gutter="48" v-if="form.luckyDrawPrizeList.length">
+          <!-- <a-col :span="12">
             <div class="form-item">
-              <div style="margin-right: 10px;"><span class="red">*</span>中奖限制:</div>
-              <a-select mode="multiple" style="width: 300px;" v-model="form.zjXz" placeholder="请选择中奖限制">
-                <a-select-option value="5">
-                  中奖后抽奖XXX次内不能再次中奖
-                </a-select-option>
-                <a-select-option value="6">
-                  每天最多可中奖XXX次
-                </a-select-option>
-                <a-select-option value="6">
-                  每人最多可中奖XXX次
-                </a-select-option>
+              <div style="margin-right: 10px;">中奖限制:</div>
+              <a-select
+                mode="multiple"
+                :disabled="state==1"
+                style="width: 80%;"
+                @change="zjxzChange"
+                v-model="form.zjXz"
+                placeholder="请选择中奖限制">
+                <a-select-option
+                  v-for="item in zjXz"
+                  :key="item.code"
+                  :value="item.code">{{ item.dispName }}</a-select-option>
               </a-select>
             </div>
-            <div class="form-item">
-              <div v-for="(item,index) in form.zjXz" :key="index">
+            <div class="form-item" v-for="(item,index) in form.luckyDrawWinPrizeLimitList" :key="index">
+              <a-form-model-item
+                style="margin: 0;"
+                :label="''"
+                :required="true"
+                :label-col=" { span: 0 }"
+                :wrapper-col=" { span: 24 }"
+                :prop="'luckyDrawWinPrizeLimitList.' + index + '.limitTimes'"
+                :rules="{
+                  required: true,
+                  message: '请输入次数',
+                  trigger: ['blur','change'],
+                }"
+              >
+                {{ index+1 }}.
+                {{ item.winPrizeLimitCodeDictValue.split('XXX')[0] }}
                 <a-input-number
-                  style="width: 150px;margin-right: 5px;"
-                  v-model="item.nums"
-                  :min="0"
+                  :disabled="state==1"
+                  style="width: 100px;"
+                  :id="'luckyDrawWinPrizeLimitList-limitTimes'+index"
+                  v-model="item.limitTimes"
+                  :min="1"
                   :max="100"
-                  :precision="2"
-                  placeholder="请输入中奖概率(%)"
+                  :precision="0"
+                  placeholder="请输入次数"
                   allowClear />
-              </div>
+                {{ item.winPrizeLimitCodeDictValue.split('XXX')[1] }}
+              </a-form-model-item>
             </div>
-          </a-col>
+          </a-col> -->
           <a-col :span="12">
             <div class="form-item">
-              <div style="margin-right: 10px;"><span class="red">*</span>赠送抽奖次数规则:</div>
-              <a-select mode="multiple" style="width: 300px;" v-model="form.cjGz" placeholder="请选择">
-                <a-select-option value="5">
-                  新用户登录送抽奖
-                </a-select-option>
-                <a-select-option value="6">
-                  用户首次投递送抽奖
-                </a-select-option>
-                <a-select-option value="6">
-                  分享给好友或朋友圈送抽奖
-                </a-select-option>
-                <a-select-option value="6">
-                  3个月内无投递记录送抽奖
-                </a-select-option>
+              <div style="margin-right: 10px;">赠送抽奖次数规则:</div>
+              <a-select
+                mode="multiple"
+                :disabled="state==1"
+                style="width: 70%;"
+                @change="cjGzChange"
+                v-model="form.cjGz"
+                placeholder="请选择">
+                <a-select-option
+                  v-for="item in cjGz"
+                  :key="item.code"
+                  :value="item.code">{{ item.dispName }}</a-select-option>
               </a-select>
             </div>
+            <div class="form-item" v-for="(item,index) in form.luckyDrawTaskList" :key="index">
+              <a-form-model-item
+                style="margin: 0;"
+                :label="''"
+                :required="true"
+                :label-col=" { span: 0 }"
+                :wrapper-col=" { span: 24 }"
+                :prop="'luckyDrawTaskList.' + index + '.giveTimes'"
+                :rules="{
+                  required: true,
+                  message: '请输入次数',
+                  trigger: ['blur','change'],
+                }"
+              >
+                {{ index+1 }}.
+                {{ item.taskCodeDictValue }}, 赠送
+                <a-input-number
+                  :disabled="state==1"
+                  style="width: 100px;"
+                  :id="'luckyDrawTaskList-giveTimes'+index"
+                  v-model="item.giveTimes"
+                  :min="1"
+                  :max="999999"
+                  :precision="0"
+                  placeholder="请输入次数"
+                  allowClear />
+                次
+              </a-form-model-item>
+            </div>
           </a-col>
         </a-row>
 
         <div class="form-item" style="justify-content:center;padding: 50px 20px 20px;">
-          <a-button type="primary" @click="onSubmit">
+          <a-button type="primary" :loading="loading" @click="onSubmit" v-if="state==0">
             保存
           </a-button>
           <a-button style="margin-left: 10px;" @click="cansel">
-            取消
+            {{ state==1?'关闭':'取消' }}
           </a-button>
         </div>
       </a-form-model>
@@ -215,6 +445,8 @@
 
 <script>
 import { VSelect, Upload } from '@/components'
+import { saveLuckyDrawConfig, getLuckyDrawDetail } from '@/api/luckyDraw.js'
+import moment from 'moment'
 export default {
   name: 'AddlotterySetModal',
   components: {
@@ -233,80 +465,227 @@ export default {
   },
   data () {
     return {
+      loading: false,
       isShow: this.showEditModal,
-      titleText: '新增活动',
-      formLayout: 'vertical',
-      labelCol: {},
-      wrapperCol: {},
+      titleText: '活动',
+      formLayout: 'horizontal',
+      labelCol: { span: 4 },
+      wrapperCol: { span: 14 },
+	    state: 0, // 活动状态
+      participantsNum: 0, // 抽奖参与人数
+      taskParticipantsNum: 0,
       form: {
-        name: '',
+        activeName: '', // 活动名称
         time: [],
-        cjRc: '',
-        bxCjRc: false,
-        price: '',
-        jpDesc: '',
-        jpTj: '',
-        cjDesc: '',
-        zpType: undefined,
-        jpList: [],
-        zjXz: [],
-        cjGz: []
+        activeStartTime: '', // 活动开始时间
+        activeEndTime: '', // 活动结束时间
+        peopleLimitCount: '', // 活动人数限制
+        isPeopleLimit: true, // 不限人数
+        purchaseTimesGold: '', // 购买抽奖次数金币数
+        prizeDesc: '', // 奖品说明
+        activeLimitDesc: '', // 活动条件说明
+        activeDesc: '', // 抽奖说明
+        prizeClsNum: undefined, // 转盘类型
+        luckyDrawPrizeList: [], // 奖品列表
+        zjXz: undefined,
+        luckyDrawWinPrizeLimitList: [], // 中奖限制
+        cjGz: undefined,
+        luckyDrawTaskList: [] // 赠送抽奖规则
       },
-      rules: {
-        name: [{ required: true, message: '请输入活动名称', trigger: 'blur' }],
-        time: [{ required: true, message: '请选择活动时间', trigger: 'blur' }],
-        cjRc: [{ required: true, message: '请输入抽奖人次', trigger: 'blur' }],
-        price: [{ required: true, message: '请输入付费抽奖规则', trigger: 'blur' }],
-        jpDesc: [{ required: true, message: '请输入奖品说明', trigger: 'blur' }],
-        jpTj: [{ required: true, message: '请输入抽奖条件', trigger: 'blur' }],
-        cjDesc: [{ required: true, message: '请输入抽奖说明', trigger: 'blur' }]
-      }
+      zjXz: [], // 中奖限制列表
+      cjGz: [], // 赠送规则列表
+      rules: {},
+      gvHj: 0 // 概率合计
     }
   },
   methods: {
+    // 不可选日期
+    disabledDate (current, dateStrings) {
+      return current && current < moment().subtract(1, 'days').endOf('day')
+    },
     // 不限人次
     bxCjRcChange (e) {
       console.log(e)
       if (e.target.checked) {
-        this.form.cjRc = ''
+        this.form.peopleLimitCount = ''
+        this.$refs.ruleForm.clearValidate('peopleLimitCount')
       }
     },
     // 选择转盘类型
     zpTypeChange (val) {
       console.log(val)
-      const _this = this
+      this.form.luckyDrawPrizeList = []
       for (let i = 0; i < val; i++) {
-        _this.form.jpList[i] = {
-          jpType: undefined,
-          name: '',
-          isZj: '0',
-          glv: '',
-          nums: '',
-          image: ''
-        }
+        this.form.luckyDrawPrizeList.push({
+          prizeType: undefined,
+          prizeDesc: '',
+          isPrizeLimit: undefined,
+          prizeRate: '',
+          prizeNum: '',
+          prizeImage: ''
+        })
       }
+      this.$refs.ruleForm.clearValidate()
+    },
+    // 中奖限制
+    zjxzChange (val) {
+      console.log(val)
+      this.form.luckyDrawWinPrizeLimitList = []
+      this.form.zjXz && this.form.zjXz.map(item => {
+        const row = this.zjXz.find(k => k.code == item)
+        this.form.luckyDrawWinPrizeLimitList.push({
+          winPrizeLimitCode: item,
+          winPrizeLimitCodeDictValue: row.dispName,
+          limitTimes: ''
+        })
+      })
+    },
+    // 抽奖规则
+    cjGzChange (val) {
+      console.log(val)
+      this.form.luckyDrawTaskList = []
+      this.form.cjGz && this.form.cjGz.map(item => {
+        const row = this.cjGz.find(k => k.code == item)
+        this.form.luckyDrawTaskList.push({
+          taskCode: item,
+          taskCodeDictValue: row.dispName,
+          giveTimes: ''
+        })
+      })
     },
     // 保存
     onSubmit () {
       this.$refs.ruleForm.validate(valid => {
-        console.log(this.form)
         if (valid) {
           console.log('valid submit!!')
+          const formData = JSON.parse(JSON.stringify(this.form))
+          formData.activeStartTime = moment(this.form.time[0]).format('YYYY-MM-DD') + ' 00:00:00'
+          formData.activeEndTime = moment(this.form.time[1]).format('YYYY-MM-DD') + ' 00:00:00'
+          formData.isPeopleLimit = this.form.isPeopleLimit ? 1 : 0
+
+          // 中奖概率之和必需是100
+          let gv = 0
+          formData.luckyDrawPrizeList.map(item => {
+            gv = gv + Number(item.prizeRate)
+            // 限制中奖
+            if (item.isPrizeLimit == 1) {
+              item.prizeNum = item.prizeNum || 0
+              item.prizeRate = item.prizeRate || 0
+            }
+            if (item.prizeType == 'NONE') {
+              item.prizeNum = 1
+            }
+          })
+          console.log(gv.toFixed(0), '奖品概率之和')
+          if (gv.toFixed(0) != 100) {
+            this.$message.warning('奖品概率之和必需是100')
+            return
+          }
+          // 提交数据
+          this.submitFormData(formData)
         } else {
           console.log('error submit!!')
           return false
         }
       })
     },
+    submitFormData (formData) {
+      this.loading = true
+      saveLuckyDrawConfig(formData).then(res => {
+        console.log(res, 'submitFormData')
+        if (res.status == 200) {
+          this.$message.info(res.message)
+          this.cansel()
+        } else {
+          // this.$message.warning(res.message)
+        }
+        this.loading = false
+      })
+    },
+    // 获取明细数据
+    getDetail (id) {
+      getLuckyDrawDetail({ id: id }).then(res => {
+        if (res.status == 200) {
+          this.participantsNum = res.data.participantsNum
+          this.taskParticipantsNum = res.data.taskParticipantsNum
+		      this.state = res.data.state
+          this.titleText = this.state == 1 ? '查看活动' : '编辑活动'
+          if (this.state == 1) {
+            this.rules = this.getRules(false)
+          }
+          res.data.luckyDrawPrizeList.map((item, index) => {
+            if (!item.hasOwnProperty('prizeRate')) {
+              item.prizeRate = ''
+            }
+            if (!item.hasOwnProperty('prizeNum')) {
+              item.prizeNum = ''
+            }
+            if (this.participantsNum <= 0) {
+              delete item.id
+            }
+          })
+          this.form = Object.assign({}, this.form, res.data)
+          this.form.isPeopleLimit = this.form.isPeopleLimit == 1
+          this.form.time = [moment(this.form.activeStartTime), moment(this.form.activeEndTime)]
+          this.form.zjXz = this.getGzVal(this.form.luckyDrawWinPrizeLimitList, 0)
+          this.form.cjGz = this.getGzVal(this.form.luckyDrawTaskList, 1)
+          console.log(this.form.luckyDrawPrizeList)
+          // 回显图片
+          const _this = this
+          setTimeout(() => {
+            _this.form.luckyDrawPrizeList.map((item, index) => {
+              _this.$refs[`prizeImage${index}`][0].setFileList(item.prizeImage)
+              item.isPrizeLimit = Number(item.isPrizeLimit)
+            })
+          }, 500)
+        }
+      })
+    },
+    getRules (required) {
+      return {
+        activeName: [{ required: required, message: '请输入活动名称', trigger: ['blur', 'change'] }],
+        time: [{ required: required, message: '请选择活动时间', trigger: ['blur', 'change'] }],
+        purchaseTimesGold: [{ required: required, message: '请输入付费抽奖规则', trigger: ['blur', 'change'] }],
+        prizeDesc: [{ required: required, message: '请输入奖品说明', trigger: ['blur', 'change'] }],
+        activeLimitDesc: [{ required: required, message: '请输入抽奖条件', trigger: ['blur', 'change'] }],
+        activeDesc: [{ required: required, message: '请输入抽奖说明', trigger: ['blur', 'change'] }],
+        prizeClsNum: [{ required: required, message: '请选择转盘类型', trigger: ['blur', 'change'] }]
+      }
+    },
+    getGzVal (data, type) {
+      const arr = []
+      data.map(item => {
+        arr.push(type == 1 ? item.taskCode : item.winPrizeLimitCode)
+      })
+      return arr
+    },
     // 取消
     cansel () {
       this.isShow = false
-    },
-    // 编辑获取数据
-    getPageInfo () {
-
+      this.participantsNum = 0
+      this.taskParticipantsNum = 0
+      this.state = 0
+      this.form.isPeopleLimit = false
+      this.form.luckyDrawPrizeList = []
+      this.form.luckyDrawTaskList = []
+      this.form.luckyDrawWinPrizeLimitList = []
+      this.form.zjXz = []
+      this.form.cjGz = []
+      if (this.form.id) {
+        delete this.form.id
+      }
+      this.rules = this.getRules(true)
     }
   },
+  created () {
+    this.$nextTick(() => {
+      setTimeout(() => {
+        this.zjXz = this.$refs.zjXzType.getOptionDatas()
+        this.cjGz = this.$refs.zsGzType.getOptionDatas()
+        this.rules = this.getRules(true)
+      }, 500)
+    })
+  },
   watch: {
     showEditModal (newValue, oldValue) {
       this.isShow = newValue
@@ -315,15 +694,16 @@ export default {
       if (!val) {
         this.$emit('close')
       } else {
-        this.$refs.ruleForm.resetFields()
+        this.$nextTick(() => {
+          this.$refs.ruleForm.resetFields()
+        })
       }
     },
     itemId (newValue, oldValue) {
       if (newValue && this.isShow) {
-        this.titleText = '编辑'
-        this.getPageInfo(newValue)
+        this.getDetail(newValue)
       } else {
-        this.titleText = '新增'
+        this.titleText = '新增活动'
       }
     }
   }
@@ -332,6 +712,40 @@ export default {
 
 <style lang="less">
   .addLottery-modal{
+    .ant-modal-body{
+      padding: 15px 25px;
+      height: 600px;
+      overflow: auto;
+      .upload-file .ant-upload.ant-upload-select-picture-card, .upload-file .ant-upload-list-picture-card .ant-upload-list-item{
+        width: 40px;
+        height: 40px;
+      }
+      .upload-file .ant-upload-list-picture-card-container{
+        width: 40px;
+        height: 40px;
+      }
+      .upload-file{
+        height: 40px!important;
+      }
+      .upload-file .ant-upload-select-picture-card i{
+            font-size: 16px;
+            margin-top: 10px;
+      }
+      .ant-upload.ant-upload-select-picture-card > .ant-upload{
+        padding: 0;
+      }
+      .upload-file .ant-upload.ant-upload-select-picture-card, .upload-file .ant-upload-list-picture-card .ant-upload-list-item{
+        padding: 0;
+      }
+    }
+    .ant-input[disabled]{
+      background: #F8F8F8;
+      color: #666;
+    }
+    .ant-input-disabled,.ant-select-disabled .ant-select-selection,.ant-input-number-disabled{
+      background: #F8F8F8;
+      color: #666;
+    }
     .form-titles{
       border-bottom: 1px solid #eee;
       padding-bottom: 10px;

+ 63 - 54
src/views/market/lotterySettings.vue

@@ -8,7 +8,7 @@
             <a-form-item label="活动名称" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
               <a-input
                 allowClear
-                v-model="searchData.name"
+                v-model="searchData.activeName"
                 :maxLength="30"
                 placeholder="请输入活动名称"
                 id="lotterySet-name" />
@@ -37,6 +37,7 @@
         icon="plus"
         class="addBtn"
         @click="showModal"
+        v-if="$hasPermissions('B_lottery_new')"
         id="lotterySet-showModal"
       >新增</a-button>
     </div>
@@ -50,26 +51,37 @@
       bordered>
       <span slot="action" slot-scope="text, record">
         <a-icon
-          type="edit"
+          :type="record.state==1?'eye':'edit'"
           id="lotterySet-handleEdit"
-          title="编辑"
+          :title="record.state==1?'查看':'编辑'"
           class="actionBtn icon-blues"
+          v-if="$hasPermissions('B_lottery_view')||$hasPermissions('B_lottery_edit')"
           @click="handleEdit(record)" />
+        <a-icon
+          v-if="record.participantsNum===0 && record.state==0 && $hasPermissions('B_lottery_del')"
+          type="delete"
+          id="lotterySet-handleDel"
+          title="删除"
+          class="actionBtn icon-red"
+          @click="handleDel(record)" />
+      </span>
+      <span slot="actime" slot-scope="text, record">
+        {{ record.activeStartTime.split(' ')[0] }} 至 {{ record.activeEndTime.split(' ')[0] }}
       </span>
       <span slot="state" slot-scope="text, record">
         <a-switch
           checkedChildren="启用"
           unCheckedChildren="禁用"
           id="lotterySet-changeFlagHandle"
+          v-if="$hasPermissions('B_lottery_enable')"
           :checked="record.state == 1 ? true : false"
           @change="changeFlagHandle(text, record)" />
-        <!-- <span v-if="!$hasPermissions('B_lotterySet_enable')">--</span> -->
+        <span v-else>--</span>
       </span>
       </span>
     </s-table>
     <addlotterySetModal
       :itemId="itemId"
-      :itemData="itemData"
       :showEditModal="showEditModal"
       @refresh="$refs.table.refresh(true)"
       @close="cancel"></addlotterySetModal>
@@ -84,9 +96,8 @@ import {
 } from '@/components'
 import addlotterySetModal from './addlotterySetModal.vue'
 import {
-  getGoodsClassList,
-  changeGoodsStatus
-} from '@/api/shopSetting.js'
+  getLuckyDrawList, enableLuckyDraw, deleteLuckyDraw
+} from '@/api/luckyDraw.js'
 
 export default {
   components: {
@@ -102,13 +113,11 @@ export default {
         wrapperCol: { span: 17 }
       },
       searchData: {
-        name: ''
+        activeName: '',
+        state: undefined
       },
       showEditModal: false, // 默认关闭弹窗
       itemId: null, // 编辑行id
-	    itemData: {}, // 编辑行数据
-      formLayout: 'horizontal',
-      form: this.$form.createForm(this),
       // 表头
       columns: [{
         title: '序号',
@@ -119,20 +128,22 @@ export default {
       {
         title: '创建时间',
         width: 100,
-        dataIndex: 'creatDate',
+        dataIndex: 'createDate',
         align: 'center'
       },
       {
         title: '活动名称',
         width: 100,
-        dataIndex: 'name',
+        dataIndex: 'activeName',
         align: 'center'
       },
       {
         title: '活动时间',
         width: 100,
-        dataIndex: 'goldLimit',
-        align: 'center'
+        align: 'center',
+        scopedSlots: {
+          customRender: 'actime'
+        }
       },
       {
         title: '状态',
@@ -154,7 +165,7 @@ export default {
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
-        return getGoodsClassList(
+        return getLuckyDrawList(
           Object.assign(parameter, this.searchData)
         ).then(res => {
           const no = (res.data.pageNo - 1) * res.data.pageSize
@@ -169,67 +180,65 @@ export default {
       }
     }
   },
-  beforeCreate () {
-    this.form = this.$form.createForm(this, {
-      name: 'validate_other'
-    })
-  },
   methods: {
     showModal () {
       this.itemId = null
-	    this.itemData = {}
       this.showEditModal = true
     },
     // 编辑
     handleEdit (record) {
       this.itemId = record.id
-	    this.itemData = record
       this.showEditModal = true
+    },
+    // 删除
+    handleDel (record) {
+      this.$confirm({
+		  title: '警告',
+		  centered: true,
+		  content: '删除后无法恢复,确认删除?',
+		  okText: '确定',
+		  cancelText: '取消',
+		  onOk: () => {
+		    deleteLuckyDraw({
+		      id: record.id
+		    }).then(res => {
+		      if (res.status == 200) {
+		        this.$message.success(res.message)
+		        this.$refs.table.refresh()
+		      }
+		    })
+		  }
+      })
+    },
+    // 查看
+    handleView (record) {
+
     },
     // 重置
     resetForm () {
-      this.searchData.name = ''
+      this.searchData.activeName = ''
+      this.searchData.state = ''
       this.$refs.table.refresh(true)
     },
-    //
+    // 取消添加编辑
     cancel () {
       this.itemId = null
       this.showEditModal = false
+      this.resetForm()
     },
     // 更改启用禁用状态
     changeFlagHandle (text, record) {
-      console.log(text)
       const _this = this
       const _data = {
         id: record.id,
-        flag: record.state == 1 ? '0' : '1'
-      }
-      if (record.state == 1) {
-        this.$confirm({
-          title: '提示',
-          centered: true,
-          content: '商品分类被禁用后,该分类将不在显示给用户,确定禁用吗?',
-          okText: '确定',
-          cancelText: '取消',
-          onOk () {
-            changeGoodsStatus(_data).then(res => {
-              if (res.status == 200) {
-                _this.$message.success(res.message)
-                _this.$refs.table.refresh()
-              }
-            })
-          }
-        })
-      } else {
-        changeGoodsStatus(_data).then(res => {
-          if (res.status == 200) {
-            _this.$message.success(res.message)
-            _this.$refs.table.refresh()
-          } else {
-            record.state = !record.state
-          }
-        })
+        state: record.state == 1 ? '0' : '1'
       }
+      enableLuckyDraw(_data).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.$refs.table.refresh()
+        }
+      })
     },
     beforeRouteEnter (to, from, next) {
       next(vm => {

+ 56 - 30
src/views/market/winingRecord.vue

@@ -14,23 +14,28 @@
                 @change="onChange" />
             </a-form-item>
           </a-col>
-          <a-col :span="6">
-            <a-form-item label="奖品名称" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
-              <a-input id="winRecord-customerMobile" allowClear :maxLength="11" v-model="queryParam.customerMobile" placeholder="请输入奖品名称" />
+          <a-col :span="5">
+            <a-form-item label="奖品" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+              <a-input id="winRecord-prizeDesc" allowClear v-model="queryParam.prizeDesc" placeholder="请输入奖品名称" />
+            </a-form-item>
+          </a-col>
+          <a-col :span="5">
+            <a-form-item label="用户" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+              <a-input id="winRecord-customerMobile" allowClear v-model="queryParam.customerMobile" placeholder="请输入用户账号" />
             </a-form-item>
           </a-col>
           <a-col :span="4">
             <a-form-item label="状态" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
               <v-select
-                v-model="queryParam.orderState"
+                v-model="queryParam.state"
                 ref="orderState"
-                id="winRecord-status"
-                code="ORDER_STATE"
+                id="winRecord-state"
+                code="PRIZE_WIN_STATE"
                 placeholder="请选择状态"
                 allowClear></v-select>
             </a-form-item>
           </a-col>
-          <a-col :span="6">
+          <a-col :span="4">
             <a-button class="handle-btn serach-btn" id="winRecord-btn-serach" type="primary" @click="$refs.table.refresh(true)">查询</a-button>
             <a-button class="handle-btn" type="" id="winRecord-btn-reset" @click="handleReset">重置</a-button>
           </a-col>
@@ -50,19 +55,23 @@
           type="rocket"
           id="winRecord-sendGood"
           title="发货"
+          v-if="record.prizeType=='GOODS'&&record.state=='WAIT_SEND_EXPRESS'&&$hasPermissions('B_winingRecord_sendGood')"
           class="actionBtn icon-blues"
           @click="sendGood(record)" />
         <a-icon
           type="eye"
           id="winRecord-handleView"
           title="详情"
+          v-else-if="record.prizeType=='GOODS'&&record.state=='FINISH'&&$hasPermissions('B_winingRecord_view')"
           class="actionBtn icon-green"
           @click="handleView(record)" />
-
+        <span v-else>--</span>
       </template>
     </s-table>
-    <!-- 物流信息 -->
-    <GoodsLogistics :openModal="openModal" @submit="handleSubmit" @close="openModal=false" />
+    <!-- 发货 -->
+    <GoodsLogistics :openModal="openModal" :itemId="itemId" @submit="handleSubmit" @close="openModal=false" />
+    <!-- 发货详情 -->
+    <GoodsLogisticsDetail :openModal="openDetailModal" :itemId="itemId" @close="openDetailModal=false" />
   </a-card>
 
 </template>
@@ -70,49 +79,53 @@
 <script>
 import { STable, VSelect } from '@/components'
 import GoodsLogistics from './GoodsLogistics.vue'
+import GoodsLogisticsDetail from './GoodsLogisticsDetail.vue'
 import getDate from '@/libs/getDate.js'
 import moment from 'moment'
-import { orderList } from '@/api/order'
+import { getLuckyWinList, sendExpress } from '@/api/luckyDraw.js'
 export default {
   name: 'WinRecord',
-  components: { STable, VSelect, GoodsLogistics },
+  components: { STable, VSelect, GoodsLogistics, GoodsLogisticsDetail },
   data () {
     return {
       openModal: false, //  是否填写物流信息
+      openDetailModal: false, //  是否查看物流信息
       formItemLayout: {
-        labelCol: { span: 7 },
-        wrapperCol: { span: 17 }
+        labelCol: { span: 6 },
+        wrapperCol: { span: 18 }
       },
       // 查询参数
       queryParam: {
         beginDate: null, // 开始时间
         endDate: null, // 结束时间
-        customerMobile: '', //  用户手机
-        orderSn: '', //  订单编号
-        orderState: null // 订单状态
+        prizeDesc: '', //  奖品
+        customerMobile: '', // 用户
+        state: '' // 状态
       },
+	  itemId: '', // 发货列id
+	  luckyDrawWinNo: '', // 中奖奖品编码
       loading: false, // 导出loading
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '中奖时间', dataIndex: 'orderTime', width: 200, align: 'center' },
-        { title: '活动名称', dataIndex: 'customerMobile', align: 'center' },
-        { title: '奖品', dataIndex: 'orderSn', width: 200, align: 'center' },
+        { title: '中奖时间', dataIndex: 'winTime', width: 200, align: 'center' },
+        { title: '活动名称', dataIndex: 'activeName', width: 200, align: 'center' },
+        { title: '奖品', dataIndex: 'prizeDesc', width: 200, align: 'center' },
         { title: '中奖用户', dataIndex: 'customerMobile', width: 200, align: 'center' },
-        { title: '状态', dataIndex: 'orderStateDictValue', width: 200, align: 'center' },
+        { title: '状态', dataIndex: 'stateDictValue', width: 200, align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 150, align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         const searchData = Object.assign(parameter, this.queryParam)
         if (this.time && this.time.length) {
-          searchData.beginDate = moment(this.time[0]).format('YYYY-MM-DD')
-          searchData.endDate = moment(this.time[1]).format('YYYY-MM-DD')
+          searchData.beginDate = moment(this.time[0]).format('YYYY-MM-DD 00:00:00')
+          searchData.endDate = moment(this.time[1]).format('YYYY-MM-DD 23:59:59')
         } else {
           searchData.beginDate = ''
           searchData.endDate = ''
         }
-        return orderList(searchData).then(res => {
+        return getLuckyWinList(searchData).then(res => {
           if (res.status == 200) {
             const no = (res.data.pageNo - 1) * res.data.pageSize
             for (let i = 0; i < res.data.list.length; i++) {
@@ -154,21 +167,33 @@ export default {
         moment(getDate.getToday().endtime, this.dateFormat)
       ]
       this.queryParam.customerMobile = ''
-      this.queryParam.orderSn = ''
-      this.queryParam.orderState = null
+      this.queryParam.prizeDesc = ''
+      this.queryParam.state = ''
       this.$refs.table.refresh(true)
     },
     //  查看物流详情
     handleView (row) {
-      this.$router.push({ path: `/order/orderManage/detail/${row.id}` })
+      this.itemId = row.id
+      this.openDetailModal = true
     },
     // 发货
-    sendGood () {
+    sendGood (row) {
+      this.itemId = row.id
+	  this.luckyDrawWinNo = row.luckyDrawWinNo
       this.openModal = true
     },
     // 提交发货
-    handleSubmit () {
-
+    handleSubmit (data) {
+      console.log(data, 'ppppppp')
+	  const params = data
+	  params.luckyDrawWinNo = this.luckyDrawWinNo
+	  sendExpress(params).then(res => {
+		  if (res.status == 200) {
+			  this.openModal = false
+			  this.$message.success(res.message)
+			  this.$refs.table.refresh(true)
+		  }
+	  })
     }
   }
 }
@@ -185,6 +210,7 @@ export default {
       }
       .handle-btn{
         margin-top: 4px;
+        margin-bottom: 20px;
       }
       .serach-btn{
         margin-right: 10px;

+ 2 - 2
vue.config.js

@@ -108,8 +108,8 @@ const vueConfig = {
     // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        // target: 'http://192.168.16.105:8301/gc-admin/',
-        target: 'https://lese.test.sxzxyj.net/gc-admin/',
+        target: 'http://192.168.16.105:8301/gc-admin/',
+        // target: 'https://lese.test.sxzxyj.net/gc-admin/',
         ws: false,
         changeOrigin: true,
         pathRewrite: {