Procházet zdrojové kódy

Merge branch 'dev' into 'test'

Dev

See merge request quanshu/mp-ui-pc!14
hunagwb před 3 roky
rodič
revize
7ded9bb96e

+ 0 - 2
.env.development

@@ -7,7 +7,5 @@ ENV = 'development'
 # 云管铺/开发环境
 VUE_APP_BASE_API = '/dev-api'
 
-VUE_APP_IMG_URL = 'https://mp-public-test-1307117429.cos.ap-shanghai.myqcloud.com/'
-
 # 路由懒加载
 VUE_CLI_BABEL_TRANSPILE_MODULES = true

+ 0 - 2
.env.production

@@ -6,5 +6,3 @@ ENV = 'production'
 
 # 云管铺/生产环境
 VUE_APP_BASE_API = '/prod-api'
-
-VUE_APP_IMG_URL = 'https://mp-public-test-1307117429.cos.ap-shanghai.myqcloud.com/'

+ 10 - 0
src/api/admin/channel.js

@@ -29,6 +29,16 @@ export function listAllChannel() {
   })
 }
 
+export function getChannelDetail(channelId) {
+  return request({
+    url: '/api/v1/mp/admin/channel/detail',
+    method: 'post',
+    data: {
+      channelId
+    }
+  })
+}
+
 
 // 新增渠道
 export function addChannel(data) {

+ 9 - 0
src/api/admin/salesite.js

@@ -11,6 +11,15 @@ export function listSaleSite(urlParams, data) {
   })
 }
 
