Parcourir la source

商品资料库修改

喻文俊 il y a 3 ans
Parent
commit
799c05ca29

+ 19 - 19
App.vue

@@ -3,7 +3,7 @@
 	 * vuex管理登陆状态,具体可以参考官方登陆模板示例
 	 */
 	import Vue from 'vue'
-	import { mapState,mapMutations} from 'vuex';
+	import { mapState,mapMutations} from 'vuex'
 	import authorize from '@/common/config/authorize.js'
 	export default {
 		onLaunch: function() {
@@ -32,20 +32,20 @@
 			// }
 			uni.getSystemInfo({
 				success: function(e) {
-					let modelmes = e.model;
-					console.log(e);
-					if (modelmes.search('iPhone 11') || modelmes.search('iPhone 11 Pro Max') ||modelmes.search('iPhone X') != -1) { //XS,XR,XS MAX均可以适配
+					let modelmes = e.model
+					console.log(e)
+					if (modelmes.search('iPhone 11') !== -1 || modelmes.search('iPhone 11 Pro Max') !== -1 ||modelmes.search('iPhone X') != -1) { //XS,XR,XS MAX均可以适配
 						self.$store.dispatch('setVariableFun',true)
 					}else{
 						self.$store.dispatch('setVariableFun',false)
 					}
 					// #ifndef MP
-					Vue.prototype.StatusBar = e.statusBarHeight;
+					Vue.prototype.StatusBar = e.statusBarHeight
 					if (e.platform == 'android') {
-						Vue.prototype.CustomBar = e.statusBarHeight + 50;
+						Vue.prototype.CustomBar = e.statusBarHeight + 50
 						Vue.prototype.platformClass = true
 					} else {
-						Vue.prototype.CustomBar = e.statusBarHeight + 45;
+						Vue.prototype.CustomBar = e.statusBarHeight + 45
 						Vue.prototype.platformClass = false
 					};
 					// #endif
@@ -59,22 +59,22 @@
 						Vue.prototype.platformClass = 'center'
 						self.$store.dispatch('setIsIphoneFun',true)
 					}
-					Vue.prototype.StatusBar = e.statusBarHeight;
+					Vue.prototype.StatusBar = e.statusBarHeight
 					Vue.prototype.fontSizeSetting = e.fontSizeSetting
 					Vue.prototype.screenWidth = e.screenWidth
-					let capsule = wx.getMenuButtonBoundingClientRect();
+					let capsule = wx.getMenuButtonBoundingClientRect()
 					Vue.prototype.capsule = capsule
 					if (capsule) {
-						Vue.prototype.Custom = capsule;
+						Vue.prototype.Custom = capsule
 						// Vue.prototype.capsuleSafe = uni.upx2px(750) - capsule.left + uni.upx2px(750) - capsule.right;
-						Vue.prototype.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;
+						Vue.prototype.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight
 					} else {
-						Vue.prototype.CustomBar = e.statusBarHeight + 50;
+						Vue.prototype.CustomBar = e.statusBarHeight + 50
 					}
 					// #endif		
 					// #ifdef MP-ALIPAY
-					Vue.prototype.StatusBar = e.statusBarHeight;
-					Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
+					Vue.prototype.StatusBar = e.statusBarHeight
+					Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight
 					// #endif
 				}
 			})
@@ -86,8 +86,8 @@
 		methods:{
 			...mapMutations(['login','logout','isWxAuthorize']),
 			async getWxAuthorize(){
-				const wechatCode = await authorize.getCode('weixin');// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
-				const getUserInfo = await authorize.getUserInfo('weixin');
+				const wechatCode = await authorize.getCode('weixin')// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
+				const getUserInfo = await authorize.getUserInfo('weixin')
 				this.UserService.UserLoginAuthApplets({ 
 					code:wechatCode,
 					encryptedData:getUserInfo.encryptedData,
@@ -95,7 +95,7 @@
 				})
 				.then(response =>{
 					this.$store.commit('updateStatus',response.data)
-					this.login(response.data);
+					this.login(response.data)
 					uni.setStorageSync('token',response.data.token)
 					uni.setStorageSync('unionId',response.data.unionId)
 				})
@@ -115,13 +115,13 @@
 				})
 			},		
 			refresh(){
-				let TIME = (20*60)*1000;
+				let TIME = (20*60)*1000
 				setInterval(()=>{
 					this.getWxAuthorize()
 				},TIME)
 			},
 			diffTime(t){
-				let date = Date.now();
+				let date = Date.now()
 				return (date -t) < 2*60*1000 ? false : true
 			}
 		},

