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 @@