From 8c711250b985463a8fc6692b7af39c2fd795bf40 Mon Sep 17 00:00:00 2001 From: "DESKTOP-GMUNQ1B\\k" <1154079537@qq.com> Date: Tue, 2 Apr 2024 16:37:05 +0800 Subject: [PATCH 1/2] 1 --- api/store.js | 18 +- config/app.js | 6 +- pages/payment/get_payment.vue | 8 +- pages/store/home/index.vue | 4207 +++++++++++++------------ pages/store/settled/index.vue | 94 +- pages/users/user_modify_pwd/index.vue | 5 +- utils/uniMPevent.js | 152 +- 7 files changed, 2260 insertions(+), 2230 deletions(-) diff --git a/api/store.js b/api/store.js index 1c96d40..a22f2cd 100644 --- a/api/store.js +++ b/api/store.js @@ -100,7 +100,7 @@ export function getCategoryIndexList() { * 获取产品列表 * @param object data */ -export function getProductslist(data, enLoad=false) { +export function getProductslist(data, enLoad = false) { if (data.brand_id && Array.isArray(data.brand_id)) { data = { ...data @@ -109,7 +109,7 @@ export function getProductslist(data, enLoad=false) { } return request.get('product/spu/lst', data, { noAuth: true, - enLoad: enLoad + enLoad: enLoad }); } /** @@ -140,22 +140,22 @@ export function getBrandlist(data) { * 获取推荐产品 * */ -export function getProductHot(page, limit, sale_type, rand=0, enLoad=false) { +export function getProductHot(page, limit, sale_type, rand = 0, enLoad = false) { return request.get("product/spu/recommend", { page: page === undefined ? 1 : page, limit: limit === undefined ? 10 : limit, - sale_type: sale_type || null, - rand: rand + sale_type: sale_type || null, + rand: rand }, { noAuth: true, - enLoad: enLoad + enLoad: enLoad }); } /** * 获取商户推荐产品 * */ -export function getMerProductHot(id,data) { +export function getMerProductHot(id, data) { return request.get(`product/spu/recommend`, { page: data.page === undefined ? 1 : data.page, limit: data.limit === undefined ? 10 : data.limit, @@ -559,11 +559,11 @@ export function getParmasValue(id) { * */ export function arrivalNoticeApi(data) { - return request.post('store/product/increase_take',data); + return request.post('store/product/increase_take', data); } /* 获取图片验证码 -*/ +*/ export function getCaptcha() { return request.get('captcha'); } diff --git a/config/app.js b/config/app.js index 1972ab4..d890ef2 100644 --- a/config/app.js +++ b/config/app.js @@ -57,9 +57,9 @@ module.exports = { // 聊天长连接地址 VUE_APP_WS_URL: wsApi ? `${wsApi}?type=user` : VUE_APP_WS_URL, // #endif - HTTP_REQUEST_URL_SIX: httpSix, + HTTP_REQUEST_URL_SIX: httpSix, openPlantGrass: openPlantGrass, - ENV: env, + ENV: env, HEADER: { 'content-type': 'application/json', //#ifdef H5 @@ -76,4 +76,4 @@ module.exports = { TOKENNAME: 'X-Token', // 缓存时间 0 永久 EXPIRE: 0, -}; +}; \ No newline at end of file diff --git a/pages/payment/get_payment.vue b/pages/payment/get_payment.vue index b1e559f..746402a 100644 --- a/pages/payment/get_payment.vue +++ b/pages/payment/get_payment.vue @@ -210,6 +210,12 @@ title: "请输入付款金额" }) } + if (!this.merchantInfo || this.merchantInfo.length == 0) { + return this.$util.Tips({ + title: "该商家当前价格下,无对应商品!" + }) + } + this.loading = true; if (that.merchantInfo && that.merchantInfo.length > 0) { // 循环加入购物车 @@ -257,7 +263,7 @@ money: that.cartForm.total_amount }).then(res => { this.loading = false; - if (!that.cartForm.total_amount) { + if (!that.cartForm.total_amount && !this.mer_name) { this.mer_name = res.data.merchant; } else { that.merchantInfo = res.data.list; diff --git a/pages/store/home/index.vue b/pages/store/home/index.vue index 73a0dc8..3fcae29 100644 --- a/pages/store/home/index.vue +++ b/pages/store/home/index.vue @@ -1,19 +1,20 @@ \ No newline at end of file diff --git a/pages/store/settled/index.vue b/pages/store/settled/index.vue index d775b70..c8fe219 100644 --- a/pages/store/settled/index.vue +++ b/pages/store/settled/index.vue @@ -192,7 +192,7 @@ - + @@ -266,8 +266,8 @@ 验证码 - + @@ -521,7 +521,7 @@ this.getGoodsDetails(options.mer_i_id) }) } else this.getCity(); - this.shoplist('mer_services_agree'); + this.shoplist('mer_services_agree'); this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 45; }, @@ -699,12 +699,12 @@ this.street_id = resData.street_id this.village_id = resData.village_id; - const bankInfo = resData.financial_bank ? JSON.parse(resData.financial_bank) : ''; - this.$set(this.merchantData, 'bank_code', bankInfo.bank_code); - this.$set(this.merchantData, 'bank_username', bankInfo.bank); - this.$set(this.merchantData, 'bank_opening', bankInfo.bank_branch); - this.$set(this.merchantData, 'bank_card_username', bankInfo.name); - this.bank_front = bankInfo.bank_front[0] ? bankInfo.bank_front[0] : ''; + // const bankInfo = resData.financial_bank ? JSON.parse(resData.financial_bank) : ''; + // this.$set(this.merchantData, 'bank_code', bankInfo.bank_code); + // this.$set(this.merchantData, 'bank_username', bankInfo.bank); + // this.$set(this.merchantData, 'bank_opening', bankInfo.bank_branch); + // this.$set(this.merchantData, 'bank_card_username', bankInfo.name); + // this.bank_front = bankInfo.bank_front[0] ? bankInfo.bank_front[0] : ''; this.nature_business = resData.is_company == 1 ? 1 : 2; @@ -766,7 +766,7 @@ let idx = e.target.value this.merchantData.mer_type = this.storeTypeArr[idx]['mer_type_id'] this.mer_storeType = this.storeTypeArr[idx]['type_name'] - this.shoplist('mer_services_agree') + this.shoplist('mer_services_agree') // if (this.storeTypeArr[idx]['type_code'] == 'TypeStore' && this.merchantData.mer_type) { // this.shoplist('mer_services_agree') // } else { @@ -1001,15 +1001,15 @@ village_id: this.village_id, is_nmsc: this.isnum, images: [this.business_license, ...that.pics], - financial_bank: { - // 开户信息 - bank_code: this.merchantData.bank_code, - bank: this.merchantData.bank_username, - bank_branch: this.merchantData.bank_opening, - name: this.nature_business == 1 ? that.merchantData.company_name : this.merchantData - .bank_card_username, - bank_front: [this.bank_front] - } + // financial_bank: { + // // 开户信息 + // bank_code: this.merchantData.bank_code, + // bank: this.merchantData.bank_username, + // bank_branch: this.merchantData.bank_opening, + // name: this.nature_business == 1 ? that.merchantData.company_name : this.merchantData + // .bank_card_username, + // bank_front: [this.bank_front] + // } } that.validate = false; @@ -1138,35 +1138,35 @@ }); - if (this.nature_business == 1 && !this.merchantData.bank_code) { - return that.$util.Tips({ - title: '请输入对公账号' - }); - } + // if (this.nature_business == 1 && !this.merchantData.bank_code) { + // return that.$util.Tips({ + // title: '请输入对公账号' + // }); + // } - if (this.nature_business != 1 && !this.merchantData.bank_code) { - return that.$util.Tips({ - title: '请输入银行卡号' - }); - } + // if (this.nature_business != 1 && !this.merchantData.bank_code) { + // return that.$util.Tips({ + // title: '请输入银行卡号' + // }); + // } - if (!this.merchantData.bank_username) { - return that.$util.Tips({ - title: '请输入开户银行' - }); - } + // if (!this.merchantData.bank_username) { + // return that.$util.Tips({ + // title: '请输入开户银行' + // }); + // } - if (!this.merchantData.bank_opening) { - return that.$util.Tips({ - title: '请输入开户网点' - }); - } + // if (!this.merchantData.bank_opening) { + // return that.$util.Tips({ + // title: '请输入开户网点' + // }); + // } - if (this.nature_business == 0 && !this.merchantData.bank_card_username) { - return that.$util.Tips({ - title: '请输入持卡人姓名' - }); - } + // if (this.nature_business == 0 && !this.merchantData.bank_card_username) { + // return that.$util.Tips({ + // title: '请输入持卡人姓名' + // }); + // } that.validate = true; return true; @@ -1614,7 +1614,7 @@ position: fixed; top: 0; left: 0; - z-index: 12; + z-index: 12; background: rgba(0, 0, 0, .5); } diff --git a/pages/users/user_modify_pwd/index.vue b/pages/users/user_modify_pwd/index.vue index 2e6ae1d..6dbc11a 100644 --- a/pages/users/user_modify_pwd/index.vue +++ b/pages/users/user_modify_pwd/index.vue @@ -173,7 +173,7 @@ }).catch((err) => { that.$util.Tips({ title: err, - icon: 'success' + icon: 'none' }) }) } else { // 登录密码 @@ -191,7 +191,8 @@ }); }).catch(err => { return that.$util.Tips({ - title: err + title: err, + icon: "none" }); }) } diff --git a/utils/uniMPevent.js b/utils/uniMPevent.js index f051aec..b5b5a53 100644 --- a/utils/uniMPevent.js +++ b/utils/uniMPevent.js @@ -1,74 +1,90 @@ const mp = uni.requireNativePlugin('uniMP'); import { - uniMPgetLocation, - test + uniMPgetLocation, + test } from "@/utils/uniMPfunction.js" export const initEvent = () => { - mp.onUniMPEventReceive(async (ret) => { - console.log('小程序事件: ', ret); - if (ret.event == 'closeApp') { - mp.closeUniMP(ret.fromAppid, (ret) => { - console.log('closeUniMP: ' + JSON.stringify(ret)); - }); - } - if (ret.event == 'getLocation') { - try { - console.log('获取定位'); - let res = await uniMPgetLocation(); - console.log(res); - // plus.geolocation.getCurrentPosition(function(position) { - // console.log('经度:' + position.coords.longitude); - // console.log('纬度:' + position.coords.latitude); - // // that.markers[1].latitude = position.coords.longitude; - // // that.markers[1].longitude = position.coords.longitude; - // mp.sendUniMPEvent( - // ret.fromAppid, - // 'getLocation', {...position.coords}, - // (ret) => { - // console.log('Host sendEvent: ' + JSON.stringify(ret)); - // }); - // }, function(error) { - // console.error('获取位置失败:', error.message); - // }, {provider:'gps'}); - mp.sendUniMPEvent( - ret.fromAppid, - 'getLocation', {...res}, - (ret) => { - console.log('Host sendEvent: ' + JSON.stringify(ret)); - }); - } catch (e) { - console.log(e); - } - } - if (ret.event == 'test') { - console.log('测试'); - mp.sendUniMPEvent( - ret.fromAppid, - 'test', { 'key': 'value', 'name': 'data' }, - (ret) => { - console.log('Host sendEvent: ' + JSON.stringify(ret)); - }); - } - if (ret.event == 'log') { - // console.log('2222222') - - console.log('收到小程序事件: ' + JSON.stringify(ret)); - } - - //直播小程序跳转商城购买商品 - if (ret.event == 'live_shop') { - console.log(JSON.stringify(ret)) - let arr1=ret.data - mp.closeUniMP(ret.fromAppid, (ret) => { - // console.log('closeUniMP: ' + JSON.stringify(ret)); - setTimeout(()=>{ - uni.navigateTo({ - url:'/pages/goods_details/index?id='+arr1.app_goods_id - },1000) - }) - }); - // console.log('收到小程序事件: ' + JSON.stringify(ret)); - } - }); + mp.onUniMPEventReceive(async (ret) => { + console.log('小程序事件: ', ret); + + // 用户如果没有注册商户 从小程序返回 入驻页面 + if (ret.event == 'closeAppToOpenShop') { + mp.closeUniMP(ret.fromAppid, (ret) => { + uni.navigateTo({ + url: "/pages/store/settled/index" + }) + }); + } + + if (ret.event == 'closeApp') { + mp.closeUniMP(ret.fromAppid, (ret) => { + console.log('closeUniMP: ' + JSON.stringify(ret)); + }); + } + if (ret.event == 'getLocation') { + try { + console.log('获取定位'); + let res = await uniMPgetLocation(); + console.log(res); + // plus.geolocation.getCurrentPosition(function(position) { + // console.log('经度:' + position.coords.longitude); + // console.log('纬度:' + position.coords.latitude); + // // that.markers[1].latitude = position.coords.longitude; + // // that.markers[1].longitude = position.coords.longitude; + // mp.sendUniMPEvent( + // ret.fromAppid, + // 'getLocation', {...position.coords}, + // (ret) => { + // console.log('Host sendEvent: ' + JSON.stringify(ret)); + // }); + // }, function(error) { + // console.error('获取位置失败:', error.message); + // }, {provider:'gps'}); + mp.sendUniMPEvent( + ret.fromAppid, + 'getLocation', { + ...res + }, + (ret) => { + console.log('Host sendEvent: ' + JSON.stringify(ret)); + }); + } catch (e) { + console.log(e); + } + } + if (ret.event == 'test') { + console.log('测试'); + mp.sendUniMPEvent( + ret.fromAppid, + 'test', { + 'key': 'value', + 'name': 'data' + }, + (ret) => { + console.log('Host sendEvent: ' + JSON.stringify(ret)); + }); + } + if (ret.event == 'log') { + // console.log('2222222') + + console.log('收到小程序事件: ' + JSON.stringify(ret)); + } + + //直播小程序跳转商城购买商品 + if (ret.event == 'live_shop') { + console.log(JSON.stringify(ret)) + let arr1 = ret.data + mp.closeUniMP(ret.fromAppid, (ret) => { + // console.log('closeUniMP: ' + JSON.stringify(ret)); + setTimeout(() => { + uni.navigateTo({ + url: '/pages/goods_details/index?id=' + arr1 + .app_goods_id + }, 1000) + }) + }); + // console.log('收到小程序事件: ' + JSON.stringify(ret)); + } + }); } \ No newline at end of file From 436ee0e6bca919e32a60835b6d7a2ccf26385f73 Mon Sep 17 00:00:00 2001 From: "DESKTOP-GMUNQ1B\\k" <1154079537@qq.com> Date: Tue, 2 Apr 2024 17:44:48 +0800 Subject: [PATCH 2/2] 1 --- pages/store/home/index.vue | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/pages/store/home/index.vue b/pages/store/home/index.vue index 3fcae29..4debee5 100644 --- a/pages/store/home/index.vue +++ b/pages/store/home/index.vue @@ -567,10 +567,6 @@ }], // 底部菜单 tabs3: [{ - icon: 'icon-yizhan_o', - name: '云商品', - value: 7, - }, { icon: 'icon-gouwu_o', name: '商品', value: 3, @@ -677,12 +673,26 @@ } } // #endif - this.getStore(); this.diyData(); shareScence(this.currSpid, this.isLogin); this.initHeight(); + + // 判断是否有云商品,如果没有 就不展示这个tab + getStoreCloudGoods(this.id, { + page: 1, + limit: 1 + }).then(res => { + const data = res.data.list; + if (data && data.length > 0) { + this.tabs3.unshift({ + icon: 'icon-yizhan_o', + name: '云商品', + value: 7, + }) + } + }) }, /**