+ 122 - 36
components/cm-module/productDetails/cm-product-doc.vue

@@ -1,5 +1,9 @@
 <template>
-    <view class="product-doc hasBottom" :style="{ paddingBottom: isIphoneX ? '60rpx' : 0 }">
+    <view
+        class="product-doc "
+        :class="{ hasBottom: TipStatus }"
+        :style="{ paddingBottom: isIphoneX && TipStatus ? '60rpx' : 0 }"
+    >
         <view class="category">
             <view class="category-title">图片资料</view>
             <view class="content">
@@ -43,14 +47,17 @@
                         <view class="cm-time">{{ $reg.formatDate('', item.addTime) }}</view>
                         <view class="cm-video-list">
                             <video
+                                class="cm-video"
                                 :id="'myVideo' + index"
                                 :src="item.fileUrl"
+                                :style="videoStyle['myVideo' + index]"
                                 controls
                                 show-fullscreen-btn
                                 show-mute-btn
                                 play-btn-position="center"
                                 @play="handlePlayer('myVideo' + index)"
                                 v-if="item.fileUrl"
+                                @loadedmetadata="loadedmetadata"
                             ></video>
                             <view class="cm-video-section" v-else>
                                 <image class="cm-video-cover" :src="videoCover"></image>
@@ -69,11 +76,11 @@
                     <view class="section" v-for="(item, index) in fileArchiveList" :key="index">
                         <image
                             src="https://static.caimei365.com/app/img/icon2/PDF-app.png"
-                            v-if="/\.pdf$/.test(item.fileName)"
+                            v-if="/\.pdf/.test(item.fileName)"
                         ></image>
                         <image
                             src="https://static.caimei365.com/app/img/icon2/DOC-app.png"
-                            v-else-if="/\.doc$/.test(item.fileName)"
+                            v-else-if="/\.doc/.test(item.fileName)"
                         ></image>
                         <image src="https://static.caimei365.com/app/img/icon2/PPT-app.png" v-else></image>
                         <view class="cm-desc">
@@ -154,13 +161,14 @@ export default {
             videoArchiveList: [], // 视频资料列表
             fileArchiveList: [], // 文件资料列表
             defaultImage: 'https://static.caimei365.com/app/img/icon2/PC-default.png', // 默认图片
-            videoCover: 'https://static.caimei365.com/app/img/icon2/video-cover.png' //默认视频封面
+            videoCover: 'https://static.caimei365.com/app/img/icon2/video-cover.png', //默认视频封面
+            videoStyle: {}
         }
     },
     computed: {
         ...mapState(['isIphoneX']),
         //资料查看状态提示
-        TipStatus: function() {
+        TipStatus() {
             // 资料权限
             const statusText = [
                 false, // 正常访问
@@ -168,12 +176,17 @@ export default {
                 { text: '请升级成为会员机构后方可查看!', btn: '去升级', redirect: '/pages/login/apply' },
                 { text: '请升级成为医美会员机构后方可查看!', btn: '去升级', redirect: '/pages/login/apply' },
                 { text: '需抵扣100采美豆方可查看!', btn: '去查看', redirect: 10 },
-                { text: '无权限查看!', btn: '' }
+                { text: '无权限查看!', btn: '确认' }
             ]
             // 0可查看,1未登录,2需升级会员机构,3需升级医美会员机构,4需要抵扣采美豆,5无权限查看
             return statusText[this.permission]
         }
     },
+    watch: {
+        TipStatus(val) {
+            this.$emit('tipStatus', this.TipStatus)
+        }
+    },
     created() {
         this.userId = uni.getStorageSync('userInfo').userId || -1
         this.getDetail()
@@ -202,19 +215,37 @@ export default {
                         duration: 1500,
                         title: res.msg
                     })
-                    setTimeout(()=>{
+                    setTimeout(() => {
                         //刷新资料列表
                         this.getDetail()
-                    },1500)
+                    }, 1500)
                 })
                 .catch(err => {
                     uni.showToast({
-                        icon:'none',
+                        icon: 'none',
                         duration: 1500,
                         title: err.msg
                     })
                 })
         },
