Преглед на файлове

Merge branch 'master' into pengyouhao_dev

pengyh преди 1 година
родител
ревизия
1e4cfa5843

+ 15 - 0
src/api/setActivity.js

@@ -39,3 +39,18 @@ export function promotionQuestionnaireStop(params) {
     params
   })
 }
+
+export function promotionQuestionnaireShow(params) {
+  return request({
+    url: '/promotion/questionnaire/show',
+    method: 'post',
+    params
+  })
+}
+
+export function promotionQuestionnaireDownload(params) {
+  return getBlob({
+    url: 'promotion/questionnaire/download',
+    params
+  })
+}

+ 112 - 67
src/components/template/editTable.js

@@ -13,27 +13,37 @@ export default {
     }
   },
   methods: {
-    convertTableJson(tableData, list, attributes = {
-      isAdd: true,
-      isDel: true,
-      isUpdate: true,
-      isConfirm: true,
-      isEdit: true,
-      isTemElm: true,
-      confirmText: "",
-      editText: "",
-      delText: "",
-    }, funs = {
-      add: function () { },
-      confirm: function () { },
-      delete: function () { },
-      update: function () { },
-      verify: function () { },
-    }) {
+    convertTableJson(
+      tableData,
+      list,
+      attributes = {
+        isAdd: true,
+        isDel: true,
+        isUpdate: true,
+        isConfirm: true,
+        isEdit: true,
+        isTemElm: true,
+        confirmText: '',
+        editText: '',
+        delText: ''
+      },
+      funs = {
+        add: function () {},
+        confirm: function () {},
+        delete: function () {},
+        update: function () {},
+        verify: function () {},
+        btnSlot: function () {}
+      }
+    ) {
       var newList = list.map(item => {
         if (item.editRender && item.viewRender) {
           item.render = (h, { row, column, index }) => {
-            if (attributes?.isTemElm !== undefined ? setShowElement(attributes?.isTemElm, { row, column, index }) : index == this.isEditTableIndex) {
+            if (
+              attributes?.isTemElm !== undefined
+                ? setShowElement(attributes?.isTemElm, { row, column, index })
+                : index == this.isEditTableIndex
+            ) {
               return item.editRender(h, { row, column, index })
             } else {
               return item.viewRender(h, { row, column, index })
@@ -41,7 +51,7 @@ export default {
           }
         }
         return item
-      });
+      })
       if (setShowElement(attributes?.isEdit)) {
         newList.push({
           columnAttributes: {
@@ -49,56 +59,91 @@ export default {
             width: 100
           },
           render: (h, { row, column, index }) => {
-            return <div style="padding-left:10px">
-              {(attributes?.isConfirm !== undefined ? setShowElement(attributes?.isConfirm, { row, column, index }) : this.isEditTableIndex == index) && <el-button type="text" onClick={async () => {
-                if (funs.verify && !await funs.verify({ row, column, index }, this.isEditTableIndex)) {
-                  return;
-                }
-                if (funs.confirm) {
-                  funs.confirm({ row, column, index })
-                } else {
-                  this.isEditTableIndex = -1
-                }
-              }}>{attributes?.confirmText || '确定'}</el-button>}
-              {(attributes?.isUpdate !== undefined ? setShowElement(attributes?.isUpdate, { row, column, index }) : this.isEditTableIndex == -1) && <el-button type="text" onClick={async () => {
-                if (funs.verify && !await funs.verify({ row, column, index }, this.isEditTableIndex)) {
-                  return;
-                }
-                if (funs.update) {
-                  funs.update({ row, column, index })
-                } else {
-                  this.isEditTableIndex = index
-                }
-              }}>{attributes?.editText || '编辑'}</el-button>}
-              {setShowElement(attributes?.isDel, { row, column, index }) && <el-button type="text" onClick={async () => {
-                if (funs.delete) {
-                  funs.delete({ row, column, index }, function(){
-                    tableData.splice(index, 1)
-                  })
-                } else {
-                  tableData.splice(index, 1)
-                }
-              }}>{attributes?.delText || '删除'}</el-button>}
-            </div>
+            return (
+              <div style="padding-left:10px">
+                {(attributes?.isConfirm !== undefined
+                  ? setShowElement(attributes?.isConfirm, { row, column, index })
+                  : this.isEditTableIndex == index) && (
+                  <el-button
+                    type="text"
+                    onClick={async () => {
+                      if (funs.verify && !(await funs.verify({ row, column, index }, this.isEditTableIndex))) {
+                        return
+                      }
+                      if (funs.confirm) {
+                        funs.confirm({ row, column, index })
+                      } else {
+                        this.isEditTableIndex = -1
+                      }
+                    }}
+                  >
+                    {attributes?.confirmText || '确定'}
+                  </el-button>
+                )}
+                {(attributes?.isUpdate !== undefined
+                  ? setShowElement(attributes?.isUpdate, { row, column, index })
+                  : this.isEditTableIndex == -1) && (
+                  <el-button
+                    type="text"
+                    onClick={async () => {
+                      if (funs.verify && !(await funs.verify({ row, column, index }, this.isEditTableIndex))) {
+                        return
+                      }
+                      if (funs.update) {
+                        funs.update({ row, column, index })
+                      } else {
+                        this.isEditTableIndex = index
+                      }
+                    }}
+                  >
+                    {attributes?.editText || '编辑'}
+                  </el-button>
+                )}
+                {setShowElement(attributes?.isDel, { row, column, index }) && (
+                  <el-button
+                    type="text"
+                    onClick={async () => {
+                      if (funs.delete) {
+                        funs.delete({ row, column, index }, function () {
+                          tableData.splice(index, 1)
+                        })
+                      } else {
+                        tableData.splice(index, 1)
+                      }
+                    }}
+                  >
+                    {attributes?.delText || '删除'}
+                  </el-button>
+                )}
+                {funs.btnSlot ? funs.btnSlot({ row, column, index }) : null}
+              </div>
+            )
           }
         })
-      };
-      return <div>
-        {setShowElement(attributes?.isAdd) ? <div>
-          <el-button size="mini" type="primary" onClick={async () => {
-            if (funs.verify && !await funs.verify({}, this.isEditTableIndex)) {
-              return;
-            }
-            if (funs.add) {
-              funs.add()
-            }
-          }}>新增</el-button>
-        </div> : null}
-        <zj-table
-          columns={newList}
-          table-data={tableData}
-        />
-      </div>
+      }
+      return (
+        <div>
+          {setShowElement(attributes?.isAdd) ? (
+            <div>
+              <el-button
+                size="mini"
+                type="primary"
+                onClick={async () => {
+                  if (funs.verify && !(await funs.verify({}, this.isEditTableIndex))) {
+                    return
+                  }
+                  if (funs.add) {
+                    funs.add()
+                  }
+                }}
+              >
+                新增
+              </el-button>
+            </div>
+          ) : null}
+          <zj-table columns={newList} table-data={tableData} />
+        </div>
+      )
     }
   }
 }

+ 2 - 2
src/utils/request.js

@@ -76,7 +76,7 @@ service.interceptors.response.use(
           cancelButtonText: '取消',
           type: 'warning'
         }).then(() => {
-          window.location.href = window.location.href.split("#")[0] + "#/setting/personal?isRenew=true"
+          window.location.href = window.location.href.split('#')[0] + '#/setting/personal?isRenew=true'
         })
       }
       return Promise.reject(new Error(res.message || 'Error'))
