gaoxs 5 years ago
parent
commit
3966b56c99
  1. 6
      README.md
  2. 2
      components/GoodList.vue
  3. 2
      libs/order.js
  4. 12
      manifest.json
  5. 316
      pages/order/OrderDetails/index.vue
  6. 131
      pages/order/OrderSubmission/index.vue
  7. 55
      pages/user/Recharge/index.vue
  8. 4
      utils/request.js

6
README.md

@ -1,8 +1,8 @@
# 使用说明 # 使用说明
## Hbuilderx(ps:因HBuilderX经常会更新,如无必要请勿更新HBuilderX为2.7.5及以上) ## Hbuilderx
- 目前已知 HBuilderX v2.7.5 版本不支持 :class 里面写 object 和 arraw - 已支持HBuilderX最新版
## 小程序安装步骤 ## 小程序安装步骤
- 先从私服上clone下来项目 - 先从私服上clone下来项目
@ -13,12 +13,14 @@
- uni会自动打开微信开发者工具并且打开uni的项目 - uni会自动打开微信开发者工具并且打开uni的项目
## 注意事项 ## 注意事项
- 目前并不支持H5运行,需要运行H5模式的,请自行调整兼容
- manifest.json 中可以配置uni项目的一些信息 - manifest.json 中可以配置uni项目的一些信息
- 打开manifest.json可配置小程序的 appid - 打开manifest.json可配置小程序的 appid
- 由于需要兼容app,公共样式由 main.js 迁移到了 App.vue,公共样式请在App.vue中进行编辑 - 由于需要兼容app,公共样式由 main.js 迁移到了 App.vue,公共样式请在App.vue中进行编辑
- 由于需要兼容app,尺寸单位由之前的rem改为rpx,由于修改样式工作量太大并且容易出错,已将.css更改为.less并在其中以之前rem的单位*100,获得新的rpx单位 - 由于需要兼容app,尺寸单位由之前的rem改为rpx,由于修改样式工作量太大并且容易出错,已将.css更改为.less并在其中以之前rem的单位*100,获得新的rpx单位
- 如需修改样式问题,请编辑.less的文件,请勿编辑.css的文件 - 如需修改样式问题,请编辑.less的文件,请勿编辑.css的文件
## 声明 ## 声明
- app测试版已上,请通过 `https://www.pgyer.com/yRYf` 安装测试。 - app测试版已上,请通过 `https://www.pgyer.com/yRYf` 安装测试。
- 运行app项目ios需要安装xcode,安卓需要装安卓的sdk以及安卓模拟器,建议安卓安装genymotion https://www.genymotion.com/ 登录时可选择私人使用,勾选后无需付费 - 运行app项目ios需要安装xcode,安卓需要装安卓的sdk以及安卓模拟器,建议安卓安装genymotion https://www.genymotion.com/ 登录时可选择私人使用,勾选后无需付费

2
components/GoodList.vue

@ -20,7 +20,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="iconfont icon-gouwuche cart-color acea-row row-center-wrapper"></view> <!-- <view class="iconfont icon-gouwuche cart-color acea-row row-center-wrapper"></view> -->
</view> </view>
</view> </view>
</template> </template>

2
libs/order.js

