From 0c100f6c702db0dd8cf696c595e83fb3fead0232 Mon Sep 17 00:00:00 2001 From: xuxueyang <xuxy@fengyuntec.com> Date: 星期六, 03 八月 2024 14:17:54 +0800 Subject: [PATCH] add 分享 --- pages/login/supplier-login.vue | 20 ++++ sub_pages/customer/trade/list.vue | 24 ++++ pages/home/home.vue | 55 +++++----- sub_pages/partner/delivery/delivery-home.vue | 20 ++++ pages/home/supplier-home.vue | 26 ++++ sub_pages/customer/shop/shop.vue | 24 ++++ sub_pages/customer/trade/trade.vue | 24 ++++ pages/user/supplier-user.vue | 58 +++++++++-- sub_pages/customer/trade/detail.vue | 41 ++++++- 9 files changed, 243 insertions(+), 49 deletions(-) diff --git a/pages/home/home.vue b/pages/home/home.vue index 900bce8..a01f944 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -22,9 +22,9 @@ <view class="search-container m-t-12 flex" @click="goto('/pages/home/components/home-search',false)"> <view class="flex1 input"> <u-input placeholder="请输入花名" disabled v-model="search_flow"> - <template slot="suffix"> + <template slot="suffix"> <!-- @click="buttonSearchFlow" --> - <uni-icons color="#20613D" type="search" size="24" ></uni-icons> + <uni-icons color="#20613D" type="search" size="24"></uni-icons> </template> </u-input> </view> @@ -165,32 +165,33 @@ currentNotice: {} }; }, - // onShareAppMessage() { - // let that = this; - // var url = - // `/pages/home/home?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${this.currentInfo&&this.currentInfo.nickName||''}`; //你的转发页面路径拼接参数 - // return { - // title: "校购GO小狗狗", - // path: url, - // } - // }, - // onShareTimeline() { - // let that = this; - // var url = "/pages/home/home" //你的分享页面路径 - // return { - // title: '校购GO小狗狗', - // path: url, - // query: `shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${this.currentInfo&&this.currentInfo.nickName||''}`, //你的参数拼接,注意:不需要加? - // // imageUrl: 'https://cdn.uviewui.com/uview/swiper/1.jpg' //你分享的封面 - // }; - // }, + onShareAppMessage() { + let that = this; + var name = that.currentInfo.customerDTO&¤tInfo.customerDTO.name || that.currentInfo.supplierDTO&¤tInfo.supplierDTO.name || that.currentInfo.partnerDTO&¤tInfo.partnerDTO.name || '' + var url = + `/pages/home/home?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫", + path: url, + } + }, + onShareTimeline() { + let that = this; + var name = that.currentInfo.customerDTO&¤tInfo.customerDTO.name || that.currentInfo.supplierDTO&¤tInfo.supplierDTO.name || that.currentInfo.partnerDTO&¤tInfo.partnerDTO.name || '' + var url = + `/pages/home/home?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫", + path: url, + } + }, - onLoad(options) { - // if(options.partnerUserId){ - // //需要前往注册了 - // uni.navigateTo({ - // url: '/pages/login/supplier-login' - // }) + onLoad(options) { + // if(options.partnerUserId){ + // //需要前往注册了 + // uni.navigateTo({ + // url: '/pages/login/supplier-login' + // }) // } // console.log('home created') //这里进行一次初始化即可 diff --git a/pages/home/supplier-home.vue b/pages/home/supplier-home.vue index 0693bff..6eee11a 100644 --- a/pages/home/supplier-home.vue +++ b/pages/home/supplier-home.vue @@ -204,6 +204,28 @@ }; }, + onShareAppMessage() { + let that = this; + var name = that.currentInfo.customerDTO && currentInfo.customerDTO.name || that.currentInfo.supplierDTO && + currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && currentInfo.partnerDTO.name || '' + var url = + `/pages/login/supplier-login?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫", + path: url, + } + }, + onShareTimeline() { + let that = this; + var name = that.currentInfo.customerDTO && currentInfo.customerDTO.name || that.currentInfo.supplierDTO && + currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && currentInfo.partnerDTO.name || '' + var url = + `/pages/login/supplier-login?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫", + path: url, + } + }, async onPullDownRefresh() { await this.$store.dispatch('getCurrentInfo') uni.stopPullDownRefresh() @@ -289,7 +311,7 @@ } }, fail: (res) => { - console.log("蓝牙状态",res) + console.log("蓝牙状态", res) that.$message.showToast('获取蓝牙状态失败') } @@ -350,7 +372,7 @@ }, fail: function(res) { - console.log('createBLEConnection fail',res) + console.log('createBLEConnection fail', res) that.$message.showToast('连接打印机失败') }, complete() { diff --git a/pages/login/supplier-login.vue b/pages/login/supplier-login.vue index ed2e6b5..a16e302 100644 --- a/pages/login/supplier-login.vue +++ b/pages/login/supplier-login.vue @@ -186,6 +186,26 @@ } // #endif + }, + onShareAppMessage() { + let that = this; + var name = that.currentInfo.customerDTO&¤tInfo.customerDTO.name || that.currentInfo.supplierDTO&¤tInfo.supplierDTO.name || that.currentInfo.partnerDTO&¤tInfo.partnerDTO.name || '' + var url = + `/pages/login/supplier-login?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫", + path: url, + } + }, + onShareTimeline() { + let that = this; + var name = that.currentInfo.customerDTO&¤tInfo.customerDTO.name || that.currentInfo.supplierDTO&¤tInfo.supplierDTO.name || that.currentInfo.partnerDTO&¤tInfo.partnerDTO.name || '' + var url = + `/pages/login/supplier-login?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫", + path: url, + } }, data() { return { diff --git a/pages/user/supplier-user.vue b/pages/user/supplier-user.vue index f6eb393..552aac9 100644 --- a/pages/user/supplier-user.vue +++ b/pages/user/supplier-user.vue @@ -336,14 +336,51 @@ order_pendding_num: 0, }; - }, - // watch: { - // currentInfo(nv, ov) { - // if (!cacheUserId) { - - // } - // } - // }, + }, + // #ifndef PUB_CUSTOMER + onShareAppMessage() { + let that = this; + var name = that.currentInfo.customerDTO&¤tInfo.customerDTO.name || that.currentInfo.supplierDTO&¤tInfo.supplierDTO.name || that.currentInfo.partnerDTO&¤tInfo.partnerDTO.name || '' + var url = + `/pages/login/supplier-login?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫", + path: url, + } + }, + onShareTimeline() { + let that = this; + var name = that.currentInfo.customerDTO&¤tInfo.customerDTO.name || that.currentInfo.supplierDTO&¤tInfo.supplierDTO.name || that.currentInfo.partnerDTO&¤tInfo.partnerDTO.name || '' + var url = + `/pages/login/supplier-login?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫", + path: url, + } + }, + // #endif + // #ifdef PUB_CUSTOMER + onShareAppMessage() { + let that = this; + var name = that.currentInfo.customerDTO&¤tInfo.customerDTO.name || that.currentInfo.supplierDTO&¤tInfo.supplierDTO.name || that.currentInfo.partnerDTO&¤tInfo.partnerDTO.name || '' + var url = + `/pages/home/home?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫", + path: url, + } + }, + onShareTimeline() { + let that = this; + var name = that.currentInfo.customerDTO&¤tInfo.customerDTO.name || that.currentInfo.supplierDTO&¤tInfo.supplierDTO.name || that.currentInfo.partnerDTO&¤tInfo.partnerDTO.name || '' + var url = + `/pages/home/home?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫", + path: url, + } + }, + // #endif onShow() { this.getTj() }, @@ -392,7 +429,7 @@ console.log('条码内容:' + res.result); var dto = undefined try { - if (res.result && res.result.startsWith('http://') && res.result.indexOf( + if (res.result && (res.result.startsWith('https://')||res.result.startsWith('http://')) && res.result.indexOf( 'partnerUserId') >= 0) { var arr = res.result.split("?")[1].split("&") dto = {} @@ -417,7 +454,8 @@ } else { that.$message.showToast('二维码格式不正确扫码失败') } - } catch (e) { + } catch (e) { + console.log('e',e) that.$message.showToast('二维码扫码错误') } }, diff --git a/sub_pages/customer/shop/shop.vue b/sub_pages/customer/shop/shop.vue index 4ce52a8..4f97dd5 100644 --- a/sub_pages/customer/shop/shop.vue +++ b/sub_pages/customer/shop/shop.vue @@ -205,6 +205,30 @@ this.query.supplierId = this.id this.getList('post') }, + // #ifdef PUB_CUSTOMER + onShareAppMessage() { + let that = this; + var name = that.currentInfo.customerDTO && currentInfo.customerDTO.name || that.currentInfo.supplierDTO && + currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && currentInfo.partnerDTO.name || '' + var url = + `/sub_pages/customer/shop/shop?id=${this.id}&shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: this.dto.id && this.dto.name ? (this.dto.name + " 的店铺") : "花满芫", + path: url, + } + }, + onShareTimeline() { + let that = this; + var name = that.currentInfo.customerDTO && currentInfo.customerDTO.name || that.currentInfo.supplierDTO && + currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && currentInfo.partnerDTO.name || '' + var url = + `/sub_pages/customer/shop/shop?id=${this.id}&shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: this.dto.id && this.dto.name ? (this.dto.name + " 的店铺") : "花满芫", + path: url, + } + }, + // #endif onReachBottom() { if (this.flg === '0') { this.getMore('post') diff --git a/sub_pages/customer/trade/detail.vue b/sub_pages/customer/trade/detail.vue index 5b10de5..1748d7e 100644 --- a/sub_pages/customer/trade/detail.vue +++ b/sub_pages/customer/trade/detail.vue @@ -148,9 +148,9 @@ shopnum: 0, } }, - onShow() { - if (this.id) { - this.getDetail() + onShow() { + if (this.id) { + this.getDetail() } this.refreshShopNum() }, @@ -161,6 +161,31 @@ } this.refreshShopNum() }, + // #ifdef PUB_CUSTOMER + onShareAppMessage() { + let that = this; + var name = that.currentInfo.customerDTO && currentInfo.customerDTO.name || that.currentInfo.supplierDTO && + currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && currentInfo.partnerDTO.name || '' + var url = + `/sub_pages/customer/trade/detail?id=${this.id}&shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + + title: this.dto.id ? (this.dto.name + " " + (this.dto.price || '-') + '元/扎 ' + (this.dto.unit || '')) : "花满芫", + path: url, + } + }, + onShareTimeline() { + let that = this; + var name = that.currentInfo.customerDTO && currentInfo.customerDTO.name || that.currentInfo.supplierDTO && + currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && currentInfo.partnerDTO.name || '' + var url = + `/sub_pages/customer/trade/detail?id=${this.id}&shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: this.dto.id ? (this.dto.name + " " + (this.dto.price || '-') + '元/扎 ' + (this.dto.unit || '')) : "花满芫", + path: url, + } + }, + // #endif methods: { async updateItemNum(item) { const res = await this.$message.confirm('', { @@ -175,7 +200,7 @@ } else { if (!item.stock || t > item.stock) { - this.$message.showToast('库存不足无法修改') + this.$message.showToast('库存不足无法修改') return } this.addnum(item, (t - item.shopnum)) @@ -219,16 +244,16 @@ }) this.$message.hideLoading() if (code === 0) { - item.shopnum += addnum + item.shopnum += addnum this.refreshShopNum() this.$forceUpdate() } }, async refreshShopNum() { - this.shopnum = await this.$store.dispatch('countShopping'); - this.$store.dispatch('sign_add','shopnum') - + this.shopnum = await this.$store.dispatch('countShopping'); + this.$store.dispatch('sign_add', 'shopnum') + }, async collectItem(dto) { if (!this.currentInfo.id) { diff --git a/sub_pages/customer/trade/list.vue b/sub_pages/customer/trade/list.vue index 4924d66..b65b6ef 100644 --- a/sub_pages/customer/trade/list.vue +++ b/sub_pages/customer/trade/list.vue @@ -184,7 +184,29 @@ [] ] } - }, + }, + // #ifdef PUB_CUSTOMER + onShareAppMessage() { + let that = this; + var name = that.currentInfo.customerDTO&¤tInfo.customerDTO.name || that.currentInfo.supplierDTO&¤tInfo.supplierDTO.name || that.currentInfo.partnerDTO&¤tInfo.partnerDTO.name || '' + var url = + `/sub_pages/customer/trade/list?category=${this.query.category}&zoneId=${this.query.zoneId}&name=${this.query.name}&shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫-商品列表", + path: url, + } + }, + onShareTimeline() { + let that = this; + var name = that.currentInfo.customerDTO&¤tInfo.customerDTO.name || that.currentInfo.supplierDTO&¤tInfo.supplierDTO.name || that.currentInfo.partnerDTO&¤tInfo.partnerDTO.name || '' + var url = + `/sub_pages/customer/trade/list?category=${this.query.category}&zoneId=${this.query.zoneId}&name=${this.query.name}&shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫-商品列表", + path: url, + } + }, + // #endif async onLoad(options) { // this.list = [{},{}] console.log('options', options) diff --git a/sub_pages/customer/trade/trade.vue b/sub_pages/customer/trade/trade.vue index f576d1c..0c5ff7f 100644 --- a/sub_pages/customer/trade/trade.vue +++ b/sub_pages/customer/trade/trade.vue @@ -109,7 +109,29 @@ currentCategory: {} } - }, + }, + // #ifdef PUB_CUSTOMER + onShareAppMessage() { + let that = this; + var name = that.currentInfo.customerDTO&¤tInfo.customerDTO.name || that.currentInfo.supplierDTO&¤tInfo.supplierDTO.name || that.currentInfo.partnerDTO&¤tInfo.partnerDTO.name || '' + var url = + `/pages/home/home?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫", + path: url, + } + }, + onShareTimeline() { + let that = this; + var name = that.currentInfo.customerDTO&¤tInfo.customerDTO.name || that.currentInfo.supplierDTO&¤tInfo.supplierDTO.name || that.currentInfo.partnerDTO&¤tInfo.partnerDTO.name || '' + var url = + `/pages/home/home?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫", + path: url, + } + }, + // #endif onPullDownRefresh() { this.$http.request('get', '/api/customer/flower/category/tree', {}).then(res => { var data = res.data diff --git a/sub_pages/partner/delivery/delivery-home.vue b/sub_pages/partner/delivery/delivery-home.vue index 2b0ff8b..cda761a 100644 --- a/sub_pages/partner/delivery/delivery-home.vue +++ b/sub_pages/partner/delivery/delivery-home.vue @@ -123,6 +123,26 @@ created() { }, + onShareAppMessage() { + let that = this; + var name = that.currentInfo.customerDTO&¤tInfo.customerDTO.name || that.currentInfo.supplierDTO&¤tInfo.supplierDTO.name || that.currentInfo.partnerDTO&¤tInfo.partnerDTO.name || '' + var url = + `/pages/login/supplier-login?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫", + path: url, + } + }, + onShareTimeline() { + let that = this; + var name = that.currentInfo.customerDTO&¤tInfo.customerDTO.name || that.currentInfo.supplierDTO&¤tInfo.supplierDTO.name || that.currentInfo.partnerDTO&¤tInfo.partnerDTO.name || '' + var url = + `/pages/login/supplier-login?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫", + path: url, + } + }, async onPullDownRefresh() { await this.$store.dispatch('getCurrentInfo') uni.stopPullDownRefresh() -- Gitblit v1.9.3