From 941e04195f65e930d936987f0aad76096dd944e8 Mon Sep 17 00:00:00 2001 From: Gao xiaosong <704041637@qq.com> Date: Mon, 3 Aug 2020 01:45:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A3=B0=E6=98=8E?= =?UTF-8?q?=E6=96=87=E4=BB=B6;=E5=8E=BB=E9=99=A4=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9A=84=E8=B4=AD=E7=89=A9=E8=BD=A6=E6=8C=89?= =?UTF-8?q?=E9=92=AE;=E5=85=85=E5=80=BC=E5=A2=9E=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=E9=99=90;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 ++-- components/GoodList.vue | 2 +- pages/user/Recharge/index.vue | 55 ++++++++++++++++++++--------------- 3 files changed, 37 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index b194621..3532314 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # 使用说明 -## Hbuilderx(ps:因HBuilderX经常会更新,如无必要请勿更新HBuilderX为2.7.5及以上) +## Hbuilderx -- 目前已知 HBuilderX v2.7.5 版本不支持 :class 里面写 object 和 arraw +- 已支持HBuilderX最新版 ## 小程序安装步骤 - 先从私服上clone下来项目 @@ -13,12 +13,14 @@ - uni会自动打开微信开发者工具并且打开uni的项目 ## 注意事项 +- 目前并不支持H5运行,需要运行H5模式的,请自行调整兼容 - manifest.json 中可以配置uni项目的一些信息 - 打开manifest.json可配置小程序的 appid - 由于需要兼容app,公共样式由 main.js 迁移到了 App.vue,公共样式请在App.vue中进行编辑 - 由于需要兼容app,尺寸单位由之前的rem改为rpx,由于修改样式工作量太大并且容易出错,已将.css更改为.less并在其中以之前rem的单位*100,获得新的rpx单位 - 如需修改样式问题,请编辑.less的文件,请勿编辑.css的文件 + ## 声明 - app测试版已上,请通过 `https://www.pgyer.com/yRYf` 安装测试。 - 运行app项目ios需要安装xcode,安卓需要装安卓的sdk以及安卓模拟器,建议安卓安装genymotion https://www.genymotion.com/ 登录时可选择私人使用,勾选后无需付费 diff --git a/components/GoodList.vue b/components/GoodList.vue index 18c5cce..13f4bfb 100644 --- a/components/GoodList.vue +++ b/components/GoodList.vue @@ -20,7 +20,7 @@ - + diff --git a/pages/user/Recharge/index.vue b/pages/user/Recharge/index.vue index b752ad7..49cfd1e 100644 --- a/pages/user/Recharge/index.vue +++ b/pages/user/Recharge/index.vue @@ -28,7 +28,10 @@ 元 - 赠送:{{ item.value.give_price }} 元 + 赠送:{{ item.value.give_price }} 元 + --> 提示:充值后帐户的金额不能提现 立即充值 @@ -58,7 +61,7 @@ export default { name: "Recharge", components: {}, props: {}, - data: function() { + data: function () { return { active: 0, from: this.$deviceType, @@ -68,12 +71,11 @@ export default { activePic: 0, numberPic: "", paid_price: "", - rechar_id: 0 - + rechar_id: 0, }; }, computed: mapGetters(["userInfo"]), - mounted: function() { + mounted: function () { this.now_money = this.userInfo.nowMoney; this.getRecharge(); }, @@ -83,7 +85,7 @@ export default { */ getRecharge() { getRechargeApi() - .then(res => { + .then((res) => { this.picList = res.data.recharge_price_ways || []; if (this.picList[0]) { this.rechar_id = this.picList[0].id; @@ -91,12 +93,12 @@ export default { this.numberPic = this.picList[0].value.give_price; } }) - .catch(res => { + .catch((res) => { uni.showToast({ title: err.msg || err.response.data.msg || err.response.data.message, icon: "none", - duration: 2000 + duration: 2000, }); }); }, @@ -116,21 +118,28 @@ export default { this.numberPic = item.value.price; } }, - recharge: function() { + recharge: function () { let that = this, price = Number(this.money); if (this.picList.length == this.activePic && price === 0) { uni.showToast({ title: "请输入您要充值的金额", icon: "none", - duration: 2000 + duration: 2000, }); return; } else if (this.picList.length == this.activePic && price < 0.01) { uni.showToast({ title: "充值金额不能低于0.01", icon: "none", - duration: 2000 + duration: 2000, + }); + return; + } else if (this.picList.length == this.activePic && price > 99999) { + uni.showToast({ + title: "充值金额不能大于99999", + icon: "none", + duration: 2000, }); return; } @@ -147,9 +156,9 @@ export default { price: prices, from: that.from, paid_price: paid_price, - rechar_id: that.rechar_id + rechar_id: that.rechar_id, }) - .then(res => { + .then((res) => { console.log(res); var data = res.data.data; weappPay(res.data.data) @@ -159,37 +168,37 @@ export default { uni.showToast({ title: "支付成功", icon: "success", - duration: 2000 + duration: 2000, }); this.$yrouter.back(); }) - .finally(res => { + .finally((res) => { //if(typeof(res) == "undefined") return uni.showToast({ title: res, icon: "none", - duration: 2000 + duration: 2000, }); }) - .catch(function() { + .catch(function () { uni.showToast({ title: "支付失败", icon: "none", - duration: 2000 + duration: 2000, }); }); }) - .catch(err => { + .catch((err) => { console.log(err); uni.showToast({ title: err.msg || err.response.data.msg || err.response.data.message, icon: "none", - duration: 2000 + duration: 2000, }); }); - } - } + }, + }, }; From 12f15fbc623b03be32aa1b48cb4de58b02827f55 Mon Sep 17 00:00:00 2001 From: Gao xiaosong <704041637@qq.com> Date: Mon, 10 Aug 2020 07:12:36 +0800 Subject: [PATCH 2/2] a --- libs/order.js | 2 + manifest.json | 12 +- pages/order/OrderDetails/index.vue | 474 +++++++++++++------------- pages/order/OrderSubmission/index.vue | 131 +++---- utils/request.js | 4 + 5 files changed, 316 insertions(+), 307 deletions(-) diff --git a/libs/order.js b/libs/order.js index 57db3e9..3082833 100644 --- a/libs/order.js +++ b/libs/order.js @@ -76,6 +76,8 @@ export function payOrderHandle(orderId, type, from) { uni.showLoading({ title: '加载中' }) payOrder(orderId, type, from) .then(res => { + console.log(res) + console.log('微信支付参数') const data = res.data; uni.hideLoading() switch (data.status) { diff --git a/manifest.json b/manifest.json index f1a422f..599c5b4 100644 --- a/manifest.json +++ b/manifest.json @@ -11,7 +11,7 @@ "nvueCompiler" : "uni-app", "compilerVersion" : 3, "splashscreen" : { - "alwaysShowBeforeRender" : false, + "alwaysShowBeforeRender" : true, "waiting" : false, "autoclose" : true, "delay" : 0 @@ -59,22 +59,24 @@ "weixin" : { "appid" : "wx7c84ede33062d1e4", "appsecret" : "c47ef66d3311194da44e60387d5c1abd", - "UniversalLinks" : "" + "UniversalLinks" : "https://yixiang.co/app/" } }, "payment" : { "weixin" : { "appid" : "wx7c84ede33062d1e4", - "UniversalLinks" : "" + "UniversalLinks" : "https://yixiang.co/app/" } }, "share" : { "weixin" : { "appid" : "wx7c84ede33062d1e4", - "UniversalLinks" : "" + "UniversalLinks" : "https://yixiang.co/app/" } }, - "ad" : {} + "ad" : { + "csj" : {} + } }, "splashscreen" : { "ios" : { diff --git a/pages/order/OrderDetails/index.vue b/pages/order/OrderDetails/index.vue index 37dc9d0..eb38893 100644 --- a/pages/order/OrderDetails/index.vue +++ b/pages/order/OrderDetails/index.vue @@ -4,9 +4,7 @@ {{ orderInfo._status._msg }} - - {{ orderInfo.createTime }} - + {{ orderInfo.createTime }} @@ -41,20 +39,12 @@ > 自提地址信息 - + 查看位置 @@ -160,9 +153,7 @@ 下单时间: - - {{ orderInfo.createTime }} - + {{ orderInfo.createTime }} 订单类型: @@ -262,22 +253,21 @@ 申请退款 - + + 查看物流 确认收货 - + 查看物流 - + 删除订单 + + + - diff --git a/pages/order/OrderSubmission/index.vue b/pages/order/OrderSubmission/index.vue index 9585dda..0c78d32 100644 --- a/pages/order/OrderSubmission/index.vue +++ b/pages/order/OrderSubmission/index.vue @@ -35,15 +35,24 @@ - - + + - {{ storeItems.name || systemStore.name }} - {{storeItems.phone || systemStore.phone}} + {{ storeItems.name }} + {{storeItems.phone }} - {{ storeItems.address || systemStore.address }} + {{ storeItems.address}} + + + + {{ systemStore.name }} + {{systemStore.phone}} + + {{ systemStore.address }} @@ -92,7 +101,7 @@ }} - + 联系人 @@ -311,10 +320,10 @@ export default { components: { OrderGoods, CouponListWindow, - AddressWindow + AddressWindow, }, props: {}, - data: function() { + data: function () { return { offlinePayStatus: 2, from: this.$deviceType, @@ -329,13 +338,13 @@ export default { addressInfo: {}, couponId: 0, orderGroupInfo: { - priceGroup: {} + priceGroup: {}, }, usableCoupon: {}, addressLoaded: false, useIntegral: false, orderPrice: { - payPrice: "计算中" + payPrice: "计算中", }, mark: "", systemStore: {}, @@ -343,7 +352,7 @@ export default { contacts: "", contactsTel: "", storeSelfMention: 0, - cartid: "" + cartid: "", }; }, computed: mapGetters(["userInfo", "storeItems"]), @@ -356,9 +365,9 @@ export default { }, shipping_type() { this.computedPrice(); - } + }, }, - mounted: function() { + mounted: function () { let that = this; this.$store.dispatch("getUser", true); that.getCartInfo(); @@ -368,28 +377,29 @@ export default { } if (that.$yroute.query.id !== undefined) { that.cartid = that.$yroute.query.id; - console.log(that.cartid) + console.log(that.cartid); } }, methods: { showStoreList() { this.$store.commit("get_to", "orders"); this.$yrouter.push({ - path: "/pages/shop/StoreList/index" + path: "/pages/shop/StoreList/index", }); }, - addressType: function(index) { + addressType: function (index) { if (index && !this.systemStore.id) { uni.showToast({ title: "暂无门店信息,您无法选择到店自提!", icon: "none", - duration: 2000 + duration: 2000, }); return; } + console.log(this); this.shipping_type = index; }, - changeUseIntegral: function(e) { + changeUseIntegral: function (e) { // this.computedPrice(); this.useIntegral = e.mp.detail.value[0]; }, @@ -399,15 +409,15 @@ export default { addressId: this.addressInfo.id, useIntegral: this.useIntegral ? 1 : 0, couponId: this.usableCoupon.id || 0, - shipping_type: parseInt(shipping_type) + 1 - }).then(res => { + shipping_type: parseInt(shipping_type) + 1, + }).then((res) => { const data = res.data; if (data.status === "EXTEND_ORDER") { this.$yrouter.replace({ path: "/pages/order/OrderDetails/index", query: { - id: data.result.orderId - } + id: data.result.orderId, + }, }); } else { this.orderPrice = data.result; @@ -420,17 +430,20 @@ export default { uni.showToast({ title: "参数有误", icon: "none", - duration: 2000 + duration: 2000, }); return this.$yrouter.back(); } postOrderConfirm(cartIds) - .then(res => { + .then((res) => { + console.log(res, 999999); + console.log(res.data.systemStore || {}, 999999); this.offlinePayStatus = res.data.offline_pay_status; this.orderGroupInfo = res.data; this.deduction = res.data.deduction; this.usableCoupon = res.data.usableCoupon || {}; this.addressInfo = res.data.addressInfo || {}; + // 用来显示到店自提的店铺地址 this.systemStore = res.data.systemStore || {}; this.storeSelfMention = res.data.storeSelfMention; this.computedPrice(); @@ -439,11 +452,11 @@ export default { uni.showToast({ title: "加载订单数据失败", icon: "none", - duration: 2000 + duration: 2000, }); }); }, - addressTap: function() { + addressTap: function () { this.showAddress = true; if (!this.addressLoaded) { this.addressLoaded = true; @@ -454,21 +467,21 @@ export default { this.addressLoaded = false; this.showAddress = false; }, - couponTap: function() { + couponTap: function () { this.showCoupon = true; }, - changeCoupon: function(coupon) { + changeCoupon: function (coupon) { if (!coupon) { this.usableCoupon = { couponTitle: "不使用优惠券", - id: 0 + id: 0, }; } else { this.usableCoupon = coupon; } this.computedPrice(); }, - payItem: function(index) { + payItem: function (index) { this.active = index; }, changeAddress(addressInfo) { @@ -480,7 +493,7 @@ export default { uni.showToast({ title: "请选择支付方式", icon: "none", - duration: 2000 + duration: 2000, }); return; } @@ -488,7 +501,7 @@ export default { uni.showToast({ title: "请选择收货地址", icon: "none", - duration: 2000 + duration: 2000, }); return; } @@ -501,7 +514,7 @@ export default { uni.showToast({ title: "请填写联系人或联系人电话", icon: "none", - duration: 2000 + duration: 2000, }); return; } @@ -510,7 +523,7 @@ export default { uni.showToast({ title: "请填写正确的手机号", icon: "none", - duration: 2000 + duration: 2000, }); return; } @@ -518,14 +531,14 @@ export default { uni.showToast({ title: "请填写您的真实姓名", icon: "none", - duration: 2000 + duration: 2000, }); return; } } uni.showLoading({ - title: "生成订单中" + title: "生成订单中", }); let from = {}; if (this.$deviceType == "app") { @@ -547,9 +560,9 @@ export default { mark: this.mark || "", shippingType: parseInt(shipping_type) + 1, storeId: this.storeItems ? this.storeItems.id : this.systemStore.id, - ...from + ...from, }) - .then(res => { + .then((res) => { uni.hideLoading(); const data = res.data; switch (data.status) { @@ -558,13 +571,13 @@ export default { uni.showToast({ title: res.msg, icon: "none", - duration: 2000 + duration: 2000, }); this.$yrouter.replace({ path: "/pages/order/OrderDetails/index", query: { - id: data.result.orderId - } + id: data.result.orderId, + }, }); break; case "PAY_DEFICIENCY": @@ -574,26 +587,26 @@ export default { uni.showToast({ title: res.msg, icon: "none", - duration: 2000 + duration: 2000, }); this.$yrouter.replace({ path: "/pages/order/OrderDetails/index", query: { - id: data.result.orderId - } + id: data.result.orderId, + }, }); break; case "SUCCESS": uni.showToast({ title: res.msg, icon: "none", - duration: 2000 + duration: 2000, }); this.$yrouter.replace({ path: "/pages/order/OrderDetails/index", query: { - id: data.result.orderId - } + id: data.result.orderId, + }, }); break; case "WECHAT_H5_PAY": @@ -601,8 +614,8 @@ export default { this.$yrouter.replace({ path: "/pages/order/OrderDetails/index", query: { - id: data.result.orderId - } + id: data.result.orderId, + }, }); setTimeout(() => { // location.href = data.result.jsConfig.mweb_url; @@ -614,8 +627,8 @@ export default { this.$yrouter.replace({ path: "/pages/order/OrderDetails/index", query: { - id: data.result.orderId - } + id: data.result.orderId, + }, }); }); break; @@ -626,8 +639,8 @@ export default { this.$yrouter.replace({ path: "/pages/order/OrderDetails/index", query: { - id: data.result.orderId - } + id: data.result.orderId, + }, }); }); break; @@ -639,7 +652,7 @@ export default { // }); } }) - .catch(err => { + .catch((err) => { uni.hideLoading(); uni.showToast({ title: @@ -648,10 +661,10 @@ export default { err.response.data.message || "创建订单失败", icon: "none", - duration: 2000 + duration: 2000, }); }); - } - } + }, + }, }; diff --git a/utils/request.js b/utils/request.js index ad5ca05..1dd7d2c 100644 --- a/utils/request.js +++ b/utils/request.js @@ -61,6 +61,10 @@ function baseRequest(options) { return fly.request(url, params || data, { ...option }).then(res => { + console.log("——————————— "+url+" —————————————") + console.log(params || data) + console.log(res.data) + console.log("—————————————— end ——————————") const data = res.data || {}; if (res.status !== 200) { return Promise.reject({ msg: "请求失败", res, data });