123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436 |
- function getShortName (comName) {
- var areaMap = chinaMapJSON || []
- var shortname = comName
- // 1. 循环省份城市进行替换
- areaMap.forEach(function (item) {
- var p = item.name.replace(/[省市]/, '')
- if (shortname.indexOf(p) !== -1) {
- shortname = shortname.replace(item.name, '').replace(p, '')
- console.log(p + ' -> \'\'')
- }
- item.city.forEach(function (iitem) {
- var c = iitem.name.replace(/[省市]/, '')
- if (shortname.indexOf(c) !== -1) {
- shortname = shortname.replace(iitem.name, '').replace(c, '')
- console.log(c + ' -> \'\'')
- }
- iitem.area.forEach(function (iiitem) {
- if (shortname.indexOf(iiitem) !== -1) {
- shortname = shortname.replace(iiitem, '')
- console.log(iiitem + ' -> \'\'')
- }
- })
- })
- })
- var matchRes = shortname.match(/[\u4e00-\u9fa5]{4}/gm)
- var shortname = matchRes ? matchRes[0] : shortname.slice(0, 4)
- if (shortname.length < 4) {
- shortname = shortname.slice(0, 4)
- }
- return shortname
- }
- var formatter11 = (type, val) => {
- if (type === 'year') {
- return `${val}年`;
- }
- if (type === 'month') {
- return `${val}月`;
- }
- return val;
- }
- var vm = new Vue({
- el: '#proRecord',
- delimiters: ['{', '}'],
- data: function () {
- return {
- dValue: '',
- pShow: false,
- working: false,
- empty: false,
- curDate: '',
- minDate: '',
- maxTime: '',
- points: {
- total: 0,
- usage: 0
- },
- years: '',
- months: '',
- contracted: false,
- listInfo: {
- value: '',
- pageNum: 1,
- pageSize: 10,
- total: -1,
- loading: true,
- finished: false
- },
- statusEnum: ['存续', '吊销', '停业', '撤销'],
- statusColors: ['#2CB7CA', '#F5AF5C', '#58A1E7', '#51CEA2'],
- list: [],
- ptype: "",
- userPower: {
- // 免费用户
- isFree: false,
- // 超级订阅(超级订阅默认一定有附件下载权益)
- vipStatus: 0,
- // 大会员
- memberStatus: 0,
- // 大会员power包含3, 则表示大会员有附件下载权益
- power: []
- },
- // 附件下载相关权益信息
- accountInfo: {
- // 充值数量
- purchaseNum: 0,
- // 兑换数量
- exchangeNum: 0,
- // 超级订阅剩余权益个数
- grantNum: 0,
- // 免费数量(免费用户权益个数)
- freeNum: 0
- },
- kfDialogShow: false,
- // 客服信息
- kefuInfo: {
- name: '',
- remark: "专属客服",
- wxer: ''
- },
- // 保存图片是否成功
- savePicSuccess: false,
- picImgUrl: null
- }
- },
- computed: {
- // 大会员是否拥有附件下载权益
- hasDownloadPower () {
- return this.userPower.power.indexOf(3) > -1
- }
- },
- created: function () {
- this.getKefuInfo()
- this.getPType("type")
- this.years = new Date().getFullYear()
- this.months = parseInt(new Date().getMonth() + 1)
- this.dValue = this.years + '年' + this.months + '月'
- this.curDate = new Date()
- this.minDate = new Date(2021, 0)
- this.maxTime = new Date(this.years, this.months - 1)
- this.getUserPower()
- this.subPoint()
- this.onLoad()
- },
- methods: {
- // 获取用户权限
- getUserPower() {
- var _this = this
- $.ajax({
- url: '/bigmember/use/isAdd',
- type: 'POST',
- success: function (res) {
- console.log(res)
- if (res.data) {
- var resData = res.data
- _this.userPower.isFree = resData.isFree
- _this.userPower.vipStatus = resData.vipStatus
- _this.userPower.memberStatus = resData.memberStatus
- _this.userPower.power = resData.power
- }
- }
- })
- },
- // 获取客服信息
- getKefuInfo () {
- var _this = this
- $.ajax({
- type: 'post',
- url: '/bigmember/use/getCustom',
- success: function (res) {
- if (res && res.data) {
- const resData = res.data || {}
- _this.kefuInfo = resData
- }
- }
- })
- },
- // 超级订阅-了解详情
- knowMore () {
- var source = 'app_mine_member_attach_learnmore'
- if(utils.$env.platform === 'h5') {
- source = 'h5_mine_member_attach_learnmore'
- }
- location.href = '/jyapp/frontPage/bigmember/free/perfect_info?source=' + source
- },
- // 咨询客服
- consultKf () {
- this.kfDialogShow = true
- },
- // 保存二维码
- savePicHandle () {
- var _this = this
- if(_this.savePicSuccess) return
- var loading = _this.$toast.loading({ duration: 0, message: '保存中...' })
- if(!_this.picImgUrl) {
- $("#creat-img-box").append($('#QRCode-pic').clone().attr('id', 'clone-image'))
- html2canvas(document.querySelector('#clone-image'), {
- // allowTaint: true,
- useCORS: true,
- backgroundColor: null,
- scale: 3,
- imageTimeout: 30000,
- }).then(canvas => {
- var imgUrl = canvas.toDataURL('image/png');
- imgUrl = imgUrl.replace('data:image/png;base64,', '')
- _this.picImgUrl = imgUrl
- $('#clone-image').remove()
- try {
- if (typeof window.__compatibleAppFn === 'function') {
- window.__compatibleAppFn(JyObj.savePic, _this.picImgUrl, '剑鱼标讯需要您的存储权限,将用于下载、保存二维码图片到相册,以便您能及时联系客服,处理附件下载时遇到的问题。')
- }
- _this.$toast('图片已经保存~')
- loading.clear()
- setTimeout(() => {
- _this.saveSuccess = false
- }, 1500)
- } catch (e) {
- $('#clone-image').remove()
- loading.clear()
- _this.$toast('保存失败')
- setTimeout(() => {
- _this.saveSuccess = false
- }, 1500)
- }
- })
- }else {
- try {
- if (typeof window.__compatibleAppFn === 'function') {
- window.__compatibleAppFn(JyObj.savePic, _this.picImgUrl, '剑鱼标讯需要您的存储权限,将用于下载、保存二维码图片到相册,以便您能及时联系客服,处理附件下载时遇到的问题。')
- }
- loading.clear()
- _this.$toast('图片已经保存,快去分享吧~')
- } catch (e) {
- loading.clear()
- _this.$toast('保存失败')
- }
- setTimeout(() => {
- _this.saveSuccess = false
- }, 1500)
- }
- },
- // 去兑换
- exchangeHandle() {
- location.href = '/jy_mobile/points/my_points'
- },
- // 兑换明细
- viewDetail () {
- location.href = '/jy_mobile/fileRecord/exchange'
- },
- // 去充值
- setBook() {
- if(this.userPower && this.userPower.isFree){
- location.href = '/jy_mobile/common/order/create/svip?type=buy'
- return
- }
- location.href = '/jy_mobile/common/order/create/filepack?type=0'
- },
- getPType (paraName) {
- let _this = this
- var url = document.location.toString();
- var arrObj = url.split("?");
- if (arrObj.length > 1) {
- var arrPara = arrObj[1].split("&");
- var arr;
- for (var i = 0; i < arrPara.length; i++) {
- arr = arrPara[i].split("=");
- if (arr != null && arr[0] == paraName) {
- _this.ptype = arr[1];
- }
- }
- }
- },
- usedHised () {
- let _this = this
- _this.pShow = true
- },
- subPoint () {
- $.ajax({
- url: '/jypay/resourcePack/account',
- type: 'POST',
- contentType: 'application/x-www-form-urlencoded',
- data: {
- product: 'attachmentDownPack'
- },
- dataType: 'json'
- }).done(res => {
- if (res.error_msg === '' && res.data && res.data.data) {
- try {
- var tempInfo = res.data.data[0]
- this.accountInfo = tempInfo
- this.points.total = tempInfo.number
- } catch (e) {
- console.warn(e)
- }
- } else {
- this.$toast(res.error_msg || '请稍后重试')
- }
- })
- },
- onLoad () {
- this.ajaxEntList().done(this.doFormatList.bind(this))
- },
- doFormatList (r) {
- if (r && r.error_msg == '' && r.data) {
- this.points.usage = r.data.total
- this.working = false
- this.empty = true
- if (this.listInfo.pageNum === 1) {
- if (r.data.total || r.data.total === 0) {
- this.listInfo.total = r.data.total
- } else {
- this.listInfo.finished = true
- }
- }
- this.listInfo.pageNum++
- if (Array.isArray(r.data.list) && r.data.list.length !== 0) {
- this.list = this.list.concat(r.data.list.map(function (v) {
- var isDoc = /.doc(x{0,})$/.test(v.s_fileName)
- v.icon = isDoc ? 'doc' : 'rar'
- return v
- }))
- } else {
- this.listInfo.finished = true
- }
- this.listInfo.loading = false
- if (this.listInfo.total !== -1 && this.listInfo.total <= this.list.length) {
- this.listInfo.finished = true
- }
- }
- },
- getDatas () {
- return {
- queryTime: new Date(this.years, this.months-1, 1).pattern('yyyy-MM'),
- platform: __pageData.platform.toUpperCase(),
- productName: '附件下载包',
- pageSize: this.listInfo.pageSize,
- pageNum: this.listInfo.pageNum
- }
- },
- ajaxEntList () {
- this.working = true
- this.empty = false
- return $.ajax({
- url: '/jypay/resourcePack/recordList',
- type: 'POST',
- contentType: 'application/x-www-form-urlencoded',
- data: this.getDatas(),
- dataType: 'json'
- })
- },
- downFile (item) {
- //location.href = item.s_downUrl
- if (utils.$envs.inWxMini) {
- return utils.toDownloadApp()
- }
- $.ajax({
- type: 'post',
- url: '/jypay/resourcePack/consumePack',
- data: {
- productName: '附件下载包',
- platform: 'APP',
- fileName: item.s_fileName,
- id: item.s_id,
- title: item.s_title
- },
- success: function (r) {
- if (r && r.m === '' && r.r) {
- location.href = r.r.downUrl
- }else{
- vant.Dialog.alert({
- message: '附件下载异常,请联系管理员,谢谢!',
- className: 'custom-dialog',
- confirmButtonText: '我知道了',
- confirmButtonColor: '#2ABDD1',
- width: 303,
- }).then(() => {})
- }
- }
- })
- },
- commonDialogFn (message, confirmText, callBack) {
- if (this.ptype == "1") {
- var curDay = new Date().pattern('yyyy/MM/dd')
- localStorage.setItem('show-buyer-dialog', curDay)
- } else {
- var curDay = new Date().pattern('yyyy/MM/dd')
- localStorage.setItem('show-ent-dialog', curDay)
- }
- this.$dialog.confirm({
- message: message,
- width: 303,
- className: 'pro-log',
- messageAlign: 'left',
- showCancelButton: 'true',
- confirmButtonColor: '#2ABED1',
- confirmButtonText: confirmText,
- showCancelButton: true
- }).then(function () {
- callBack && callBack()
- }).catch(function () { })
- },
- usedDialog () {
- this.commonDialogFn('超级订阅用户每月享有下载10个附件的权限,也可充值附件下载包増加当月附件下载个数,每月1号上月余额清零重新计算。', '我知道了')
- },
- helpTiped () {
- this.$dialog.alert({
- width: 303,
- message: '超级订阅用户每月享有下载<span class="on">10</span>个附件的权限,也可充值附件下载包増加当月附件下载个数,每月1号上月余额清零重新计算。',
- className: 'pro-log',
- messageAlign: 'left',
- confirmButtonColor: '#2ABED1',
- confirmButtonText: '我知道了',
- })
- },
- confirmed (val) {
- this.years = val.getFullYear()
- this.months = val.getMonth() + 1
- this.listInfo.pageNum = 1
- this.list = []
- this.listInfo.total = -1
- this.listInfo.finished = false
- this.listInfo.loading = true
- this.onLoad()
- this.dValue = this.years + '年' + this.months + '月'
- this.pShow = false
- },
- canceled () {
- this.pShow = false
- },
- ChangeDate (time) {
- var d = new Date(time)
- var Y = d.getFullYear() + '年'
- var M = (d.getMonth() + 1 < 10 ? '0' + (d.getMonth() + 1) : d.getMonth() + 1) + '月'
- return (Y + M).replace(/^\s+|\s+$/g, "")
- },
- detailed (ids) {
- if (this.ptype == "") {
- location.href = '/jyapp/big/page/ent_portrait?eId=' + ids + '&svip=1'
- } else {
- location.href = '/jyapp/big/page/unit_portrayal?entName=' + ids + '&svip=1'
- }
- },
- contractPerson () {
- location.href = '/jyapp/free/customer'
- // try {
- // JyObj.callPhone('400-108-6670')
- // } catch (error) {
- // console.log(error)
- // }
- }
- }
- })
|