lilei 4 gadi atpakaļ
vecāks
revīzija
404cf81dbd
2 mainītis faili ar 126 papildinājumiem un 110 dzēšanām
  1. 32 32
      src/config/router.config.js
  2. 94 78
      src/views/market/addlotterySetModal.vue

+ 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_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: '/shopSetting',
     redirect: '/shopSetting/bannerSetting',

+ 94 - 78
src/views/market/addlotterySetModal.vue

@@ -20,7 +20,7 @@
         <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" placeholder="15个字以内"/>
+              <a-input id="addLottery-time" v-model="form.name" allowClear :maxLength="15" placeholder="15个字以内"/>
             </a-form-model-item>
           </a-col>
           <a-col :span="6">
@@ -28,33 +28,36 @@
               <a-range-picker
                 id="addLottery-time"
                 v-model="form.time"
+                allowClear
                 format="YYYY-MM-DD"
                 :placeholder="['开始时间','结束时间']"
               />
             </a-form-model-item>
           </a-col>
           <a-col :span="6">
-            <a-form-model-item ref="name" label="抽奖人次" prop="name">
+            <a-form-model-item ref="cjRc" label="抽奖人次" prop="cjRc">
               <a-input-number
                 id="addLottery-cjRc"
                 style="width: 50%;margin-right: 20px;"
-                v-model="form.nums"
+                v-model="form.cjRc"
+                :disabled="form.bxCjRc"
                 :min="0"
                 :max="999999"
                 :precision="0"
                 placeholder="请输入抽奖人次(0~999999)"
                 allowClear />
-              <a-checkbox v-model="form.bxNums">
+              <a-checkbox @change="bxCjRcChange" v-model="form.bxCjRc">
                 不限
               </a-checkbox>
             </a-form-model-item>
           </a-col>
           <a-col :span="6">
-            <a-form-model-item ref="name" label="付费抽奖规则" prop="name">
+            <a-form-model-item ref="price" label="付费抽奖规则" prop="price">
               每次抽奖需要支付
               <a-input-number
                 id="addLottery-cjgz"
                 style="width: 30%;margin-right: 5px;"
+                v-model="form.price"
                 :min="0"
                 :max="999999"
                 :precision="0"
@@ -67,18 +70,18 @@
 
         <a-row :gutter="48">
           <a-col :span="8">
-            <a-form-model-item ref="name" label="奖品说明" prop="name">
-              <a-input v-model="form.desc" type="textarea" />
+            <a-form-model-item ref="jpDesc" label="奖品说明" prop="jpDesc">
+              <a-input v-model="form.jpDesc" allowClear :maxLength="100" placeholder="请输入奖品说明,100字以内" type="textarea" />
             </a-form-model-item>
           </a-col>
           <a-col :span="8">
-            <a-form-model-item ref="name" label="抽奖条件" prop="name">
-              <a-input v-model="form.desc" type="textarea" />
+            <a-form-model-item ref="jpTj" label="抽奖条件" prop="jpTj">
+              <a-input v-model="form.jpTj" allowClear :maxLength="100" placeholder="请输入抽奖条件,100字以内" type="textarea" />
             </a-form-model-item>
           </a-col>
           <a-col :span="8">
-            <a-form-model-item ref="name" label="抽奖说明" prop="name">
-              <a-input v-model="form.desc" type="textarea" />
+            <a-form-model-item ref="cjDesc" label="抽奖说明" prop="cjDesc">
+              <a-input v-model="form.cjDesc" allowClear :maxLength="100" placeholder="请输入抽奖说明,100字以内" type="textarea" />
             </a-form-model-item>
           </a-col>
         </a-row>
@@ -88,7 +91,7 @@
           <a-col :span="24">
             <div class="form-item">
               <div style="margin-right: 10px;"><span class="red">*</span>请选择转盘类型</div>
-              <a-select style="width: 300px;" v-model="form.region" placeholder="请选择类型">
+              <a-select style="width: 300px;" @change="zpTypeChange" v-model="form.zpType" placeholder="请选择转盘类型">
                 <a-select-option value="5">
                   五等分
                 </a-select-option>
@@ -97,9 +100,9 @@
                 </a-select-option>
               </a-select>
             </div>
-            <div class="form-item" v-for="(item, index) in 6" :key="index">
-              <div style="margin-right: 10px;"><span class="red">*</span> 奖品{{ index }}</div>
-              <a-select style="width: 120px;margin-right: 5px;" placeholder="请选择类型">
+            <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>
@@ -110,8 +113,8 @@
                   未中奖
                 </a-select-option>
               </a-select>
-              <a-input style="width: 200px;margin-right: 5px;" placeholder="请输入奖品名称,10个字以内"/>
-              <a-select style="width: 120px;margin-right: 5px;" placeholder="是否中奖">
+              <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>
@@ -121,6 +124,7 @@
               </a-select>
               <a-input-number
                 style="width: 150px;margin-right: 5px;"
+                v-model="item.glv"
                 :min="0"
                 :max="100"
                 :precision="2"
@@ -128,6 +132,7 @@
                 allowClear />
               <a-input-number
                 style="width: 150px;margin-right: 5px;"
+                v-model="item.nums"
                 :min="0"
                 :max="999999"
                 :precision="0"
