소스 검색

更新协销分享

xiebaomin 1 년 전
부모
커밋
01d482ece2

+ 2 - 2
components/cm-share-popup/cm-seller-modal.vue

@@ -69,7 +69,7 @@
 <script>
 export default {
     props: {
-        sellerUserId: {
+        suid: {
             type: Number,
             default: 0
         }
@@ -94,7 +94,7 @@ export default {
             uni.setStorageSync('sellerCardChange', 2)
         },
         initData() {
-            this.userId = this.sellerUserId || uni.getStorageSync('sellerUserId')
+            this.userId = this.suid || uni.getStorageSync('suid')
             if(this.userId > 0) {
                 this.getUserInfo()
                 if (uni.getStorageSync('sellerCardChange') === 1) {

+ 1 - 1
components/cm-share-popup/cm-share-popup.vue

@@ -107,7 +107,7 @@ export default {
                     this.posterData = { ...this.posterData, ...this.data }
                     const { data: qrCodeImage } = await generateWxUnlimited(this, {
                         pagePath: this.posterData.path,
-                        queryStr: 'sellerUserId=' + this.userInfo.userId + '&id=' + this.posterData.id
+                        queryStr: 'suid=' + this.userInfo.userId + '&id=' + this.posterData.id + '&spId=' + this.userInfo.serviceProviderId
                     })
                     this.posterData.qrCodeImage = qrCodeImage
                     switch (this.type) {

+ 2 - 2
main.js

@@ -9,7 +9,7 @@ import ResidenceTime from './plugins/simple-residence-time'
 import residence from './utils/residence.js'
 
 // 友盟
-import Uma from './plugins/uma'
+// import Uma from './plugins/uma'
 
 // 公共组件 全局组件
 import { msg, modal, prePage, boundingClientRect } from './utils/util'
@@ -58,7 +58,7 @@ Vue.prototype.$Static = 'https://static.caimei365.com/app/img/'
 App.mpType = 'app'
 
 // 使用插件
-Vue.use(Uma)
+// Vue.use(Uma)
 Vue.use(ResidenceTime, residence)
 
 

+ 21 - 25
pages/goods/product.vue

@@ -618,7 +618,7 @@
         <cm-share-popup ref="sharePopup" :data="posterData" type="product"></cm-share-popup>
 
         <!-- 协销名片 -->
-        <cm-seller-modal :sellerUserId="sellerUserId"></cm-seller-modal>
+        <cm-seller-modal :suid="suid"></cm-seller-modal>
     </view>
 </template>
 
@@ -777,8 +777,9 @@ export default {
             returnGoodsStutas: false,
             helpContent: '',
             posterData: {}, // 商品详情
-            sellerUserId: 0 ,// 协销id
-            scene: {} //获取二维码参数 
+            suid: 0 ,// 协销id
+            scene: {} ,//获取二维码参数 
+            options: {},
         }
     },
     computed: {
@@ -831,14 +832,7 @@ export default {
         if (option.page == 2) {
             this.backPage = option.page
         }
-        const sellerUserId = option.sellerUserId ? option.sellerUserId : this.scene.sellerUserId ? this.scene.sellerUserId : 0
-        if(!uni.getStorageSync('sellerUserId')) {
-            uni.setStorageSync('sellerUserId', sellerUserId)
-        }
-        console.log('sellerUserId', uni.getStorageSync('sellerUserId'), sellerUserId)
-        // if (!uni.getStorageSync('sellerCardChange')) {
-        //     uni.setStorageSync('sellerCardChange', 1)
-        // }
+        this.options = option.scene ? this.scene : option
         this.getWinHeight()
     },
     onReady() {
@@ -1409,7 +1403,7 @@ export default {
             this.posterData = {
                 productName: this.product.name,
                 productImage: this.productImage[0],
-                sellerUserId: this.sellerUserId,
+                suid: this.suid,
                 path: 'pages/goods/product',
                 id: this.productId
             }
@@ -1601,9 +1595,9 @@ export default {
         }
         return {
             title: `${this.product.name}`,
-            path: `pages/goods/product?type=share&id=${this.productId}&sellerUserId=${
+            path: `pages/goods/product?type=4&id=${this.productId}&suid=${
                 this.userInfo.userIdentity === 1 ? this.userInfo.userId : 0
-            }`,
+            }&spId=${this.userInfo.userIdentity === 1 ? this.userInfo.serviceProviderId : 0}`,
             imageUrl: `${this.productImage[0]}`
         }
     },
@@ -1614,20 +1608,22 @@ export default {
             this.initGetStotage()
         }
         this.isPreviewImage = false
-        if (!uni.getStorageSync('spUserId')) {
-            this.sellerUserId = uni.getStorageSync('sellerUserId')
-        } else {
-            if (uni.getStorageSync('spUserId') === uni.getStorageSync('sellerUserId')) {
-                this.sellerUserId = uni.getStorageSync('sellerUserId')
+        console.log('userInfo', this.userInfo, this.options, this.scene, "uni.getStorageSync('suid')", uni.getStorageSync('suid'))
+        const suid = this.options.suid ? this.options.suid : this.scene.suid ? this.scene.suid : uni.getStorageSync('suid') > 0 ? uni.getStorageSync('suid') : 0 // 协销userId
+        const spId = this.options.spId ? this.options.spId : this.scene.spId ? this.scene.spId : uni.getStorageSync('spId') > 0 ? uni.getStorageSync('spId') : 0 // 协销id
+        if ((this.options.type == 4 || uni.getStorageSync('suid') > 0) && this.userInfo.userIdentity !== 1) { // 分享进入 且 用户非协销
+            if (!uni.getStorageSync('spUserId') || (uni.getStorageSync('spUserId') === uni.getStorageSync('suid'))) {// 如果未分配或者分配相同
+                this.suid = suid
+                uni.setStorageSync('suid', suid)
+                uni.setStorageSync('spId', spId)
             } else {
-                uni.setStorageSync('sellerUserId', 0)
-                this.sellerUserId = 0
+                uni.setStorageSync('suid', 0)
+                this.suid = 0
+                uni.setStorageSync('spId', 0)
             }
+            
         }
-        if (this.userInfo.userIdentity === 1) {
-            this.sellerUserId = 0
-            uni.setStorageSync('sellerUserId', 0)
-        }
+        console.log(this.suid)
     }
 }
 </script>

+ 4 - 1
pages/login/register.vue

@@ -171,7 +171,7 @@ export default {
                 source: 1,
                 unionId: '',
                 isSp: 1,
-                spId: uni.getStorageSync('sellerUserId') || '', // 协销分享的id
+                spId: '', // 协销分享的id
             },
             imageCode: '', //图形验证码
             imageCodeUrl: '', //图形验证码图片
@@ -249,6 +249,9 @@ export default {
                     self.wxLogin(res.userInfo)
                     self.params.nickName = res.userInfo.nickName
                     self.params.avatarUrl = res.userInfo.avatarUrl
+                    if (uni.getStorageSync('spId') && uni.getStorageSync('spId') > 0) {
+                        self.params.spId = uni.getStorageSync('spId')
+                    }
                     self.UserRegisterClub(self.params)
                     // 友盟自定义事件
                     if (process.env.NODE_ENV != 'development') {

+ 1 - 5
pages/seller/index/index.vue

@@ -100,11 +100,7 @@ export default {
     computed: {
         ...mapState(['userInfo'])
     },
-    // onShow() {
-    //     this.updateSellerNoticeNum() // 消息通知
-    // },
 	methods: {
-        // ...mapMutations(['updateSellerNoticeNum']),
 		// 切换组件
 		cut_index(type) {
 			this.show_index = type
@@ -148,7 +144,7 @@ export default {
 		}
 		return {
 			title: '生美医美正品采购服务平台',
-			path: `pages/tabBar/home/index?type=sellerShare&sellerUserId=${this.userInfo.userId || 0}`,
+			path: `pages/tabBar/home/index?type=4&suid=${this.userInfo.userId}&spId=${this.userInfo.serviceProviderId}`,
 			imageUrl: 'https://static.caimei365.com/app/img/bg/min-banner.jpg'
 		}
 	}

+ 7 - 4
pages/seller/notice/service/Institutional_visits.vue

@@ -22,15 +22,19 @@ export default {
         return {
             visitsList: [],
             accDateTime: '',
-            userInfo: {}
+            userInfo: {},
+            spId: ''
         }
     },
     onLoad(options) {
         this.accDateTime = options.accDateTime
+        this.spId = options.spId
+        console.log('options',options)
     },
     mounted() {
         this.userInfo = uni.getStorageSync('userInfo')
         this.getVisitesClubList()
+        console.log('visitsList', this.visitsList)
     },
     onReachBottom() {
     },
@@ -41,10 +45,9 @@ export default {
     },
     methods: {
         handlerVisits($event) {
-            uni.setStorageSync('visitsInfo', JSON.stringify($event))
             this.$api.navigateTo(
                 '/pages/seller/notice/service/visits_details?spId=' +
-                    this.userInfo.serviceProviderId +
+                    this.spId +
                     '&clubId=' +
                     $event.clubId +
                     '&accessTime=' +
@@ -53,7 +56,7 @@ export default {
         },
         async getVisitesClubList() {
             const { data } = await this.SellerService.getVisitesClubList({
-                spId: this.userInfo.serviceProviderId,
+                spId: this.spId,
                 accDateTime: this.accDateTime
             })
             this.visitsList = data

+ 7 - 1
pages/seller/notice/service/visits_details.vue

@@ -38,9 +38,15 @@ export default {
     methods: {
         handlerVisits($event) {},
         async getVisitesClubDetail() {
-            this.visitsInfo = JSON.parse(uni.getStorageSync('visitsInfo')) || {}
             const {data} = await this.SellerService.getVisitesClubInfo({accessTime: this.accessTime, spId: this.spId, clubId: this.clubId})
             this.detailList = data
+            this.visitsInfo = {
+                image: data[0].image,
+                linkMan: data[0].linkMan,
+                contractMobile: data[0].contractMobile,
+                pageLabel: data[0].pageLabel
+            }
+            console.log('visitsInfo', data)
         }
     }
 }

+ 19 - 17
pages/tabBar/home/index.vue

@@ -49,7 +49,7 @@
 			:beanNumber="beanNumber"
 			@cancel="handleBeanlClick"
 		></activityBean>
-        <cm-seller-modal :sellerUserId="sellerUserId"></cm-seller-modal>
+        <cm-seller-modal :suid="suid"></cm-seller-modal>
 	</view>
 </template>
 
@@ -69,6 +69,7 @@ import activityAlert from '@/components/cm-module/activity/activity.vue'
 import activityBean from '@/components/cm-module/activity/activityBean.vue'
 import quickOpera from '@/components/cm-module/homeIndex/quickOperation.vue'
 import cmSellerModal from '@/components/cm-share-popup/cm-seller-modal.vue'
+import wxLogin from '@/common/config/wxLogin.js'
 import homeMiXins from './index.js'
 export default {
 	mixins: [ homeMiXins ], 
@@ -127,30 +128,31 @@ export default {
 			couponEntry: 2,
 			autoplay: true,
             isScroll: false,
-            sellerUserId: 0, // 协销id
+            suid: 0, // 协销id
+            options: {}, // 分享数据
 		}
 	},
 	onLoad(option) {
-        console.log('options', option)
-        if(!uni.getStorageSync('sellerUserId')) {
-            uni.setStorageSync('sellerUserId', option.sellerUserId || 0)
-        }
+        this.options = option
     },
     onShow() {
-        if (!uni.getStorageSync('spUserId')) {
-            this.sellerUserId = uni.getStorageSync('sellerUserId')
-        } else {
-            if (uni.getStorageSync('spUserId') === uni.getStorageSync('sellerUserId')) {
-                this.sellerUserId = uni.getStorageSync('sellerUserId')
+        wxLogin.wxLoginAuthorize()
+        console.log('userInfo', this.userInfo, this.options, this.scene, "uni.getStorageSync('suid')", uni.getStorageSync('suid'))
+        const suid = this.options.suid ? this.options.suid : uni.getStorageSync('suid') > 0 ? uni.getStorageSync('suid') : 0 // 协销userId
+        const spId = this.options.spId ? this.options.spId : uni.getStorageSync('spId') > 0 ? uni.getStorageSync('spId') : 0 // 协销id
+        if ((this.options.type == 4 || uni.getStorageSync('suid') > 0) && this.userInfo.userIdentity !== 1) { // 分享进入 且 用户非协销
+            if (!uni.getStorageSync('spUserId') || (uni.getStorageSync('spUserId') === uni.getStorageSync('suid'))) {// 如果未分配或者分配相同
+                this.suid = suid
+                uni.setStorageSync('suid', suid)
+                uni.setStorageSync('spId', spId)
             } else {
-                uni.setStorageSync('sellerUserId', 0)
-                this.sellerUserId = 0
+                uni.setStorageSync('suid', 0)
+                this.suid = 0
+                uni.setStorageSync('spId', 0)
             }
+            
         }
-        if (this.userInfo.userIdentity === 1) {
-            this.sellerUserId = 0
-            uni.setStorageSync('sellerUserId', 0)
-        }
+        console.log(this.suid)
     },
     computed: {
         ...mapState(['hasLogin', 'userInfo'])