From 1e49e17d482e3a3e67108bdffa4ae5f374e26cb8 Mon Sep 17 00:00:00 2001
From: zhaoxiaoqiang <287285524@qq.com>
Date: Thu, 31 Aug 2023 18:05:46 +0800
Subject: [PATCH] 订单管理管理员订单管理

---
 src/views/qyp-project-management/promotion.vue |  183 ++++++++++++++++++++++++++-------------------
 1 files changed, 106 insertions(+), 77 deletions(-)

diff --git a/src/views/qyp-project-management/promotion.vue b/src/views/qyp-project-management/promotion.vue
index 54113f3..5994076 100644
--- a/src/views/qyp-project-management/promotion.vue
+++ b/src/views/qyp-project-management/promotion.vue
@@ -80,12 +80,14 @@
             </div>
           </div>
           <el-form-item style="text-align: right;">
-            <el-button type="primary" style="margin-left: 10px;margin-bottom: 8px;" v-if='filterBtnById("150102")' @click="addProduct">新 增</el-button>
             <el-button type="primary" style="margin-left: 10px;margin-bottom: 8px;" @click="onSearch">查 询</el-button>
           </el-form-item>
         </el-form>
       </div>
       <div class="table_box">
+        <div  style="margin-left: 10px;text-align: right;">
+          <el-button type="primary" size="small" @click="addPromotion">新增推广位</el-button>
+        </div>
         <Etable
           hasIndex
           httpUrl="promoteList"
@@ -99,10 +101,41 @@
           }"
         ></Etable>
       </div>
-      <el-dialog top="8vh"  title="新增商品" :visible.sync="addProd" width="60%">
+      <el-dialog top="2vh"  :title="title" :visible.sync="addProd" width="50%">
         <!-- 新增商品名称 -->
-       
-      
+        <el-form :model="ruleForm" :rules="rules" ref="ruleForm" :disabled="disabled" size="small" label-width="100px" class="demo-ruleForm">
+            <el-form-item label="项目" prop="projId">
+              <el-select v-model="ruleForm.projId"  placeholder="请选择项目">
+                <el-option
+                  v-for="item in relustObj.projList"
+                  :key="item.code"
+                  :label="item.name"
+                  :value="item.code"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="代理名称" prop="agencyName">
+              <el-input v-model="ruleForm.agencyName" :disabled="disabled"></el-input>
+            </el-form-item>
+            <el-form-item label="推广位名称" prop="promName">
+              <el-input v-model="ruleForm.promName"></el-input>
+            </el-form-item>
+            <el-form-item label="推广位姓名" prop="promoterName">
+              <el-input v-model="ruleForm.promoterName"></el-input>
+            </el-form-item>
+            <el-form-item label="推广位电话" prop="promoterMblNo">
+              <el-input v-model="ruleForm.promoterMblNo"></el-input>
+            </el-form-item>
+            <el-form-item label="推广位状态" prop="status">
+              <el-radio-group v-model="ruleForm.status" :disabled="disabled">
+                <el-radio v-for="item in relustObj.statusList" :key="item.code" :label="item.code">{{ item.name }}</el-radio>
+              </el-radio-group>
+            </el-form-item>
+            <el-form-item style="text-align:right;" v-if="!disabled">
+              <el-button type="primary" @click="submitForm('ruleForm')">保 存</el-button>
+              <!-- <el-button @click="resetForm('ruleForm')">重置</el-button> -->
+            </el-form-item>
+        </el-form>
       </el-dialog>
     </div>
   </template>
@@ -111,39 +144,14 @@
   import Etable from "@/components/table.vue";
   import {promoteInit,promoteAdd,promoteDtl,promotePpdate} from "@/api/credit";
   import uploadImg from "@/components/upload.vue";