@ -76,6 +76,8 @@ export function payOrderHandle(orderId, type, from) {
uni.showLoading({ title: '加载中' }) uni.showLoading({ title: '加载中' })
payOrder(orderId, type, from) payOrder(orderId, type, from)
.then(res => { .then(res => {
console.log(res)
console.log('微信支付参数')
const data = res.data; const data = res.data;
uni.hideLoading() uni.hideLoading()
switch (data.status) { switch (data.status) {

12
manifest.json

@ -11,7 +11,7 @@
"nvueCompiler" : "uni-app", "nvueCompiler" : "uni-app",
"compilerVersion" : 3, "compilerVersion" : 3,
"splashscreen" : { "splashscreen" : {
"alwaysShowBeforeRender" : false, "alwaysShowBeforeRender" : true,
"waiting" : false, "waiting" : false,
"autoclose" : true, "autoclose" : true,
"delay" : 0 "delay" : 0
@ -59,22 +59,24 @@
"weixin" : { "weixin" : {
"appid" : "wx7c84ede33062d1e4", "appid" : "wx7c84ede33062d1e4",
"appsecret" : "c47ef66d3311194da44e60387d5c1abd", "appsecret" : "c47ef66d3311194da44e60387d5c1abd",
"UniversalLinks" : "" "UniversalLinks" : "https://yixiang.co/app/"
} }
}, },
"payment" : { "payment" : {
"weixin" : { "weixin" : {
"appid" : "wx7c84ede33062d1e4", "appid" : "wx7c84ede33062d1e4",
"UniversalLinks" : "" "UniversalLinks" : "https://yixiang.co/app/"
} }
}, },
"share" : { "share" : {
"weixin" : { "weixin" : {
"appid" : "wx7c84ede33062d1e4", "appid" : "wx7c84ede33062d1e4",
"UniversalLinks" : "" "UniversalLinks" : "https://yixiang.co/app/"
} }
}, },
"ad" : {} "ad" : {
"csj" : {}
}
}, },
"splashscreen" : { "splashscreen" : {
"ios" : { "ios" : {

316
pages/order/OrderDetails/index.vue

@ -4,9 +4,7 @@
<view class="header bg-color-red acea-row row-middle" :class="refundOrder ? 'on' : ''"> <view class="header bg-color-red acea-row row-middle" :class="refundOrder ? 'on' : ''">
<view class="data" :class="refundOrder ? 'on' : ''"> <view class="data" :class="refundOrder ? 'on' : ''">
<view class="state">{{ orderInfo._status._msg }}</view> <view class="state">{{ orderInfo._status._msg }}</view>
<view> <view>{{ orderInfo.createTime }}</view>
{{ orderInfo.createTime }}
</view>
</view> </view>
</view> </view>
<template v-if="!refundOrder"> <template v-if="!refundOrder">
@ -41,20 +39,12 @@
></view> ></view>
<view <view
class="line" class="line"
:class="{ :class="{'bg-color-red':status.type > 1 && status.type != 6 && status.type != 9}"
'bg-color-red':
status.type > 1 && status.type != 6 && status.type != 9
}"
v-if="orderInfo.shippingType === 1" v-if="orderInfo.shippingType === 1"
></view> ></view>
<view <view
class="iconfont" class="iconfont"
:class="[ :class="[status.type === 2 ? 'icon-webicon318' : 'icon-yuandianxiao',status.type >= 2 && status.type != 6 && status.type != 9? 'font-color-red': '']"
status.type === 2 ? 'icon-webicon318' : 'icon-yuandianxiao',
status.type >= 2 && status.type != 6 && status.type != 9
? 'font-color-red'
: ''
]"
v-if="orderInfo.shippingType === 1" v-if="orderInfo.shippingType === 1"
></view> ></view>
<view <view
@ -125,7 +115,10 @@
v-if="orderInfo.shippingType === 2 && orderInfo.paid === 1" v-if="orderInfo.shippingType === 2 && orderInfo.paid === 1"
> >
<div>自提地址信息</div> <div>自提地址信息</div>
<div class="place cart-color acea-row row-center-wrapper" @click="showChang(orderInfo.systemStore)"> <div
class="place cart-color acea-row row-center-wrapper"
@click="showChang(orderInfo.systemStore)"
>
<span class="iconfont icon-weizhi"></span>查看位置 <span class="iconfont icon-weizhi"></span>查看位置
</div> </div>
</div> </div>
@ -160,9 +153,7 @@
</view> </view>
<view class="item acea-row row-between"> <view class="item acea-row row-between">
<view>下单时间</view> <view>下单时间</view>
<view class="conter"> <view class="conter">{{ orderInfo.createTime }}</view>
{{ orderInfo.createTime }}
</view>
</view> </view>
<view class="item acea-row row-between"> <view class="item acea-row row-between">
<view>订单类型</view> <view>订单类型</view>
@ -262,22 +253,21 @@
<template v-if="status.type == 1"> <template v-if="status.type == 1">
<view class="bnt cancel" @click="goGoodsReturn(orderInfo)">申请退款</view> <view class="bnt cancel" @click="goGoodsReturn(orderInfo)">申请退款</view>
</template> </template>
<template v-if="status.type == 2"> <!-- -->
<template v-if="orderInfo.shippingType == 1 && status.type == 2">
<view <view
class="bnt default" class="bnt default"
@click="$yrouter.push({ path: '/pages/order/Logistics/index' ,query:{id:orderInfo.orderId }})" @click="$yrouter.push({ path: '/pages/order/Logistics/index' ,query:{id:orderInfo.orderId }})"
>查看物流</view> >查看物流</view>
<view class="bnt bg-color-red" @click="takeOrder">确认收货</view> <view class="bnt bg-color-red" @click="takeOrder">确认收货</view>
</template> </template>
<template v-if="status.type == 3 && orderInfo.deliveryType == 'express'"> <template v-if="orderInfo.shippingType == 1 && status.type == 3 && orderInfo.deliveryType == 'express'">
<view <view
class="bnt default" class="bnt default"
@click=" @click="$yrouter.push({ path: '/pages/order/Logistics/index' ,query:{id:orderInfo.orderId }})"
$yrouter.push({ path: '/pages/order/Logistics/index' ,query:{id:orderInfo.orderId }})
"
>查看物流</view> >查看物流</view>
</template> </template>
<template v-if="status.type == 4"> <template v-if="orderInfo.shippingType == 1 && status.type == 4">
<view class="bnt cancel" @click="delOrder">删除订单</view> <view class="bnt cancel" @click="delOrder">删除订单</view>
<view <view
class="bnt default" class="bnt default"
@ -302,133 +292,18 @@
</view> </view>
</view> </view>
</template> </template>
<style scoped lang="less">
.geoPage {
position: fixed;
width: 100%;
height: 100%;
top: 0;
z-index: 10000;
}
.order-details .writeOff {
background-color: #fff;
margin-top: 0.13 * 100rpx;
padding-bottom: 0.3 * 100rpx;
}
.order-details .writeOff .title {
font-size: 0.3 * 100rpx;
color: #282828;
height: 0.87 * 100rpx;
border-bottom: 1px solid #f0f0f0;
padding: 0 0.3 * 100rpx;
line-height: 0.87 * 100rpx;
}
.order-details .writeOff .grayBg {
background-color: #f2f5f7;
width: 5.9 * 100rpx;
height: 3.84 * 100rpx;
border-radius: 0.2 * 100rpx 0.2 * 100rpx 0 0;
margin: 0.5 * 100rpx auto 0 auto;
padding-top: 0.55 * 100rpx;
}
.order-details .writeOff .grayBg .pictrue {
width: 2.9 * 100rpx;
height: 2.9 * 100rpx;
margin: 0 auto;
}
.order-details .writeOff .grayBg .pictrue img {
width: 100%;
height: 100%;
display: block;
}
.order-details .writeOff .gear {
width: 5.9 * 100rpx;
height: 0.3 * 100rpx;
margin: 0 auto;
}
.order-details .writeOff .gear img {
width: 100%;
height: 100%;
display: block;
}
.order-details .writeOff .num {
background-color: #f0c34c;
width: 5.9 * 100rpx;
height: 0.84 * 100rpx;
color: #282828;
font-size: 0.48 * 100rpx;
margin: 0 auto;
border-radius: 0 0 0.2 * 100rpx 0.2 * 100rpx;
text-align: center;
padding-top: 0.04 * 100rpx;
}
.order-details .writeOff .rules {
margin: 0.46 * 100rpx 0.3 * 100rpx 0 0.3 * 100rpx;
border-top: 0.01 * 100rpx solid #f0f0f0;
padding-top: 0.1 * 100rpx;
}
.order-details .writeOff .rules .item {
margin-top: 0.15 * 100rpx;
}
.order-details .writeOff .rules .item .rulesTitle {
font-size: 0.28 * 100rpx;
color: #282828;
}
.order-details .writeOff .rules .item .rulesTitle .iconfont {
font-size: 0.3 * 100rpx;
color: #333;
margin-right: 0.08 * 100rpx;
margin-top: 0.05 * 100rpx;
}
.order-details .writeOff .rules .item .info {
font-size: 0.28 * 100rpx;
color: #999;
margin-top: 0.05 * 100rpx;
}
.order-details .writeOff .rules .item .info .time {
margin-left: 0.2 * 100rpx;
}
.order-details .map {
height: 0.86 * 100rpx;
font-size: 0.3 * 100rpx;
color: #282828;
line-height: 0.86 * 100rpx;
border-bottom: 0.01 * 100rpx solid #f0f0f0;
margin-top: 0.13 * 100rpx;
background-color: #fff;
padding: 0 0.3 * 100rpx;
}
.order-details .map .place {
font-size: 0.26 * 100rpx;
width: 1.76 * 100rpx;
height: 0.5 * 100rpx;
border-radius: 0.25 * 100rpx;
line-height: 0.5 * 100rpx;
text-align: center;
}
.order-details .map .place .iconfont {
font-size: 0.27 * 100rpx;
height: 0.27 * 100rpx;
line-height: 0.27 * 100rpx;
margin: 0.02 * 100rpx 0.03 * 100rpx 0 0;
}
.order-details .address .name .iconfont {
font-size: 0.34 * 100rpx;
margin-left: 0.1 * 100rpx;
}
</style>
<script> <script>
import OrderGoods from "@/components/OrderGoods"; import OrderGoods from "@/components/OrderGoods";
import { orderDetail } from "@/api/order"; import { orderDetail } from "@/api/order";
import Payment from "@/components/Payment"; import Payment from "@/components/Payment";
import DataFormat from "@/components/DataFormat";
import { isWeixin, copyClipboard } from "@/utils"; import { isWeixin, copyClipboard } from "@/utils";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import { import {
cancelOrderHandle, cancelOrderHandle,
takeOrderHandle, takeOrderHandle,
delOrderHandle, delOrderHandle,
payOrderHandle payOrderHandle,
} from "@/libs/order"; } from "@/libs/order";
// import { wechatEvevt } from "@/libs/wechat"; // import { wechatEvevt } from "@/libs/wechat";
@ -439,10 +314,8 @@ export default {
components: { components: {
OrderGoods, OrderGoods,
Payment, Payment,
DataFormat
}, },
props: {}, data: function () {
data: function() {
return { return {
offlinePayStatus: 2, offlinePayStatus: 2,
orderTypeName: "普通订单", orderTypeName: "普通订单",
@ -450,7 +323,7 @@ export default {
offlineStatus: true, offlineStatus: true,
id: "", id: "",
orderInfo: { orderInfo: {
_status: {} _status: {},
}, },
status: {}, status: {},
pay: false, pay: false,
@ -458,21 +331,20 @@ export default {
from: this.$deviceType, from: this.$deviceType,
system_store: {}, system_store: {},
mapKay: "", mapKay: "",
mapShow: false mapShow: false,
}; };
}, },
computed: { computed: {
refundOrder() { refundOrder() {
return this.orderInfo.refund_status > 0; return this.orderInfo.refund_status > 0;
}, },
...mapGetters(["userInfo"]) ...mapGetters(["userInfo"]),
}, },
onShow() { onShow() {
this.id = this.$yroute.query.id; this.id = this.$yroute.query.id;
this.getDetail(); this.getDetail();
}, },
inject: ["app"], mounted: function () {
mounted: function() {
this.id = this.$yroute.query.id; this.id = this.$yroute.query.id;
// this.getDetail(); // this.getDetail();
}, },
@ -482,23 +354,23 @@ export default {
this.$yrouter.push({ this.$yrouter.push({
path: "/pages/order/GoodsReturn/index", path: "/pages/order/GoodsReturn/index",
query: { query: {
id: orderInfo.orderId id: orderInfo.orderId,
} },
}); });
}, },
goGroupRule(orderInfo) { goGroupRule(orderInfo) {
this.$yrouter.push({ this.$yrouter.push({
path: "/pages/activity/GroupRule/index", path: "/pages/activity/GroupRule/index",
query: { query: {
id: orderInfo.pinkId id: orderInfo.pinkId,
} },
}); });
}, },
showChang: function(data) { showChang: function (data) {
// //
this.$yrouter.push({ this.$yrouter.push({
path: "/pages/map/index", path: "/pages/map/index",
query: data query: data,
}); });
// if (isWeixin()) { // if (isWeixin()) {
// let config = { // let config = {
@ -525,7 +397,7 @@ export default {
} else { } else {
console.log(this); console.log(this);
this.$yrouter.replace({ this.$yrouter.replace({
path: "/pages/order/MyOrder/index" path: "/pages/order/MyOrder/index",
}); });
return; return;
} }
@ -549,14 +421,14 @@ export default {
setTimeout(() => this.goBack(), 300); setTimeout(() => this.goBack(), 300);
}); });
}, },
setOfflinePayStatus: function(status) { setOfflinePayStatus: function (status) {
var that = this; var that = this;
that.offlinePayStatus = status; that.offlinePayStatus = status;
if (status === 1 && that.orderTypeNameStatus === true) { if (status === 1 && that.orderTypeNameStatus === true) {
that.payType.push("offline"); that.payType.push("offline");
} }
}, },
getOrderStatus: function() { getOrderStatus: function () {
let orderInfo = this.orderInfo || {}, let orderInfo = this.orderInfo || {},
_status = orderInfo._status || { _type: 0 }, _status = orderInfo._status || { _type: 0 },
status = {}; status = {};
@ -569,7 +441,7 @@ export default {
: 0; : 0;
status = { status = {
type: type, type: type,
class_status: 0 class_status: 0,
}; };
if (type == 1 && combination_id > 0) { if (type == 1 && combination_id > 0) {
status.type = 6; status.type = 6;
@ -598,12 +470,12 @@ export default {
uni.showToast({ uni.showToast({
title: "订单不存在", title: "订单不存在",
icon: "none", icon: "none",
duration: 2000 duration: 2000,
}); });
return; return;
} }
orderDetail(id) orderDetail(id)
.then(res => { .then((res) => {
this.orderInfo = res.data; this.orderInfo = res.data;
this.getOrderStatus(); this.getOrderStatus();
if (this.orderInfo.combinationId > 0) { if (this.orderInfo.combinationId > 0) {
@ -620,11 +492,11 @@ export default {
this.mapKey = res.data.mapKay; this.mapKey = res.data.mapKay;
this.setOfflinePayStatus(this.orderInfo.offlinePayStatus); this.setOfflinePayStatus(this.orderInfo.offlinePayStatus);
}) })
.catch(err => { .catch((err) => {
uni.showToast({ uni.showToast({
title: err.response.data.msg, title: err.response.data.msg,
icon: "none", icon: "none",
duration: 2000 duration: 2000,
}); });
}); });
}, },
@ -633,7 +505,123 @@ export default {
console.log(type, "支付方式"); console.log(type, "支付方式");
await payOrderHandle(this.orderInfo.orderId, type, that.from); await payOrderHandle(this.orderInfo.orderId, type, that.from);
that.getDetail(); that.getDetail();
} },
} },
}; };
</script> </script>
<style scoped lang="less">
.geoPage {
position: fixed;
width: 100%;
height: 100%;
top: 0;
z-index: 10000;
}
.order-details .writeOff {
background-color: #fff;
margin-top: 0.13 * 100rpx;
padding-bottom: 0.3 * 100rpx;
}
.order-details .writeOff .title {
font-size: 0.3 * 100rpx;
color: #282828;
height: 0.87 * 100rpx;
border-bottom: 1px solid #f0f0f0;
padding: 0 0.3 * 100rpx;
line-height: 0.87 * 100rpx;
}
.order-details .writeOff .grayBg {
background-color: #f2f5f7;
width: 5.9 * 100rpx;
height: 3.84 * 100rpx;
border-radius: 0.2 * 100rpx 0.2 * 100rpx 0 0;
margin: 0.5 * 100rpx auto 0 auto;
padding-top: 0.55 * 100rpx;
}
.order-details .writeOff .grayBg .pictrue {
width: 2.9 * 100rpx;
height: 2.9 * 100rpx;
margin: 0 auto;
}
.order-details .writeOff .grayBg .pictrue img {
width: 100%;
height: 100%;
display: block;
}
.order-details .writeOff .gear {
width: 5.9 * 100rpx;
height: 0.3 * 100rpx;
margin: 0 auto;
}
.order-details .writeOff .gear img {
width: 100%;
height: 100%;
display: block;
}
.order-details .writeOff .num {
background-color: #f0c34c;
width: 5.9 * 100rpx;
height: 0.84 * 100rpx;
color: #282828;
font-size: 0.48 * 100rpx;
margin: 0 auto;
border-radius: 0 0 0.2 * 100rpx 0.2 * 100rpx;
text-align: center;
padding-top: 0.04 * 100rpx;
}
.order-details .writeOff .rules {
margin: 0.46 * 100rpx 0.3 * 100rpx 0 0.3 * 100rpx;
border-top: 0.01 * 100rpx solid #f0f0f0;
padding-top: 0.1 * 100rpx;
}
.order-details .writeOff .rules .item {
margin-top: 0.15 * 100rpx;
}
.order-details .writeOff .rules .item .rulesTitle {
font-size: 0.28 * 100rpx;
color: #282828;
}
.order-details .writeOff .rules .item .rulesTitle .iconfont {
font-size: 0.3 * 100rpx;
color: #333;
margin-right: 0.08 * 100rpx;
margin-top: 0.05 * 100rpx;
}
.order-details .writeOff .rules .item .info {
font-size: 0.28 * 100rpx;
color: #999;
margin-top: 0.05 * 100rpx;
}
.order-details .writeOff .rules .item .info .time {
margin-left: 0.2 * 100rpx;
}
.order-details .map {
height: 0.86 * 100rpx;
font-size: 0.3 * 100rpx;
color: #282828;
line-height: 0.86 * 100rpx;
border-bottom: 0.01 * 100rpx solid #f0f0f0;
margin-top: 0.13 * 100rpx;
background-color: #fff;
padding: 0 0.3 * 100rpx;
}
.order-details .map .place {
font-size: 0.26 * 100rpx;
width: 1.76 * 100rpx;
height: 0.5 * 100rpx;
border-radius: 0.25 * 100rpx;
line-height: 0.5 * 100rpx;
text-align: center;
}
.order-details .map .place .iconfont {
font-size: 0.27 * 100rpx;
height: 0.27 * 100rpx;
line-height: 0.27 * 100rpx;
margin: 0.02 * 100rpx 0.03 * 100rpx 0 0;
}
.order-details .address .name .iconfont {
font-size: 0.34 * 100rpx;
margin-left: 0.1 * 100rpx;
}
</style>

131
pages/order/OrderSubmission/index.vue

@ -35,15 +35,24 @@
</view> </view>
<view class="iconfont icon-jiantou"></view> <view class="iconfont icon-jiantou"></view>
</view> </view>
<div class="address acea-row row-between-wrapper" v-else @click="showStoreList"> <div
<div class="addressCon"> class="address acea-row row-between-wrapper"
v-if="shipping_type === 1"
@click="showStoreList"
>
<div class="addressCon" v-if="storeItems">
<div class="name">
{{ storeItems.name }}
<span class="phone">{{storeItems.phone }}</span>
</div>
<div>{{ storeItems.address}}</div>
</div>
<div class="addressCon" v-else>
<div class="name"> <div class="name">
{{ storeItems.name || systemStore.name }} {{ systemStore.name }}
<span <span class="phone">{{systemStore.phone}}</span>
class="phone"
>{{storeItems.phone || systemStore.phone}}</span>
</div> </div>
<div>{{ storeItems.address || systemStore.address }}</div> <div>{{ systemStore.address }}</div>
</div> </div>
<div class="iconfont icon-jiantou"></div> <div class="iconfont icon-jiantou"></div>
</div> </div>
@ -92,7 +101,7 @@
}} }}
</view> </view>
</view> </view>
<view v-else> <view v-if="shipping_type === 1">
<view class="item acea-row row-between-wrapper"> <view class="item acea-row row-between-wrapper">
<view>联系人</view> <view>联系人</view>
<view class="discount"> <view class="discount">
@ -311,10 +320,10 @@ export default {
components: { components: {
OrderGoods, OrderGoods,
CouponListWindow, CouponListWindow,
AddressWindow AddressWindow,
}, },
props: {}, props: {},
data: function() { data: function () {
return { return {
offlinePayStatus: 2, offlinePayStatus: 2,
from: this.$deviceType, from: this.$deviceType,
@ -329,13 +338,13 @@ export default {
addressInfo: {}, addressInfo: {},
couponId: 0, couponId: 0,
orderGroupInfo: { orderGroupInfo: {
priceGroup: {} priceGroup: {},
}, },
usableCoupon: {}, usableCoupon: {},
addressLoaded: false, addressLoaded: false,
useIntegral: false, useIntegral: false,
orderPrice: { orderPrice: {
payPrice: "计算中" payPrice: "计算中",
}, },
mark: "", mark: "",
systemStore: {}, systemStore: {},
@ -343,7 +352,7 @@ export default {
contacts: "", contacts: "",
contactsTel: "", contactsTel: "",
storeSelfMention: 0, storeSelfMention: 0,
cartid: "" cartid: "",
}; };
}, },
computed: mapGetters(["userInfo", "storeItems"]), computed: mapGetters(["userInfo", "storeItems"]),
@ -356,9 +365,9 @@ export default {
}, },
shipping_type() { shipping_type() {
this.computedPrice(); this.computedPrice();
} },
}, },
mounted: function() { mounted: function () {
let that = this; let that = this;
this.$store.dispatch("getUser", true); this.$store.dispatch("getUser", true);
that.getCartInfo(); that.getCartInfo();
@ -368,28 +377,29 @@ export default {
} }
if (that.$yroute.query.id !== undefined) { if (that.$yroute.query.id !== undefined) {
that.cartid = that.$yroute.query.id; that.cartid = that.$yroute.query.id;
console.log(that.cartid) console.log(that.cartid);
} }
}, },
methods: { methods: {
showStoreList() { showStoreList() {
this.$store.commit("get_to", "orders"); this.$store.commit("get_to", "orders");
this.$yrouter.push({ this.$yrouter.push({
path: "/pages/shop/StoreList/index" path: "/pages/shop/StoreList/index",
}); });
}, },
addressType: function(index) { addressType: function (index) {
if (index && !this.systemStore.id) { if (index && !this.systemStore.id) {
uni.showToast({ uni.showToast({
title: "暂无门店信息,您无法选择到店自提!", title: "暂无门店信息,您无法选择到店自提!",
icon: "none", icon: "none",
duration: 2000 duration: 2000,
}); });
return; return;
} }
console.log(this);
this.shipping_type = index; this.shipping_type = index;
}, },
changeUseIntegral: function(e) { changeUseIntegral: function (e) {
// this.computedPrice(); // this.computedPrice();
this.useIntegral = e.mp.detail.value[0]; this.useIntegral = e.mp.detail.value[0];
}, },
@ -399,15 +409,15 @@ export default {
addressId: this.addressInfo.id, addressId: this.addressInfo.id,
useIntegral: this.useIntegral ? 1 : 0, useIntegral: this.useIntegral ? 1 : 0,
couponId: this.usableCoupon.id || 0, couponId: this.usableCoupon.id || 0,
shipping_type: parseInt(shipping_type) + 1 shipping_type: parseInt(shipping_type) + 1,
}).then(res => { }).then((res) => {
const data = res.data; const data = res.data;
if (data.status === "EXTEND_ORDER") { if (data.status === "EXTEND_ORDER") {
this.$yrouter.replace({ this.$yrouter.replace({
path: "/pages/order/OrderDetails/index", path: "/pages/order/OrderDetails/index",
query: { query: {
id: data.result.orderId id: data.result.orderId,
} },
}); });
} else { } else {
this.orderPrice = data.result; this.orderPrice = data.result;
@ -420,17 +430,20 @@ export default {
uni.showToast({ uni.showToast({
title: "参数有误", title: "参数有误",
icon: "none", icon: "none",
duration: 2000 duration: 2000,
}); });
return this.$yrouter.back(); return this.$yrouter.back();
} }
postOrderConfirm(cartIds) postOrderConfirm(cartIds)
.then(res => { .then((res) => {
console.log(res, 999999);
console.log(res.data.systemStore || {}, 999999);
this.offlinePayStatus = res.data.offline_pay_status; this.offlinePayStatus = res.data.offline_pay_status;
this.orderGroupInfo = res.data; this.orderGroupInfo = res.data;
this.deduction = res.data.deduction; this.deduction = res.data.deduction;
this.usableCoupon = res.data.usableCoupon || {}; this.usableCoupon = res.data.usableCoupon || {};
this.addressInfo = res.data.addressInfo || {}; this.addressInfo = res.data.addressInfo || {};
//
this.systemStore = res.data.systemStore || {}; this.systemStore = res.data.systemStore || {};
this.storeSelfMention = res.data.storeSelfMention; this.storeSelfMention = res.data.storeSelfMention;
this.computedPrice(); this.computedPrice();
@ -439,11 +452,11 @@ export default {
uni.showToast({ uni.showToast({
title: "加载订单数据失败", title: "加载订单数据失败",
icon: "none", icon: "none",
duration: 2000 duration: 2000,
}); });
}); });
}, },
addressTap: function() { addressTap: function () {
this.showAddress = true; this.showAddress = true;
if (!this.addressLoaded) { if (!this.addressLoaded) {
this.addressLoaded = true; this.addressLoaded = true;
@ -454,21 +467,21 @@ export default {
this.addressLoaded = false; this.addressLoaded = false;
this.showAddress = false; this.showAddress = false;
}, },
couponTap: function() { couponTap: function () {
this.showCoupon = true; this.showCoupon = true;
}, },
changeCoupon: function(coupon) { changeCoupon: function (coupon) {
if (!coupon) { if (!coupon) {
this.usableCoupon = { this.usableCoupon = {
couponTitle: "不使用优惠券", couponTitle: "不使用优惠券",
id: 0 id: 0,
}; };
} else { } else {
this.usableCoupon = coupon; this.usableCoupon = coupon;
} }
this.computedPrice(); this.computedPrice();
}, },
payItem: function(index) { payItem: function (index) {
this.active = index; this.active = index;
}, },
changeAddress(addressInfo) { changeAddress(addressInfo) {
@ -480,7 +493,7 @@ export default {
uni.showToast({ uni.showToast({
title: "请选择支付方式", title: "请选择支付方式",
icon: "none", icon: "none",
duration: 2000 duration: 2000,
}); });
return; return;
} }
@ -488,7 +501,7 @@ export default {
uni.showToast({ uni.showToast({
title: "请选择收货地址", title: "请选择收货地址",
icon: "none", icon: "none",
duration: 2000 duration: 2000,
}); });
return; return;
} }
@ -501,7 +514,7 @@ export default {
uni.showToast({ uni.showToast({
title: "请填写联系人或联系人电话", title: "请填写联系人或联系人电话",
icon: "none", icon: "none",
duration: 2000 duration: 2000,
}); });
return; return;
} }
@ -510,7 +523,7 @@ export default {
uni.showToast({ uni.showToast({
title: "请填写正确的手机号", title: "请填写正确的手机号",
icon: "none", icon: "none",
duration: 2000 duration: 2000,
}); });
return; return;
} }
@ -518,14 +531,14 @@ export default {
uni.showToast({ uni.showToast({
title: "请填写您的真实姓名", title: "请填写您的真实姓名",
icon: "none", icon: "none",
duration: 2000 duration: 2000,
}); });
return; return;
} }
} }
uni.showLoading({ uni.showLoading({
title: "生成订单中" title: "生成订单中",
}); });
let from = {}; let from = {};
if (this.$deviceType == "app") { if (this.$deviceType == "app") {
@ -547,9 +560,9 @@ export default {
mark: this.mark || "", mark: this.mark || "",
shippingType: parseInt(shipping_type) + 1, shippingType: parseInt(shipping_type) + 1,
storeId: this.storeItems ? this.storeItems.id : this.systemStore.id, storeId: this.storeItems ? this.storeItems.id : this.systemStore.id,
...from ...from,
}) })
.then(res => { .then((res) => {
uni.hideLoading(); uni.hideLoading();
const data = res.data; const data = res.data;
switch (data.status) { switch (data.status) {
@ -558,13 +571,13 @@ export default {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: "none",
duration: 2000 duration: 2000,
}); });
this.$yrouter.replace({ this.$yrouter.replace({
path: "/pages/order/OrderDetails/index", path: "/pages/order/OrderDetails/index",
query: { query: {
id: data.result.orderId id: data.result.orderId,
} },
}); });
break; break;
case "PAY_DEFICIENCY": case "PAY_DEFICIENCY":
@ -574,26 +587,26 @@ export default {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: "none",
duration: 2000 duration: 2000,
}); });
this.$yrouter.replace({ this.$yrouter.replace({
path: "/pages/order/OrderDetails/index", path: "/pages/order/OrderDetails/index",
query: { query: {
id: data.result.orderId id: data.result.orderId,
} },
}); });
break; break;
case "SUCCESS": case "SUCCESS":
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: "none",
duration: 2000 duration: 2000,
}); });
this.$yrouter.replace({ this.$yrouter.replace({
path: "/pages/order/OrderDetails/index", path: "/pages/order/OrderDetails/index",
query: { query: {
id: data.result.orderId id: data.result.orderId,
} },
}); });
break; break;
case "WECHAT_H5_PAY": case "WECHAT_H5_PAY":
@ -601,8 +614,8 @@ export default {
this.$yrouter.replace({ this.$yrouter.replace({
path: "/pages/order/OrderDetails/index", path: "/pages/order/OrderDetails/index",
query: { query: {
id: data.result.orderId id: data.result.orderId,
} },
}); });
setTimeout(() => { setTimeout(() => {
// location.href = data.result.jsConfig.mweb_url; // location.href = data.result.jsConfig.mweb_url;
@ -614,8 +627,8 @@ export default {
this.$yrouter.replace({ this.$yrouter.replace({
path: "/pages/order/OrderDetails/index", path: "/pages/order/OrderDetails/index",
query: { query: {
id: data.result.orderId id: data.result.orderId,
} },
}); });
}); });
break; break;
@ -626,8 +639,8 @@ export default {
this.$yrouter.replace({ this.$yrouter.replace({
path: "/pages/order/OrderDetails/index", path: "/pages/order/OrderDetails/index",
query: { query: {
id: data.result.orderId id: data.result.orderId,
} },
}); });
}); });
break; break;
@ -639,7 +652,7 @@ export default {
// }); // });
} }
}) })
.catch(err => { .catch((err) => {
uni.hideLoading(); uni.hideLoading();
uni.showToast({ uni.showToast({
title: title:
@ -648,10 +661,10 @@ export default {
err.response.data.message || err.response.data.message ||
"创建订单失败", "创建订单失败",
icon: "none", icon: "none",
duration: 2000 duration: 2000,
}); });
}); });
} },
} },
}; };
</script> </script>