+        // 获取视频源信息
+        loadedmetadata(e) {
+            // 获取视频长宽
+            const w = e.detail.width //视频真实宽度
+            const h = e.detail.height //视频真实高度
+            let rw = 0 //视频展示宽度
+            let rh = 0 //视频展示宽度
+            // 视频宽大于等于高时
+            if (w >= h) {
+                rw = 702
+                rh = (rh * h) / w
+            } else {
+                rw = 400
+                rh = (rw * h) / w
+            }
+            // 使用set向videoStyle添加样式信息
+            this.$set(this.videoStyle, e.currentTarget.id, `width:${rw}rpx;height:${rh}rpx;`)
+        },
         // 视频播放
         handlePlayer(id) {
             if (this.checkPermission()) {
@@ -338,23 +369,75 @@ export default {
         // 文件预览
         previewFile(file) {
             if (this.checkPermission()) return
-            //先将链接缓存
-            uni.setStorageSync('openLink', file.fileUrl)
+            // 获取文件后缀
+            // const index = file.fileName.lastIndexOf('.')
+            // const suffix = file.fileName.substring(index)
+            this.openDocument(file)
+            // if (suffix === '.doc' || suffix === '.ppt' || suffix === '.pptx' || suffix === '.docx') {
+            //     //先将链接缓存
+            //     uni.setStorageSync('openLink', file.htmlUrl)
+            //     this.openDocument(file.fileUrl)
+            //     // this.$api.navigateTo('/pages/h5/article/path?key=openLink&type=1')
+            // } else if (suffix === '.pdf') {
+            //     //先将链接缓存
+            //     uni.setStorageSync('openLink', file.fileUrl)
+            //     this.$api.navigateTo('/pages/h5/article/path?key=openLink&type=2')
+            // } else {
+            //     // 不支持的文件
+            //     return uni.showModal({
+            //         content: `${suffix}类型文件暂不支持预览`,
+            //         cancelColor: '#666',
+            //         confirmColor: '#E15616'
+            //     })
+            // }
+        },
+        // 打开文档
+        openDocument(file) {
+            uni.showLoading({
+                title:'加载中'
+            })
             // 获取文件后缀
             const index = file.fileName.lastIndexOf('.')
-            const suffix = file.fileName.substring(index)
-            if (suffix === '.doc' || suffix === '.ppt') {
-                this.$api.navigateTo('/pages/h5/article/path?key=openLink&type=1')
-            } else if (suffix === '.pdf') {
-                this.$api.navigateTo('/pages/h5/article/path?key=openLink&type=2')
-            } else {
-                // 不支持的文件
-                return uni.showModal({
-                    content: `${suffix}类型文件暂不支持预览`,
-                    cancelColor: '#666',
-                    confirmColor: '#E15616'
-                })
-            }
+            const suffix = file.fileName.substring(index + 1)
+            // 下载文件
+            uni.downloadFile({
+                url: file.fileUrl,
+                success(res) {
+                    const filePath = res.tempFilePath
+                    console.log(filePath) 
+                    // 打开文件
+                    uni.openDocument({
+                        filePath: filePath,
+                        fileType: suffix,
+                        success(res) {
+                            uni.showToast({
+                                icon:'success',
+                                title:'打开成功',
+                                duration: 1200
+                            })
+                            uni.hideLoading()
+                        },
+                        fail(err) {
+                            if(err.errMsg.indexOf('fail filetype not supported')){
+                                uni.showModal({
+                                    content: '不支持的文件预览',
+                                    cancelColor: '#666',
+                                    confirmColor: '#E15616'
+                                })
+                            }
+                            uni.hideLoading()
+                        }
+                    })
+                },
+                fail(err){
+                    uni.showToast({
+                        title: JSON.stringify(err),
+                        icon:'none',
+                        duration: 5000
+                    })
+                    uni.hideLoading()
+                },
+            })
         }
     }
 }
@@ -380,6 +463,7 @@ export default {
     background: #ffe6dc;
     border-radius: 16px;
     box-sizing: border-box;
+    z-index: 9;
     &.maxBottom {
         bottom: 175rpx;
     }
@@ -525,18 +609,20 @@ export default {
         }
         .cm-video-list {
             margin-top: 18rpx;
-            width: 702rpx;
-            height: 420rpx;
-            video {
-                width: 100% !important;
-                max-width: 100%;
-                min-width: 100%;
-                display: flex;
-                max-height: 420rpx;
-                // width: 100%;
-                // height: 100%;
-                background: #000;
-            }
+            // // width: 702rpx;
+            // // height: 420rpx;
+            // width: 544rpx;
+            // height: 960rpx;
+            // .cm-video {
+            //     width: 100% !important;
+            //     max-width: 100%;
+            //     min-width: 100%;
+            //     display: flex;
+            //     // max-height: 420rpx;
+            //     // width: 100%;
+            //     height: 100%;
+            //     background: #000;
+            // }
         }
     }
 }

