wangshan 3 lat temu
rodzic
commit
2ac04faad3

+ 4 - 2
src/jfw/modules/bigmember/src/service/use/use.go

@@ -624,8 +624,10 @@ func (u *Use) IsAdd() {
 		var notBigFileBool = bigPower.Status <= 0 || !bigPower.PowerMap[3]
 		//超级订阅非大会员用户附件下载本月可用次数
 		uk := qu.If(notBigFileBool && bigPower.VipStatus > 0 && bigPower.Vip_BuySet.Upgrade == 1, "v", "f").(string)
-		// log.Println(uk, "-----", config.Config.FileUploadNum[uk])
-		d["fileNum"] = config.Config.FileUploadNum[uk] - redis.GetInt(jy.PowerCacheDb, fmt.Sprintf(jy.VipFileUploadNumKey, userid, fmt.Sprint(time.Now().Month()))) + redis.GetInt(jy.PowerCacheDb, fmt.Sprintf(jy.FilePackNumKey, userid, fmt.Sprint(time.Now().Month())))
+		//附件下载包的剩余次数
+		filePackKey := fmt.Sprintf(jy.FilePackNumKey, userid, fmt.Sprint(time.Now().Month()))
+		filePackNum := redis.GetInt(jy.PowerCacheDb, filePackKey)
+		d["fileNum"] = config.Config.FileUploadNum[uk] - redis.GetInt(jy.PowerCacheDb, fmt.Sprintf(jy.VipFileUploadNumKey, userid, fmt.Sprint(time.Now().Month()))) + filePackNum
 		//新用户->新订阅设置页面
 		if config.Config.NewFreeUser < bigPower.Registedate {
 			d["isUpgrade"] = true

+ 1 - 1
src/jfw/modules/common/src/qfw/util/jy/bigVipPower.go

@@ -50,7 +50,7 @@ const (
 	UserUpdateAreaKey   = "free_area_num_%s_%s"
 	BaseAreaNum         = 1
 	VipFileUploadNumKey = "vip_file_num_%s_%s"  //超级订阅附件本月一下载次数 %s:userid ; %s:当前月份-fmt.Sprint(time.Now().Month())
-	FilePackNumKey      = "file_pack_num_%s_%s" //附件下载包本月  下载次数  %s:userid   %s 当前月份-fmt.Sprint(time.Now().Month())
+	FilePackNumKey      = "file_pack_num_%s_%s" //附件下载包本月  剩余次数  %s:userid   %s 当前月份-fmt.Sprint(time.Now().Month())
 )
 
 //初始化大会员权益

+ 11 - 1
src/jfw/modules/subscribepay/src/entity/resourcePackStruct.go

@@ -8,6 +8,7 @@ import (
 	"math"
 	qu "qfw/util"
 	"qfw/util/jy"
+	"qfw/util/redis"
 	"strconv"
 	"time"
 	"util"
@@ -61,13 +62,22 @@ func (this *resoucePackStruct) PayCallBack(param *CallBackParam) bool {
 				log.Printf("用户%sPurchaseUserBalance出错:%v", userId, (*orderData)["order_code"], err)
 				return false
 			}
+			//附件下载包剩余次数
+			filePackKey := fmt.Sprintf(jy.FilePackNumKey, userId, fmt.Sprint(time.Now().Month()))
+			filePackNum := redis.GetInt(jy.PowerCacheDb, filePackKey)
+			if filePackNum == 0 {
+				redis.Put(jy.PowerCacheDb, filePackKey, qu.IntAll(filterM["num"]), int(this.LastDate(now).Unix()-now.Unix()))
+			} else {
+				filePackNum += qu.IntAll(filterM["num"])
+				redis.Put(jy.PowerCacheDb, filePackKey, filePackNum, int(this.LastDate(now).Unix()-now.Unix()))
+			}
 			//卡卷使用
 			userLotteryId := qu.ObjToString((*orderData)["d_relation_id"])
 			order_code := qu.ObjToString((*orderData)["order_code"])
 			if userLotteryId != "" {
 				go func(userId, userLotteryId, order_code string) {
 					phone, name := util.GetMyPhoneAndName(userId)
-					if !util.UpdateCouponState(userId, userLotteryId, name, phone, order_code, "省份订阅包", "0", 1, 0) {
+					if !util.UpdateCouponState(userId, userLotteryId, name, phone, order_code, ATTACHMENT, "0", 1, 0) {
 						log.Println(fmt.Sprintf("单号%s-消费失败-卡卷%s", order_code, userLotteryId))
 					}
 				}(userId, userLotteryId, order_code)

+ 2 - 0
src/jfw/modules/subscribepay/src/timetask/timetask.go

@@ -314,6 +314,8 @@ func checkIsExpire() {
 				go jy.ClearBigVipUserPower(_id)
 				log.Println("用户", _id, i_vip_status, l_vip_endtime, "修改已到期状态")
 				redis.Del("other", "p1_indexMessage_"+_id) //清除redis中vip状态
+				filePackKey := fmt.Sprintf(jy.FilePackNumKey, _id, fmt.Sprint(time.Now().Month()))
+				redis.Del(jy.PowerCacheDb, filePackKey) //清除redis中附件下载包次数
 			} else if l_vip_endtime-now_unix <= threeday && i_vip_expire_tip != 1 {
 				updateOk := util.MQFW.UpdateById("user", _id, map[string]interface{}{
 					"$set": map[string]interface{}{

+ 65 - 20
src/web/staticres/frontRouter/pc/seeBuyerHistory/js/index-pc.js

@@ -29,6 +29,31 @@ function getShortName (comName) {
   }
   return shortname
 }
+function debounce(func, wait) {
+  var timeout;
+  return function () {
+    var context = this;
+    var args = Array.prototype.slice.call(arguments);
+    if (timeout) clearTimeout(timeout);
+    var callNow = !timeout;
+    timeout = setTimeout(function () {
+      timeout = null;
+    }, wait);
+    if (callNow) func.apply(context, args);
+  };
+}
+function downFile (src, name) {
+  var a = document.createElement('a')
+  var event = new MouseEvent('click')
+  a.download = name || '附件名称'
+  a.href = src
+  a.dispatchEvent(event)
+}
+
+var downFileOfURL = debounce(function (src , name) {
+  return downFile(src, name)
+}, 1500)
+
 var vm = new Vue({
   el: '.see-container',
   delimiters: ['{', '}'],
@@ -69,6 +94,18 @@ var vm = new Vue({
     this.subRecord()
   },
   methods: {
+    cellClick (row, column, cell, event) {
+      console.log(row, column, cell, event)
+      if (column.label === '附件') {
+        return downFileOfURL(row.s_downUrl, row.s_fileName);
+      }
+      if (column.label === '公告来源') {
+        location.href = row.articleUrl
+      }
+    },
+    indexMethod (index) {
+      return ((this.seeList.pageNum - 1) * this.seeList.pageSize) + index + 1
+    },
     showTip () {
       this.tipDialog = true
     },
@@ -84,34 +121,50 @@ var vm = new Vue({
     subPoint () {
       var _this = this
       $.ajax({
-        url: '/bigmember/portrait/subVipPortrait/usage?p_type=1',
+        url: '/jypay/resourcePack/account',
         type: 'POST',
         contentType: 'application/x-www-form-urlencoded',
-        data: '',
+        data: {
+          product: 'attachmentDownPack'
+        },
         dataType: 'json'
       }).done(res => {
-        if (res.error_code == 0) {
-          _this.points = res.data
-          if (res.data.total == res.data.usage) {
-            _this.tipDialog = true
+          if (res.error_msg === '' && res.data && res.data.data) {
+            this.points = {
+              total: '',
+              usage: ''
+            }
+            try {
+              var tempInfo = res.data.data[0]
+              this.points = {
+                total: tempInfo.number,
+                usage: tempInfo.number
+              }
+              if (this.points.usage > tempInfo.thirtyNum) {
+                this.points.usage = tempInfo.thirtyNum
+              }
+            } catch (e) {
+              console.warn(e)
           }
+          } else {
+            this.$toast(res.error_msg || '请稍后重试')
         }
       })
     },
     getDatas () {
       return {
-        year: this.years,
-        month: this.months,
+        queryTime: new Date(this.years, this.months - 1, 1).pattern('yyyy-MM'),
+        platform: 'PC',
+        productName: '附件下载包',
         pageSize: this.seeList.pageSize,
-        pageNum: this.seeList.pageNum - 1,
-        p_type: 1
+        pageNum: this.seeList.pageNum
       }
     },
     subRecord () {
       this.working = true
       this.empty = false
       $.ajax({
-        url: '/bigmember/portrait/subVipPortrait/record',
+       url: '/jypay/resourcePack/recordList',
         type: 'POST',
         contentType: 'application/x-www-form-urlencoded',
         data: this.getDatas(),
@@ -128,15 +181,7 @@ var vm = new Vue({
             res.data.list = []
             return
           }
-          this.seeList.list = this.seeList.list.concat(res.data.list.map(function (v) {
-            return {
-              name: v.name,
-              province: v.province,
-              city: v.city,
-              buyerclass: v.buyerclass,
-              checked: false
-            }
-          }))
+          this.seeList.list = this.seeList.list.concat(res.data.list)
         }
       })
     },

+ 138 - 22
src/web/templates/frontRouter/pc/fileHistory/sess/index.html

@@ -19,6 +19,103 @@
   <link rel="stylesheet" href='{{Msg "seo" "cdn"}}/css/ele-reset.css?v={{Msg "seo" "version"}}'>
   <link rel="stylesheet" href='{{Msg "seo" "cdn"}}/css/selector/selector.css?v={{Msg "seo" "version"}}'>
   <link rel="stylesheet" href='{{Msg "seo" "cdn"}}/frontRouter/pc/seeBuyerHistory/css/index-pc.css?v={{Msg "seo" "version"}}'>
+  <style>
+    .w1080 {
+      width: 1080px;
+      margin: 0 auto;
+    }
+    .show-total-info-group button {
+      width: 132px;
+      height: 36px;
+      background: #FFFFFF;
+      border-radius: 6px 6px 6px 6px;
+      font-size: 16px;
+      font-weight: 400;
+      color: #2CB7CA;
+    }
+    .show-total-info-group {
+      display: flex;
+      flex-direction: row;
+      align-items: center;
+      justify-content: space-between;
+      margin-top: 24px;
+      width: 1080px;
+      min-height: 122px;
+      background: linear-gradient(315deg, #14A7D6 0%, #1EC2DB 99%);
+      font-size: 14px;
+      font-weight: 400;
+      color: rgba(255, 255, 255, 0.9);
+      line-height: 22px;
+      padding: 28px 32px;
+      box-sizing: border-box;
+      border-radius: 6px;
+    }
+    .show-total-info-item > span {
+      font-size: 14px;
+      font-weight: 400;
+      color: rgba(255, 255, 255, 0.9);
+      line-height: 22px;
+    }
+    .show-total-info-item {
+      font-size: 16px;
+      font-weight: bold;
+      color: #FFFFFF;
+      line-height: 24px;
+      margin-bottom: 8px;
+    }
+    .show-total-info-item .file-pack-total {
+      font-size: 36px;
+      line-height: 36px;
+      padding: 0 8px;
+    }
+    .el-table th.el-table__cell>.cell {
+      font-size: 14px;
+      font-weight: bold;
+      color: #1D1D1D;
+      padding-left: 24px;
+      padding-right: 24px;
+    }
+    .el-table .cell {
+      padding: 4px 24px;
+      font-size: 14px;
+      font-weight: 400;
+      color: #1D1D1D;
+    }
+    .el-table .el-table__cell.text-center {
+      text-align: center;
+    }
+
+    .el-table td.el-table__cell.file-name .cell {
+      font-size: 14px;
+      font-weight: 400;
+      color: #2CB7CA;
+      text-decoration: underline;
+      cursor: pointer;
+    }
+    .el-table td.el-table__cell.title-name .cell {
+      display: -webkit-box;
+      overflow: hidden;
+      text-overflow: ellipsis;
+      -webkit-line-clamp: 2;
+      -webkit-box-orient: vertical;
+      cursor: pointer;
+    }
+    .el-table .el-table__cell.first-index {
+      padding-left: 6px;
+    }
+    .el-table th.el-table__cell.is-leaf {
+      border-bottom-color: transparent;
+    }
+    .el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell {
+      background: #F5F5FB;
+    }
+    .tab-title {
+      font-size: 18px;
+      font-weight: 400;
+      color: #1D1D1D;
+      line-height: 28px;
+    }
+  </style>
 </head>
 
 <body>
@@ -26,17 +123,20 @@
 
   <section class="see-container" v-cloak>
     <div class="see-header flex w">
-      <div class="l-tabs flex">
+      <div class="w1080">
         <h3 class="tab-title">线上自助充值帐户</h3>
+        <div class="show-total-info-group">
+          <div class="show-total-info-item">
+            <div>附件下载包帐户余额<span class="file-pack-total">{points.total?points.total:0}</span>个</div>
+            <span>注:超级订阅用户每月享有下载10个附件的权限,也可充值附件下载包增加当月附件下载个数;每月1号上月附件下载余额清零重新计算。</span>
+          </div>
+          <button>立即充值</button>
+        </div>
       </div>
     </div>
-    <div class="see-header flex w">
+    <div class="see-header flex w w1080" style=" margin-bottom: 30px;">
       <div class="l-tabs flex">
-        <h3 class="tab-title">使用记录</h3>
-        <div class="tips">
-          当月已使用:<span>{points.usage?points.usage:0}</span>/{points.total?points.total:0}
-        </div>
-        <div class="tip" style="cursor: pointer;" @click="helpDialog = true"></div>
+        <h3 class="tab-title">使用记录(当月已使用{points.usage?points.usage:0}个)</h3>
       </div>
       <div class="l-tabs r-tabs">
         <span class="r-word">选择月份</span>
@@ -46,21 +146,37 @@
         <i class="el-icon-arrow-down r-icons" ></i>
       </div>
     </div>
-    <div class="see-content w" v-show="seeList.list.length !== 0 && empty">
-      <div class="lists flex" v-for="item in seeList.list" :key="item._id">
-        <div class="r-conts flex">
-          <h3 class="flex" @click="detailed(item.name)">{item.name}<span v-show="item.status >= 0"
-              :class="'status-' + item.status">{item.statusWord}</span></h3>
-          <div class="line">
-            <div class="cont-tips address"><i class="addr">所在地:</i>
-              <span v-if="item.province">{item.province}</span>
-              <span v-if="item.city">{item.city}</span>
-              <span v-if="!(item.province && item.city)">--</span>
-            </div>
-            <div class="cont-tips buyerclass"><i class="buyer">采购单位类型:</i><span>{item.buyerclass || '--'}</span></div>
-          </div>
-        </div>
-      </div>
+    <div class="see-content w w1080" v-show="seeList.list.length !== 0 && empty">
+      <el-table
+              :data="seeList.list"
+              @cell-click="cellClick"
+              style="width: 100%">
+        <el-table-column
+                width="94"
+                type="index"
+                class-name="first-index"
+                label="序号"
+                :index="indexMethod">
+        </el-table-column>
+        <el-table-column
+                prop="s_fileName"
+                class-name="file-name"
+                label="附件"
+                width="384">
+        </el-table-column>
+        <el-table-column
+                prop="s_title"
+                width="384"
+                class-name="title-name ex-line2"
+                label="公告来源">
+        </el-table-column>
+        <el-table-column
+                prop="l_date"
+                width="218"
+                class-name="text-center"
+                label="下载时间">
+        </el-table-column>
+      </el-table>
       <div class="el-pagination-container" v-show="seeList.total">
         <el-pagination background layout="prev, pager, next, ->" :hide-on-single-page="true"
           :current-page="seeList.pageNum" :page-size="seeList.pageSize" :total="seeList.total"

+ 37 - 0
src/web/templates/order/pc/paySuccess.html

@@ -45,6 +45,11 @@
                 <p style="margin-top: 6px;"> 充值成功!</p>
                 <p class="datapackage-money-tip-group">¥<span></span></p>
                 <p class="datapackage-tip-group">数据流量包+<span></span>条</p>
+            {{else if eq .T.orderType "filePack"}}
+                <p style="margin-top: 6px;"> 充值成功!</p>
+                <p class="file-info datapackage-money-tip-group">¥<span name="file-price"></span></p>
+                <p class="file-info datapackage-tip-group"><span name="file-num"></span>个附件下载</p>
+                <p class="file-info datapackage-tip-group">有效期至<span name="file-time"></span></p>
             {{else}}
                 <p>支付成功!</p>
             {{end}}
@@ -107,6 +112,38 @@
 {{include "/common/pcbottom.html"}}
 <script type="text/javascript">
     var myPageNavIsNormal = true;
+    var orderType = {{.T.orderType}}
+    if (orderType === 'filePack') {
+        getFilePackInfo()
+    }
+    function getFilePackInfo () {
+        $.ajax({
+            type: 'POST',
+            url: '/subscribepay/orderListDetails/getOrderPayAllMsg',
+            data: {
+                orderCode: {{.T.orderCode}}
+            },
+            success: function (res) {
+                if (res && res.errMsg === '' && res.data) {
+                    console.log(res.data)
+                    try {
+                        switch (res.data.order.product_type) {
+                            case '附件下载包': {
+                                var tempNode = $('.file-info')
+                                var tempInfo = JSON.parse(res.data.order.filter)
+                                tempNode.find('span[name="file-price"]').text(res.data.order.pay_money / 100)
+                                tempNode.find('span[name="file-num"]').text('+' + tempInfo.num)
+                                tempNode.find('span[name="file-time"]').text(tempInfo.validTime.replace(/-/g, '/'))
+                                break
+                            }
+                        }
+                    } catch (e) {
+                        console.warn(e)
+                    }
+                }
+            }
+        })
+    }
     $(function () {
         var payway = getParam('payway')
         if (payway) {