55
pages/user/Recharge/index.vue

@ -28,7 +28,10 @@
<text class="pic-number"></text> <text class="pic-number"></text>
</text> </text>
</view> </view>
<view class="pic-number" v-if="item.value.give_price > 0">赠送{{ item.value.give_price }} </view> <view
class="pic-number"
v-if="item.value.give_price > 0"
>赠送{{ item.value.give_price }} </view>
</view> </view>
<!-- <view <!-- <view
class="pic-box pic-box-color acea-row row-center-wrapper" class="pic-box pic-box-color acea-row row-center-wrapper"
@ -40,7 +43,7 @@
v-model="money" v-model="money"
class="pic-box-money pic-number-pic" class="pic-box-money pic-number-pic"
/> />
</view> --> </view>-->
</view> </view>
<view class="tip">提示充值后帐户的金额不能提现</view> <view class="tip">提示充值后帐户的金额不能提现</view>
<view class="pay-btn bg-color-red" @click="recharge">立即充值</view> <view class="pay-btn bg-color-red" @click="recharge">立即充值</view>
@ -58,7 +61,7 @@ export default {
name: "Recharge", name: "Recharge",
components: {}, components: {},
props: {}, props: {},
data: function() { data: function () {
return { return {
active: 0, active: 0,
from: this.$deviceType, from: this.$deviceType,
@ -68,12 +71,11 @@ export default {
activePic: 0, activePic: 0,
numberPic: "", numberPic: "",
paid_price: "", paid_price: "",
rechar_id: 0 rechar_id: 0,
}; };
}, },
computed: mapGetters(["userInfo"]), computed: mapGetters(["userInfo"]),
mounted: function() { mounted: function () {
this.now_money = this.userInfo.nowMoney; this.now_money = this.userInfo.nowMoney;
this.getRecharge(); this.getRecharge();
}, },
@ -83,7 +85,7 @@ export default {
*/ */
getRecharge() { getRecharge() {
getRechargeApi() getRechargeApi()
.then(res => { .then((res) => {
this.picList = res.data.recharge_price_ways || []; this.picList = res.data.recharge_price_ways || [];
if (this.picList[0]) { if (this.picList[0]) {
this.rechar_id = this.picList[0].id; this.rechar_id = this.picList[0].id;
@ -91,12 +93,12 @@ export default {
this.numberPic = this.picList[0].value.give_price; this.numberPic = this.picList[0].value.give_price;
} }
}) })
.catch(res => { .catch((res) => {
uni.showToast({ uni.showToast({
title: title:
err.msg || err.response.data.msg || err.response.data.message, err.msg || err.response.data.msg || err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000,
}); });
}); });
}, },
@ -116,21 +118,28 @@ export default {
this.numberPic = item.value.price; this.numberPic = item.value.price;
} }
}, },
recharge: function() { recharge: function () {
let that = this, let that = this,
price = Number(this.money); price = Number(this.money);
if (this.picList.length == this.activePic && price === 0) { if (this.picList.length == this.activePic && price === 0) {
uni.showToast({ uni.showToast({
title: "请输入您要充值的金额", title: "请输入您要充值的金额",
icon: "none", icon: "none",
duration: 2000 duration: 2000,
}); });
return; return;
} else if (this.picList.length == this.activePic && price < 0.01) { } else if (this.picList.length == this.activePic && price < 0.01) {
uni.showToast({ uni.showToast({
title: "充值金额不能低于0.01", title: "充值金额不能低于0.01",
icon: "none", 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; return;
} }
@ -147,9 +156,9 @@ export default {
price: prices, price: prices,
from: that.from, from: that.from,
paid_price: paid_price, paid_price: paid_price,
rechar_id: that.rechar_id rechar_id: that.rechar_id,
}) })
.then(res => { .then((res) => {
console.log(res); console.log(res);
var data = res.data.data; var data = res.data.data;
weappPay(res.data.data) weappPay(res.data.data)
@ -159,37 +168,37 @@ export default {
uni.showToast({ uni.showToast({
title: "支付成功", title: "支付成功",
icon: "success", icon: "success",
duration: 2000 duration: 2000,
}); });
this.$yrouter.back(); this.$yrouter.back();
}) })
.finally(res => { .finally((res) => {
//if(typeof(res) == "undefined") return //if(typeof(res) == "undefined") return
uni.showToast({ uni.showToast({
title: res, title: res,
icon: "none", icon: "none",
duration: 2000 duration: 2000,
}); });
}) })
.catch(function() { .catch(function () {
uni.showToast({ uni.showToast({
title: "支付失败", title: "支付失败",
icon: "none", icon: "none",
duration: 2000 duration: 2000,
}); });
}); });
}) })
.catch(err => { .catch((err) => {
console.log(err); console.log(err);
uni.showToast({ uni.showToast({
title: title:
err.msg || err.response.data.msg || err.response.data.message, err.msg || err.response.data.msg || err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000,
}); });
}); });
} },
} },
}; };
</script> </script>

4
utils/request.js

@ -61,6 +61,10 @@ function baseRequest(options) {
return fly.request(url, params || data, { return fly.request(url, params || data, {
...option ...option
}).then(res => { }).then(res => {
console.log("——————————— "+url+" —————————————")
console.log(params || data)
console.log(res.data)
console.log("—————————————— end ——————————")
const data = res.data || {}; const data = res.data || {};
if (res.status !== 200) { if (res.status !== 200) {
return Promise.reject({ msg: "请求失败", res, data }); return Promise.reject({ msg: "请求失败", res, data });

Loading…
Cancel
Save