From 09485747a640b1b6474270bd96c529dd05ffedde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E5=BE=88=E5=B7=AE=E5=95=A6?= <17633066053@163.com> Date: Wed, 20 Jul 2022 18:24:49 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BB=85=E4=BE=9B=E6=B5=8B=E8=AF=95]=E9=87=8D?= =?UTF-8?q?=E5=86=99navigateTo=E6=96=B9=E6=B3=95=EF=BC=8C=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B=E5=BA=8F=E4=B8=AD?= =?UTF-8?q?=E8=B6=85=E8=BF=8710=E4=B8=AA=E9=A1=B5=E9=9D=A2=E6=A0=88?= =?UTF-8?q?=E6=97=B6=E4=BC=9A=E5=87=BA=E7=8E=B0=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 469 +++++++++--------- components/m-buy/goods.vue | 112 ++--- components/m-goods-list/list.vue | 8 +- components/m-goods-recommend/index.vue | 2 +- main.js | 6 +- pages/cart/coupon/couponCenter.vue | 2 +- pages/cart/coupon/myCoupon.vue | 4 +- pages/cart/payment/payOrder.vue | 16 +- pages/mine/address/add.vue | 6 +- pages/mine/address/address.vue | 4 +- pages/mine/address/addressManage.vue | 2 +- pages/mine/deposit/operation.vue | 2 +- pages/mine/deposit/recharge.vue | 2 +- pages/mine/distribution/home.vue | 4 +- pages/mine/distribution/list.vue | 2 +- pages/mine/msgTips/main.vue | 2 +- pages/mine/msgTips/packageMsg/index.vue | 2 +- pages/mine/myCollect.vue | 4 +- pages/mine/myTracks.vue | 6 +- pages/mine/set/editionIntro.vue | 2 +- .../set/securityCenter/securityCenter.vue | 2 +- pages/mine/set/setUp.vue | 2 +- pages/navigation/search/searchPage.vue | 4 +- pages/order/afterSales/afterSales.vue | 10 +- pages/order/afterSales/afterSalesSelect.vue | 2 +- pages/order/afterSales/applyDetail.vue | 4 +- pages/order/complain/complainList.vue | 4 +- pages/order/evaluate/myEvaluate.vue | 4 +- pages/order/fillorder.vue | 4 +- pages/order/myOrder.vue | 16 +- pages/order/orderDetail.vue | 20 +- pages/passport/login.vue | 6 +- pages/product/goods.vue | 10 +- .../product/evaluation/-evaluation.vue | 2 +- pages/product/product/popup/address.vue | 4 +- pages/product/product/shop/-shop.vue | 4 +- pages/product/shopList.vue | 2 +- pages/product/shopPage.vue | 30 +- pages/promotion/bargain/list.vue | 2 +- pages/promotion/bargain/log.vue | 2 +- pages/promotion/joinGroup.vue | 2 +- pages/promotion/lives.vue | 2 +- pages/promotion/point/pointList.vue | 4 +- pages/promotion/seckill.vue | 2 +- pages/tabbar/cart/cartList.vue | 12 +- pages/tabbar/category/category.vue | 4 +- pages/tabbar/home/template/tpl_goods.vue | 2 +- .../home/template/tpl_promotions_detail.vue | 8 +- pages/tabbar/home/template/tpl_search.vue | 2 +- pages/tabbar/home/views.vue | 14 +- pages/tabbar/screen/fullScreen.vue | 4 +- pages/tabbar/user/my.vue | 2 +- pages/tabbar/user/similarGoods.vue | 2 +- pages/tabbar/user/utils/tool.vue | 8 +- utils/navigateRoute.js | 24 + uview-ui/components/u-parse/libs/trees.vue | 4 +- uview-ui/components/u-parse/u-parse.vue | 4 +- uview-ui/components/u-toast/u-toast.vue | 2 +- 58 files changed, 472 insertions(+), 421 deletions(-) create mode 100644 utils/navigateRoute.js diff --git a/App.vue b/App.vue index 42b33aa..6290180 100644 --- a/App.vue +++ b/App.vue @@ -1,234 +1,257 @@ - - diff --git a/components/m-buy/goods.vue b/components/m-buy/goods.vue index 60724a3..e73204f 100644 --- a/components/m-buy/goods.vue +++ b/components/m-buy/goods.vue @@ -46,20 +46,20 @@ formatPrice(item.price)[0] }} .{{ formatPrice(item.price)[1] }} - - - {{item.num}}{{goodsDetail.goodsUnit}} + + + {{item.num}}{{goodsDetail.goodsUnit}} - -
- - ¥ - {{ - formatPrice(goodsDetail.price)[0] - }} - .{{ formatPrice(goodsDetail.price)[1] }} - +
+
+ + ¥ + {{ + formatPrice(goodsDetail.price)[0] + }} + .{{ formatPrice(goodsDetail.price)[1] }} +
@@ -68,12 +68,12 @@ {{ selectName }} ,{{ num }}个 - - - 库存 - - {{ goodsDetail.quantity }} - + + + 库存 + + {{ goodsDetail.quantity }} + @@ -101,7 +101,7 @@ 数量 - + @@ -133,14 +133,14 @@ formatList: [], currentSelceted: [], skuList: "", - isClose: false, //是否可以点击遮罩关闭 + isClose: false, //是否可以点击遮罩关闭 }; }, - props: { - wholesaleList:{ - type: null, - default: false, + props: { + wholesaleList:{ + type: null, + default: false, }, buyMask: { type: Boolean, @@ -170,23 +170,23 @@ default: "", type: null, }, - }, - computed: { - wholesalePrice(key){ - return this.wholesaleList.length ? this.wholesaleList.map(item=>{ return item.price }) :[] - }, - wholesaleNum(key){ - return this.wholesaleList.length ? this.wholesaleList.map(item=>{ return item.num }) :[] - } }, - watch: { - num(val){ - if(val){ - if(val > this.goodsDetail.quantity){ - console.log(val) - this.val = this.goodsDetail.quantity - } - } + computed: { + wholesalePrice(key){ + return this.wholesaleList.length ? this.wholesaleList.map(item=>{ return item.price }) :[] + }, + wholesaleNum(key){ + return this.wholesaleList.length ? this.wholesaleList.map(item=>{ return item.num }) :[] + } + }, + watch: { + num(val){ + if(val){ + if(val > this.goodsDetail.quantity){ + console.log(val) + this.val = this.goodsDetail.quantity + } + } }, buyType: { handler(val) { @@ -263,7 +263,7 @@ buy(data) { API_trade.addToCart(data).then((res) => { if (res.data.success) { - uni.navigateTo({ + this.$navigateTo({ url: `/pages/order/fillorder?way=${ data.cartType }&addr=${""}&parentOrder=${encodeURIComponent( @@ -314,7 +314,7 @@ API_trade.addToCart(data).then((res) => { if (res.data.code == 200) { - uni.navigateTo({ + this.$navigateTo({ url: `/pages/order/fillorder?way=${data.cartType}&addr=${ this.addr.id || "" }&parentOrder=${encodeURIComponent(JSON.stringify(this.parentOrder))}`, @@ -399,9 +399,9 @@ + diff --git a/components/m-goods-list/list.vue b/components/m-goods-list/list.vue index 18b4a53..dfc6e89 100644 --- a/components/m-goods-list/list.vue +++ b/components/m-goods-list/list.vue @@ -151,7 +151,7 @@ for (let i of Array.from(keyword)) { unicodes += this.unicode(i) + "|" } - const rule = '(' + unicodes + ')' + const rule = '(' + unicodes + ')' const reg = new RegExp(rule, 'gi'); return str ? str.replace(reg, matchValue => `${matchValue}` @@ -198,13 +198,13 @@ }, // 跳转到商品详情 navigateToDetailPage(item) { - uni.navigateTo({ + this.$navigateTo({ url: `/pages/product/goods?id=${item.content.id}&goodsId=${item.content.goodsId}`, }); }, // 跳转地址 navigateToStoreDetailPage(item) { - uni.navigateTo({ + this.$navigateTo({ url: `/pages/product/shopPage?id=${item.content.storeId}`, }); }, @@ -341,4 +341,4 @@ } } - + diff --git a/components/m-goods-recommend/index.vue b/components/m-goods-recommend/index.vue index 8f60967..dc19323 100644 --- a/components/m-goods-recommend/index.vue +++ b/components/m-goods-recommend/index.vue @@ -62,7 +62,7 @@ export default { this.goodsList.push(...goodsList.data.result.content); }, handleClick(item) { - uni.navigateTo({ + this.$navigateTo({ url: `/pages/product/goods?id=${item.content.id}&goodsId=${item.content.goodsId}`, }); }, diff --git a/main.js b/main.js index e02f774..37296c1 100644 --- a/main.js +++ b/main.js @@ -3,7 +3,7 @@ import App from "./App"; import * as filters from "./utils/filters.js"; // global filter import uView from "uview-ui"; import store from "./store"; - +import {navigateTo} from '@/utils/navigateRoute.js' /** * 仅在h5中显示唤醒app功能 @@ -27,6 +27,10 @@ Object.keys(filters).forEach((key) => { // 引入Vuex Vue.prototype.$store = store; + + +// // 引入Vuex +Vue.prototype.$navigateTo = navigateTo; Vue.use(uView); Vue.config.productionTip = false; diff --git a/pages/cart/coupon/couponCenter.vue b/pages/cart/coupon/couponCenter.vue index e8806ad..5c8e818 100644 --- a/pages/cart/coupon/couponCenter.vue +++ b/pages/cart/coupon/couponCenter.vue @@ -145,7 +145,7 @@ }, }, onNavigationBarButtonTap(e) { - uni.navigateTo({ + this.$navigateTo({ url: "/pages/cart/coupon/couponIntro", }); }, diff --git a/pages/cart/coupon/myCoupon.vue b/pages/cart/coupon/myCoupon.vue index ac59a4a..1d63237 100644 --- a/pages/cart/coupon/myCoupon.vue +++ b/pages/cart/coupon/myCoupon.vue @@ -189,7 +189,7 @@ export default { */ useItNow(item) { if (item.storeId && item.storeId!='0') { - uni.navigateTo({ + this.$navigateTo({ url: `/pages/product/shopPage?id=${item.storeId}`, }); } else { @@ -203,7 +203,7 @@ export default { * 优惠券详情 */ couponDetail(item) { - uni.navigateTo({ + this.$navigateTo({ url: "/pages/cart/coupon/couponDetail?item=" + encodeURIComponent(JSON.stringify(item)), diff --git a/pages/cart/payment/payOrder.vue b/pages/cart/payment/payOrder.vue index f5b092c..179422b 100644 --- a/pages/cart/payment/payOrder.vue +++ b/pages/cart/payment/payOrder.vue @@ -120,7 +120,7 @@ * 支付成功后跳转 */ callback(paymentMethod){ - uni.navigateTo({ + this.$navigateTo({ url: "/pages/cart/payment/success?paymentMethod=" + paymentMethod + "&payPrice=" + @@ -138,7 +138,7 @@ if (this.routerVal.recharge_sn) { // 判断当前是否是充值 this.sn = this.routerVal.recharge_sn; - this.orderType = "RECHARGE"; + this.orderType = "RECHARGE"; } else if (this.routerVal.trade_sn) { this.sn = this.routerVal.trade_sn; @@ -178,12 +178,12 @@ this.payList = res.data.result.support.filter((item) => { return item != "ALIPAY"; - }); - // 充值的话仅保留微信支付 - if(this.orderType == "RECHARGE"){ - this.payList = res.data.result.support.filter((item) => { - return item == "WECHAT"; - }); + }); + // 充值的话仅保留微信支付 + if(this.orderType == "RECHARGE"){ + this.payList = res.data.result.support.filter((item) => { + return item == "WECHAT"; + }); } } diff --git a/pages/mine/address/add.vue b/pages/mine/address/add.vue index 7cf807f..08bac21 100644 --- a/pages/mine/address/add.vue +++ b/pages/mine/address/add.vue @@ -1,11 +1,11 @@