+ 13 - 4
pages/goods/goods-doc-detail.vue

@@ -1,16 +1,20 @@
 <!-- 自定义页面 -->
 <template>
-    <view class="goods-doc-detail">
+    <view class="goods-doc-detail" :style="{ paddingBottom: tipStatus ? '80rpx' : '0' }">
         <view class="cm-header">
-            <image class="cm-cover" :src="productImage"></image>
+            <image
+                class="cm-cover"
+                :src="productImage ? productImage : 'https://static.caimei365.com/app/img/icon2/placeholder.png'"
+            ></image>
             <view class="cm-title"> {{ productName }} </view>
-            <view class="cm-params"><text>供应商:</text>{{ shopName }}</view>
+            <view class="cm-params"><text>供应商:</text>{{ shopName || '暂无' }}</view>
             <view class="cm-params"><text>商品属性:</text>{{ productType === 1 ? '商品' : '仪器' }}</view>
         </view>
         <cm-product-doc
             v-if="archiveId !== 0"
             :archiveId="archiveId"
             :bottom="isIphoneX ? '60rpx' : '10rpx'"
+            @tipStatus="getTipStatus"
         ></cm-product-doc>
     </view>
 </template>
@@ -39,9 +43,10 @@ export default {
             productName: '',
             productType: 0,
             shopName: '',
+            tipStatus: ''
         }
     },
-    methods:{
+    methods: {
         // 获取商品资料详情
         getDetail() {
             console.log(this.userId)
@@ -57,6 +62,10 @@ export default {
                 this.shopName = res.data.shopName
             })
         },
+        // 获取权限tip
+        getTipStatus(status) {
+            this.tipStatus = status
+        }
     }
 }
 </script>

+ 65 - 25
pages/goods/goods-doc-list.vue

@@ -7,7 +7,7 @@
                     placeholder-class="search-placeholder"
                     placeholder="请输入商品名称/供应商名称"
                     class="search-input"
-                    type="text"
+                    type="search"
                     v-model="listQuery.keyword"
                     @click="isFoucs = true"
                     @blur="handleBlur"
@@ -33,13 +33,17 @@
         <!-- list -->
         <view class="doc-list" :style="{ paddingTop: isSitcky ? '80rpx' : '' }">
             <view class="section" v-for="(item, index) in showList" :key="index" @click="handleRoute(item)">
-                <image class="cover" :src="item.productImage"></image>
+                <image class="cover" :src="item.productImage ? item.productImage : 'https://static.caimei365.com/app/img/icon2/placeholder.png'"></image>
                 <view class="content">
-                    <view class="title">{{ item.productName }}</view>
-                    <view class="params"><text>供应商:</text>{{ item.shopName }}</view>
-                    <view class="params"><text>商品属性:</text>{{ item.productType === 1 ? '仪器' : '产品' }}</view>
+                    <view class="title" v-if="!isSearch">{{ item.productName }}</view>
+                    <view class="title" v-else v-html="item.productName"></view>
+                    <view class="params"><text>供应商:</text>{{ item.shopName || '暂无' }}</view>
+                    <view class="params"><text>商品属性:</text>{{ item.productType === 1 ? '产品' : '仪器' }}</view>
                 </view>
             </view>
+            <view class="cm-emtpy" v-if="isEmpty">
+                <image src="https://static.caimei365.com/app/img/icon2/PC-empty.png"></image> <text>暂无资料~</text>
+            </view>
         </view>
         <!-- loading more -->
         <view v-if="showList.length > 6">