@@ -97,7 +97,7 @@ service.interceptors.response.use(
 
 export default service
 
-function zhapi(add, path) {
+export function zhapi(add, path) {
   if (add[add.length - 1] == '/' && path[0] == '/') {
     return add + path.substr(1)
   }

+ 31 - 8
src/views/mallManagement/activityOrder/detail.vue

@@ -30,15 +30,28 @@
 								  </el-select>
 							</el-form-item>
 						</el-col>
-						<el-col :span="12" style="margin-bottom: 1px;">
+						<el-col :span="6" style="height: 51px;">
+							<el-form-item label="活动网点" prop="customWebsitName">
+								<el-select v-model="formData.customWebsitName" :disabled="formType!=0" placeholder="请选择" style="width: 100%;">
+								    <el-option
+								      v-for="(item,index) in websitList"
+								      :key="index"
+								      :label="item.websitName"
+								      :value="item.websitName">
+								    </el-option>
+								  </el-select>
+							</el-form-item>
+						</el-col>
+						<el-col :span="6" style="margin-bottom: 1px;">
 							<el-form-item label="活动时间" prop="" class="is-required">
 								<el-date-picker
-								      v-model="formData.activeDate"
-									  disabled
-								      type="daterange"
-								      range-separator="至"
-								      start-placeholder="开始日期"
-								      end-placeholder="结束日期">
+									style="width: 100%"
+								    v-model="formData.activeDate"
+									disabled
+								    type="daterange"
+								    range-separator="至"
+								    start-placeholder="开始日期"
+								    end-placeholder="结束日期">
 								</el-date-picker>
 							</el-form-item>
 						</el-col>
@@ -184,10 +197,12 @@
 				dataList: [],
 				activeList: [],
 				activeItems: [],
+				websitList: [],
 				formData: {
 					active: {},
 					activeDate: [],
 					promotionActivityId: '',
+					customWebsitName: '',
 					userName: '',
 					linkName: '',
 					userMobile: '',
@@ -233,7 +248,9 @@
 			if(this.activeId){
 				this.formData.active = {id: this.activeId}
 				this.formData.promotionActivityId = this.activeId
-				this.getActiveDetail(this.activeId)
+				if(this.formType == 0){
+					this.getActiveDetail(this.activeId)
+				}
 			}
 			this.getActiveList()
 		},
@@ -248,6 +265,7 @@
 					Object.assign(this.formData, res.data, {
 						active: {id: res.data.promotionQuestionnaireId}
 					})
+					this.websitList = res.data.promotionQuestionnaireQrcodes
 					this.status = res.data.status
 					res.data.items.forEach(item=>{
 						item.answer = JSON.parse(item.answer)
@@ -266,6 +284,9 @@
 						})
 					})
 					this.activeItems = res.data.items
+					getActiveDetail({id:res.data.promotionQuestionnaireId}).then(res => {
+						this.formData.activeDate = [res.data.startTime,res.data.endTime]
+					})
 					// this.getActiveDetail(res.data.promotionQuestionnaireId,res.data.items)
 				})
 			},