+export function getSaleSiteDetail(channelId) {
+  return request({
+    url: '/api/v1/mp/admin/salesite/detail',
+    method: 'post',
+    data: {
+      channelId
+    }
+  })
+}
 
 // 新增经销商
 export function addSaleSite(data) {

+ 49 - 36
src/views/business/channel/components/Create.vue

@@ -113,20 +113,10 @@
   </el-dialog>
 </template>
 <script>
-import { addChannel, updateChannel, listAllChannel} from "@/api/admin/channel";
+import { addChannel, updateChannel, listAllChannel, getChannelDetail} from "@/api/admin/channel";
 import { listAreaByPid} from "@/api/admin/area";
 import { mapGetters } from "vuex";
-import CustomFieldsMixin from "@/mixins/CustomFields";
-// import {
-//   getCollector,
-//   addCollector,
-//   updateCollector,
-//   itemTypes
-// } from "@/api/business/collector";
-// import { itemCustomer } from "@/api/business/customer";
-// import { itemStore } from "@/api/business/store";
 export default {
-  mixins: [CustomFieldsMixin],
   props: {
     dialogVisible: {
       type: Boolean,
@@ -146,7 +136,18 @@ export default {
       areaList:[],
       statusOptions: [],
       // 表单参数
-      form: {},
+      form: {
+        name:"",
+        mobile:"",
+        contact:"",
+        commRate:"",
+        provinceId:"",
+        cityId:"",
+        areaId:"",
+        province:"",
+        city:"",
+        area:""
+      },
       detail: {},
       // 表单校验
       rules: {
@@ -188,10 +189,12 @@ export default {
     //console.log("watch dialogVisible created == ");
     // 是编辑
     if (this.editId) {
-     // this.getDetail();
+       this.getDetail();
+    }else{
+       this.getProvinceList()
     }
     // this.getChannelList()
-    this.getProvinceList()
+
   },
 
   mounted() {
@@ -225,10 +228,18 @@ export default {
       this.cityList = []
       this.areaList = []
       this.form.cityId = ""
+      this.form.city = ""
       this.form.areaId = ""
+      this.form.area = ""
       listAreaByPid(0).then(response => {
         // console.log("getProvinceList"+JSON.stringify(response))
+         console.log("getProvinceList this.form=="+JSON.stringify(this.form))
          this.provinceList = response || [];
+          console.log("this.editId && this.form.provinceId == "+(this.editId && this.form.provinceId))
+         if(this.editId && this.detail.provinceId){
+            this.form.provinceId = this.detail.provinceId
+            this.getCityList()
+         }
       });
     },
 
@@ -254,8 +265,11 @@ export default {
       var provinceId = this.form.provinceId
       this.form.province = this.getProvinceName()
       listAreaByPid(provinceId).then(response => {
-        // console.log("getCityList"+JSON.stringify(response))
          this.cityList = response || [];
+         if(this.editId && this.detail.cityId){
+            this.form.cityId = this.detail.cityId
+            this.getAreaList()
+         }
       });
 
     },
@@ -277,6 +291,9 @@ export default {
       listAreaByPid(cityId).then(response => {
         // console.log("getAreaList"+JSON.stringify(response))
          this.areaList = response || [];
+         if(this.editId && this.detail.areaId){
+            this.form.areaId = this.detail.areaId
+         }
       });
     },
 
@@ -310,27 +327,23 @@ export default {
     /**
      * 获取项目详情
      */
-    // getDetail() {
-    //   this.loading = true;
-    //   getCollector({
-    //     colDeviceId: this.editId
-    //   }).then(res => {
-    //       const data = res.data || {}
-    //       // console.log("getDetail :" + JSON.stringify(data))
-    //       this.detail = data
-    //       this.$set(this.form,'custId', data.custId)
-    //       this.$set(this.form,'storeId', data.storeId)
-    //       this.$set(this.form,'colAddress', data.colAddress)
-    //       const deviceCategory = JSON.parse(data.typeId || {})
-    //       this.detail.typeId = deviceCategory
-    //       this.$set(this.form,'typeId', deviceCategory.value)
-    //       this.$set(this.form,'label', data.label)
-    //       this.loading = false
-    //     })
-    //     .catch(() => {
-    //       this.loading = false;
-    //     });
-    // },
+    getDetail() {
+      this.loading = true;
+      getChannelDetail(this.editId).then(res => {
+          const data = res.data || {}
+          // console.log("getDetail :" + JSON.stringify(data))
+          this.detail = data
+          this.form.name = data.name
+          this.form.mobile = data.mobile
+          this.form.contact = data.contact
+          this.form.commRate = data.commRate
+          this.loading = false
+          this.getProvinceList()
+        })
+        .catch(() => {
+          this.loading = false;
+        });
+    },
 
 
     saveClick(){

+ 85 - 39
src/views/business/channel/components/Detail.vue

@@ -7,37 +7,93 @@
     :before-close="close"
     :destroy-on-close="true"
     :close-on-click-modal="false">
-   <el-form ref="form" :model="form" label-width="120px" label-position="top" style="max-height: 375px;overflow: auto;">
+   <el-form ref="form" label-width="120px" label-position="top" >
      <flexbox
          class="ygp-form-items"
          align="flex-start"
          justify="flex-start">
-        <el-form-item label="运营企业" prop="custId" style="width: 50%;" >
-          <span :class="loading?'el-icon-loading':''">{{detail.customer && detail.customer.name}}</span>
+        <el-form-item label="渠道名称" style="width: 50%; margin-bottom:5px;" >
+          <span :class="loading?'el-icon-loading':''"></span>
+          {{detail.name}}
         </el-form-item>
-         <el-form-item label="门店" prop="storeId" style="width: 50%;" >
-            <span :class="loading?'el-icon-loading':''">{{detail.store && detail.store.name}}</span>
+         <el-form-item label="手机号码" style="width: 50%; margin-bottom:5px;" >
+            <span :class="loading?'el-icon-loading':''"></span>
+            {{detail.mobile}}
          </el-form-item>
      </flexbox>
      <flexbox
          class="ygp-form-items"
          align="flex-start"
          justify="flex-start">
-         <el-form-item label="采集器编号" prop="colAddress" style="width: 50%;">
-             <span :class="loading?'el-icon-loading':''">{{detail.colAddress}}</span>
+         <el-form-item label="联系人" style="width: 50%;margin-bottom:5px;" >
+           <span :class="loading?'el-icon-loading':''"></span>
+           {{detail.contact}}
          </el-form-item>
-         <el-form-item label="类型" prop="typeId" style="width: 50%;">
-           <span :class="loading?'el-icon-loading':''">{{detail.typeId && detail.typeId.desc}}</span>
+          <el-form-item label="渠道级别" style="width: 50%;margin-bottom:5px;" >
+             <span :class="loading?'el-icon-loading':''"></span>
+             {{detail.level}}级渠道
+          </el-form-item>
+     </flexbox>
+     <flexbox
+         class="ygp-form-items"
+         align="flex-start"
+         justify="flex-start">
+         <el-form-item label="上级渠道" style="width: 50%;margin-bottom:5px;" >
+           <span :class="loading?'el-icon-loading':''"></span>
+           {{detail.parentName}}
+         </el-form-item>
+          <el-form-item label="佣金比例" style="width: 50%;margin-bottom:5px;" >
+             <span :class="loading?'el-icon-loading':''"></span>
+             {{detail.commRate}}%
+          </el-form-item>
+     </flexbox>
+     <flexbox
+         class="ygp-form-items"
+         align="flex-start"
+         justify="flex-start">
+         <el-form-item label="所在地区" style="width: 50%;margin-bottom:5px;" >
+           <span :class="loading?'el-icon-loading':''"></span>
+           {{detail.province}} {{detail.city}} {{detail.area}}
          </el-form-item>
+          <el-form-item label="创建时间" style="width: 50%;margin-bottom:5px;" >
+             <span :class="loading?'el-icon-loading':''"> </span>
+            {{ detail.createdTime | moment("YYYY-MM-DD HH:mm:ss") }}
+          </el-form-item>
      </flexbox>
+      <el-divider></el-divider>
      <flexbox
-          class="ygp-form-items"
-          align="flex-start"
-          justify="flex-start">
-         <el-form-item label="备注" prop="label" style="width: 100%;">
-            <span :class="loading?'el-icon-loading':''">{{detail.label}}</span>
+         class="ygp-form-items"
+         align="flex-start"
+         justify="flex-start">
+         <el-form-item label="经销商" style="width: 50%;margin-bottom:5px;" >
+           <span :class="loading?'el-icon-loading':''"></span>
+           {{detail.siteCnt}}
          </el-form-item>
-      </flexbox>
+          <el-form-item label="用户数" style="width: 50%;margin-bottom:5px;" >
+             <span :class="loading?'el-icon-loading':''"></span>
+             {{detail.userCnt}}
+          </el-form-item>
+     </flexbox>
+     <flexbox
+         class="ygp-form-items"
+         align="flex-start"
+         justify="flex-start">
+         <el-form-item label="订单数" style="width: 50%;margin-bottom:5px;" >
+           <span :class="loading?'el-icon-loading':''"> </span>
+           {{detail.operData && detail.operData.orderCnt}}
+         </el-form-item>
+          <el-form-item label="营业额" style="width: 50%;margin-bottom:5px;" >
+             <span :class="loading?'el-icon-loading':''"></span>{{detail.operData &&detail.operData.saleAmt}}
+          </el-form-item>
+     </flexbox>
+     <flexbox
+         class="ygp-form-items"
+         align="flex-start"
+         justify="flex-start">
+         <el-form-item label="佣金" style="width: 50%;margin-bottom:5px;" >
+           <span :class="loading?'el-icon-loading':''">{{detail.operData && detail.operData.commAmt}} </span>
+         </el-form-item>
+     </flexbox>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="close">关 闭</el-button>
@@ -47,10 +103,8 @@
 <script>
 
 import { mapGetters } from 'vuex'
-import CustomFieldsMixin from '@/mixins/CustomFields'
-// import { getCollector } from "@/api/business/collector";
+import { getChannelDetail} from "@/api/admin/channel";
 export default {
-  mixins: [CustomFieldsMixin],
   props: {
     dialogVisible: {
       type: Boolean,
@@ -62,8 +116,7 @@ export default {
   data() {
     return {
       loading: false,
-      // 表单参数
-      form: {},
+      // 详情数据
       detail: {}
     }
   },
@@ -71,14 +124,14 @@ export default {
   computed: {
     ...mapGetters(['userInfo']),
     title() {
-      return '采集器详情'
+      return '渠道详情'
     }
   },
 
   created() {
     // 是编辑
     if (this.editId) {
-      // this.getDetail()
+      this.getDetail()
     }
   },
 
@@ -100,20 +153,11 @@ export default {
      */
     getDetail() {
       this.loading = true
-      getCollector({
-        colDeviceId: this.editId
-      }).then(res => {
+      getChannelDetail(this.editId).then(res => {
+          this.loading = false
           const data = res.data || {}
-          this.detail = data
           // console.log("getDetail :" + JSON.stringify(data))
-          this.$set(this.form,'custId', data.custId)
-          this.$set(this.form,'storeId', data.storeId)
-          this.$set(this.form,'colAddress', data.colAddress)
-          const deviceCategory = JSON.parse(data.typeId || {})
-          this.detail.typeId = deviceCategory
-          this.$set(this.form,'typeId', deviceCategory.value)
-          this.$set(this.form,'label', data.label)
-          this.loading = false
+          this.detail = data
         })
         .catch(() => {
           this.loading = false
@@ -125,10 +169,6 @@ export default {
      */
     close() {
       this.$emit('close')
-      this.form = {
-        month:3,
-        packageType:'1'
-      }
     }
   }
 }
@@ -178,13 +218,19 @@ export default {
 </style>
 
 <style lang="scss">
+
+.el-dialog__body {
+    padding: 15px 20px;
+}
+
 .ygp-form-items {
    .el-form-item{
      padding: 0 5px;
    }
+
   .el-form-item__label {
     line-height: 1.2;
-    padding-bottom: 8px;
+    padding-bottom: 0px;
     word-break: break-all;
     word-wrap: break-word;
     color: #333;

+ 14 - 6
src/views/business/channel/index.vue

@@ -18,6 +18,7 @@
             :props="defaultProps"
             ref="tree"
             :load="loadNode"
+            :data="channelOptions"
             lazy
             @node-click="handleNodeClick"
           />
@@ -135,14 +136,12 @@
               <el-button
                 size="mini"
                 type="text"
-                disabled
                 @click="handleDetail(scope.row)"
                 v-hasPermi="['admin:channel:read']"
               >查看</el-button>
               <el-button
                 size="mini"
                 type="text"
-                disabled
                 @click="handleUpdate(scope.row)"
                 v-hasPermi="['admin:channel:edit']"
               >编辑</el-button>
@@ -233,8 +232,8 @@ export default {
       // 总条数
       total: 0,
       // 用户表格数据
-      channelList: null,
-
+      channelList: [],
+      channelOptions: [],
       channelName:"",
       // 状态数据字典
       statusOptions: [],
@@ -303,6 +302,12 @@ export default {
 
     },
 
+    refreshChannelTree(){
+      treeChannel({}).then(response => {
+         this.channelOptions = response.data
+      });
+    },
+
     // 省
     getProvinceList(){
       this.cityList = []
@@ -377,7 +382,8 @@ export default {
       this.handleQuery();
     },
     handleDetail(row){
-
+      this.detailShow = true
+      this.editId = row.channelId
     },
     /** 新增按钮操作 */
     handleAdd() {
@@ -386,11 +392,13 @@ export default {
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
-
+      this.createShow = true
+      this.editId = row.channelId
     },
     // 保存后的操作
     submitSuccess(){
       this.getList();
+      this.refreshChannelTree();
     },
     /**关闭弹窗*/
     hideDialog(){

+ 75 - 24
src/views/business/coupon/add.vue

@@ -4,8 +4,8 @@
     <el-row>
       <el-col :span="23">
         <el-form ref="addItem" :model="addData" :rules="rules" label-width="160px">
-          <el-form-item label="代金券名称:" prop="title">
-            <el-input v-model="addData.title" placeholder="请输入代金券名称" :maxlength="32" show-word-limit />
+          <el-form-item label="券名称:" prop="title">
+            <el-input v-model="addData.title" placeholder="请输入券名称" :maxlength="32" show-word-limit />
           </el-form-item>
           <el-form-item label="使用场景:" prop="type">
             <el-radio-group v-model="addData.type">
@@ -14,27 +14,29 @@
             </el-radio-group>
           </el-form-item>
           <el-form-item label="面值:" prop="discount">
-            <el-input v-model.number="addData.discount" type="number" placeholder="请输入代金券面值">
+            <el-input v-model.number="addData.discount" type="number" :min="0" placeholder="请输入券面值">
               <template slot="append">元</template>
             </el-input>
           </el-form-item>
-          <el-form-item label="数量:" prop="quantity">
-            <el-input v-model.number="addData.quantity" type="number" placeholder="请输入代金券数量">
+          <!-- <el-form-item label="数量:" prop="quantity">
+            <el-input v-model.number="addData.quantity" type="number" :min="0" placeholder="请输入券数量">
               <template slot="append">元</template>
             </el-input>
-          </el-form-item>
-          <el-form-item label="图片:" prop="picUrl">
+          </el-form-item> -->
+          <!-- <el-form-item label="图片:" prop="picUrl">
             <Upload :value="addData.picUrl ? [{ fileName: addData.picUrl }] : []" @input="addData.picUrl = $event[0] ? $event[0].fileName : ''" :limit="1" />
-          </el-form-item>
-          <el-form-item label="门店默认承担比例:" prop="channelSharedRate">
-            <el-input v-model.number="addData.channelSharedRate" type="number" placeholder="请输入面值">
+          </el-form-item> -->
+          <el-form-item v-if="addData.type === 1" label="门店默认承担比例:" prop="channelSharedRate">
+            <el-input v-model.number="addData.channelSharedRate" type="number" placeholder="请输入门店默认承担比例">
               <template slot="append">%</template>
             </el-input>
+            <div class="tip">若门店承担100%,则核销后公司不需要打款给门店,依此类推。</div>
           </el-form-item>
           <el-form-item label="最低消费金额:" prop="minOrderAmt">
             <el-input v-model.number="addData.minOrderAmt" type="number" placeholder="请输入可使用的最低消费金额">
               <template slot="append">元</template>
             </el-input>
+            <div class="tip">最低消费金额小于等于面值则为无门槛券</div>
           </el-form-item>
           <el-form-item label="有效期:" prop="dueDays">
             <el-input v-model.number="addData.dueDays" placeholder="请输入有效期">
@@ -45,14 +47,43 @@
           <el-form-item label="使用说明:" prop="description">
             <el-input type="textarea" rows="4" v-model="addData.description" placeholder="请输入使用说明 对用户可见"/>
           </el-form-item>
-          <el-form-item label="使用范围:" prop="boxIds">
-            <el-radio-group v-model="addData.boxIds">
-              <el-radio :label="1">进票门店</el-radio>
-              <el-radio :label="2">所有盲票</el-radio>
-              <el-radio :label="3">制定盲票</el-radio>
+          <el-form-item v-if="addData.type === 1" label="使用范围:" prop="useArea">进票门店</el-form-item>
+          <el-form-item v-else label="使用范围:" prop="useArea">
+            <el-radio-group v-model="useArea" @change="$event === 'all' ? this.addData.boxIdList = [] : ''">
+              <el-radio label="all">所有盲票</el-radio>
+              <el-radio label="spec">指定盲票</el-radio>
             </el-radio-group>
           </el-form-item>
         </el-form>
+        <div v-if="useArea === 'spec'" style="padding: 0 20px">
+          <el-table :data="addData.boxIdList" height="300px">
+            <el-table-column label="盲票图片" prop="picUrl" align="center" width="80">
+              <template slot-scope="{row}">
+                <a target="_black" v-if="row.picUrl && row.picUrl.split(',').length > 0" :href="`${IMG_URL + row.picUrl}`"><img :src="`${IMG_URL + row.picUrl.split(',')[0]}`" style="max-height: 37px;max-width: 54px"></a>
+                <span v-else>-</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="盲票名称" prop="title" />
+            <el-table-column label="盲票面值" prop="facePrice" />
+            <el-table-column label="盲票类型" prop="type">
+              <template slot-scope="{row}">
+                {{ JSON.parse(row.type).desc }}
+              </template>
+            </el-table-column>
+            <el-table-column label="盲票状态" prop="status">
+              <template slot-scope="{row}">
+                <el-tag :type="JSON.parse(row.status).value === 'on' ? 'success' : 'info'">{{ JSON.parse(row.status).desc }}</el-tag>
+              </template>
+            </el-table-column>
+            <el-table-column prop="date" label="操作">
+              <template slot-scope="{ $index }">
+                <el-button type="text" class="del" @click="addData.boxIdList.splice($index, 1)">删除</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+          <br>
+          <el-button type="primary" size="small" plain @click="$refs.select.show()">选择盲票</el-button> <span style="margin-left: 10px">已选盲票({{ addData.boxIdList.length }})</span>
+        </div>
       </el-col>
     </el-row>
     <el-row>
@@ -61,39 +92,51 @@
         <el-button :loading="addIng" type="primary" @click="update()">保存</el-button>
       </el-col>
     </el-row>
+
+    <!-- 弹出层 -->
+    <SelectTicket ref="select" v-model="addData.boxIdList" />
   </div>
 </template>
 <script>
 import Upload from '@/components/ImageUpload'
+import SelectTicket from './components/selectTicket'
+import { publicFileGetUrl } from "@/api/common"
 import { getCouponDetail, addCoupon } from '@/api/business/coupon'
 export default {
   name: 'CouponAdd',
   components: {
-    Upload
+    Upload,
+    SelectTicket
   },
   data() {
     return {
+      IMG_URL: publicFileGetUrl,
       id: this.$route.query.id,
+      readonly: this.$route.name === 'View',
       addData: {},
       addIng: false,
       rules: {
-        title: [{ required: true, message: '请输入代金券名称', trigger: 'blur' }],
-        type: [{ required: true, message: '请输入代金券类型', trigger: 'blur' }],
-        quantity: [{ required: true, message: '请输入代金券类型', trigger: 'blur' }],
-        picUrl: [{ required: true, message: '请输入代金券类型', trigger: 'blur' }],
-        discount: [{ required: true, message: '请输入代金券面值', trigger: 'blur' }],
+        title: [{ required: true, message: '请输入券名称', trigger: 'blur' }],
+        type: [{ required: true, message: '请输入券类型', trigger: 'blur' }],
+        quantity: [{ required: true, message: '请输入券类型', trigger: 'blur' }],
+        picUrl: [{ required: true, message: '请输入券类型', trigger: 'blur' }],
+        discount: [{ required: true, message: '请输入券面值', trigger: 'blur' }],
         channelSharedRate: [{ required: true, message: '请输入门店默认承担比例', trigger: 'blur' }],
         minOrderAmt: [{ required: true, message: '请输入最低消费金额', trigger: 'blur' }],
         dueDays: [{ required: true, message: '请输入有效期', trigger: 'blur' }],
-        description: [{ required: true, message: '请输入使用说明', trigger: 'blur' }],
-        boxIds: [{ required: true, message: '请选择使用范围', trigger: 'blur' }]
-      }
+        description: [{ required: true, message: '请输入使用说明', trigger: 'blur' }]
+      },
+      useArea: 'all'
     }
   },
   created() {
     if (this.id) {
       getCouponDetail(this.id).then(res => {
         this.addData = res.data
+        this.addData.type = JSON.parse(res.data.type).value
+        if (res.data.boxIdList instanceof Array && res.data.boxIdList.length > 0) {
+          this.useArea = 'spec'
+        }
       })
     }
   },
@@ -102,6 +145,7 @@ export default {
       this.$refs.addItem.validate((valid, items) => {
         if (valid) {
           this.addIng = true
+          this.addData.boxIds = this.addData.boxIdList.map(item => { return item.boxId }).toString()
           addCoupon(this.addData).then(res => {
             this.addIng = false
             if (res.code === 0) {
@@ -127,3 +171,10 @@ export default {
   }
 }
 </script>
+
+<style lang="scss" scoped>
+.tip {
+  font-size: 12px;
+  color: #888;
+}
+</style>

+ 125 - 0
src/views/business/coupon/components/selectTicket.vue

@@ -0,0 +1,125 @@
+<template>
+  <el-dialog title="选择盲票" :visible.sync="selectShow" width="800px" :close-on-click-modal="false" :destroy-on-close="true">
+    <el-form :model="queryParams" ref="queryForm" label-width="80px" size="small">
+      <el-row :gutter="10">
+        <el-col :span="7">
+          <el-form-item label="盲票名称">
+            <el-input
+              v-model="queryParams.title"
+              placeholder="请输入盲票名称"
+              clearable
+              @keyup.enter.native="queryParams.pageNum = 1;getList()"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="7">
+          <el-form-item label="盲票类型">
+            <el-select v-model="queryParams.type" placeholder="请选择盲票类型" clearable>
+              <el-option label="全部" value="" />
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="7">
+          <el-form-item label="上架状态">
+            <el-select v-model="queryParams.status" placeholder="请选择上架状态" clearable>
+              <el-option label="全部" value="" />
+              <!-- <el-option label="待上架" value="init" /> -->
+              <el-option label="已上架" value="on" />
+              <el-option label="已下架" value="off" />
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="3">
+          <el-form-item label-width="0">
+            <el-button type="primary" icon="el-icon-search" @click="queryParams.pageNum = 1;getList()">搜索</el-button>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+    <el-table v-loading="loading" :data="tableData" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" />
+      <el-table-column label="盲票ID" prop="boxId" width="80" />
+      <el-table-column label="盲票图片" prop="picUrl" align="center" width="80">
+        <template slot-scope="{row}">
+          <a target="_black" v-if="row.picUrl && row.picUrl.split(',').length > 0" :href="`${IMG_URL + row.picUrl}`"><img :src="`${IMG_URL + row.picUrl.split(',')[0]}`" style="max-height: 37px;max-width: 54px"></a>
+          <span v-else>-</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="盲票名称" prop="title" />
+      <el-table-column label="盲票面值" prop="facePrice" />
+      <el-table-column label="盲票类型" prop="type">
+        <template slot-scope="{row}">
+          {{ JSON.parse(row.type).desc }}
+        </template>
+      </el-table-column>
+      <el-table-column label="盲票状态" prop="status">
+        <template slot-scope="{row}">
+          <el-tag :type="JSON.parse(row.status).value === 'on' ? 'success' : 'info'">{{ JSON.parse(row.status).desc }}</el-tag>
+        </template>
+      </el-table-column>
+    </el-table>
+    <pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList()" />
+    <span slot="footer">
+      <el-button type="info" plain @click="selectShow = false">取消</el-button>
+      <el-button type="primary" @click="update">确定</el-button>
+    </span>
+  </el-dialog>
+</template>
+<script>
+import { getTicketList } from "@/api/business/ticket"
+import { publicFileGetUrl } from "@/api/common"
+export default {
+  name: "SelectTicket",
+  props: {
+    value: {
+      type: Array,
+      default: []
+    }
+  },
+  data() {
+    return {
+      IMG_URL: publicFileGetUrl,
+      loading: false,
+      selectShow: false,
+      tableData: [],
+      queryParams: {},
+      total: 0,
+      selection: []
+    }
+  },
+  methods: {
+    show() {
+      this.getList(true)
+      this.selectShow = true
+      this.selection = this.value
+      // this.$refs.table.toggleRowSelection(this.selection)
+    },
+    getList(reset) {
+      if (this.loading) {
+        return
+      }
+      this.loading = true
+      if (reset) {
+        this.queryParams = { pageNum: 1, pageSize: 20 }
+      }
+      getTicketList('pageNum='+this.queryParams.pageNum + '&pageSize='+this.queryParams.pageSize+'&', this.queryParams).then(res => {
+        this.loading = false
+        if (res.code === 0) {
+          this.tableData = res.rows
+          
+          this.total = res.total
+        }
+      }).catch(() => {
+        this.loading = false
+      })
+    },
+    handleSelectionChange(val) {
+      this.selection = val
+    },
+    update() {
+      this.$emit('input', this.selection)
+      this.selectShow = false
+    }
+  }
+}
+</script>

+ 30 - 17
src/views/business/coupon/index.vue

@@ -1,18 +1,27 @@
 <template>
   <div class="app-container coupon-list">
     <el-form v-show="showSearch" :model="queryParams" ref="queryForm" :inline="true" size="small">
-      <el-form-item label="优惠券名称" prop="title">
+      <el-form-item label="券名称">
         <el-input
           v-model="queryParams.title"
-          placeholder="请输入优惠券名称"
+          placeholder="请输入券名称"
           clearable
           @keyup.enter.native="queryParams.pageNum = 1;getList()"
         />
       </el-form-item>
-      <el-form-item label="状态" prop="status">
-        <el-select v-model="queryParams.status" placeholder="请选择优惠券状态" clearable>
-          <el-option label="上架" value="on" />
-          <el-option label="下架" value="off" />
+      <el-form-item label="使用场景">
+        <el-select v-model="queryParams.type" placeholder="请选择券状态" clearable>
+          <el-option label="全部" value="" />
+          <el-option label="盲票购买" :value="1" />
+          <el-option label="门店消费" :value="2" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="状态">
+        <el-select v-model="queryParams.status" placeholder="请选择券状态" clearable>
+          <el-option label="全部" value="" />
+          <el-option label="待上架" value="init" />
+          <el-option label="已上架" value="on" />
+          <el-option label="已下架" value="off" />
         </el-select>
       </el-form-item>
       <el-form-item>
@@ -28,22 +37,25 @@
           size="mini"
           @click="$router.push('/coupon/add')"
           v-hasPermi="['business:coupon:add']"
-        >添加门店优惠券</el-button>
+        >添加券</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
     <el-table v-loading="loading" :data="tableData">
-      <el-table-column label="优惠券ID" prop="couponId" width="80" />
-      <el-table-column label="优惠券名称" prop="title" />
-      <el-table-column label="优惠券金额" prop="discount" />
-      <el-table-column label="优惠券类型" prop="type">
+      <el-table-column label="券ID" prop="couponId" width="80" />
+      <el-table-column label="券名称" prop="title" />
+      <el-table-column label="券金额" prop="discount" />
+      <el-table-column label="券类型" prop="type">
         <template slot-scope="{row}">
-          <span v-if="row.type === 1">门店消费</span>
-          <span v-if="row.type === 2">盲票购买</span>
+          {{ JSON.parse(row.type).desc }}
         </template>
       </el-table-column>
       <el-table-column label="已领取数量" prop="quantity" />
-      <el-table-column label="有效期限(天)" prop="dueDays" />
+      <el-table-column label="有效期限(天)" prop="dueDays">
+        <template slot-scope="{row}">
+          领取后{{ row.dueDays }}天内有效
+        </template>
+      </el-table-column>
       <el-table-column label="状态" prop="status">
         <template slot-scope="{row}">
           <el-tag :type="JSON.parse(row.status).value === 'on' ? 'success' : 'info'">{{ JSON.parse(row.status).desc }}</el-tag>
@@ -51,7 +63,8 @@
       </el-table-column>
       <el-table-column fixed="right" align="right" label="操作" width="150">
         <template slot-scope="{row}">
-          <el-button v-hasPermi="['business:coupon:edit']" type="text" @click="$router.push('/coupon/edit?id=' + row.couponId)">编辑</el-button>
+          <el-button v-hasPermi="['business:coupon:query']" type="text" @click="$router.push('/coupon/view?id=' + row.couponId)">查看</el-button>
+          <el-button v-if="JSON.parse(row.status).value === 'init'" v-hasPermi="['business:coupon:edit']" type="text" @click="$router.push('/coupon/edit?id=' + row.couponId)">编辑</el-button>
           <el-button v-if="JSON.parse(row.status).value === 'off'" v-hasPermi="['business:coupon:on']" type="text" @click="setStatus(row, 'on')">上架</el-button>
           <el-button v-if="JSON.parse(row.status).value === 'on'" v-hasPermi="['business:coupon:off']" type="text" @click="setStatus(row, 'off')">下架</el-button>
           <el-button v-if="JSON.parse(row.status).value === 'off'" v-hasPermi="['business:coupon:remove']" class="del" type="text" @click="del(row)">删除</el-button>
@@ -97,7 +110,7 @@ export default {
       })
     },
     setStatus(item, status) {
-      this.$confirm(`确认${status === 'on' ? '上架' : '下架'}代金券 “${item.title}” 吗?`, `${status === 'on' ? '上架' : '下架'}代金券`, {
+      this.$confirm(`确认${status === 'on' ? '上架' : '下架'}券 “${item.title}” 吗?`, `${status === 'on' ? '上架' : '下架'}券`, {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
@@ -114,7 +127,7 @@ export default {
       })
     },
     del(item) {
-      this.$confirm(`确认删除代金券 “${item.title}” 吗?`, '删除代金券', {
+      this.$confirm(`确认删除券 “${item.title}” 吗?`, '删除券', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'

+ 265 - 147
src/views/business/salesite/components/Create.vue

@@ -18,53 +18,44 @@
     >
     <flexbox class="ygp-form-items" align="flex-start" justify="flex-start">
       <el-form-item label="经销商名称" prop="colAddress" style="width: 50%;">
-        <el-input v-model="form.colAddress" placeholder="请输入采集器编号" v-if="!editId" />
-        <span v-else :class="loading?'el-icon-loading':''">{{detail.colAddress}}</span>
+        <el-input v-model="form.name" placeholder="请输入经销商名称" />
       </el-form-item>
-       <el-form-item label="手机号码" prop="colAddress" style="width: 50%;">
-         <el-input v-model="form.colAddress" placeholder="请输入采集器编号" v-if="!editId" />
-         <span v-else :class="loading?'el-icon-loading':''">{{detail.colAddress}}</span>
+       <el-form-item label="手机号码" prop="mobile" style="width: 50%;">
+         <el-input v-model="form.mobile" placeholder="请输入采集器编号"/>
        </el-form-item>
     </flexbox>
       <flexbox class="ygp-form-items" align="flex-start" justify="flex-start">
-        <el-form-item label="上级渠道" prop="custId" style="width: 50%;">
+        <el-form-item label="上级渠道" prop="parentId" style="width: 50%;">
           <el-select
-            v-if="!editId"
-            v-model="form.custId"
-            placeholder="请选择客户"
+            v-model="form.parentId"
+            placeholder="请选择上级渠道"
             style="width: 100%;"
             filterable
             clearable
-            @change="getCustStoreItem"
           >
             <el-option
-              v-for="(item, index) in custOptions"
+              v-for="(item, index) in channelList"
               :key="index"
               :label="item.name"
-              :value="item.custId"
+              :value="item.channelId"
             />
           </el-select>
-          <span v-else :class="loading?'el-icon-loading':''">{{detail.customer && detail.customer.name}}</span>
         </el-form-item>
-       <el-form-item label="联系人" prop="colAddress" style="width: 50%;">
-         <el-input v-model="form.colAddress" placeholder="请输入采集器编号" v-if="!editId" />
-         <span v-else :class="loading?'el-icon-loading':''">{{detail.colAddress}}</span>
+       <el-form-item label="联系人" prop="contact" style="width: 50%;">
+         <el-input v-model="form.contact" placeholder="请输入联系人" />
        </el-form-item>
       </flexbox>
       <flexbox class="ygp-form-items" align="flex-start" justify="flex-start">
-        <el-form-item label="佣金比例" prop="colAddress" style="width: 50%;">
-          <el-input v-model="form.colAddress" placeholder="请输入采集器编号" v-if="!editId" />
-          <span v-else :class="loading?'el-icon-loading':''">{{detail.colAddress}}</span>
+        <el-form-item label="佣金比例" prop="commRate" style="width: 50%;">
+          <el-input v-model="form.commRate" placeholder="请输入佣金比例" />
         </el-form-item>
-        <el-form-item label="经销商类型" prop="typeId" style="width: 50%;">
+        <el-form-item label="门店类型" prop="siteType" style="width: 50%;">
           <el-select
-            v-if="!editId"
-            v-model="form.typeId"
-            placeholder="请选择类型"
+            v-model="form.siteType"
+            placeholder="请选择门店类型"
             style="width: 100%;"
             filterable
             clearable
-            :disabled="editId?true:false"
           >
             <el-option
               v-for="(item, index) in typeOptions"
@@ -73,89 +64,105 @@
               :value="item.typeId"
             />
           </el-select>
-          <span v-else :class="loading?'el-icon-loading':''">{{detail.typeId && detail.typeId.desc}}</span>
         </el-form-item>
       </flexbox>
-
       <flexbox class="ygp-form-items" align="flex-start" justify="flex-start">
-        <el-form-item label="地区" style="width: 50%;">
-          <el-select v-model="form.status" placeholder="选择省份" clearable size="small" style="width: 33%;margin-right: 1px;">
+       <el-form-item label="门店名称" prop="siteName" style="width: 100%;">
+         <el-input v-model="form.siteName" placeholder="例如xxxx店, 对用户可见" />
+       </el-form-item>
+      </flexbox>
+      <flexbox class="ygp-form-items" align="flex-start" justify="flex-start">
+        <el-form-item label="省" prop="provinceId" style="width: 30%;">
+          <el-select
+            v-model="form.provinceId"
+            placeholder="选择省份"
+            clearable
+            size="small"
+            @change="getCityList()"
+            style="width: 100%;margin-right: 1px;">
             <el-option
-              v-for="dict in statusOptions"
-              :key="dict.dictValue"
-              :label="dict.dictLabel"
-              :value="dict.dictValue"
+              v-for="item in provinceList"
+              :key="item.areaId"
+              :label="item.areaName"
+              :value="item.areaId"
             />
           </el-select>
-          <el-select v-model="form.status" placeholder="选择市" clearable size="small" style="width: 33%;margin-right: 1px;">
+
+        </el-form-item>
+        <el-form-item label="市" prop="cityId" style="width: 30%;">
+          <el-select
+            v-model="form.cityId"
+            placeholder="选择市"
+            clearable
+            size="small"
+             @change="getAreaList()"
+            style="width: 100%;margin-right: 1px;">
             <el-option
-              v-for="dict in statusOptions"
-              :key="dict.dictValue"
-              :label="dict.dictLabel"
-              :value="dict.dictValue"
+              v-for="item in cityList"
+              :key="item.areaId"
+              :label="item.areaName"
+              :value="item.areaId"
             />
           </el-select>
-          <el-select v-model="form.status" placeholder="选择区" clearable size="small" style="width: 33%;margin-right: 1px;">
+        </el-form-item>
+        <el-form-item label="区" prop="areaId" style="width: 30%;" >
+          <el-select v-model="form.areaId"
+            placeholder="选择区"
+            clearable
+            size="small"
+            @change="getAreaName()"
+            style="width: 100%;margin-right: 1px;">
             <el-option
-              v-for="dict in statusOptions"
-              :key="dict.dictValue"
-              :label="dict.dictLabel"
-              :value="dict.dictValue"
+              v-for="item in areaList"
+              :key="item.areaId"
+              :label="item.areaName"
+              :value="item.areaId"
             />
           </el-select>
         </el-form-item>
-        <el-form-item label="详细地址" prop="colAddress" style="width: 50%;">
-          <el-input v-model="form.colAddress" placeholder="请输入采集器编号" v-if="!editId" />
-          <span v-else :class="loading?'el-icon-loading':''">{{detail.colAddress}}</span>
-        </el-form-item>
       </flexbox>
       <flexbox
           class="ygp-form-items"
           align="flex-start"
           justify="flex-start">
-         <el-form-item label="营业执照" prop="rentContract" style="width: 50%;">
+          <el-form-item label="详细地址" prop="adress" style="width: 100%;">
+            <el-input v-model="form.adress" placeholder="请输入详细地址" />
+          </el-form-item>
+      </flexbox>
+      <flexbox
+          class="ygp-form-items"
+          align="flex-start"
+          justify="flex-start">
+         <el-form-item label="营业执照" prop="bizLicensePic" style="width: 50%;">
           <image-upload
-            :limit="7"
-            :value="rentContract"
+            :limit="1"
+            :value="form.bizLicensePic"
             :file-size="50"
             :is-public="false"
             :show-file-list="true"
-            :auto-upload="false"
-             @input="rentContractSelect"
+             @input="bizLicensePicSelect"
           />
+
          </el-form-item>
-         <el-form-item label="门头照片" prop="rentContract" style="width: 50%;">
+
+         <el-form-item label="门头照片" prop="doorPic" style="width: 50%;">
           <image-upload
-            :limit="7"
-            :value="rentContract"
+            :limit="1"
+            :value="form.doorPic"
             :file-size="50"
-            :is-public="false"
+            :is-public="true"
             :show-file-list="true"
-            :auto-upload="false"
-             @input="rentContractSelect"
+             @input="doorPicSelect"
           />
+
          </el-form-item>
+
       </flexbox>
       <flexbox class="ygp-form-items" align="flex-start" justify="flex-start">
-         <el-form-item label="认证状态" prop="colAddress" style="width: 50%;">
-           <el-input v-model="form.colAddress" placeholder="请输入采集器编号" v-if="!editId" />
-           <span v-else :class="loading?'el-icon-loading':''">{{detail.colAddress}}</span>
+         <el-form-item label="认证状态" prop="certifyStatus" style="width: 50%;">
+          <el-checkbox v-model="form.certifyStatus">已认证</el-checkbox>
          </el-form-item>
       </flexbox>
-     <!-- <flexbox class="ygp-form-items" align="flex-start" justify="flex-start">
-        <el-form-item label="备注" prop="label" style="width: 100%;">
-          <el-input
-            type="textarea"
-            :rows="3"
-            :autosize="{ minRows: 3}"
-            :maxlength="64"
-            show-word-limit
-            resize="none"
-            v-model="form.label"
-            placeholder="请输入备注"
-          />
-        </el-form-item>
-      </flexbox> -->
     </el-form>
     <div slot="footer" class="dialog-footer">
       <el-button @click="close">取 消</el-button>
@@ -164,18 +171,11 @@
   </el-dialog>
 </template>
 <script>
+import { addSaleSite, updateSaleSite, getSaleSiteDetail} from "@/api/admin/salesite";
+import { listAllChannel} from "@/api/admin/channel";
+import { listAreaByPid} from "@/api/admin/area";
 import { mapGetters } from "vuex";
-import CustomFieldsMixin from "@/mixins/CustomFields";
-// import {
-//   getCollector,
-//   addCollector,
-//   updateCollector,
-//   itemTypes
-// } from "@/api/business/collector";
-// import { itemCustomer } from "@/api/business/customer";
-// import { itemStore } from "@/api/business/store";
 export default {
-  mixins: [CustomFieldsMixin],
   props: {
     dialogVisible: {
       type: Boolean,
@@ -186,27 +186,66 @@ export default {
 
   data() {
     return {
+      IMG_URL: process.env.VUE_APP_IMG_URL,
       loading: false,
+      // 上级渠道列表
+      channelList:[],
+      channelCopyList:[],
+      provinceList:[],
+      cityList:[],
+      areaList:[],
       statusOptions: [],
+      typeOptions:[],
       // 表单参数
-      form: {},
+      form: {
+        name:"",
+        mobile:"",
+        contact:"",
+        commRate:"",
+        provinceId:"",
+        cityId:"",
+        areaId:"",
+        province:"",
+        city:"",
+        area:""
+      },
       detail: {},
-      feeItems: [],
-      checkedItems: [],
-      custOptions: [],
-      storeOptions: [],
-      typeOptions: [],
       // 表单校验
       rules: {
-        custId: [{ required: true, message: "请选择客户", trigger: "change" }],
-        storeId: [{ required: true, message: "请选择门店", trigger: "change" }],
-        colAddress: [
-          { required: true, message: "请输入采集器编号", trigger: "blur" }
+        name: [
+          { required: true, message: "请输入渠道名称", trigger: "blur" }
+        ],
+        mobile: [
+          { required: true, message: "请输入手机号码", trigger: "blur" },
+          {pattern: /^((\+?86)|(\(\+86\)))?1\d{10}$/, message: "请输入正确的手机号码", trigger: "blur" }
         ],
-        typeId: [
-          { required: true, message: "请选择设备类型", trigger: "change" }
+        parentId: [{ required: true, message: "请选择上级渠道", trigger: "change" }],
+        contact: [
+          { required: true, message: "请输入联系人", trigger: "blur" }
         ],
-        label: [{ required: false, message: "请输入备注", trigger: "blur" }]
+        commRate: [
+          { required: true, message: "请输入佣金比例", trigger: "blur" },
+          { pattern: /^(([1-9]{1}\d{0,99}))(\.\d{1,2})?$/, message: "佣金比例只能为大于0的数字", trigger:['blur', 'change'] },
+        ],
+        siteType: [
+          { required: true, message: "请选择门店类型", trigger: "change" }
+        ],
+        siteName: [
+          { required: true, message: "请输入门店名称", trigger: "blur" }
+        ],
+        provinceId: [{ required: true, message: "请选择省", trigger: "change" }],
+        cityId: [{ required: true, message: "请选择市", trigger: "change" }],
+        areaId: [{ required: true, message: "请选择区", trigger: "change" }],
+        address: [
+          { required: true, message: "请输入详细地址", trigger: "blur" }
+        ],
+        bizLicensePic: [
+          { required: true, message: "请选择营业执照", trigger: "blur" }
+        ],
+        doorPic: [
+          { required: true, message: "请选择门头照片", trigger: "blur" }
+        ],
+
       },
       //招商推广宣传图
       picture: []
@@ -226,8 +265,12 @@ export default {
     //console.log("watch dialogVisible created == ");
     // 是编辑
     if (this.editId) {
-     // this.getDetail();
+       this.getDetail();
+    }else{
+       this.getProvinceList()
     }
+    this.getChannelList()
+
   },
 
   mounted() {
@@ -242,70 +285,145 @@ export default {
   },
 
   methods: {
-    // /** 查询可分配的门店 */
-    getCustItems() {
-      this.custOptions = [];
-      itemCustomer({})
-        .then(res => {
-          const resData = res.data || [];
-          this.custOptions = resData;
+
+    // 获取上级渠道下拉列表
+    getChannelList(){
+      listAllChannel().then(response => {
+        // console.log("getChannelList == "+ JSON.stringify(response.data))
+         this.channelList = this.channelList.concat(response.data || []);
+         this.channelCopyList = this.channelList;
+      });
+    },
+
+
+    // 添加营业执照
+    bizLicensePicSelect(data) {
+      this.form.bizLicensePic = data
+      console.log("bizLicensePicSelect 添加营业执照 data = "+JSON.stringify(data))
+    },
+
+    // 添加门头照片
+    doorPicSelect(data) {
+      this.form.doorPic = data
+      console.log("doorPicSelect 添加门头照片 data = "+JSON.stringify(data))
+    },
+
+    // 省
+    getProvinceList(){
+      this.cityList = []
+      this.areaList = []
+      this.form.cityId = ""
+      this.form.city = ""
+      this.form.areaId = ""
+      this.form.area = ""
+      listAreaByPid(0).then(response => {
+        // console.log("getProvinceList"+JSON.stringify(response))
+         console.log("getProvinceList this.form=="+JSON.stringify(this.form))
+         this.provinceList = response || [];
+          console.log("this.editId && this.form.provinceId == "+(this.editId && this.form.provinceId))
+         if(this.editId && this.detail.provinceId){
+            this.form.provinceId = this.detail.provinceId
+            this.getCityList()
+         }
+      });
+    },
+
+    getProvinceName(){
+      let val = this.form.provinceId
+      if(val){
+        let nameObj = this.provinceList.find(item => {
+              return item.areaId == val;
         })
-        .catch(() => {
-          this.loading = false;
-        });
+        return nameObj && nameObj.areaName
+      }
+      return ""
+    },
+
+
+    getCityList(){
+      this.cityList = []
+      this.areaList = []
+      this.form.cityId = ""
+      this.form.city = ""
+      this.form.areaId = ""
+      this.form.area = ""
+      var provinceId = this.form.provinceId
+      this.form.province = this.getProvinceName()
+      listAreaByPid(provinceId).then(response => {
+         this.cityList = response || [];
+         if(this.editId && this.detail.cityId){
+            this.form.cityId = this.detail.cityId
+            this.getAreaList()
+         }
+      });
+
     },
 
-    // /** 查询可分配的门店 */
-    getCustStoreItem() {
-      this.storeOptions = [];
-      this.$set(this.form, "storeId", "");
-      itemStore({
-        custId: this.form.custId
-      })
-        .then(res => {
-          const resData = res.data || [];
-          this.storeOptions = resData;
+    getCityName(){
+      let val = this.form.cityId
+      if(val){
+        let nameObj = this.cityList.find(item => {
+              return item.areaId == val;
         })
-        .catch(() => {
-          this.loading = false;
-        });
+        return nameObj && nameObj.areaName
+      }
+      return ""
+    },
+
+    getAreaList(){
+      var cityId = this.form.cityId
+      this.form.city = this.getCityName();
+      listAreaByPid(cityId).then(response => {
+        // console.log("getAreaList"+JSON.stringify(response))
+         this.areaList = response || [];
+         if(this.editId && this.detail.areaId){
+            this.form.areaId = this.detail.areaId
+         }
+      });
     },
 
-    // /** 查询可分配的门店 */
-    getTypeItems() {
-      this.typeOptions = [];
-      itemTypes({})
-        .then(res => {
-          const resData = res.data || [];
-          this.typeOptions = resData;
+    getAreaName(){
+      let val = this.form.areaId
+      if(val){
+        let nameObj = this.areaList.find(item => {
+              return item.areaId == val;
         })
-        .catch(() => {
-          this.loading = false;
-        });
+        this.form.area = nameObj && nameObj.areaName
+      }else{
+        this.form.area = "";
+      }
     },
 
+    dataFilter(val) {
+      this.value = val;
+      if (val) { //val存在
+        this.channelList = this.channelCopyList.filter((item) => {
+          // console.log("dataFilter item"+JSON.stringify(item))
+          if (!!~item.mobile.indexOf(val) || !!~item.mobile.toUpperCase().indexOf(val.toUpperCase())) {
+             return true
+          }
+        })
+      } else { //val为空时,还原数组
+        this.channelList = this.channelCopyList;
+      }
+    },
+
+
     /**
      * 获取项目详情
      */
     getDetail() {
       this.loading = true;
-      getCollector({
-        colDeviceId: this.editId
-      }).then(res => {
+      getSaleSiteDetail(this.editId).then(res => {
           const data = res.data || {}
           // console.log("getDetail :" + JSON.stringify(data))
           this.detail = data
-          this.$set(this.form,'custId', data.custId)
-          this.$set(this.form,'storeId', data.storeId)
-          this.$set(this.form,'colAddress', data.colAddress)
-          const deviceCategory = JSON.parse(data.typeId || {})
-          this.detail.typeId = deviceCategory
-          this.$set(this.form,'typeId', deviceCategory.value)
-          this.$set(this.form,'label', data.label)
+          this.form.name = data.name
+          this.form.mobile = data.mobile
+          this.form.contact = data.contact
+          this.form.commRate = data.commRate
           this.loading = false
-          // if(this.editId){
-          //   this.getCustStoreItem()
-          // }
+          this.getProvinceList()
         })
         .catch(() => {
           this.loading = false;
@@ -333,11 +451,11 @@ export default {
      * 保存
      */
     submitForm(params) {
-      // console.log("submitForm =============")
+      //  console.log("submitForm =============")
       if (this.editId) {
-        params.colDeviceId = this.editId;
+        params.channelId = this.editId;
       }
-      const request = this.editId ? updateCollector : addCollector
+      const request = this.editId ? updateSaleSite : addSaleSite
       // console.log("submitForm params = "+ JSON.stringify(params))
       request(params).then(response => {
         this.loading = false

+ 113 - 39
src/views/business/salesite/components/Detail.vue

@@ -7,37 +7,120 @@
     :before-close="close"
     :destroy-on-close="true"
     :close-on-click-modal="false">
-   <el-form ref="form" :model="form" label-width="120px" label-position="top" style="max-height: 375px;overflow: auto;">
+   <el-form ref="form" label-width="120px" label-position="top" >
      <flexbox
          class="ygp-form-items"
          align="flex-start"
          justify="flex-start">
-        <el-form-item label="运营企业" prop="custId" style="width: 50%;" >
-          <span :class="loading?'el-icon-loading':''">{{detail.customer && detail.customer.name}}</span>
+        <el-form-item label="经销商名称" style="width: 50%; margin-bottom:5px;" >
+          <span :class="loading?'el-icon-loading':''"></span>
+          {{detail.name}}
         </el-form-item>
-         <el-form-item label="门店" prop="storeId" style="width: 50%;" >
-            <span :class="loading?'el-icon-loading':''">{{detail.store && detail.store.name}}</span>
+         <el-form-item label="手机号码" style="width: 50%; margin-bottom:5px;" >
+            <span :class="loading?'el-icon-loading':''"></span>
+            {{detail.mobile}}
          </el-form-item>
      </flexbox>
      <flexbox
          class="ygp-form-items"
          align="flex-start"
          justify="flex-start">
-         <el-form-item label="采集器编号" prop="colAddress" style="width: 50%;">
-             <span :class="loading?'el-icon-loading':''">{{detail.colAddress}}</span>
+         <el-form-item label="上级渠道" style="width: 50%;margin-bottom:5px;" >
+           <span :class="loading?'el-icon-loading':''"></span>
+           {{detail.parentName}}
          </el-form-item>
-         <el-form-item label="类型" prop="typeId" style="width: 50%;">
-           <span :class="loading?'el-icon-loading':''">{{detail.typeId && detail.typeId.desc}}</span>
+         <el-form-item label="联系人" style="width: 50%;margin-bottom:5px;" >
+           <span :class="loading?'el-icon-loading':''"></span>
+           {{detail.contact}}
          </el-form-item>
      </flexbox>
      <flexbox
-          class="ygp-form-items"
-          align="flex-start"
-          justify="flex-start">
-         <el-form-item label="备注" prop="label" style="width: 100%;">
-            <span :class="loading?'el-icon-loading':''">{{detail.label}}</span>
+         class="ygp-form-items"
+         align="flex-start"
+         justify="flex-start">
+          <el-form-item label="佣金比例" style="width: 50%;margin-bottom:5px;" >
+             <span :class="loading?'el-icon-loading':''"></span>
+             {{detail.commRate}}%
+          </el-form-item>
+          <el-form-item label="门店类型" style="width: 50%;margin-bottom:5px;" >
+            <span :class="loading?'el-icon-loading':''"></span>
+            <span v-if="detail.siteType">{{detail.siteType && JSON.parse(detail.siteType).desc}}</span>
+            <span v-else>--</span>
+          </el-form-item>
+     </flexbox>
+     <flexbox
+         class="ygp-form-items"
+         align="flex-start"
+         justify="flex-start">
+          <el-form-item label="门店名称" style="width: 50%;margin-bottom:5px;" >
+             <span :class="loading?'el-icon-loading':''"></span>
+             <span v-if="detail.siteName">{{detail.siteName}}</span>
+             <span v-else>--</span>
+          </el-form-item>
+     </flexbox>
+     <flexbox
+         class="ygp-form-items"
+         align="flex-start"
+         justify="flex-start">
+         <el-form-item label="所在地区" style="width: 50%;margin-bottom:5px;" >
+           <span :class="loading?'el-icon-loading':''"></span>
+           {{detail.province}} {{detail.city}} {{detail.area}}
+         </el-form-item>
+          <el-form-item label="详细地址" style="width: 50%;margin-bottom:5px;" >
+             <span :class="loading?'el-icon-loading':''"> </span>
+             <span v-if="detail.address">{{ detail.address }}</span>
+             <span v-else>--</span>
+          </el-form-item>
+     </flexbox>
+     <flexbox
+         class="ygp-form-items"
+         align="flex-start"
+         justify="flex-start">
+         <el-form-item label="认证状态" style="width: 100%;margin-bottom:5px;" >
+           <span :class="loading?'el-icon-loading':''"></span>
+           {{detail.certifyStatus && JSON.parse(detail.certifyStatus).desc}}
+         </el-form-item>
+     </flexbox>
+     <flexbox
+         class="ygp-form-items"
+         align="flex-start"
+         justify="flex-start">
+         <el-form-item label="营业执照" style="width: 50%;margin-bottom:5px;" >
+           <span :class="loading?'el-icon-loading':''"></span>
+            <a target="_black" v-if="detail.bizLicensePic" :href="`${IMG_URL + detail.bizLicensePic}`"><img :src="`${IMG_URL + detail.bizLicensePic}`" style="max-height: 37px;max-width: 54px"></a>
+            <span v-else>无</span>
          </el-form-item>
-      </flexbox>
+          <el-form-item label="门头照片" style="width: 50%;margin-bottom:5px;" >
+             <span :class="loading?'el-icon-loading':''"> </span>
+            <a target="_black" v-if="detail.doorPic" :href="`${IMG_URL + detail.doorPic}`"><img :src="`${IMG_URL + detail.doorPic}`" style="max-height: 37px;max-width: 54px"></a>
+            <span v-else>无</span>
+          </el-form-item>
+     </flexbox>
+      <el-divider></el-divider>
+     <flexbox
+         class="ygp-form-items"
+         align="flex-start"
+         justify="flex-start">
+          <el-form-item label="用户数" style="width: 50%;margin-bottom:5px;" >
+             <span :class="loading?'el-icon-loading':''"></span>
+             {{detail.userCnt}}
+          </el-form-item>
+          <el-form-item label="订单数" style="width: 50%;margin-bottom:5px;" >
+            <span :class="loading?'el-icon-loading':''"> </span>
+            {{detail.operData && detail.operData.orderCnt}}
+          </el-form-item>
+     </flexbox>
+     <flexbox
+         class="ygp-form-items"
+         align="flex-start"
+         justify="flex-start">
+          <el-form-item label="营业额" style="width: 50%;margin-bottom:5px;" >
+             <span :class="loading?'el-icon-loading':''"></span>{{detail.operData &&detail.operData.saleAmt}}
+          </el-form-item>
+          <el-form-item label="佣金" style="width: 50%;margin-bottom:5px;" >
+            <span :class="loading?'el-icon-loading':''">{{detail.operData && detail.operData.commAmt}} </span>
+          </el-form-item>
+     </flexbox>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="close">关 闭</el-button>
@@ -47,10 +130,8 @@
 <script>
 
 import { mapGetters } from 'vuex'
-import CustomFieldsMixin from '@/mixins/CustomFields'
-// import { getCollector } from "@/api/business/collector";
+import { getSaleSiteDetail} from "@/api/admin/salesite";
 export default {
-  mixins: [CustomFieldsMixin],
   props: {
     dialogVisible: {
       type: Boolean,
@@ -61,9 +142,9 @@ export default {
 
   data() {
     return {
+      IMG_URL: process.env.VUE_APP_IMG_URL,
       loading: false,
-      // 表单参数
-      form: {},
+      // 详情数据
       detail: {}
     }
   },
@@ -71,14 +152,14 @@ export default {
   computed: {
     ...mapGetters(['userInfo']),
     title() {
-      return '采集器详情'
+      return '渠道详情'
     }
   },
 
   created() {
     // 是编辑
     if (this.editId) {
-      // this.getDetail()
+      this.getDetail()
     }
   },
 
@@ -100,20 +181,11 @@ export default {
      */
     getDetail() {
       this.loading = true
-      getCollector({
-        colDeviceId: this.editId
-      }).then(res => {
+      getSaleSiteDetail(this.editId).then(res => {
+          this.loading = false
           const data = res.data || {}
-          this.detail = data
           // console.log("getDetail :" + JSON.stringify(data))
-          this.$set(this.form,'custId', data.custId)
-          this.$set(this.form,'storeId', data.storeId)
-          this.$set(this.form,'colAddress', data.colAddress)
-          const deviceCategory = JSON.parse(data.typeId || {})
-          this.detail.typeId = deviceCategory
-          this.$set(this.form,'typeId', deviceCategory.value)
-          this.$set(this.form,'label', data.label)
-          this.loading = false
+          this.detail = data
         })
         .catch(() => {
           this.loading = false
@@ -125,10 +197,6 @@ export default {
      */
     close() {
       this.$emit('close')
-      this.form = {
-        month:3,
-        packageType:'1'
-      }
     }
   }
 }
@@ -178,13 +246,19 @@ export default {
 </style>
 
 <style lang="scss">
+
+.el-dialog__body {
+    padding: 15px 20px;
+}
+
 .ygp-form-items {
    .el-form-item{
      padding: 0 5px;
    }
+
   .el-form-item__label {
     line-height: 1.2;
-    padding-bottom: 8px;
+    padding-bottom: 0px;
     word-break: break-all;
     word-wrap: break-word;
     color: #333;

+ 36 - 49
src/views/business/salesite/index.vue

@@ -90,7 +90,6 @@
           type="primary"
           icon="el-icon-plus"
           size="mini"
-          disabled=""
           @click="handleAdd"
           v-hasPermi="['system:post:add']"
         >添加经销商</el-button>
@@ -100,10 +99,11 @@
 
     <el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange">
      <!-- <el-table-column type="selection" width="55" align="center" /> -->
-      <el-table-column label="经销商ID" prop="channelId" />
-      <el-table-column label="经销商名称" align="center" prop="name" />
+      <el-table-column label="经销商ID" prop="channelId" width="100px"/>
+      <el-table-column label="经销商名称" show-overflow-tooltip align="center" prop="name" max-width="100px" />
       <el-table-column label="手机号码" align="center" prop="mobile" />
       <el-table-column label="佣金比例" align="center" prop="commRate" />
+      <el-table-column label="上级渠道" align="center" prop="parentName" />
       <el-table-column label="用户数" align="center" prop="userCnt" />
       <el-table-column label="认证状态" align="center" prop="certifyStatus" >
         <template slot-scope="{ row, column }">
@@ -122,14 +122,12 @@
           <el-button
             size="mini"
             type="text"
-            disabled
-            @click="handleUpdate(scope.row)"
+            @click="handleDetail(scope.row)"
             v-hasPermi="['admin:salesite:read']"
           >查看</el-button>
           <el-button
             size="mini"
             type="text"
-            disabled
             @click="handleUpdate(scope.row)"
             v-hasPermi="['admin:salesite:edit']"
           >编辑</el-button>
@@ -139,10 +137,8 @@
             @click="handleStatusChange(scope.row)"
             v-hasPermi="['admin:salesite:remove']"
           >
-
-          <span v-if="getValue(scope.row.status) == 1"> 停用</span>
-          <span v-if="getValue(scope.row.status) == 2"> 启用</span>
-
+            <span v-if="getValue(scope.row.status) == 1"> 停用</span>
+            <span v-if="getValue(scope.row.status) == 2"> 启用</span>
           </el-button>
         </template>
       </el-table-column>
@@ -397,6 +393,10 @@ export default {
       this.single = selection.length!=1
       this.multiple = !selection.length
     },
+    handleDetail(row){
+      this.detailShow = true
+      this.editId = row.channelId
+    },
     /** 新增按钮操作 */
     handleAdd() {
        this.createShow = true
@@ -404,49 +404,36 @@ export default {
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
-      this.reset();
-      const postId = row.postId || this.ids
-      getPost(postId).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改岗位";
-      });
+      this.createShow = true
+      this.editId = row.channelId
     },
-    /** 提交按钮 */
-    submitForm: function() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.postId != undefined) {
-            updatePost(this.form).then(response => {
-              this.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addPost(this.form).then(response => {
-              this.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
-      });
+
+    // 保存后的操作
+    submitSuccess(){
+      this.getList();
     },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const postIds = row.postId || this.ids;
-      this.$confirm('是否确认删除名称为"' + row.name + '"的经销商?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(function() {
-          return delPost(postIds);
-        }).then(() => {
-          this.getList();
-          this.msgSuccess("删除成功");
-        }).catch(() => {});
+
+    /**关闭弹窗*/
+    hideDialog(){
+      this.createShow = false
+      this.detailShow = false
     },
 
+    /** 删除按钮操作 */
+    // handleDelete(row) {
+    //   const postIds = row.postId || this.ids;
+    //   this.$confirm('是否确认删除名称为"' + row.name + '"的经销商?', "警告", {
+    //       confirmButtonText: "确定",
+    //       cancelButtonText: "取消",
+    //       type: "warning"
+    //     }).then(function() {
+    //       return delPost(postIds);
+    //     }).then(() => {
+    //       this.getList();
+    //       this.msgSuccess("删除成功");
+    //     }).catch(() => {});
+    // },
+
 
     // 状态修改
     handleStatusChange(row) {

+ 2 - 2
src/views/skip.vue

@@ -7,7 +7,7 @@
         <div>{{ id }}</div>
       </div>
       <div class="skip-btn">
-        <p @click="showWechat()">打开微信</p>
+        <p @click="showWechat()">打开微信小程序</p>
       </div>
     </div>
   </div>
@@ -24,7 +24,7 @@ export default {
   methods: {
     showWechat() {
         
-      window.location.href = "weixin://dl/business/?t=PrgPhLuOEKi";
+      window.location.href = "weixin://dl/business/?t=ngsLEPp3hTi";
     },
   },
   components: {},