@@ -62,15 +66,16 @@ export default {
             isSitcky: false,
             listQuery: {
                 keyword: '', //查询关键词
-                productType: 0, //商品类型 0 全部 1 仪器 2 产品
+                productType: 0, //商品类型 0 全部 1 产品 2 仪器
                 pageNum: 1,
                 pageSize: 10
             },
             isFoucs: false,
-            tabs: [{ id: 0, name: '全部' }, { id: 1, name: '仪器' }, { id: 2, name: '产品' }],
+            tabs: [{ id: 0, name: '全部' }, { id: 1, name: '产品' }, { id: 2, name: '仪器' }],
             currentTab: 0,
             searchList: [],
-            list: []
+            list: [],
+            isEmpty: false
         }
     },
     computed: {
@@ -88,9 +93,9 @@ export default {
             return this.list
         }
     },
-    watch:{
-        isSearch(val){
-            if(!val) this.searchList = []
+    watch: {
+        isSearch(val) {
+            if (!val) this.searchList = [] //退出搜索,清空搜索列表
         }
     },
     onLoad() {
@@ -102,16 +107,29 @@ export default {
             this.isLoading = true
             this.BeautyArchive.GetArchiveProduct(this.listQuery).then(res => {
                 console.log(res)
-                if(res.code) return
-                if(this.isSearch) {
+                if (res.code) return
+                if (this.isSearch) {
+                    this.formatTitle(res.data.results) // 如果是搜索,需要高亮关键词
                     this.searchList = [...this.searchList, ...res.data.results]
-                }else {
+                    this.isEmpty = this.searchList.length === 0
+                } else {
                     this.list = [...this.list, ...res.data.results]
+                    this.isEmpty = this.list.length === 0
                 }
                 this.hasMore = res.data.hasNextPage
                 this.isLoading = false
             })
         },
+        // 高亮文字
+        formatTitle(list) {
+            list.forEach((item, index) => {
+                //正则表达式
+                const reg = new RegExp(this.listQuery.keyword, 'g')
+                item.productName = item.productName.replace(reg, $1 => {
+                    return `<span style="color: #E15616;">${$1}</span>`
+                })
+            })
+        },
         // tab切换
         tabChange(e) {
             this.currentTab = e.index
@@ -127,28 +145,27 @@ export default {
         },
         // 搜索框输入
         handleInput(e) {
-            if(e.detail.value.trim() === '') return
+            if (e.detail.value.trim() === '') return
             this.searchList = []
             // 从第一页开始 , 搜索全部
             this.listQuery.pageNum = 1
             this.listQuery.productType = 0
             let timer = null
             clearTimeout(timer)
-            timer = setTimeout(()=>{
+            timer = setTimeout(() => {
                 this.getList()
-            },500)
+            }, 500)
         },
         // 搜索框失去焦点
-        handleBlur(){
+        handleBlur() {
             this.isFoucs = false
             this.listQuery.productType = this.currentTab
         },
         // 路由跳转
-        handleRoute(item){
-            console.log(item)
-            if(item.redirectType === 1){
-                this.$api.navigateTo(`/pages/goods/product?id=${item.productId}`)
-            }else{
+        handleRoute(item) {
+            if (item.redirectType === 1) {
+                this.$api.navigateTo(`/pages/goods/product?id=${item.productId}&open=caimei`)
+            } else {
                 this.$api.navigateTo(`/pages/goods/goods-doc-detail?id=${item.archiveId}`)
             }
         }
@@ -160,11 +177,11 @@ export default {
         if (!this.hasMore) return
         let timer = null
         clearTimeout(timer)
-        this.listQuery.pageNum ++
+        this.listQuery.pageNum++
         this.isLoading = true
         timer = setTimeout(() => {
             this.getList()
-        }, 200)
+        }, 400)
     }
 }
 </script>
@@ -212,6 +229,9 @@ page {
             display: -webkit-box; /*设置弹性盒模型*/
             -webkit-line-clamp: 2; /*文本占的行数,如果要设置2行加...则设置为2*/
             -webkit-box-orient: vertical;
+            text {
+                color: #e15616;
+            }
         }
         .params {
             margin-top: 8rpx;
@@ -257,4 +277,24 @@ page {
         }
     }
 }
+.cm-emtpy {
+    width: 100%;
+    padding-top: 40vw;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    flex-direction: column;
+    image {
+        display: block;
+        width: 260rpx;
+        height: 260rpx;
+    }
+    text {
+        display: block;
+        margin-top: 10rpx;
+        font-size: 26rpx;
+        font-weight: 400;
+        color: #999999;
+    }
+}
 </style>

+ 23 - 13
pages/goods/product.vue

@@ -194,15 +194,8 @@
                     </view>
                     <!-- 供应商 -->
                     <view class="product-supplier" v-if="isNoneSupplier" @click="goSupplier">
-                        <view class="logo"
-                            ><img
-                                :src="
-                                    shop.logo
-                                        ? shop.logo
-                                        : 'https://static.caimei365.com/app/img/icon/icon-shoplogo.png'
-                                "
-                                alt=""
-                        /></view>
+                        <view class="logo">
+                            <img :src="shop.logo? shop.logo: 'https://static.caimei365.com/app/img/icon/icon-shoplogo.png'"alt=""/></view>
                         <view class="main">
                             <view class="name">{{ shop.name }}</view>
                             <view class="massgs">
@@ -239,7 +232,7 @@
                         </view>
                     </view>
                     <!-- 服务项目 -->
-                    <view class="product-details service product-details1" style="height: 1000px;">
+                    <view class="product-details service product-details1">
                         <view class="title"> <view class="title-tab">服务项目</view> </view>
                         <view
                             class="content service"
@@ -619,7 +612,6 @@ export default {
             productCouponList: [], // 优惠券弹窗列表
             headerBtnPosi: this.setHeaderBtnPosi(), // 获取设备顶部胶囊高度
             systeminfo: this.setSysteminfo(), // 获取设备信息
-            isIphoneX: this.$store.state.isIphoneX,
             windowHeight: '',
             headerColor: false,
             backPage: 1,
@@ -650,11 +642,12 @@ export default {
             },
             bottomCartNumber: 0,
             navbar: [{ name: '未领取', num: 0 }, { name: '已领取', num: 0 }],
-            isPreviewImage: false
+            isPreviewImage: false,
+            opentype: ''
         }
     },
     computed: {
-        ...mapState(['hasLogin', 'isWxAuthorize', 'identity'])
+        ...mapState(['hasLogin', 'isWxAuthorize', 'identity','isIphoneX'])
     },
     filters: {
         TypeFormat(value) {
@@ -690,6 +683,7 @@ export default {
     },
     onLoad(option) {
         this.productId = this.couponParam.productId = option.id //获取商品ID
+        this.opentype = option.open
         this.isShareType = option.type
         this.linkPath = option.path
         this.isHeaderPoduct = true
@@ -701,6 +695,20 @@ export default {
         }
         this.getWinHeight()
     },
+    onReady() {
+      if(this.opentype == 'caimei'){
+          // 跳转到资料详情
+          uni.showLoading({
+              title:'加载中'
+          })
+          setTimeout(()=>{
+              this.isNavbarFiexd = true
+              this.tabClick(3)
+              uni.hideLoading()
+          }, 2000)
+      } 
+      console.log('是iPhoneX', this.isIphoneX)
+    },
     methods: {
         initData() {
             // 初始化商品详情查询
@@ -785,6 +793,7 @@ export default {
                     // }, 2000)
                     this.shoppingHeaderCartNumber()
                     this.queryProductDetilsCoupons()
+                    
                     this.isRequest = true
                 })
                 .catch(error => {
@@ -1183,6 +1192,7 @@ export default {
                 // - topBar.height
             })
             this.sectionPropsArr = sectionPropsArr
+            
             console.log('更新tab影响区域')
         },
         //当滑动时也能同步激活tab

+ 25 - 24
pages/user/account/account-bean.vue

@@ -60,10 +60,10 @@
 	</view>
 </template>
 <script>
-	import tuiLoadmore from "@/components/tui-components/loadmore/loadmore"
-	import tuiNomore from "@/components/tui-components/nomore/nomore"
+	import tuiLoadmore from '@/components/tui-components/loadmore/loadmore'
+	import tuiNomore from '@/components/tui-components/nomore/nomore'
 	import uniCalendar from '@/components/uni-calendar/uni-calendar.vue'
-	var date = new Date();
+	var date = new Date()
 	export default{
 		components: {
 			uniCalendar,
@@ -138,14 +138,15 @@
 						9:'抵用退回',
 						10:'抵用运费',
 						11:'退款回收',
-						12:'登录奖励'
-					};
+						12:'登录奖励',
+                        13:'查看商品资料'
+					}
 				Object.keys(stateTextObject).forEach(function(key){
 					if(key == state){
 						stateText = stateTextObject[key]
 					}
-				});
-				return stateText;
+				})
+				return stateText
 },
 		},
 		methods: {
@@ -160,10 +161,10 @@
 					let data = response.data
 					let list = data.pageInfo.list
 					this.userBeans = data.userBeans
-					this.hasNextPage =  data.pageInfo.hasNextPage;
+					this.hasNextPage =  data.pageInfo.hasNextPage
 					if(list && list.length > 0){
-						this.isEmpty = false;
-						this.beansList = [...list];
+						this.isEmpty = false
+						this.beansList = [...list]
 					}else{
 						this.isEmpty = true
 					}
@@ -188,10 +189,10 @@
 					let data = response.data
 					let list = data.pageInfo.list
 					this.userBeans = data.userBeans
-					this.hasNextPage =  data.pageInfo.hasNextPage;
+					this.hasNextPage =  data.pageInfo.hasNextPage
 					this.beansList = this.beansList.concat(list)
-					this.pullFlag = false;// 防上拉暴滑
-					setTimeout(()=>{this.pullFlag = true;},500)
+					this.pullFlag = false// 防上拉暴滑
+					setTimeout(()=>{this.pullFlag = true},500)
 					if(this.hasNextPage){
 						this.pullUpOn = false
 						this.nomoreText = '上拉显示更多'
@@ -205,17 +206,17 @@
 				})
 			},
 			tabClick(index){//tab点击
-				this.tabCurrentIndex = index;
-				this.listQuery.type = index;
+				this.tabCurrentIndex = index
+				this.listQuery.type = index
 				this.listQuery.pageNum = 1
 				this.beansList = []
 				this.pullUpOn = true //隐藏
-				this.GetAccountInitData();
+				this.GetAccountInitData()
 			},			
 			monthSwitch(e) {
-				this.listQuery.year = e.year;
-				this.listQuery.month = e.month;
-				this.GetAccountInitData();
+				this.listQuery.year = e.year
+				this.listQuery.month = e.month
+				this.GetAccountInitData()
 			},
 			cheakType(type){
 				let typeTextHtml,
@@ -229,18 +230,18 @@
 						7:'余额订单充值',
 						8:'订金订单退款',
 						9:'余额订单退款'
-					};
+					}
 				Object.keys(typeObject).forEach(function(key){
 					if(key == type){
 						typeTextHtml = typeObject[key]
 					}
-				});	
-				return typeTextHtml;
+				})	
+				return typeTextHtml
 			},
 			hanldNavigateBack(){
 				uni.navigateBack({
 					delta: 1
-				});
+				})
 			},
 		},
 		onReachBottom() {
@@ -251,7 +252,7 @@
 			}	
 		},
 		onPullDownRefresh() {//下拉刷新
-			this.listQuery.pageNum = 1;
+			this.listQuery.pageNum = 1
 			this.GetAccountInitData()
 			uni.stopPullDownRefresh()
 		},

+ 3 - 3
services/ajax.service.js

@@ -34,7 +34,7 @@ class AjaxService {
         }
         let { isLoading = true } = options
         if (isLoading) {
-            wx.showLoading({ title: '加载中' })
+            uni.showLoading({ title: '加载中' })
         }
         const requestPromise = new Promise((resolve, reject) => {
             uni.request({
@@ -43,7 +43,7 @@ class AjaxService {
                 data: options.data || {},
                 header,
                 success: res => {
-                    if (isLoading) wx.hideLoading()
+                    if (isLoading) uni.hideLoading()
                     if(options.isStatus){
                         resolve(res.data)
                     }else{
@@ -56,7 +56,7 @@ class AjaxService {
                 },
                 fail: error => {
                     reject(error)
-                    wx.hideLoading()
+                    if (isLoading) uni.hideLoading()
                 }
             })
         })