-  import MultipleSelect from "@/components/secect.vue";
+  import MultipleSelect from "@/components/fl-select.vue";
   export default {
     name: "order",
     components: { Etable, MultipleSelect, uploadImg },
     data() {
-      let validateImage = (rule, value, callback) => { //验证器
-        if (!this.payForm.prodListImages.length) {     //为true代表图片在  false报错
-          callback(new Error('请上传商品展示图片'));
-        } else {
-          callback();
-        }
-      };
-      let validateImage1 = (rule, value, callback) => { //验证器
-        if (!this.payForm.prodImages.length) {     //为true代表图片在  false报错
-          callback(new Error('请上传商品轮播图'));
-        } else {
-          callback();
-        }
-      };
-      let validateImage2 = (rule, value, callback) => { //验证器
-        if (!this.payForm.prodDescImages.length) {     //为true代表图片在  false报错
-          callback(new Error('请上传商品详情图片'));
-        } else {
-          callback();
-        }
-      };
       return {
-          disabled: true,
-          payForm: {
-            prodImages: [],
-            prodListImages:[],
-            prodDescImages:"",
-          },
+          disabled: false,
+          ruleForm: {},
           columns: [
             {
               lable: "推广位链接",
@@ -204,37 +212,46 @@
               render: (h, scope) => {
                 return h("div", [
                   h(
-                    "span",
+                    "el-button",
                     {
+                      props:{
+                        type:'text',
+                        size:'small'
+                      },
                       style: {
-                        cursor: "pointer",
-                        color: "#3C8EFE",
-                        display: this.filterBtnById(150101)
-                          ? "inline-block"
-                          : "none",
+                        // display: this.filterBtnById(150101)
+                        //   ? "inline-block"
+                        //   : "none",
                       },
                       on: {
                         click: () => {
-                         
+                          this.title ='推广位详情';
+                          this.disabled =true;
+                          let { promId } = scope.row;
+                          this.getProductDetail(promId)
                         },
                       },
                     },
                     "查看详情"
                   ),
                   h(
-                    "span",
+                    "el-button",
                     {
+                      props:{
+                        type:'text',
+                        size:'small'
+                      },
                       style: {
-                        cursor: "pointer",
-                        "margin-left": "8px",
-                        color: "#3C8EFE",
-                        display: this.filterBtnById(150104)
-                          ? "inline-block"
-                          : "none",
+                        // display: this.filterBtnById(150101)
+                        //   ? "inline-block"
+                        //   : "none",
                       },
                       on: {
                         click: () => {
-                          
+                          this.disabled = false;
+                          this.title ='编辑推广位';
+                          let { promId } = scope.row;
+                          this.getProductDetail(promId)
                         },
                       },
                     },
@@ -244,25 +261,40 @@
               },
             },
           ],
-          licensePaths: [],
-          prodListImages:[],
-          prodDescImages:[],
-          payFormRule: {
-            prodListImage:[{ required: true,  trigger: "change",validator: validateImage}],
-            prodImages:[{ required: true,  trigger: "change",validator: validateImage1}],
-            prodDescImages:[{ required: true,  trigger: "change",validator: validateImage2}],
-            desc: [{ required: true, message: "请输入商品简介", trigger: "blur" }],
+          rules: {
+            projId:[{ required: true,  trigger: "change",message: "请选择项目"}],
+            agencyName:[{ required: true,  trigger: "blur",message: "请输入代理名称"}],
+            promName:[{ required: true,  trigger: "blur",message: "请输入推广位名称"}],
+            promoterName:[{ required: true,  trigger: "blur",message: "请输入推广位姓名"}],
+            promoterMblNo:[{ required: true,  trigger: "blur",message: "请输入推广位电话"}],
             status:[{ required: true, message: "请选择上架状态", trigger: "change" }]
           },
           formInline: {
             status:"all",
           },
           searchData: {},
-          
           relustObj: {},
           addProd:false,
           createdTime:[],
-          promotionCreatedTime:[]
+          promotionCreatedTime:[],
+          title:'新增推广位'
+      }
+    },
+    watch:{
+      addProd:{
+        handler: function(val) {
+          if(!val){
+            this.ruleForm = {
+              agencyName:"",
+              promName:"",
+              promoterName:"",
+              promoterMblNo:"",
+              status:""
+            };
+            this.$refs['ruleForm'].resetFields();
+          }
+        },
+        deep: true
       }
     },
     //生命周期 - 创建完成(可以访问当前this实例)
@@ -274,14 +306,14 @@
         //只能输入整数
         e.target.value = e.target.value.replace(/[^\d]/g, "");
       },
-      addPDH(){
-        this.$refs['skuObj'].validate((valid) => {
+      submitForm(){
+        this.$refs['ruleForm'].validate((valid) => {
             if(valid){
-              let {productAttr,prodName,prodFundType,prodOsType} = this.skuObj;
-              let data = {prodName,prodFundType,prodOsType,prodBrandCode:productAttr[1].value,prodModelCode:productAttr[2].value,prodType:productAttr[0].value};
-              prodAdd(data).then((res)=>{
+              let { promId } = this.ruleForm;
+              let event = {promoteAdd,promotePpdate};
+              event[promId?"promotePpdate":"promoteAdd"](this.ruleForm).then((res)=>{
                 this.addProd = false;
-                this.initSerch();
+                this.onSearch();
               })
             }
         })
@@ -290,7 +322,9 @@
         this.$refs["skuObj"].resetFields();
         this.addProd = false;
       },
-      addProduct(){
+      addPromotion(){
+       this.addProd = true;
+       this.title='新增推广位';
        this.disabled = false;
       },
       onSearch() {
@@ -334,19 +368,14 @@
       },
       getDataList(e) {
       },
-      // prodDescSend(e){
-      //    //文件上传
-      //   this.payForm.prodDescImages = e.map((res) => {
-      //     return res.filePath;
-      //   });
-      //   this.$refs.prodDescImagesIplaod.clearValidate();
-      // },
-      // productShowUSend(e){
-      //   this.payForm.prodListImages = e.map((res) => {
-      //     return res.filePath;
-      //   });
-      //   this.$refs.productShowUpload.clearValidate();
-      // },
+      getProductDetail(promId,type){
+        promoteDtl({promId:promId}).then(({body})=>{
+          this.ruleForm = body;
+          this.$nextTick(()=>{ 
+            this.addProd = true; 
+          });
+        })
+      },
     }
   };
   </script>

--
Gitblit v1.8.0