Browse Source

Merge branch 'dev1.4.7' into dev1.4.8

liumiaomiao 3 năm trước cách đây
mục cha
commit
1ccc8cc477

+ 3 - 1
README.md

@@ -1,4 +1,6 @@
 ## 剑鱼大会员PC端
+v1.4.7
+营销平台卡券二期
 ##### 无顶部底部开发
 v1.4.8
 呼叫中心数据同步
@@ -14,4 +16,4 @@ v1.4.8
 
     > 文件地址 /src/web/templates/frontRouter/pc/page_big_pc/sess/index.html
 
-3. 访问`/swordfish/docs/index`
+T3. 访问`/swordfish/docs/index`

+ 10 - 0
src/api/modules/home.js

@@ -27,6 +27,16 @@ export function getExportPushList (data) {
   })
 }
 
+export function getExportSelectItems (data) {
+  data = qs.stringify(data)
+  return request({
+    baseURL: '/publicapply',
+    url: '/dataexpoet/bySelects',
+    method: 'post',
+    data: data
+  })
+}
+
 export function getSimpleFollowList (data) {
   data = qs.stringify(data)
   return request({

+ 11 - 0
src/api/modules/svip.js

@@ -51,3 +51,14 @@ export function svipUpgrade (data) {
     data
   })
 }
+
+// 统一下单接口
+export function createCommonOrder (data) {
+  // data = qs.stringify(data)
+  return request({
+    baseURL: '/jypay',
+    url: '/common/createorder',
+    method: 'POST',
+    data
+  })
+}

+ 8 - 1
src/components/article-item/ArticleItem.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="article-item" :class="{'style-for-gray': config.gray, 'style-for-table': config.table }">
-    <input v-if="config.collect" @click.stop class="custom-checkbox title-text-checkbox" name="bid-list" type="checkbox" :dataid="article._id">
+    <input v-if="config.collect" @change="changeCheck" @click.stop class="custom-checkbox title-text-checkbox" name="bid-list" type="checkbox" :dataid="article._id">
     <div class="a-i-left ellipsis visited-hd" @click="onClick" v-html="calcTitle"></div>
     <div class="a-i-right">
       <div class="tags">
@@ -78,6 +78,13 @@ export default {
     onClick() {
       this.$emit('onClick')
     },
+    changeCheck (e) {
+      const resultObj = {
+        id: $(e.target).attr('dataid'),
+        check: $(e.target).prop('checked')
+      }
+      this.$emit('changeCheck', resultObj)
+    },
     collectChange(item, event) {
       this.$emit('onCollect', {
         item: item,

+ 1 - 0
src/components/common/SpecCard.vue

@@ -49,6 +49,7 @@ export default {
   background-color: #f5f6f7;
   border-radius: 8px;
   border: 2px solid transparent;
+  box-sizing: border-box;
   cursor: pointer;
   &.active {
     border-color: #2abed1;

+ 2 - 1
src/components/coupon/BuySubmit.vue

@@ -127,7 +127,7 @@ export default {
 
 <style lang="scss" scoped>
 .buy-submit {
-  padding: 12px 0;
+  padding: 12px 0 40px;
   .price-buy-info-group {
     display: flex;
     flex-direction: row;
@@ -140,6 +140,7 @@ export default {
     align-items: flex-end;
     padding: 22px;
     background-color: #F5F5FB;
+    border-top: 1px solid #E0E0E0;
     .preview-item {
       display: flex;
       align-items: center;

+ 2 - 2
src/components/coupon/CouponCardList.vue

@@ -166,7 +166,7 @@ export default {
       margin: 8px 7px;
       padding: 0;
       width: 240px;
-      height: 108px;
+      // height: 108px;
       &:nth-of-type(4n) {
         margin-right: 0;
       }
@@ -233,7 +233,7 @@ export default {
   padding: 0 18px;
   flex: 1;
   font-size: 12px;
-  line-height: 20px;
+  line-height: 30px;
   background-color: #fff;
   border-bottom-left-radius: 6px;
   border-bottom-right-radius: 6px;

+ 2 - 1
src/components/coupon/SpecList.vue

@@ -80,7 +80,8 @@ export default {
   ::v-deep {
     .spec-card {
       width: 240px;
-      height: 120px;
+      // height: 105px;
+      justify-content: initial;
     }
     .spec-card:not(:last-of-type) {
       margin-right: 16px;

+ 155 - 28
src/components/push-list/PushList.vue

@@ -38,6 +38,7 @@
         :config="config"
         @onCollect="onCollect"
         @onClick="toDetail(item)"
+        @changeCheck="changeCheck"
       />
       <empty v-show="showEmpty">
         <div v-if="isAllFirst && canSubmanager">
@@ -68,7 +69,8 @@
         </tr>
         </thead>
         <tbody>
-        <tr v-for="(item, index) in tableList" :class="{ visited: item.visited }" :key="index + '_' + item._id" @click="toDetail(item)">
+        <tr v-for="(item, index) in tableList" :class="{ visited: item.visited }" :key="index + '_' + item._id"
+            @click="toDetail(item)">
           <td width="48">{{ index + 1 }}</td>
           <td width="315" class="tt-l" v-html="calcTitle(item, index)"></td>
           <td width="84">{{ item.type }}</td>
@@ -127,13 +129,14 @@
 </template>
 
 <script>
-import { Pagination, Card, Button } from 'element-ui'
+import { Button, Card, Pagination } from 'element-ui'
 import Empty from '@/components/common/Empty.vue'
 import ArticleItem from '@/components/article-item/ArticleItem.vue'
-import { getPushList, getExportPushList } from '@/api/modules/'
-import { moneyUnit, dateFromNow, replaceKeyword } from '@/utils/'
+import { getExportPushList, getExportSelectItems, getPushList } from '@/api/modules/'
+import { dateFromNow, moneyUnit, replaceKeyword } from '@/utils/'
 import { mixinVisited } from '@/utils/mixins/visited'
 /* eslint-disable */
+var selectDataIds = []
 export default {
   name: 'push-list',
   mixins: [mixinVisited],
@@ -202,7 +205,8 @@ export default {
         pageSize: 10, // 每页多少条数据
         total: 0, // 一共多少条数据
         list: [] // 查询请求返回的数据
-      }
+      },
+      nowCheckList: [],
     }
   },
   created () {
@@ -223,42 +227,88 @@ export default {
       }
     },
     calcTitle (item) {
-      const { projectName, matchkeys } = item
+      const {
+        projectName,
+        matchkeys
+      } = item
       const hightLightedTitle = replaceKeyword(projectName, matchkeys, ['<span class="highlight-text">', '</span>'])
       return `${hightLightedTitle}`
     },
     async onClickDataExport () {
-      const nowCheckItems = this.getCheckIds(function () {
+      this.getNewData()
+      let nowCheckItems = this.getCheckIds(function () {
         return $(this).attr('dataid')
       })
+      nowCheckItems = selectDataIds
+      let exportDataFlag = ''
       if (nowCheckItems.length) {
-        return location.href = `/front/dataExport/superSearchExport?selectIds=${nowCheckItems.join(',')}`
-      }
-
-      console.log('all')
-      const query = {}
-      if (this.getFilters && Object.keys(this.getFilters).length > 0) {
-        Object.keys(this.getFilters).forEach(v => {
-          if (typeof this.getFilters[v] !== 'undefined') {
-            query[v] = this.getFilters[v]
+        //导出选择(因可以翻页多选,修改为post请求,防止穿参数过长,后跳转)
+        //return location.href = `/front/dataExport/superSearchExport?selectIds=${nowCheckItems.join(',')}`
+        const res = await getExportSelectItems({ selectIds: nowCheckItems.join(',') })
+        if (res.error_code === 0) {
+          exportDataFlag = res.data
+        }
+      } else {
+        //导出筛选条件
+        const query = {}
+        if (this.getFilters && Object.keys(this.getFilters).length > 0) {
+          Object.keys(this.getFilters).forEach(v => {
+            if (typeof this.getFilters[v] !== 'undefined') {
+              query[v] = this.getFilters[v]
+            }
+          })
+        }
+        const res = await getExportPushList(query)
+        if (res.error_code === 0) {
+          if (res.data._id) {
+            exportDataFlag = res.data._id
           }
-        })
+        }
       }
-      const res = await getExportPushList(query)
-      if (res.error_code === 0) {
-        if (res.data._id) {
-          location.href = '/front/dataExport/toCreateOrderPage/' + res.data._id
+      if (exportDataFlag) {
+        window.open('/front/dataExport/toCreateOrderPage/' + exportDataFlag)
+      }
+    },
+    changeCheck (data) {
+      console.log(data)
+      if(selectDataIds.length == 0) {
+        if(data.check) {
+          selectDataIds.push(data.id)
         }
       }
+      selectDataIds.forEach((v, i) => {
+        if(data.check) {
+          if (!this.contains(selectDataIds, data.id)) {
+            selectDataIds.push(data.id)
+          }
+        }
+      })
+      if(!data.check) {
+        selectDataIds.splice($.inArray(data.id,selectDataIds), 1)
+          $('.custom-checkbox.has-top').prop('checked', false)
+      }
     },
     onClickDataCollect () {
-      const nowCheckItems = this.getCheckIds(function () {
-        return {
-          id: $(this).attr('dataid'),
-          index: $(this).index('.info-list .custom-checkbox'),
-          check: $(this).parent().find('.icon-collect.checked').length > 0
+      let _this = this
+      let nowCheckItems = []
+      this.getNewData()
+      $('.custom-checkbox:not(.has-top):checked').each(function(index) {
+        const tempN = $(this).attr('dataid')
+        if (!_this.contains(selectDataIds, tempN)) {
+          selectDataIds.push(tempN)
+        }
+        const haschecked =  $(this).siblings('.a-i-right').find('i').hasClass('checked')
+        if (haschecked) {
+          selectDataIds.splice(index, 1)
         }
       })
+      selectDataIds.forEach((item, index) => {
+        nowCheckItems.push({
+          id: item,
+          index: index,
+          check: $(this).parent().find('.icon-collect.checked').length > 0
+        }) 
+      })
       this.onCollect({
         list: nowCheckItems
       })
@@ -269,6 +319,26 @@ export default {
     changeAllCheck (e) {
       const nowStatus = $(e.target).prop('checked')
       $('.custom-checkbox:not(.has-top)').prop('checked', nowStatus)
+      if(nowStatus) {
+        let pageCheckId = []
+        this.listState.list.forEach((v) => {
+          pageCheckId.push(v._id)
+        })
+        if(selectDataIds.length == 0) {
+          selectDataIds = pageCheckId
+        } else {
+          selectDataIds.concat(pageCheckId)
+        }
+        $.unique(selectDataIds)
+      } else {
+        this.listState.list.forEach((v) => {
+          selectDataIds.forEach((s, index) => {
+            if(v._id == s) {
+              selectDataIds.splice(index, 1)
+            }
+          })
+        })
+      }
     },
     getCheckIds (callback) {
       const arr = []
@@ -297,6 +367,7 @@ export default {
       this.getList(filters)
     },
     async getList (filters) {
+      let _this = this
       const query = {
         pageNum: this.listState.pageNum,
         pageSize: this.listState.pageSize
@@ -348,6 +419,26 @@ export default {
         this.listState.list = res.data || []
         this.$nextTick(() => {
           this.getCollectStatusForList()
+          // 等dataid赋值完成后再获取值
+          var $dom = $('.info-list-card .title-text-checkbox[name="bid-list"]')
+          var selectPageNum = 0
+          $dom.each(function () {
+            // 回显列表选中状态
+            if (!_this.contains(selectDataIds, $(this).attr('dataid'))) {
+              $(this).prop('checked', false)
+            }
+            if (_this.contains(selectDataIds, $(this).attr('dataid'))) {
+              selectPageNum++
+              $(this).prop('checked', true)
+            }
+            // 全选复选框选中/不选中
+            if (!$(this).attr('checked')) {
+              $('.custom-checkbox.has-top').prop('checked', false)
+            }
+            if (selectPageNum >= 10) {
+              $('.custom-checkbox.has-top').prop('checked', true)
+            }
+          })
         })
       } else {
         this.listState.total = 0
@@ -365,10 +456,38 @@ export default {
       )
       window.open(`/article/content/${_id}.html`)
     },
+    getNewData () {
+      const nowCheckItems = this.getCheckIds(function () {
+        return $(this).attr('dataid')
+      })
+      this.nowCheckList = nowCheckItems
+      if(selectDataIds.length === 0) {
+        selectDataIds = nowCheckItems
+      } else {
+        nowCheckItems.forEach((sum, index) => {
+          if (!this.contains(selectDataIds, sum)) {
+            selectDataIds.push(sum)
+          }
+        })
+      }
+    },
     onPageChange (p) {
+      this.getNewData()
       this.listState.pageNum = p
       this.getList()
     },
+    contains(arr, ele) {
+      if(arr.length == 0){
+        return;
+      }
+        var i = arr.length;
+        while (i--) {
+          if (arr[i] == ele) {
+                return true;  
+            }  
+        }  
+        return false;  
+    },
     getMore () {
       this.$emit('getMore')
     },
@@ -416,7 +535,11 @@ export default {
       return collBidAction(baction, binfo, callback)
     },
     onCollect (data) {
-      let { item, event, list } = data
+      let {
+        item,
+        event,
+        list
+      } = data
       let binfo = []
       if (list) {
         binfo = list.filter(v => !v.check).map(v => ({ bid: v.id }))
@@ -447,7 +570,11 @@ export default {
             _this.showTip('收藏成功', 1500)
             if (list) {
               list.filter(v => !v.check).forEach(function (v) {
-                _this.listState.list[v.index].collection = 1
+                _this.nowCheckList.forEach(function(s, i) {
+                  if (s === v.id) {
+                    _this.listState.list[i].collection = 1
+                  }
+                })
               })
               event = {
                 target: $('.info-list .list-item i.icon-collect')

+ 1 - 1
src/views/portrayal/EntPortrayal.vue

@@ -59,7 +59,7 @@
             </div>
             <div :style="{margin: !isConf4 ? '40px 40px 0' : '64px 0 0'}" v-show="showConf13 && !emptyShow">
               <Dynamic-list :key="dynamicKey" :filters="ScreenParams"
-                            :config="{baseParam:{entId: decodeURIComponent(this.$route.params.eId)},isWinner:true}"
+                            :config="{baseParam:{entId: decodeURIComponent(this.$route.params.eId)},isWinner:true,hasPower:showConf13}"
                             style="width: 856px"></Dynamic-list>
             </div>
             <ent-chart @showEmpty="showEmpty"  v-show="!emptyShow" @loadingChart="loadingChart" :params="bidInfoParams"

+ 24 - 30
src/views/portrayal/EntSearchPortrayal.vue

@@ -55,10 +55,10 @@
               <div class="pro_info_tip">数据统计范围:{{ dateRange.start }}-{{ dateRange.end }}</div>
             </div>
             <Dynamic-list :key="dynamicKey" :filters="ScreenParams"
-                          :config="{baseParam:{entId: decodeURIComponent($route.params.eId)},isWinner:true}"
+                          :config="{baseParam:{entId: decodeURIComponent($route.params.eId)},isWinner:true,hasPower:pagePowerInfo.visited||pagePowerInfo.balance>0}"
                           style="width: 856px"></Dynamic-list>
-            <ent-chart @showEmpty="showEmpty" @loadingChart="loadingChart" :params="bidInfoParams"
-                       :active="activeName" v-on:entInfo="getEntInfo"></ent-chart>
+            <ent-chart @showEmpty="showEmpty" @loadingChart="loadingChart" :params="bidInfoParams" :active="activeName"
+                       v-on:entInfo="getEntInfo"></ent-chart>
           </div>
           <div class="ent-vip-upgrade-group" v-else key="tab2" style="margin-top:60px">
             <!-- 占位dom 解决锚点tab有fixed定位 scrollview位置会偏移 同时作为tab1和tab2的间距 -->
@@ -142,7 +142,8 @@ export default {
         provin: 1,
         total: 50,
         usage: 50,
-        visited: false
+        visited: false,
+        balance: 0 // 剩余次数
       },
       powerInfo: {
         entniche: false,
@@ -259,23 +260,15 @@ export default {
         const tempTitle = isMemberText ? '开通大会员' : '超级订阅'
         let tempButton = isMemberText ? '免费体验' : '前往升级'
         if (info.memberStatus > 0) {
-          if (tempPagePowerInfo.total <= tempPagePowerInfo.usage && info.viper) {
-            if (v === '项目动态') {
-              tempButton = '前往升级'
-            } else {
-              tempButton = '联系客服'
-            }
+          if (v === '项目动态') {
+            tempButton = '去开通'
           } else {
-            if (v === '项目动态') {
-              tempButton = '去开通'
-            } else {
-              tempButton = '联系客服'
-            }
+            tempButton = '联系客服'
           }
         } else if (info.vipStatus > 0) {
           if (info.viper) {
             // 新超级订阅
-            if (tempPagePowerInfo.total <= tempPagePowerInfo.usage) {
+            if (tempPagePowerInfo.balance > 0) {
               // 没用完
               if (tempPagePowerInfo.provin === 0) {
                 tempButton = '去开通'
@@ -316,7 +309,7 @@ export default {
     showTab2Content () {
       // 显示tab2
       // 1.开通了超级订阅升级版
-      const hasPower = this.info.viper && (this.powerInfo.vip > 1 && (this.pagePowerInfo.visited || this.pagePowerInfo.usage < this.pagePowerInfo.total))
+      const hasPower = this.info.viper && (this.powerInfo.vip > 1 && (this.pagePowerInfo.visited || this.pagePowerInfo.balance > 0))
       return hasPower || this.hasTrailPower
     },
     hasTrailPower () { // 有此权限,可查看中标分析
@@ -349,23 +342,24 @@ export default {
     }
   },
   created () {
+    var _this = this
     this.getPower()
     this.checkShowExp((res) => {
-      if (res && !(res.vipStatus > 0 || res.memberStatus > 0)) {
+      this.getUserForPagePower().then(() => {
         this.getSelect()
-        getSubVipEntChart({ entId: this.$route.params.eId }).then(res => {
-          if (res && res.data) {
-            if (res.data.onTrial) {
-              this.freeTrialStatus = true
-            }
-            this.getEntInfo(res.data)
-          }
-        })
-      } else {
-        this.getUserForPagePower().then(() => {
+        // 无权限需要再次请求展示基本数据
+        if (res && !((res.vipStatus > 0 && (_this.pagePowerInfo.balance > 0 || _this.pagePowerInfo.visited)))) {
           this.getSelect()
-        })
-      }
+          getSubVipEntChart({ entId: this.$route.params.eId }).then(res => {
+            if (res && res.data) {
+              if (res.data.onTrial) {
+                this.freeTrialStatus = true
+              }
+              this.getEntInfo(res.data)
+            }
+          })
+        }
+      })
     })
   },
   mounted () {

+ 135 - 28
src/views/portrayal/UnitPortrayal.vue

@@ -28,7 +28,7 @@
           <div class="unlock-btn" @click="goUnlock('去解锁')">去解锁>></div>
         </div>
         <div class="supervip-bg" v-if="vipStatusNoMember">
-          <div class="vip-balance">当月采购单位画像余额:<em class="highlight-text">{{ usageInfo.surplus }}</em></div>
+          <div class="vip-balance">当月采购单位画像余额:<em class="highlight-text">{{ usageInfo.balance }}</em></div>
           <div class="update-btn" @click.stop="goUpdate">{{ vipStatusBtn }}</div>
         </div>
       </div>
@@ -76,11 +76,13 @@
         <div class="u-i-tip" v-if="baseShow">数据统计范围:{{ info.start }}-{{ info.end }}</div>
       </div>
       <!-- 招标动态 -->
-      <Dynamic-list :key="dynamicKey"  v-show="!emptyShow" @onClickUnlock="goEmitClick" :noBuyerAuth="noBuyerAuth" :usage="usageInfo"
-                    :config="{baseParam:{buyer: decodeURIComponent(this.$route.params.entName)},isWinner:false}"
+      <Dynamic-list @click="openCheckPop" @vipClick="buyerTipDialog = true" :key="dynamicKey" v-show="!emptyShow"
+                    @onClickUnlock="goEmitClick" :usage="usageInfo"
+                    :config="{baseParam:{buyer: decodeURIComponent(this.$route.params.entName)},isWinner:false,hasPower:!noBuyerAuth}"
                     :filters="bidInfoParams" style="padding: 32px 40px 0;width: 936px"></Dynamic-list>
       <!-- <unit-list :noauth="noBuyerAuth" :usage="usageInfo" :bidparams="bidInfoParams" v-if="unitlistshow" @list="getList" @click="openCheckPop" @onClickUnlock="goEmitClick"></unit-list>-->
-      <unit-chart @isTrial="getIsTrail" @baseInfoBool="baseInfoBool" @showEmpty="showEmpty" :params="bidInfoParams"
+      <unit-chart @getUse="getUse" @isTrial="getIsTrail" @baseInfoBool="baseInfoBool" @showEmpty="showEmpty"
+                  :params="bidInfoParams"
                   v-on:baseInfo="getBaseInfo"></unit-chart>
       <div class="unit-big-upgrade-group" v-if="noBuyerAuth && !emptyShow">
         <MaskCard @click="openBigPage(k, item)" v-for="(item, k) in getBigUpgradeMap"
@@ -94,6 +96,23 @@
         </div>
       </Empty>
     </div>
+    <el-dialog
+      :visible.sync="buyerTipDialog"
+      :show-close="false"
+      title="请选择充值方式"
+      class="buyer-tip-dialog"
+      width="380px"
+      center>
+      <div>
+        <div>升级超级订阅:适合需要订阅更多省份、查看更多采购单位画像及企业画像的用户。</div>
+        <div>充值画像包:适合仅需要查看更多采购单位画像的用户。</div>
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <el-button class="el-btn el-right-btn" @click.stop="goVipUpdate">升级超级订阅</el-button>
+        <el-button class="el-btn el-left-btn" type="primary" @click.stop="goHandle(dialogBtnText)">{{ dialogBtnText }}
+        </el-button>
+      </div>
+    </el-dialog>
     <el-dialog
       class="unit-dialog-group"
       title="联系客服"
@@ -114,7 +133,7 @@ import ContactList from '@/components/contact-info/ContactInfo'
 import MaskCard from '@/components/mask-card/MaskCard.vue'
 import CollectInfo from '@/components/collect-info/CollectInfo.vue'
 import Empty from '@/components/common/Empty'
-import { Dialog } from 'element-ui'
+import { Button, Dialog } from 'element-ui'
 import {
   getBuyerSelect,
   getStatusCustomer,
@@ -143,12 +162,14 @@ export default {
     BidInfoActive,
     DynamicList,
     [Dialog.name]: Dialog,
+    [Button.name]: Button,
     Empty
   },
   data () {
     return {
       isDialogShow: false,
       loading: true,
+      buyerTipDialog: false,
       dynamicKey: new Date().getTime(),//筛选重新渲染动态数据
       info: {
         buyerName: '',
@@ -255,7 +276,7 @@ export default {
         usage: 0,
         provin: 0,
         visited: false,
-        surplus: 0
+        balance: 0, // 剩余次数
       }, // 画像访问量
       freeTrial: false,
       showFreeOpen: false
@@ -296,9 +317,9 @@ export default {
       // 大会员用户有采购单位全景分析权限
       const bigMember = info.memberStatus > 0 && info.power.indexOf(5) !== -1
       // 新超级订阅用户 有采购单位画像余额
-      const svip = info.vipStatus > 0 && info.viper && usage.surplus > 0
+      const svip = info.vipStatus > 0 && info.viper && usage.balance > 0
       // 新超级订阅用户 次数用完 浏览过
-      const svipTrial = info.vipStatus > 0 && info.viper && usage.surplus <= 0 && usage.visited
+      const svipTrial = info.vipStatus > 0 && info.viper && usage.balance <= 0 && usage.visited
       // 免费用户 留过资 免费体验一次
       const freePort = info.isFree && info.freeBuyerPort > 0
       // 免费用户 体验过期 浏览过
@@ -310,10 +331,10 @@ export default {
       const info = this.userInfo
       const usage = this.usageInfo
       const isFreeAuth = info.isFree && info.freeBuyerPort > 0
-      const isVipAuth = info.vipStatus > 0 && info.viper && usage.surplus > 0
+      const isVipAuth = info.vipStatus > 0 && info.viper && usage.balance > 0
       const isMember = info.power.indexOf(5) !== -1
       // 超级订阅用户是否访问过该画像
-      const vipTrial = info.vipStatus > 0 && info.viper && usage.surplus === 0 && usage.visited
+      const vipTrial = info.vipStatus > 0 && info.viper && usage.balance === 0 && usage.visited
       // 免费用户是否查看过该画像
       const freeTrial = info.isFree && info.freeBuyerPort < 0 && this.freeTrial
       // 免费用户无体验次数的、超级订阅用户无剩余次数的、没有大会员浏览权限的 显示遮罩
@@ -339,11 +360,17 @@ export default {
     // 超级订阅余额提醒 对应文案
     vipStatusBtn () {
       let text = ''
-      if (this.usageInfo.provin === -1) {
-        text = '联系客服'
-      } else {
-        text = '前往升级'
-      }
+      // if (this.usageInfo.provin === -1) {
+      //   text = '联系客服'
+      // } else {
+      //   text = '前往升级'
+      // }
+      text = '立即充值'
+      return text
+    },
+    dialogBtnText () {
+      let text = ''
+      text = '充值画像包'
       return text
     },
     getBigUpgradeMap () {
@@ -384,17 +411,25 @@ export default {
         // 大会员用户
         const member = info.memberStatus > 0
         // 新超级订阅用户买的非全国 余额为0
-        const noAllProvinNoCounts = newVip && usage.provin !== -1 && usage.surplus <= 0
+        const noAllProvinNoCounts = newVip && usage.provin !== -1 && usage.balance <= 0
         // 超级订阅新用户 购买的全国 余额为0
-        const allProvinNoCounts = newVip && usage.provin === -1 && usage.surplus <= 0
+        const allProvinNoCounts = newVip && usage.provin === -1 && usage.balance <= 0
         // 无权限的大会员用户
         const noAuthMember = info.memberStatus > 0 && info.power.indexOf(5) === -1
         // 纯商机管理用户
         const entniche = info.entniche && !oldVip && !newVip && !member
         if (oldVip || noAllProvinNoCounts) {
-          btnText = '前往升级'
+          if (oldVip) {
+            btnText = '前往升级'
+          } else {
+            btnText = '立即充值'
+          }
         } else if (allProvinNoCounts || noAuthMember || entniche) {
-          btnText = '联系客服'
+          if (allProvinNoCounts && !noAuthMember) {
+            btnText = '立即充值'
+          } else {
+            btnText = '联系客服'
+          }
         }
       }
       return btnText
@@ -407,7 +442,6 @@ export default {
     this.info.buyerName = decodeURIComponent(this.$route.params.entName)
     // this.getBigUpgradeMap()
     this.getFollowState()
-    this.getBuyerUsage()
     var _this = this
     $.ajax({
       url: '/publicapply/bidcoll/power',
@@ -466,6 +500,10 @@ export default {
     getIsTrail (data) {
       this.freeTrial = data ? data : false
     },
+    // 等待画像接口请求完成再调用usage接口
+    getUse (data) {
+      this.getBuyerUsage()
+    },
     // 采购单位画像访问量查询
     getBuyerUsage () {
       const info = this.userInfo
@@ -479,8 +517,12 @@ export default {
           if (res.data.usage > res.data.total) {
             res.data.usage = res.data.total
           }
-          res.data.surplus = res.data.total - res.data.usage
           this.usageInfo = res.data
+          //未访问过且有余额 则余额减1
+          if (!this.usageInfo.visited && this.usageInfo.balance > 0) {
+            this.usageInfo.balance--
+            this.usageInfo.visited = true
+          }
         }
       })
     },
@@ -515,7 +557,15 @@ export default {
         button: this.shadeBottomBtnText
       })
     },
-
+    goHandle (data) {
+      if (data === '充值画像包') {
+        this.$router.push('/free/filePack/buy?type=1')
+        this.buyerTipDialog = false
+      }
+    },
+    goVipUpdate () {
+      this.$router.push('/free/svip/buy?type=upgrade')
+    },
     openBigPage (k, item) {
       try {
         // eslint-disable-next-line no-undef
@@ -532,6 +582,8 @@ export default {
       } else if (item.button === '联系客服') {
         // this.isDialogShow = true
         $('.help-slide-zx.open-customer').trigger('click')
+      } else if (item.button === '立即充值') {
+        this.goUpdate()
       }
     },
     getList (data) {
@@ -602,13 +654,10 @@ export default {
     },
     goUpdate () {
       if (this.usageInfo.provin === -1) {
-        try {
-          $('.help-slide-zx.open-customer').unbind('click').trigger('click')
-        } catch (e) {
-          console.log(e)
-        }
+        // 充值采购单位画像包
+        this.$router.push('/free/filePack/buy?type=1')
       } else {
-        this.$router.push('/free/svip/buy?type=upgrade')
+        this.buyerTipDialog = true
       }
     }
   }
@@ -955,5 +1004,63 @@ export default {
     transform: translateX(-50%);
     z-index: 9999;
   }
+
+  .buyer-tip-dialog {
+    ::v-deep {
+      .el-btn {
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        padding: 10px 26px;
+        font-size: 16px;
+        color: #fff;
+        background: #2CB7CA;
+        border-radius: 6px;
+        color: #fff;
+        border: 0;
+        cursor: pointer;
+      }
+
+      .el-right-btn {
+        background: #fff;
+        border: 1px solid #E0E0E0;
+        color: #686868;
+      }
+
+      .el-dialog__header {
+        padding: 32px 0 20px;
+      }
+
+      .el-dialog__body {
+        padding: 0 32px 20px;
+        color: #686868;
+        font-size: 14px;
+        line-height: 22px;
+        text-align: justify;
+      }
+
+      .el-button--default,
+      .el-button--default:hover,
+      .el-button--default:focus {
+        width: 132px;
+        height: 36px;
+        text-align: center;
+        background: #fff;
+        border-radius: 6px;
+        font-style: 16px;
+        color: #686868;
+        border: 1px solid #DCDFE6;
+      }
+
+      .el-dialog__footer {
+        padding: 0 32px 32px;
+
+        .dialog-footer {
+          display: flex;
+          justify-content: space-between;
+        }
+      }
+    }
+  }
 }
 </style>

+ 155 - 36
src/views/portrayal/components/DynamicList.vue

@@ -34,10 +34,11 @@
       <portrayal-article-item
         class="list-item"
         :class="{ visited: item.visited }"
-        v-for="(item, index) in listState.list"
-        :key="index"
-        :index="(listState.pageSize * (listState.pageNum - 1)) +  index + 1"
+        v-for="item in listState.list"
+        :key="item.id"
         :article="item"
+        :selected="selected[item.id]"
+        @change="changeCheckInput"
         @onCollect="onCollect"
         @onClick="toDetail(item)"
       />
@@ -58,7 +59,8 @@
         </tr>
         </thead>
         <tbody>
-        <tr v-for="(item, index) in tableList" :class="{ visited: item.visited }" :key="index + '_' + item.id" @click="toDetail(item)">
+        <tr v-for="(item, index) in tableList" :class="{ visited: item.visited }" :key="index + '_' + item.id"
+            @click="toDetail(item)">
           <td width="48">{{ (listState.pageNum - 1) * listState.pageSize + index + 1 }}</td>
           <td width="315" class="tt-l">{{ item.title }}</td>
           <td width="84">{{ item.bidstatus }}</td>
@@ -71,7 +73,8 @@
             }}
           </td>
           <td width="174" class="tt-l winner-column" v-if="!config.isWinner">
-            <a v-for="(w, i) in getWinnerList(item)" :key="i" style="text-decoration:none" v-on:click.stop="goPortrayalDetail(w.id)"><span v-if="i > 0">,</span>
+            <a v-for="(w, i) in getWinnerList(item)" :key="i" style="text-decoration:none"
+               v-on:click.stop="goPortrayalDetail(w.id)"><span v-if="i > 0">,</span>
               {{ w.name }}</a>
           </td>
           <td width="76" class="tt-r">{{ calcAmount(item.bidamount) }}</td>
@@ -112,6 +115,21 @@
         <div class="tags-button button-cancel">暂不添加</div>
       </div>
     </div>
+    <el-dialog
+      :visible.sync="tipDialog"
+      title="提示信息"
+      :show-close="false"
+      class="tip-dialog"
+      width="380px"
+      center>
+      <div>
+        当月采购单位画像余额为0,如需查看更多,请前往充值
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click.stop="goHandle(dialogBtnText)">{{ dialogBtnText }}</el-button>
+        <el-button @click="tipDialog = false">取 消</el-button>
+      </div>
+    </el-dialog>
   </el-card>
 </template>
 
@@ -145,6 +163,7 @@ export default {
       default () {
         return {
           isWinner: false,
+          hasPower: false,
           baseParam: {
             buyer: '',
             entId: '',
@@ -161,9 +180,6 @@ export default {
         }
       }
     },
-    noBuyerAuth: {
-      type: Boolean
-    },
     usage: {
       type: Object,
       default () {
@@ -209,9 +225,9 @@ export default {
         // 大会员用户
         const member = info.memberStatus > 0
         // 新超级订阅用户买的非全国 余额为0
-        const noAllProvinNoCounts = newVip && usage.provin !== -1 && usage.surplus <= 0
+        const noAllProvinNoCounts = newVip && usage.provin !== -1 && usage.balance <= 0
         // 超级订阅新用户 购买的全国 余额为0
-        const allProvinNoCounts = newVip && usage.provin === -1 && usage.surplus <= 0
+        const allProvinNoCounts = newVip && usage.provin === -1 && usage.balance <= 0
         // 无权限的大会员用户
         const noAuthMember = info.memberStatus > 0 && info.power.indexOf(5) === -1
         // 纯商机管理用户
@@ -224,6 +240,14 @@ export default {
       }
       return btnText
     },
+    dialogBtnText () {
+      // if (this.usage.provin === -1) {
+      //   return '联系客服'
+      // } else {
+      //   return '前往升级'
+      // }
+      return '立即充值'
+    },
     getDialogInfo () {
       //采购单位画像弹框
       const info = {}
@@ -248,6 +272,8 @@ export default {
       showIcon: 'list',
       isAllFirst: false,
       isDialogShow: false,
+      tipDialog: false,
+      selected: {}, // 已选中的信息
       tableList: [],
       listState: {
         loaded: true, // 是否已经搜索过
@@ -267,6 +293,13 @@ export default {
     this.initCollectEvent()
   },
   methods: {
+    getCheckStatus (id) {
+      console.log('id', id, this.selected[id])
+      return this.selected[id]
+    },
+    changeCheckInput (id) {
+      this.$set(this.selected, id, !this.selected[id])
+    },
     dateFormatter,
     calcBudget (budget) {
       if (budget) {
@@ -299,6 +332,22 @@ export default {
 
       return list
     },
+    goHandle (data) {
+      const usage = this.usage
+      if (data === '立即充值') {
+        if (usage.provin === -1) {
+          this.$router.push('/free/filePack/buy?type=1')
+        } else {
+          this.$emit('vipClick')
+        }
+        this.tipDialog = false
+      } else if (data === '联系客服') {
+        $('.help-slide-zx.open-customer').trigger('click')
+        this.tipDialog = false
+      } else {
+        this.$router.push('/free/svip/buy?type=upgrade')
+      }
+    },
     goPortrayalDetail (flag) {
       if (this.config.isWinner) {
         window.open('/swordfish/page_big_pc/unit_portrayal/' + flag)
@@ -324,9 +373,7 @@ export default {
       })
     },
     async onClickDataExport () {
-      const nowCheckItems = this.getCheckIds(function () {
-        return $(this).attr('dataid')
-      })
+      const nowCheckItems = this.getAllSelectId()
       let param = this.getFilters
       if (nowCheckItems.length) {//有选择导出选择条
         param.selectIds = nowCheckItems.join(',')
@@ -339,11 +386,9 @@ export default {
       }
     },
     onClickDataCollect () {
-      const nowCheckItems = this.getCheckIds(function () {
+      const nowCheckItems = this.getAllSelectId(function (id) {
         return {
-          id: $(this).attr('dataid'),
-          index: $(this).index('.info-list .custom-checkbox'),
-          check: $(this).parent().find('.icon-collect.checked').length > 0
+          id: id,
         }
       })
       this.onCollect({
@@ -352,12 +397,7 @@ export default {
     },
     toggleActiveIcon (type) {
       if (type === 'table') {
-        if (this.userInfo.memberStatus > 0 || (this.userInfo.vipStatus > 0)) {
-          if (this.listState.pageNum > 4) {
-            this.showToDataExportAlert()
-            return false
-          }
-        } else {
+        if (this.listState.pageNum > 4) {
           this.showToDataExportAlert()
           return false
         }
@@ -365,17 +405,35 @@ export default {
       this.showIcon = type
     },
     changeAllCheck (e) {
+      //次页数据全选或这全不选切换
+      var _this = this
       const nowStatus = $(e.target).prop('checked')
       $('.custom-checkbox:not(.has-top)').prop('checked', nowStatus)
+      this.getPageInputObj(function () {
+        _this.selected[$(this).attr('dataid')] = nowStatus
+      })
     },
-    getCheckIds (callback) {
+    getPageInputObj (callback) {
       const arr = []
-      $('.custom-checkbox:not(.has-top):checked').each(function () {
+      $('.custom-checkbox:not(.has-top)').each(function () {
         const tempN = callback.bind(this)()
         arr.push(tempN)
       })
       return arr
     },
+    getAllSelectId (callback) {
+      const arr = []
+      for (var id in this.selected) {
+        if (this.selected[id]) {
+          if (callback) {
+            arr.push(callback(id))
+          } else {
+            arr.push(id)
+          }
+        }
+      }
+      return arr
+    },
     // 恢复数据至第一次请求的状态(页码等)
     resetListState () {
       const state = {
@@ -422,6 +480,9 @@ export default {
       if (res.data?.count) {
         if (this.listState.pageNum === 1) {
           this.listState.total = res.data.count
+          if (res.data.count !== res.data.list.length) {
+            this.listState.pageSize = res.data.list.length
+          }
         }
         try {
           res.data.list = res.data.list.map(item => {
@@ -436,7 +497,8 @@ export default {
               visited
             }
           })
-        } catch (error) {}
+        } catch (error) {
+        }
         this.listState.list = res.data.list.map(v => {
           v.collection = 0
           return v
@@ -465,13 +527,14 @@ export default {
       //免费用户仅展示前三条
       //付费用户展示前4页 20条表格数据
       if (this.isTable) {
-        if (this.userInfo.memberStatus > 0 || (this.userInfo.vipStatus > 0)) {
+        if (this.config.hasPower) {
           if (p > 4) {
             this.listState.pageNum = this.listState.lastNum
             this.showToDataExportAlert()
             return false
           }
         } else {
+          this.listState.pageNum = this.listState.lastNum
           this.showToDataExportAlert()
           return false
         }
@@ -486,10 +549,10 @@ export default {
             return false
           }
           // 没有权限 弹出对应弹框
-          if (p !== 1 && this.noBuyerAuth) {
-            if (usage.provin === -1 && usage.usage === usage.total) {
+          if (p !== 1 && !this.config.hasPower) {
+            if (usage.provin === -1 && usage.balance === 0) {
               this.tipDialog = true
-            } else if (usage.provin >= 1 && usage.usage === usage.total) {
+            } else if (usage.provin >= 1 && usage.balance === 0) {
               this.tipDialog = true
             } else {
               this.isDialogShow = true
@@ -563,7 +626,7 @@ export default {
       } = data
       let binfo = []
       if (list) {
-        binfo = list.filter(v => !v.check).map(v => ({ bid: v.id }))
+        binfo = list.map(v => ({ bid: v.id }))
         item = {}
         event = {}
       } else {
@@ -590,8 +653,12 @@ export default {
           if (res.data) {
             _this.showTip('收藏成功', 1500)
             if (list) {
-              list.filter(v => !v.check).forEach(function (v) {
-                _this.listState.list[v.index].collection = 1
+              const tempList = list.map(v => v.id)
+              _this.listState.list.forEach(v => {
+                const tempIndex = tempList.indexOf(v.id)
+                if (tempIndex > -1) {
+                  v.collection = 1
+                }
               })
               event = {
                 target: $('.info-list .list-item i.icon-collect')
@@ -603,10 +670,10 @@ export default {
             var left = (parseInt($(event.target).position().left) - 300)
 
             if (left < 0) {
-              top = (parseInt($(".collect-list-header .j-icon.icon-star").position().top) + 30 - (list ? 28 : 0)) + 33 + 'px'
-              left = (parseInt($(".collect-list-header .j-icon.icon-star").position().left) - 300 + 54)
+              top = (parseInt($('.collect-list-header .j-icon.icon-star').position().top) + 30 - (list ? 28 : 0)) + 33 + 'px'
+              left = (parseInt($('.collect-list-header .j-icon.icon-star').position().left) - 300 + 54)
             }
-              left +=  'px'
+            left += 'px'
 
             $('.tags-box').show(function () {
               window.activeTags = []
@@ -1079,6 +1146,58 @@ export default {
 }
 /* eslint-enable */
 </script>
+<style lang="scss" scoped>
+.tip-dialog {
+  ::v-deep {
+    .el-button--primary,
+    .el-button--primary:hover,
+    .el-button--primary:focus {
+      width: 132px;
+      height: 36px;
+      margin-right: 52px;
+      text-align: center;
+      background: #2CB7CA;
+      border-radius: 6px;
+      font-size: 16px;
+      color: #fff;
+      border: 0;
+    }
+
+    .el-dialog__header {
+      padding-top: 32px !important;
+    }
+
+    .el-dialog__body {
+      padding: 20px 32px;
+      color: #686868;
+      font-size: 14px;
+      line-height: 22px;
+      text-align: justify;
+    }
+
+    .el-dialog__body i {
+      color: #2CB7CA;
+    }
+
+    .el-button--default,
+    .el-button--default:hover,
+    .el-button--default:focus {
+      width: 132px;
+      height: 36px;
+      text-align: center;
+      background: #fff;
+      border-radius: 6px;
+      font-size: 16px;
+      color: #686868;
+      border: 1px solid #DCDFE6;
+    }
+
+    .el-dialog__footer {
+      padding-bottom: 32px;
+    }
+  }
+}
+</style>
 <style lang="scss">
 .info-list-card .custom-checkbox {
   float: left;

+ 11 - 5
src/views/portrayal/components/DynamicListItem.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="article-item">
-    <input @click.stop class="custom-checkbox title-text-checkbox" name="bid-list" type="checkbox" :dataid="article.id">
+    <input @click.stop="$emit('change', article.id )" :checked="selected" class="custom-checkbox title-text-checkbox" name="bid-list" type="checkbox" :dataid="article.id">
     <div class="item-right">
       <div class="row-1">
         <div class="a-i-left ellipsis visited-hd" @click="onClick" v-html="calcTitle"></div>
@@ -22,7 +22,7 @@
 </template>
 <script>
 import { Tag } from 'element-ui'
-import { moneyUnit, dateFromNow } from '@/utils/'
+import { dateFromNow, moneyUnit } from '@/utils/'
 
 export default {
   name: 'portrayal-article-item',
@@ -30,9 +30,11 @@ export default {
     [Tag.name]: Tag
   },
   props: {
-    index: {
-      type: [String, Number],
-      default: '1'
+    select: {
+      type: Object,
+      default () {
+        return undefined
+      }
     },
     article: {
       type: Object,
@@ -46,6 +48,10 @@ export default {
           bidamount: 0 // 中标金额
         }
       }
+    },
+    selected: {
+      type: Boolean,
+      default: false
     }
   },
   computed: {

+ 1 - 0
src/views/portrayal/components/UnitChart.vue

@@ -353,6 +353,7 @@ export default {
         } else {
           this.getSectionChartData('a', newval)
         }
+        this.$emit('getUse', res.data)
       } else {
         this.showChart = false
       }

+ 19 - 11
src/views/portrayal/components/UnitList.vue

@@ -38,14 +38,13 @@
     <Empty v-if="!showDt" tip="暂无数据"></Empty>
     <el-dialog
       :visible.sync="tipDialog"
+      title="提示信息"
       :show-close="false"
       class="tip-dialog"
       width="380px"
       center>
       <div>
-        每购买1个省,每月可查看<i>5个</i>采购单位画像,<i>上限为80个</i>,您当前订阅了
-        <span v-if="usage.provin == -1">全国,查看机会已经消耗完毕,如需要更多服务,请前往联系客服。</span>
-        <span v-else>{{usage.provin}}个省,如需查看更多,前往订阅更多省份。</span>
+        当月采购单位画像余额为0,如需查看更多,请前往充值
       </div>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click.stop="goHandle(dialogBtnText)">{{dialogBtnText}}</el-button>
@@ -170,11 +169,12 @@ export default {
       return info
     },
     dialogBtnText () {
-      if (this.usage.provin === -1) {
-        return '联系客服'
-      } else {
-        return '前往升级'
-      }
+      // if (this.usage.provin === -1) {
+      //   return '联系客服'
+      // } else {
+      //   return '前往升级'
+      // }
+      return '立即充值'
     }
   },
   created () {
@@ -274,7 +274,15 @@ export default {
       }
     },
     goHandle (data) {
-      if (data === '联系客服') {
+      const usage = this.usage
+      if (data === '立即充值') {
+        if (usage.provin === -1) {
+          this.$router.push('/free/filePack/buy?type=1')
+        } else {
+          this.$emit('vipClick')
+        }
+        this.tipDialog = false
+      } else if (data === '联系客服') {
         $('.help-slide-zx.open-customer').trigger('click')
         this.tipDialog = false
       } else {
@@ -379,10 +387,10 @@ export default {
         border: 0;
       }
       .el-dialog__header{
-        padding: 0;
+        padding-top: 32px;
       }
       .el-dialog__body{
-        padding: 32px;
+        padding: 20px 32px;
         color: #686868;
         font-size: 14px;
         line-height: 22px;

+ 200 - 187
src/views/public/Buy.vue

@@ -9,8 +9,8 @@
           :cardType="conf.selectorType">
           <div slot="header" class="vip-sub-item-title">{{ buySpecLabel }}</div>
           <div class="vip-sub-item-content">
-            <SpecList :list="specList" v-model="specIdActive" @change="specChange" />
-            <div class="top-tip-banner">使用有效期至{{endTime}}<span v-if="endDay > 0">(剩 {{endDay}} 天)</span></div>
+            <SpecList :list="specList" v-model="specIdActive" @change="specChange"/>
+            <div class="top-tip-banner">使用有效期至{{ endTime }}<span v-if="endDay > 0">(剩 {{ endDay }} 天)</span></div>
           </div>
         </SelectorCard>
         <SelectorCard
@@ -23,7 +23,7 @@
               :productionId="specActiveItem.productionId"
               :price="computedPrice.total"
               @loaded="couponCardLoaded"
-              @change="couponCardChange" />
+              @change="couponCardChange"/>
           </div>
         </SelectorCard>
         <SelectorCard
@@ -34,7 +34,7 @@
           <div class="vip-sub-item-content">
             <CouponGiftList
               :productionId="specActiveItem.productionId"
-              @loaded="giftListLoaded" />
+              @loaded="giftListLoaded"/>
           </div>
         </SelectorCard>
         <SelectorCard
@@ -42,7 +42,7 @@
           :cardType="conf.selectorType">
           <div slot="header" class="vip-sub-item-title">手机号码</div>
           <div class="vip-sub-item-content">
-            <CheckPhone v-model="userInfo.phone" :pass.sync="phoneRegPass" />
+            <CheckPhone v-model="userInfo.phone" :pass.sync="phoneRegPass"/>
           </div>
         </SelectorCard>
       </div>
@@ -55,7 +55,7 @@
       >
         <template v-slot:buy-tip-group>
           <p class="buy-tip">购买须知:
-            <br>1.仅限超级订阅用户充值附件下载个数时使用,可多次购买。
+            <br>1.仅限超级订阅用户充值{{ descType }}个数时使用,可多次购买。
             <br>2.使用有效期仅限超级订阅服务周期内的当月,次月清零,不可转赠。
           </p>
         </template>
@@ -76,15 +76,10 @@ import BuySubmit from '@/components/coupon/BuySubmit.vue'
 import Contrast from '@/views/vipsubscribe/components/Contrast.vue'
 import { Dialog } from 'element-ui'
 
-import {
-  getFilePackList,
-  createOrder,
-  getUserAccountInfo,
-  getUserPower
-} from '@/api/modules/'
+import { getFilePackList, getUserAccountInfo, getUserPower, createCommonOrder } from '@/api/modules/'
 /* eslint-disable */
 export default {
-  name: 'vip-subscribe-buy',
+  name: 'source-pack-buy',
   components: {
     Layout,
     SelectorCard,
@@ -134,98 +129,112 @@ export default {
       couponActiveItem: {},
       specIdActive: 1,
       specActiveItem: {},
-      specList: [
-        {
-          id: 1,
-          cycleType: 1, // 月
-          label: '5个附件',
-          value: 5,
-          price: 0,
-          desc: '',
-          perDayPrice: 0,
-          productionId: 1141, // 产品id,后台配置
-          tipText: ''
+      confMap: {
+        titleText: {
+          0: '附件下载包充值',
+          1: '充值采购单位画像包'
         },
-        {
-          id: 2,
-          cycleType: 2, // 季
-          label: '10个附件',
-          value: 10,
-          price: 0,
-          desc: '',
-          perDayPrice: 0,
-          productionId: 1142,
-          tipText: ''
+        specLabel: {
+          0: '选择附件个数',
+          1: '选择画像个数'
         },
-        {
-          id: 3,
-          cycleType: 3, // 年
-          label: '20个附件',
-          value: 20,
-          price: 0,
-          desc: '',
-          perDayPrice: 0,
-          productionId: 1143,
-          tipText: ''
-        }
-      ],
+        descType: {
+          0: '附件下载',
+          1: '采购单位画像'
+        },
+        priceQuery: {
+          0: 'attachmentDownPack',
+          1: 'buyerPortraitPack'
+        },
+        specList: {
+          0: [
+            {
+              id: 1,
+              cycleType: 1, // 月
+              label: '5个附件',
+              value: 5,
+              price: 0,
+              desc: '',
+              perDayPrice: 0,
+              productionId: 1141, // 产品id,后台配置
+              tipText: ''
+            },
+            {
+              id: 2,
+              cycleType: 2, // 季
+              label: '10个附件',
+              value: 10,
+              price: 0,
+              desc: '',
+              perDayPrice: 0,
+              productionId: 1142,
+              tipText: ''
+            },
+            {
+              id: 3,
+              cycleType: 3, // 年
+              label: '20个附件',
+              value: 20,
+              price: 0,
+              desc: '',
+              perDayPrice: 0,
+              productionId: 1143,
+              tipText: ''
+            }
+          ],
+          1: [
+            {
+              id: 1,
+              cycleType: 1, // 月
+              label: '5个画像',
+              value: 5,
+              price: 0,
+              desc: '',
+              perDayPrice: 0,
+              productionId: 1151, // 产品id,后台配置
+              tipText: ''
+            },
+            {
+              id: 2,
+              cycleType: 2, // 季
+              label: '10个画像',
+              value: 10,
+              price: 0,
+              desc: '',
+              perDayPrice: 0,
+              productionId: 1152,
+              tipText: ''
+            },
+            {
+              id: 3,
+              cycleType: 3, // 年
+              label: '20个画像',
+              value: 20,
+              price: 0,
+              desc: '',
+              perDayPrice: 0,
+              productionId: 1153,
+              tipText: ''
+            }
+          ]
+        },
+      },
+      priceQuery: '',
+      descType: '',
+      buyTypeText: '',
+      specList: [],
       computedPrice: {
         total: 0,
         discount: 0,
         pay: 0
-      }
+      },
+      orderType: this.$route.query.type
     }
   },
   computed: {
-    oldVip () { // 是否是老版本超级订阅
-      return !this.powerInfo.viper
-    },
     isCanPay () {
       return this.powerInfo.viper && this.powerInfo.vipStatus > 0
     },
-    upgradeTipShow () {
-      if (this.buyType === 'buy') {
-        return false
-      } else {
-        return !this.canUpgrade && !this.oldVip
-      }
-    },
-    canUpgrade () {
-      const buyset = this.buyInfo.buyset
-      if (this.buyType === 'buy') {
-        return false
-      } else {
-        if (buyset.areacount === -1) {
-          return false
-        } else {
-          const selectCount = this.selectedCount
-          if (selectCount === -1) {
-            return true
-          } else {
-            return selectCount > buyset.areacount
-          }
-        }
-      }
-    },
-    buyTypeText () {
-      return '附件下载包充值'
-    },
-    noSelect () {
-      return !this.selectInfo.area
-    },
-    selectedCountInfo () {
-      const area = this.selectInfo.area
-      const count = Object.keys(area).length
-      return {
-        text: (count === 0 || count > this.conf.maxAreaCount) ? '全国' : `${count}个省`,
-        detail: (count === 0 || count > this.conf.maxAreaCount) ? '全国' : Object.keys(area).join('、')
-      }
-    },
-    selectedCount () {
-      const area = this.selectInfo.area
-      const length = Object.keys(area).length
-      return length === 0 ? -1 : length
-    },
     allPass () {
       const basicReg = this.phoneRegPass && this.isCanPay
       return basicReg
@@ -241,7 +250,11 @@ export default {
   beforeRouteEnter (to, from, next) {
     const title = document.title
     // 修改头部高亮
-    document.title = '附件下载包充值'
+    if (Number(to.query.type)) {
+      document.title = '采购单位画像包充值'
+    } else {
+      document.title = '附件下载包充值'
+    }
     next(vm => {
       vm.preTitle = title
     })
@@ -254,32 +267,33 @@ export default {
     $('#public-nav .jynav-list').find('span[name=大会员]').removeClass('active')
     try {
       window.trySelectNav('招标订阅')
-    } catch (error) {}
+    } catch (error) {
+    }
   },
   methods: {
     getMonthEndTime: function (date) {
       var tempDate = new Date(date)
       let month = tempDate.getMonth()
-      var new_year = tempDate.getFullYear(); //取当前的年份
-      var new_month = ++month; //取下一个月的第一天,方便计算(最后一天不固定)
+      var new_year = tempDate.getFullYear() //取当前的年份
+      var new_month = ++month //取下一个月的第一天,方便计算(最后一天不固定)
       if (month > 12) {
-        new_month -= 12; //月份减
-        new_year++; //年份增
+        new_month -= 12 //月份减
+        new_year++ //年份增
       }
-      var new_date = new Date(new_year, new_month, 1); //取当年当月中的第一天
-      return (new Date(new_date.getTime() - 1000));
+      var new_date = new Date(new_year, new_month, 1) //取当年当月中的第一天
+      return (new Date(new_date.getTime() - 1000))
     },
     getDayDiff: function (date1, date2, unit) {
-      var myDate1 = typeof date1 === 'string' && date1.includes('-') ? date1.replace(/-/g, '/') : date1;
-      var myDate2 = typeof date2 === 'string' && date2.includes('-') ? date2.replace(/-/g, '/') : date2;
+      var myDate1 = typeof date1 === 'string' && date1.includes('-') ? date1.replace(/-/g, '/') : date1
+      var myDate2 = typeof date2 === 'string' && date2.includes('-') ? date2.replace(/-/g, '/') : date2
       var map = {
         day: 1000 * 60 * 60 * 24,
         hour: 1000 * 60 * 60,
         minute: 1000 * 60,
         second: 1000,
         ms: 1,
-      };
-      return ((new Date(myDate2) - new Date(myDate1)) / (map[unit]));
+      }
+      return ((new Date(myDate2) - new Date(myDate1)) / (map[unit]))
     },
     getEndTime: function (vipEndTime) {
       var nowDate = new Date().getTime()
@@ -300,7 +314,6 @@ export default {
         url: '/subscribepay/vipsubscribe/getSubBuyMsg',
         type: 'GET',
         success: function (res) {
-          console.log(res)
           if (res && res.data && res.data.endTime) {
             this.getEndTime(res.data.endTime * 1000)
           }
@@ -309,49 +322,54 @@ export default {
     },
     getType () {
       var type = this.$route.query.type
-      var types = ['buy', 'upgrade']
-      if (types.includes(type)) {
-        this.buyType = type || types[0]
-      } else {
-        this.buyType = types[0]
-      }
-      if (this.buyType === 'upgrade') {
-        this.moduleShow.specList = false
-        this.getUserBuyInfo()
-      }
+      this.orderType = type || 0
+
+      const { titleText, descType, specLabel, priceQuery, specList } = this.confMap
+
+      this.priceQuery = priceQuery[this.orderType]
+      this.specList = specList[this.orderType]
+      this.buySpecLabel = specLabel[this.orderType]
+      this.descType = descType[this.orderType]
+      this.buyTypeText = titleText[this.orderType]
     },
-    setPriceItem (index, id, price, num) {
-      this.specList[index].productionId = id
+    setPriceItem (index, price, num) {
       this.specList[index].desc = ''
       this.specList[index].price = price / 100
-      this.specList[index].label = num + '个附件'
     },
     async getGoods () {
       const priceInfo = await getFilePackList({
-        product: 'attachmentDownPack'
+        product: this.priceQuery
       })
-      console.log(priceInfo)
       if (priceInfo.error_msg === '' && priceInfo.data) {
-          this.setPriceItem(0, 1141, priceInfo.data[5], 5)
-          this.setPriceItem(1, 1142, priceInfo.data[10], 10)
-          this.setPriceItem(2, 1143, priceInfo.data[20], 20)
+        this.setPriceItem(0, priceInfo.data[5], 5)
+        this.setPriceItem(1, priceInfo.data[10], 10)
+        this.setPriceItem(2, priceInfo.data[20], 20)
       }
       this.specChange(this.specList[0])
     },
     async getUserAccountInfo () {
-      const { data, error_code: code } = await getUserAccountInfo()
+      const {
+        data,
+        error_code: code
+      } = await getUserAccountInfo()
       if (code === 0) {
         Object.assign(this.userInfo, data)
       }
     },
     async getUserPower () {
-      const { data, error_code: code } = await getUserPower()
+      const {
+        data,
+        error_code: code
+      } = await getUserPower()
       if (code === 0) {
         Object.assign(this.powerInfo, data)
       }
     },
     async getUserBuyInfo () {
-      const { data, success } = await getUserAccountInfo()
+      const {
+        data,
+        success
+      } = await getUserAccountInfo()
       if (success && data) {
         Object.assign(this.buyInfo, data)
         this.selectInfo.area = this.buyInfo.area
@@ -395,53 +413,6 @@ export default {
         this.$set(this.specActiveItem, 'discountId', '')
       }
     },
-    showAreaDialog () {
-      this.dialog.area = true
-      this.$nextTick(() => {
-        this.$refs.areaSelector.setCitySelected(this.selectInfo.area)
-      })
-    },
-    commonGetPrice (buyAreaCount, cycleType) {
-      if (buyAreaCount > this.conf.maxAreaCount) {
-        buyAreaCount = -1
-      }
-      const info = this.priceRules
-      const isGreaterThanMaxArea = buyAreaCount === -1 // 是否购买全国
-
-      const priceInfo = {
-        price: 0,
-        perDayPrice: 0
-      }
-
-      switch (cycleType) {
-        // 1个月
-        case 1: {
-          const monthPriceFen = isGreaterThanMaxArea ? info.month.allProvince_allBuyerClass : info.month.oneProvince_allBuyerClass * buyAreaCount
-          priceInfo.price = monthPriceFen / 100
-          priceInfo.perDayPrice = buyAreaCount === 0 ? 0 : (priceInfo.price / 30).toFixed(2)
-          break
-        }
-        // 1个季度
-        case 2: {
-          const quarterPriceFen = isGreaterThanMaxArea ? info.quarter.allProvince_allBuyerClass : info.quarter.oneProvince_allBuyerClass * buyAreaCount
-          priceInfo.price = quarterPriceFen / 100
-          priceInfo.perDayPrice = buyAreaCount === 0 ? 0 : (priceInfo.price / (30 * 3)).toFixed(2)
-          break
-        }
-        // 1年
-        case 3: {
-          const yearPriceFen = isGreaterThanMaxArea ? info.year.allProvince_allBuyerClass : info.year.oneProvince_allBuyerClass * buyAreaCount
-          priceInfo.price = yearPriceFen / 100
-          priceInfo.perDayPrice = buyAreaCount === 0 ? 0 : (priceInfo.price / 365).toFixed(2)
-          break
-        }
-        default: {
-          return priceInfo
-        }
-      }
-
-      return priceInfo
-    },
     async updatePrice () {
       // TODO 获取优惠价格
       const tempPrice = {
@@ -449,10 +420,10 @@ export default {
         pay_price: this.specActiveItem.price * 100
       }
       if (this.couponActiveItem?.disCount) {
-        tempPrice.pay_price = tempPrice.original_price - Math.floor(tempPrice.original_price * (1 - this.couponActiveItem.disCount / 10))
+        tempPrice.pay_price = tempPrice.original_price - (tempPrice.original_price * (1 - this.couponActiveItem.disCount / 10)).fixed(2)
       }
       if (this.couponActiveItem?.reduce) {
-        tempPrice.pay_price = Math.floor(tempPrice.original_price - this.couponActiveItem.reduce * 100)
+        tempPrice.pay_price = (tempPrice.original_price - this.couponActiveItem.reduce * 100).fixed(2)
       }
       this.computedPrice.total = tempPrice.original_price
       this.computedPrice.pay = tempPrice.pay_price
@@ -462,9 +433,9 @@ export default {
       const buyInfo = this.buyInfo
       const coupon = this.couponActiveItem
       const param = {
-        "product":"attachmentDownPack",
-        "data":{
-          "num": this.specActiveItem.value
+        'product': this.priceQuery,
+        'data': {
+          'num': this.specActiveItem.value
         },
         order_phone: this.userInfo.phone,
         userLotteryId: coupon.userLotteryId,
@@ -475,22 +446,44 @@ export default {
       return param
     },
     async submitXHR () {
+      const type = Number(this.$route.query.type)
       const params = this.getSubmitParam()
       params.price = this.computedPrice.total
-      return createOrder(params)
+      console.log(params, '222')
+      const newParams = {
+        product: type ? '采购单位画像包' : '附件下载包',
+        productId: params.useProduct,
+        data: {
+          discountId: params.discountId,
+          num: params.data.num,
+          order_phone: this.userInfo.phone,
+          lotteryId: params.lotteryId
+        }
+      }
+      return createCommonOrder(newParams)
+      // return createOrder(params)
 
     },
     async submit () {
-      const res = await this.submitXHR()
-      if (res && res.msg === '') {
-        const orderCode = res.order_code
+      // eslint-disable-next-line
+      const { data, error_msg } = await this.submitXHR()
+      if (data && data.needPay) {
+        const orderCode = data.order_code
         if (this.computedPrice.pay !== 0) {
-          window.open(`/front/filePack/orderPay/${orderCode}`)
+          if (this.orderType === '1') {
+            window.open(`/front/buyerPortraitPack/orderPay/${orderCode}`)
+          } else {
+            window.open(`/front/filePack/orderPay/${orderCode}`)
+          }
         } else {
-          window.open(`/front/filePack/paySuccess/${orderCode}?payTime=${parseInt(Date.now() / 1000)}`)
+          if (this.orderType === '1') {
+            window.open(`/front/buyerPortraitPack/paySuccess/${orderCode}?payTime=${parseInt(Date.now() / 1000)}`)
+          } else {
+            window.open(`/front/filePack/paySuccess/${orderCode}?payTime=${parseInt(Date.now() / 1000)}`)
+          }
         }
       } else {
-        this.$toast(res.msg || '创建订单失败')
+        this.$toast(error_msg || '创建订单失败')
       }
     }
   }
@@ -504,22 +497,30 @@ export default {
     color: #FF3A20;
   }
 }
+
 ::v-deep .custom-dialog {
   margin: 0 auto;
   top: 50%;
   transform: translateY(-50%);
   background-color: transparent;
   box-shadow: none;
+
   .el-dialog__header,
   .el-dialog__body {
     padding: 0;
   }
+
   .el-dialog__body {
     display: flex;
     align-items: center;
     justify-content: center;
   }
 }
+
+.content-container.vip-subscribe-buy{
+  margin: 48px auto;
+}
+
 .top-tip-banner {
   margin-top: 12px;
   width: 1012px;
@@ -532,22 +533,27 @@ export default {
   color: #FF3A20;
   line-height: 32px;
 }
+
 .buy-tip {
   margin-top: 28px;
   font-size: 12px;
   font-weight: 400;
   color: #888888;
-  line-height: 14px;
+  line-height: 16px;
 }
+
 .vip-sub-list .vip-sub-list-item {
   padding: 40px 0;
 }
+
 .vip-sub-list .vip-sub-list-item:not(:last-of-type) {
   border-bottom: 1px solid #E0E0E0;
 }
+
 .vip-sub-list .vip-sub-item-title {
   width: 120px;
 }
+
 .vip-sub-item-content {
   line-height: 26px;
 }
@@ -563,38 +569,45 @@ export default {
   border-radius: 12px;
   background-color: #2CB7CA;
 }
+
 .vip-subscribe-title {
   font-size: 18px;
   color: #1D1D1D;
   line-height: 28px;
 }
+
 .vip-subscribe-content {
   margin-top: 12px;
   padding: 0 32px;
   background-color: #fff;
   border-top: 2px solid #2CB7CA;
 }
+
 .area-container {
   display: flex;
   width: 600px;
   padding: 6px 10px;
   border: 1px solid #E0E0E0;
   border-radius: 4px;
+
   .pre-tag {
     margin-right: 10px;
     height: 26px;
   }
 }
+
 .area-container {
   &-content {
     flex: 1;
     cursor: pointer;
   }
+
   &-placeholder {
     color: #aaa;
     cursor: pointer;
   }
 }
+
 .tip-content {
   margin-left: 16px;
   font-size: 12px;

+ 65 - 20
src/views/vipsubscribe/Buy.vue

@@ -38,6 +38,7 @@
           <div slot="header" class="vip-sub-item-title">选择优惠券</div>
           <div class="vip-sub-item-content">
             <CouponCardList
+              ref="couponRef"
               :productionId="specActiveItem.productionId"
               :price="computedPrice.total"
               @loaded="couponCardLoaded"
@@ -94,12 +95,11 @@ import { Dialog } from 'element-ui'
 
 import {
   getGoodsPrice,
-  createSVIPOrder,
   getSelectPrice,
   getSVIPBuyInfo,
-  svipUpgrade,
   getUserAccountInfo,
-  getUserPower
+  getUserPower,
+  createCommonOrder
 } from '@/api/modules/'
 
 export default {
@@ -196,22 +196,36 @@ export default {
       if (this.buyType === 'buy') {
         return false
       } else {
-        return !this.canUpgrade && !this.oldVip
+        return !this.canUpgrade
       }
     },
     canUpgrade () {
       const buyset = this.buyInfo.buyset
+      const selectCount = this.selectedCount
+      console.log(buyset, selectCount, this.oldVip)
       if (this.buyType === 'buy') {
         return false
       } else {
         if (buyset.areacount === -1) {
-          return false
+          // 老版超级订阅全国全行业用户选择16个地区以上或者全国才能去支付
+          if (this.oldVip) {
+            if (this.computedPrice.pay >= 0 && (selectCount >= 16 || selectCount === -1)) {
+              return true
+            } else {
+              return false
+            }
+          } else {
+            return true
+          }
         } else {
-          const selectCount = this.selectedCount
           if (selectCount === -1) {
             return true
           } else {
-            return selectCount > buyset.areacount
+            if (this.oldVip) {
+              return selectCount >= buyset.areacount
+            } else {
+              return selectCount > buyset.areacount
+            }
           }
         }
       }
@@ -244,7 +258,11 @@ export default {
       if (this.buyType === 'buy') {
         return basicReg
       } else if (this.buyType === 'upgrade') {
-        return basicReg && (this.canUpgrade || this.oldVip)
+        if (this.oldVip) {
+          return basicReg && (this.canUpgrade && this.oldVip)
+        } else {
+          return basicReg && (this.canUpgrade || this.oldVip)
+        }
       } else {
         return false
       }
@@ -295,6 +313,7 @@ export default {
     init () {
       if (this.buyType === 'upgrade') {
         // this.specChange(this.specList[2])
+        this.specChange({})
       } else {
         // 设置盛世选择器所有不选中
         this.$refs.areaSelector.content.setAllNoSelected()
@@ -329,6 +348,7 @@ export default {
         Object.assign(this.buyInfo, data)
         this.selectInfo.area = this.buyInfo.area
         this.$refs.areaSelector.setCitySelected(this.buyInfo.area)
+        this.updatePrice()
       }
     },
     onAreaChange (area) {
@@ -339,7 +359,7 @@ export default {
     },
     specChange (spec) {
       if (this.buyType === 'upgrade') {
-        spec.productionId = 101
+        spec.productionId = 1015
       }
       this.specActiveItem = spec
       this.resetCouponList()
@@ -351,6 +371,9 @@ export default {
       this.specActiveItem.discountId = ''
     },
     resetCouponList () {
+      if (this.$refs.couponRef) {
+        this.$refs.couponRef.active = ''
+      }
       this.couponActiveItem = {}
     },
     couponCardLoaded ({ data }) {
@@ -471,25 +494,47 @@ export default {
     async submitXHR () {
       const params = this.getSubmitParam()
       params.price = this.computedPrice.total
-      if (this.buyType === 'buy') {
-        return createSVIPOrder(params)
-      } else if (this.buyType === 'upgrade') {
-        return svipUpgrade(params)
+      let type = ''
+      switch (this.buyType) {
+        case 'buy':
+          type = 'firstBuy'
+          break
+        case 'upgrade':
+          type = 'upgrade'
+          break
+        case 'renew':
+          type = 'renew'
+          break
       }
+      const t = {
+        product: 'VIP订阅',
+        productId: this.buyType === 'upgrade' ? 1015 : params.useProduct,
+        data: {
+          type: type,
+          order_phone: this.userInfo.phone,
+          disWord: ''
+        }
+      }
+      Object.assign(t.data, params)
+      return createCommonOrder(t)
+      // if (this.buyType === 'buy') {
+      //   return createSVIPOrder(params)
+      // } else if (this.buyType === 'upgrade') {
+      //   return svipUpgrade(params)
+      // }
     },
     async submit () {
-      const { data, success, errMsg } = await this.submitXHR()
-      if (success) {
-        const orderCode = data.code
-        if (this.computedPrice.pay !== 0) {
+      // eslint-disable-next-line
+      const { data, error_msg } = await this.submitXHR()
+      if (data) {
+        const orderCode = data.order_code
+        if (data.needPay) {
           window.open(`/front/subvip/orderPay/${orderCode}`)
         } else {
           window.open(`/front/subvip/paySuccess/${orderCode}?payTime=${parseInt(Date.now() / 1000)}&from=vipUPgrade`)
         }
       } else {
-        if (errMsg) {
-          this.$toast(errMsg)
-        }
+        this.$toast(error_msg)
       }
     }
   }