@@ -135,6 +140,7 @@
                 allowClear />
               <Upload
                 class="upload"
+                v-model="item.image"
                 ref="homeImage"
                 :fileSize="0.25"
                 listType="picture-card">
@@ -148,7 +154,7 @@
           <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.region" placeholder="请选择">
+              <a-select mode="multiple" style="width: 300px;" v-model="form.zjXz" placeholder="请选择中奖限制">
                 <a-select-option value="5">
                   中奖后抽奖XXX次内不能再次中奖
                 </a-select-option>
@@ -160,11 +166,23 @@
                 </a-select-option>
               </a-select>
             </div>
+            <div class="form-item">
+              <div v-for="(item,index) in form.zjXz" :key="index">
+                <a-input-number
+                  style="width: 150px;margin-right: 5px;"
+                  v-model="item.nums"
+                  :min="0"
+                  :max="100"
+                  :precision="2"
+                  placeholder="请输入中奖概率(%)"
+                  allowClear />
+              </div>
+            </div>
           </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.region" placeholder="请选择">
+              <a-select mode="multiple" style="width: 300px;" v-model="form.cjGz" placeholder="请选择">
                 <a-select-option value="5">
                   新用户登录送抽奖
                 </a-select-option>
@@ -186,8 +204,8 @@
           <a-button type="primary" @click="onSubmit">
             保存
           </a-button>
-          <a-button style="margin-left: 10px;" @click="resetForm">
-            重置
+          <a-button style="margin-left: 10px;" @click="cansel">
+            取消
           </a-button>
         </div>
       </a-form-model>
@@ -197,7 +215,6 @@
 
 <script>
 import { VSelect, Upload } from '@/components'
-import { goodsClassDetails, saveGoodsClass } from '@/api/shopSetting.js'
 export default {
   name: 'AddlotterySetModal',
   components: {
@@ -212,12 +229,6 @@ export default {
     itemId: {
       type: String,
       default: ''
-    },
-    itemData: {
-      type: Object,
-      default: function () {
-        return {}
-      }
     }
   },
   data () {
@@ -229,66 +240,71 @@ export default {
       wrapperCol: {},
       form: {
         name: '',
-        region: undefined,
-        date1: undefined,
-        delivery: false,
-        type: [],
-        resource: '',
-        desc: ''
+        time: [],
+        cjRc: '',
+        bxCjRc: false,
+        price: '',
+        jpDesc: '',
+        jpTj: '',
+        cjDesc: '',
+        zpType: undefined,
+        jpList: [],
+        zjXz: [],
+        cjGz: []
       },
       rules: {
-        name: [
-          { required: true, message: 'Please input Activity name', trigger: 'blur' },
-          { min: 3, max: 5, message: 'Length should be 3 to 5', trigger: 'blur' }
-        ],
-        region: [{ required: true, message: 'Please select Activity zone', trigger: 'change' }],
-        date1: [{ required: true, message: 'Please pick a date', trigger: 'change' }],
-        type: [
-          {
-            type: 'array',
-            required: true,
-            message: 'Please select at least one activity type',
-            trigger: 'change'
-          }
-        ],
-        resource: [
-          { required: true, message: 'Please select activity resource', trigger: 'change' }
-        ],
-        desc: [{ required: true, message: 'Please input activity form', trigger: 'blur' }]
+        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' }]
       }
     }
   },
   methods: {
-    // 查看详情
-    getPageInfo () {
+    // 不限人次
+    bxCjRcChange (e) {
+      console.log(e)
+      if (e.target.checked) {
+        this.form.cjRc = ''
+      }
+    },
+    // 选择转盘类型
+    zpTypeChange (val) {
+      console.log(val)
       const _this = this
-      goodsClassDetails({
-        id: _this.itemId
-      }).then(res => {
-        if (res.status == 200) {
-          this.form.setFieldsValue({ formData: res.data })
+      for (let i = 0; i < val; i++) {
+        _this.form.jpList[i] = {
+          jpType: undefined,
+          name: '',
+          isZj: '0',
+          glv: '',
+          nums: '',
+          image: ''
         }
-      })
+      }
     },
-    // 点击保存;
-    handleSubmit (e) {
-      e.preventDefault()
-      const _this = this
-      this.form.validateFields((err, values) => {
-        if (!err) {
-          const formData = Object.assign({}, this.itemData, this.formData, values.formData)
-          formData.id = _this.itemId
-          saveGoodsClass(formData).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.$emit('refresh')
-              setTimeout(function () {
-                _this.isShow = false
-              }, 300)
-            }
-          })
+    // 保存
+    onSubmit () {
+      this.$refs.ruleForm.validate(valid => {
+        console.log(this.form)
+        if (valid) {
+          console.log('valid submit!!')
+        } else {
+          console.log('error submit!!')
+          return false
         }
       })
+    },
+    // 取消
+    cansel () {
+      this.isShow = false
+    },
+    // 编辑获取数据
+    getPageInfo () {
+
     }
   },
   watch: {
@@ -299,7 +315,7 @@ export default {
       if (!val) {
         this.$emit('close')
       } else {
-        this.form.resetFields()
+        this.$refs.ruleForm.resetFields()
       }
     },
     itemId (newValue, oldValue) {