@@ -277,6 +298,7 @@
 			getActiveDetail(id,items){
 				getActiveDetail({id}).then(res => {
 					this.formData.activeDate = [res.data.startTime,res.data.endTime]
+					this.websitList = res.data.promotionQuestionnaireQrcodes
 					res.data.promotionQuestionnaireItems.forEach((item,index)=>{
 						item.answer = JSON.parse(item.answer)
 						if(items){
@@ -377,6 +399,7 @@
 								userMobile: this.formData.userMobile,
 								userMobile2: this.formData.userMobile2,
 								userAddress: this.formData.userAddress,
+								customWebsitName: this.formData.customWebsitName,
 								items
 							}).then(res => {
 								if(res.code == 200){

+ 34 - 4
src/views/mallManagement/goods/goods_add/index.vue

@@ -92,11 +92,27 @@
           </el-col>
           <el-col :span="12">
             <el-form-item label="商品主图:" prop="imgUrl">
-              <el-upload class="avatar-uploader" style="height:122px" :action="baseURL + 'common/upload'" :headers="myHeaders"
+              <el-upload class="avatar-uploader goodsImageUpload" style="height: 0;" :action="baseURL + 'common/upload'" :headers="myHeaders"
                 :show-file-list="false" :on-success="uploadSuccess" :before-upload="beforeUpload">
-                <img v-if="step1Form.imgUrl" :src="step1Form.imgUrl" class="avatar">
-                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
               </el-upload>
+              <div class="images">
+                <div class="item" style="margin: 0;" v-if="step1Form.imgUrl">
+                  <div class="img">
+                    <el-image ref="goodsImg" :src="step1Form.imgUrl" style="width: 120px; height: 120px" fit="cover" :preview-src-list="[step1Form.imgUrl]"></el-image>
+                    <div class="mask" v-if="step1Form.imgUrl">
+                      <div class="row">
+                        <div class="it" @click="previewGoodsImage()"><i class="el-icon-search"></i></div>
+                        <div class="it" @click="uploadGoodsImage()"><i class="el-icon-upload2"></i></div>
+                      </div>
+                    </div>
+                  </div>
+                </div>
+                <div class="item" style="margin: 0;" v-else>
+                  <div class="add" @click="uploadGoodsImage()">
+                    <i class="el-icon-plus avatar-uploader-icon"></i>
+                  </div>
+                </div>
+              </div>
               <div class="tips">
                 <span>建议尺寸:800*800</span>
               </div>
@@ -125,9 +141,10 @@
               <div class="images">
                 <div class="item" v-for="(item, index) in step1Form.images" :key="index">
                   <div class="img">
-                    <el-image ref="img" :src="item.url" style="width: 120px; height: 120px" fit="cover"></el-image>
+                    <el-image :ref="`img${index}`" :src="item.url" style="width: 120px; height: 120px" fit="cover" :preview-src-list="[item.url]"></el-image>
                     <div class="mask">
                       <div class="row">
+                        <div class="it" @click="previewImage(index)"><i class="el-icon-search"></i></div>
                         <div class="it" @click="uploadImage(item.id)"><i class="el-icon-upload2"></i></div>
                         <div class="it" @click="deleteImage(index)"><i class="el-icon-delete"></i></div>
                       </div>
@@ -986,6 +1003,14 @@ export default {
       }
     },
 
+    uploadGoodsImage() {
+      document.querySelector('.goodsImageUpload input').click();
+    },
+
+    previewGoodsImage() {
+      this.$refs.goodsImg.clickHandler()
+    },
+
     // 商品视频 - 上传成功
     uploadSuccess3(res, file) {
       this.step1Form.videoUrl = res.data.url;
@@ -1117,6 +1142,11 @@ export default {
       }
     },
 
+    // 轮播图 - 预览
+    previewImage(index) {
+      this.$refs[`img${index}`][0].clickHandler()
+    },
+
     // 轮播图 - 删除图片
     deleteImage(index) {
       this.step1Form.images.splice(index, 1);

+ 254 - 166
src/views/mallManagement/setActivity/answer.vue

@@ -1,8 +1,14 @@
 <template>
-  <el-dialog title="新增活动内容" width="800px" :modal="true" :visible.sync="showBool" :before-close="formCancel">
+  <el-dialog
+    title="新增活动内容"
+    width="800px"
+    :close-on-click-modal="false"
+    :modal="true"
+    :visible.sync="showBool"
+    :before-close="formCancel"
+  >
     <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
-      <zj-form-module title="" label-width="100px" :showHade="false" :form-data="formData"
-        :form-items="formItems">
+      <zj-form-module title="" label-width="100px" :showHade="false" :form-data="formData" :form-items="formItems">
       </zj-form-module>
     </zj-form-container>
     <div slot="footer" class="dialog-footer">
@@ -15,199 +21,281 @@
 <script>
 import ImageUpload from '@/components/file-upload'
 export default {
-  props:{
-    defaultData:{
+  props: {
+    defaultData: {
       type: Object,
-      default: ()=>({}),
-    },
+      default: () => ({})
+    }
   },
   components: {
     ImageUpload
   },
   data() {
     return {
-      showBool:true,
-      formData: Object.assign({
-        question: "",
-        type: 1,
-        isRequire: true,
-        answer: [],
-      }, this.defaultData),
+      showBool: true,
+      formData: Object.assign(
+        {
+          question: '',
+          type: 1,
+          isRequire: true,
+          answerType: '',
+          answer: []
+        },
+        this.defaultData
+      )
     }
   },
   computed: {
     formItems() {
-      return [{
-        md: 24,
-        name: 'slot-component',
-        formItemAttributes: {
-          label: '',
-          prop: '',
-        },
-        render: (h, { props, onInput }) => {
-          return <div/>
-        }
-      },{
-        md: 24,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入' },
-        formItemAttributes: {
-          label: '名称',
-          prop: 'question',
-          rules: [{ required: true, message: '请输入', trigger: 'blur' }]
+      return [
+        {
+          md: 24,
+          name: 'slot-component',
+          formItemAttributes: {
+            label: '',
+            prop: ''
+          },
+          render: (h, { props, onInput }) => {
+            return <div />
+          }
         },
-      },
-      {
-        md: 24,
-        isShow: true,
-        name: 'el-radio',
-        options: [{ label: "单选题", value: 1 }, { label: "多选题", value: 2 }, { label: "填写", value: 3 }, { label: "图片", value: 4 }, { label: "视频", value: 5 }],
-        attributes: { filterable: true, placeholder: '请选择', disabled: this.formData.id ? true : false },
-        formItemAttributes: {
-          label: '类型',
-          prop: 'type',
-          rules: [{ required: true, message: '请选择', trigger: 'blur' }]
+        {
+          md: 24,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: {
+            label: '名称',
+            prop: 'question',
+            rules: [{ required: true, message: '请输入', trigger: 'blur' }]
+          }
         },
-        events: {
-          change: (newVal) => {
-            if (!!~[1,2].indexOf(newVal)) {
-              this.formData.answer = []
-            } else {
-              setTimeout(() => {
-                this.formData.answer = [
-                  {
-                    option_name: "",
-                    option_value: "",
-                    option_files: [],
-                    option_limit: '',
-                  }
-                ]
-              }, 250);
+        {
+          md: 24,
+          isShow: true,
+          name: 'el-radio',
+          options: [
+            { label: '单选题', value: 1 },
+            { label: '多选题', value: 2 },
+            { label: '填写', value: 3 },
+            { label: '图片', value: 4 },
+            { label: '视频', value: 5 }
+          ],
+          attributes: { filterable: true, placeholder: '请选择', disabled: false },
+          formItemAttributes: {
+            label: '类型',
+            prop: 'type',
+            rules: [{ required: true, message: '请选择', trigger: 'blur' }]
+          },
+          events: {
+            change: newVal => {
+              if (!!~[1, 2].indexOf(newVal)) {
+                this.formData.answer = []
+              } else {
+                setTimeout(() => {
+                  this.formData.answer = [
+                    {
+                      option_name: '',
+                      option_value: '',
+                      option_files: [],
+                      option_limit: ''
+                    }
+                  ]
+                }, 250)
+              }
             }
           }
-        }
-      },
-      {
-        md: 24,
-        isShow: true,
-        name: 'el-radio',
-        options: [{ label: "是", value: true }, { label: "否", value: false }],
-        attributes: { filterable: true, placeholder: '请选择', disabled: this.formData.id ? true : false },
-        formItemAttributes: {
-          label: '是否必填',
-          prop: 'isRequire',
-          rules: [{ required: true, message: '请选择', trigger: 'blur' }]
-        }
-      },
-      ...(()=>{
-        if(!!~[1, 2].indexOf(this.formData.type)){
-          return [{
-            md: 24,
-            name: 'slot-component',
-            attributes: { placeholder: '请输入' },
-            formItemAttributes: {
-              label: '试题选项',
-              prop: 'answer',
-              rules: [{ required: true, message: '请添加选项', trigger: 'blur' }]
-            },
-            render: (h, { props, onInput }) => {
-              var { value } = props
-              return (
-                <div>
-                  <div>
-                    <el-button size="mini" onClick={() => {
-                      this.formData.answer.push({
-                        option_name: "",
-                        option_value: "",
-                        option_files: [],
-                        option_limit: '',
-                      })
-                    }} type="primary">添加</el-button>
-                  </div>
-                  {this.formData.answer.map((item, index) => {
-                    item.option_name = `选项${index + 1}`
-                    return (
-                      <div>
-                        <div style="display: flex;justify-content: space-between;">
-                          <span style="font-weight: bold;">{this.formData.answer[index].option_name}</span>
-                          <span style="color: red;" onClick={() => {
-                            this.formData.answer.splice(index, 1)
-                          }}>删除</span>
-                        </div>
-                        <div class="redbordererr">
-                          <el-form-item
-                            label=""
-                            lebel-width="0px"
-                            prop={`answer.${index}.option_value`}
-                            rules={[{ required: true, message: '请填写', trigger: 'blur' }]}
-                          >
-                            <el-input type="textarea" rows={2} placeholder="请输入内容" value={this.formData.answer[index].option_value} onInput={(val) => { this.formData.answer[index].option_value = val }}></el-input>
-                          </el-form-item>
-                        </div>
-                        <div style="margin-top:5px">
-                          <ImageUpload fileList={this.formData.answer[index].option_files} uid={`questionFiles_ImageUpload_${index}`} limit={1} isUpdate={false} />
-                        </div>
-                        <br />
-                      </div>
-                    )
-                  })}
-                </div>
-              )
-            }
-          }]
-        }else if(!!~[3].indexOf(this.formData.type)){
-          return [{
-            md: 24,
-            name: 'slot-component',
-            attributes: { placeholder: '请输入' },
-            formItemAttributes: {
-              label: '限制字数',
-              prop: 'answer',
-              rules: []
-            },
-            render: (h, { props, onInput }) => {
-              var { value } = props
-              return (
-                <div>
-                  {this.formData.answer.map((item, index) => {
-                    return (
+        },
+        {
+          md: 24,
+          isShow: true,
+          name: 'el-radio',
+          options: [
+            { label: '是', value: true },
+            { label: '否', value: false }
+          ],
+          attributes: { filterable: true, placeholder: '请选择', disabled: false },
+          formItemAttributes: {
+            label: '是否必填',
+            prop: 'isRequire',
+            rules: [{ required: true, message: '请选择', trigger: 'blur' }]
+          }
+        },
+        ...(() => {
+          if (!!~[1, 2].indexOf(this.formData.type)) {
+            return [
+              {
+                md: 24,
+                isShow: true,
+                name: 'el-radio',
+                options: [
+                  { label: '图文结合', value: 1 },
+                  { label: '纯文字', value: 2 },
+                  { label: '纯图片', value: 3 }
+                ],
+                attributes: { filterable: true, placeholder: '请选择', disabled: false },
+                formItemAttributes: {
+                  label: '选项类型',
+                  prop: 'answerType',
+                  rules: [{ required: true, message: '请选择', trigger: 'blur' }]
+                }
+              },
+              {
+                md: 24,
+                name: 'slot-component',
+                attributes: { placeholder: '请输入' },
+                formItemAttributes: {
+                  label: '试题选项',
+                  prop: 'answer',
+                  rules: [{ required: true, message: '请添加选项', trigger: 'blur' }]
+                },
+                render: (h, { props, onInput }) => {
+                  var { value } = props
+                  return (
+                    <div>
                       <div>
-                        <div>
-                          <el-input type='number' placeholder="请输入限制长度" value={this.formData.answer[index].option_limit} onInput={(val) => { this.formData.answer[index].option_limit = val }}></el-input>
-                        </div>
+                        <el-button
+                          size="mini"
+                          onClick={() => {
+                            this.formData.answer.push({
+                              option_name: '',
+                              option_value: '',
+                              option_files: [],
+                              option_limit: ''
+                            })
+                          }}
+                          type="primary"
+                        >
+                          添加
+                        </el-button>
                       </div>
-                    )
-                  })}
-                </div>
-              )
-            }
-          }]
-        }
-        return []
-      })()]
-    },
+                      {this.formData.answer.map((item, index) => {
+                        item.option_name = `选项${index + 1}`
+                        return (
+                          <div>
+                            <div style="display: flex;justify-content: space-between;">
+                              <span style="font-weight: bold;">{this.formData.answer[index].option_name}</span>
+                              <span
+                                style="color: red;"
+                                onClick={() => {
+                                  this.formData.answer.splice(index, 1)
+                                }}
+                              >
+                                删除
+                              </span>
+                            </div>
+                            <div class="redbordererr">
+                              {~[1, 2].indexOf(this.formData.answerType) ? (
+                                <el-form-item
+                                  label=""
+                                  lebel-width="0px"
+                                  prop={`answer.${index}.option_value`}
+                                  rules={[{ required: true, message: '请填写', trigger: 'blur' }]}
+                                >
+                                  <el-input
+                                    type="textarea"
+                                    rows={2}
+                                    placeholder="请输入内容"
+                                    value={this.formData.answer[index].option_value}
+                                    onInput={val => {
+                                      this.formData.answer[index].option_value = val
+                                    }}
+                                  ></el-input>
+                                </el-form-item>
+                              ) : null}
+                              {~[1].indexOf(this.formData.answerType) ? <div style="margin-top:5px"></div> : null}
+                              {~[1, 3].indexOf(this.formData.answerType) ? (
+                                <el-form-item
+                                  label=""
+                                  lebel-width="0px"
+                                  prop={`answer.${index}.option_files`}
+                                  rules={[{ required: true, message: '请填写', trigger: 'blur' }]}
+                                >
+                                  <ImageUpload
+                                    fileList={this.formData.answer[index].option_files}
+                                    uid={`questionFiles_ImageUpload_${index}`}
+                                    limit={1}
+                                    isUpdate={false}
+                                  />
+                                </el-form-item>
+                              ) : null}
+                            </div>
+                            <br />
+                          </div>
+                        )
+                      })}
+                    </div>
+                  )
+                }
+              }
+            ]
+          } else if (!!~[3, 4, 5].indexOf(this.formData.type)) {
+            return [
+              {
+                md: 24,
+                name: 'slot-component',
+                attributes: { placeholder: '请输入' },
+                formItemAttributes: {
+                  label: '限制数量',
+                  prop: 'answer',
+                  rules: []
+                },
+                render: (h, { props, onInput }) => {
+                  var { value } = props
+                  return (
+                    <div>
+                      {this.formData.answer.map((item, index) => {
+                        return (
+                          <div>
+                            <div>
+                              <el-input
+                                type="number"
+                                placeholder="请输入限制长度"
+                                value={this.formData.answer[index].option_limit}
+                                onInput={val => {
+                                  this.formData.answer[index].option_limit = val
+                                }}
+                              ></el-input>
+                            </div>
+                          </div>
+                        )
+                      })}
+                    </div>
+                  )
+                }
+              }
+            ]
+          }
+          return []
+        })()
+      ]
+    }
   },
   methods: {
     formCancel() {
-      this.$emit("close", this.formData)
+      this.$emit('close', this.formData)
     },
     formConfirm() {
       this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
         if (valid) {
-          this.$emit("confirm", this.formData)
+          this.$emit('confirm', this.formData)
         }
       })
-    },
+    }
   }
 }
 </script>
 
 <style lang="scss" scoped>
-  ::v-deep .el-dialog__body{
-    padding: 30px 20px 0 20px !important
-  }
-  ::v-deep .dialog-footer{
-    padding: 0 !important
+::v-deep .el-dialog__body {
+  padding: 30px 20px 0 20px !important;
+}
+::v-deep .dialog-footer {
+  padding: 0 !important;
+}
+::v-deep .is-error {
+  .add {
+    border-color: red !important;
   }
+}
 </style>

+ 195 - 0
src/views/mallManagement/setActivity/formModule.vue

@@ -0,0 +1,195 @@
+<template>
+  <zj-form-module title="活动网点" label-width="120px" :form-data="item" :form-items="formItems">
+    <div style="text-align: right; padding-bottom: 10px; padding-right: 10px">
+      <el-button
+        v-if="item.promotionQuestionnaireQrcodes.length && item.id"
+        size="mini"
+        type="primary"
+        @click="piliangxiazai"
+        >批量下载二维码</el-button
+      >
+    </div>
+  </zj-form-module>
+</template>
+
+<script>
+import editTable from '@/components/template/editTable.js'
+import { getToken } from '@/utils/auth'
+import { zhapi } from '@/utils/request'
+export default {
+  props: {
+    item: {
+      type: Object,
+      default: () => ({})
+    },
+    typeView: {
+      type: [String, Number],
+      default: 0
+    }
+  },
+  mixins: [editTable],
+  data() {
+    return {}
+  },
+  computed: {
+    formItems() {
+      return [
+        {
+          name: 'slot-component',
+          md: 24,
+          formItemAttributes: {
+            label: '',
+            'label-width': '0px',
+            prop: 'promotionQuestionnaireQrcodes',
+            rules: []
+          },
+          render: (h, { props, onInput }) => {
+            var { value } = props
+            return this.convertTableJson(
+              value,
+              [
+                {
+                  columnAttributes: {
+                    label: '网点名称',
+                    prop: 'websitName'
+                  },
+                  editRender: (h, { row, column, index }) => {
+                    return (
+                      <div class="redbordererr">
+                        <el-form-item
+                          label=""
+                          label-width="0px"
+                          prop={`promotionQuestionnaireQrcodes.${index}.${column.columnAttributes.prop}`}
+                          rules={[{ required: true, message: '请填写', trigger: 'blur' }]}
+                        >
+                          <el-input
+                            value={row[column.columnAttributes.prop]}
+                            onInput={val => {
+                              row[column.columnAttributes.prop] = val
+                            }}
+                            placeholder="请输入内容"
+                          ></el-input>
+                        </el-form-item>
+                      </div>
+                    )
+                  },
+                  viewRender: (h, { row, column, index }) => {
+                    return <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+                  }
+                },
+                {
+                  columnAttributes: {
+                    label: '活动二维码',
+                    prop: 'qrcode',
+                    width: 160
+                  },
+                  render: (h, { row, column, index }) => {
+                    return (
+                      <div class="redbordererr">
+                        {row[column.columnAttributes.prop] ? (
+                          <el-image
+                            src={row[column.columnAttributes.prop]}
+                            preview-src-list={[row[column.columnAttributes.prop]]}
+                            fit="fit"
+                            style="width:80px;height:80px;"
+                          />
+                        ) : null}
+                      </div>
+                    )
+                  }
+                }
+              ],
+              {
+                isEdit: true,
+                isAdd: this.qx(this.item),
+                isUpdate: false,
+                isDel: ({ row, column, index }) => {
+                  return !row.id
+                }
+              },
+              {
+                add: () => {
+                  this.item.promotionQuestionnaireQrcodes.push({
+                    websitName: '',
+                    qrcode: ''
+                  })
+                  this.isEditTableIndex = this.item.promotionQuestionnaireQrcodes.length - 1
+                },
+                delete: ({ row, column, index }, cb) => {
+                  if (this.isEditTableIndex == index) {
+                    this.isEditTableIndex = -1
+                  } else if (this.isEditTableIndex > index) {
+                    this.isEditTableIndex--
+                  }
+                  cb && cb()
+                },
+                verify: ({ row, column, index }, isEditTableIndex) => {
+                  return new Promise(r => {
+                    if (isEditTableIndex > -1) {
+                      this.acquireVerify(this, 'dqangqianyemian')(
+                        [`promotionQuestionnaireQrcodes.${isEditTableIndex}.websitName`],
+                        v => {
+                          if (v) {
+                            r(true)
+                          } else {
+                            r(false)
+                          }
+                        }
+                      )
+                      r(true)
+                    } else {
+                      r(true)
+                    }
+                  })
+                },
+                btnSlot: ({ row, column, index }) => {
+                  if (row.id && row.qrcode) {
+                    return (
+                      <el-button
+                        type="text"
+                        onClick={() => {
+                          window.open(
+                            zhapi(
+                              process.env.VUE_APP_BASE_API,
+                              `/promotion/questionnaire/download?id=${this.item.id}&id2=${row.id}&token=${getToken()}`
+                            )
+                          )
+                        }}
+                      >
+                        下载二维码
+                      </el-button>
+                    )
+                  }
+                  return null
+                }
+              }
+            )
+          }
+        }
+      ]
+    }
+  },
+  methods: {
+    qx(item) {
+      return (
+        !!this.typeView &&
+        (!item.id || !!~[0, 1].indexOf(item.status) || !!~['待生效', '生效中'].indexOf(item.statusText))
+      )
+    },
+    acquireVerify(v, name) {
+      if (v.$parent[name]) {
+        return v.$parent[name]
+      } else {
+        return this.acquireVerify(v.$parent, name)
+      }
+    },
+    piliangxiazai() {
+      window.open(
+        zhapi(process.env.VUE_APP_BASE_API, `/promotion/questionnaire/download?id=${this.item.id}&token=${getToken()}`)
+      )
+    }
+  }
+}
+</script>
+
+<style lang="scss"></style>

Файловите разлики са ограничени, защото са твърде много
+ 531 - 320
src/views/mallManagement/setActivity/index.vue


Някои файлове не бяха показани, защото твърде много файлове са промени