Forráskód Böngészése

Merge branch 'master' of ssh://gogs.zfire.top:2222/zfire-front/recycle-mobile

* 'master' of ssh://gogs.zfire.top:2222/zfire-front/recycle-mobile:
  no message
  feat: 修改
Moss 1 éve
szülő
commit
b0121ffa6c

+ 0 - 11
src/common/http/index.js

@@ -138,9 +138,7 @@ export const axios = function(obj = {}) {
         mask: true,
       })
     }
-
     let _url = process.env.VUE_APP_BASE_URL + process.env.VUE_APP_BASE_API + obj.url
-
     let isGet = obj.method && obj.method.toLowerCase() == 'get';
     let isQuery = obj.isQuery;
     if (isGet || isQuery) {
@@ -150,7 +148,6 @@ export const axios = function(obj = {}) {
     if (obj.type == 'json') {
       _type = 'application/json'
     }
-
     uni.request({
       url: _url,
       data: isGet || isQuery ? '' : (obj.params || ''),
@@ -160,17 +157,11 @@ export const axios = function(obj = {}) {
       },
       method: obj.method ? obj.method : "POST",
       success: function(ress) {
-
-        console.log(ress, "----------------")
-
         if (obj.isLoading) {
           uni.hideLoading();
         }
-
         const res = ress.data;
         if (whiteCodes.indexOf(res.code) < 0) {
-
-
           uni.showToast({
             title: res.message || 'Error',
             icon: 'none',
@@ -180,8 +171,6 @@ export const axios = function(obj = {}) {
         } else {
           resolve(res)
         }
-
-
       },
       fail: function(err) {
         uni.hideLoading();

+ 255 - 139
src/pages/goods/order.vue

@@ -1,184 +1,300 @@
 <template>
   <zj-page-layout :hasFooter="true">
-    <view class="address-container" @tap="$navPage(`/pages/mine/address/list?isChoose=1`)">
-    	<view class="left">
-    		<view class="icon"><text class="iconfont icon-dingwei1"></text></view>
-    		<view class="nodata" v-if="!hasAddress">选择收货地址</view>
-    		<view class="hasdata" v-else>
-    			<view class="name">{{addressInfo.name}}<text>{{addressInfo.phone}}</text></view>
-    			<view class="address ellipsis-2">{{addressInfo.province}}{{addressInfo.city}}{{addressInfo.area}}{{addressInfo.street}}{{addressInfo.address}}{{addressInfo.houseNo}}</view>
-    		</view>
-    	</view>
-    	<text class="right iconfont icon-jinru"></text>
+    <view class="address-container" @tap="goAddress">
+      <view class="left">
+        <view class="icon"><text class="iconfont icon-dingwei1"></text></view>
+        <view class="nodata" v-if="!hasAddress">选择收货地址</view>
+        <view class="hasdata" v-else>
+          <view class="name">{{addressInfo.name}}<text>{{addressInfo.phone}}</text></view>
+          <view class="address ellipsis-2">
+            {{addressInfo.province}}{{addressInfo.city}}{{addressInfo.area}}{{addressInfo.street}}{{addressInfo.address}}
+          </view>
+        </view>
+      </view>
+      <text class="right iconfont icon-jinru"></text>
     </view>
 
     <view class="goods-container">
       <view class="goods">
-        <image src="@/static/user/other_book.png"></image>
+        <image v-if="goodsDetail.goodsPicUrl" :src="imageUrl + goodsDetail.goodsPicUrl||''"></image>
         <view class="main">
-          <view class="name">商品名称</view>
-          <view class="des">商品描述</view>
+          <view class="name">{{goodsDetail.title||''}}</view>
+          <view class="des">{{goodsDetail.content||''}}</view>
           <view class="bottom">
-          	<view class="price">¥1200.00</view>
-          	<u-number-box
-          		@tap.stop
-          		v-model="num"
-          		:min="1"
-          		:buttonSize="26"
-          		iconStyle="font-size: 12px;"
-          		:disabled="!hasAddress"
-          		@change="changeCount($event, index)">
-          	</u-number-box>
+            <view class="price">¥{{goodsDetail.amount||''}}</view>
+            <!-- <u-number-box @tap.stop v-model="num" :min="1" :buttonSize="26" iconStyle="font-size: 12px;"
+              :disabled="!hasAddress" @change="changeCount($event, index)">
+            </u-number-box> -->
           </view>
         </view>
       </view>
-      <view class="total">订单总金额<text>¥1200.00</text></view>
+      <view class="total">订单总金额<text>¥{{goodsDetail.amount||''}}</text></view>
     </view>
-
     <template slot="footer">
       <view class="bottom-container">
-      	<view class="left">
-          实付款:<text>¥1200.00</text>
-      	</view>
-      	<u-button type="primary" text="提交订单" @click="submitOrder"></u-button>
+        <view class="left">
+          实付款:<text>¥{{goodsDetail.amount||''}}</text>
+        </view>
+        <u-button type="primary" :disabled="!hasAddress" text="提交订单" @click="submitOrder"></u-button>
       </view>
     </template>
-
   </zj-page-layout>
 </template>
 
 <script>
+  import api from '@/common/http/'
+  export default {
+    data() {
+      return {
+        imageUrl: this.$imageUrl,
+        addressInfo: {},
+        hasAddress: false,
+        pam: {},
+        goodsDetail: {}
+      }
+    },
+    onLoad(pam) {
+      this.pam = pam
+      this.getGoods()
+      uni.$on("chooseAddress", (data) => {
+        this.hasAddress = true
+        this.addressInfo = data
+      })
+    },
+    onUnload() {
+      uni.$off("chooseAddress")
+    },
+    methods: {
+      submitOrder() {
+        api.post('/orderPay/buy', {
+          goodsId: this.pam.id,
+          userAddress: this.addressInfo
+        }, false).then(res => {
+          uni.showModal({
+            title: '支付查询',
+            content: '等待支付结果,或直接去订单管理',
+            showCancel: false,
+            confirmText: "订单管理",
+            success: function() {
+              if (this.timeId) {
+                clearTimeout(this.timeId)
+              }
+              this.$navToPage({
+                url: '/pages/mine/myBuy/list'
+              })
+            }
+          });
+          uni.requestPayment({
+            provider: 'wxpay',
+            timeStamp: res.data.timeStamp,
+            nonceStr: res.data.nonceStr,
+            package: res.data.payPackage,
+            signType: "MD5",
+            paySign: res.data.paySign,
+            success: () => {
+              var getList = () => {
+                if (this.timeId) {
+                  clearTimeout(this.timeId)
+                }
+                api.postJson('/orderPay/detail', {
+                  orderId: res.data.id,
+                }, false).then(res2 => {
+                  if (res2.data.payStatus === "WAIT") {
+                    if (this.timeId) {
+                      clearTimeout(this.timeId)
+                    }
+                    this.$navToPage({
+                      url: '/pages/mine/myBuy/list'
+                    })
+                  } else {
+                    this.timeId = setTimeout(getList, 1000)
+                  }
+                })
+              }
+              getList()
+            },
+            fail: (ress) => {
+              console.log(ress)
+            },
+            complete: () => {
+              console.log("失败")
+            }
+          });
+        })
+      },
+      getGoods() {
+        if (!this.pam.id) {
+          return
+        }
+        api.postJson('/goods/detail', {
+          id: this.pam.id,
+        }, false).then(res => {
+          console.log(res.data)
+          this.goodsDetail = res.data
+        })
+      },
+      goAddress(item) {
+        this.$navToPage({
+          url: '/pages/mine/address/list?isChoose=1'
+        })
+      },
+    },
+  }
 </script>
 
 <style lang="scss" scoped>
-.address-container {
-  background: #FFFFFF;
-  display: flex;
-  justify-content: space-between;
-  align-items: center;
-  height: 150rpx;
-  padding: 0 20rpx;
-  margin-top: 30rpx;
-  .right {
-    font-size: 36rpx;
-    flex-shrink: 0;
-    color: $sec-font;
-  }
-  .left {
+  .address-container {
+    background: #FFFFFF;
     display: flex;
+    justify-content: space-between;
     align-items: center;
-    margin-right: 20rpx;
-    .icon {
-      width: 52rpx;
-      height: 52rpx;
-      border-radius: 50%;
-      background: $theme-color;
-      display: flex;
+    height: 150rpx;
+    padding: 0 20rpx;
+    margin-top: 30rpx;
+
+    .right {
+      font-size: 36rpx;
       flex-shrink: 0;
-      justify-content: center;
+      color: $sec-font;
+    }
+
+    .left {
+      display: flex;
       align-items: center;
       margin-right: 20rpx;
-      .iconfont {
-        font-size: 36rpx;
-        color: #ffffff;
-      }
-    }
-    .nodata {
-      font-size: 28rpx;
-      color: #999999;
-    }
-    .hasdata {
-      .name {
-        font-size: 32rpx;
-        color: #333333;
-        text {
-          color: #999999;
-          font-size: 28rpx;
-          margin-left: 16rpx;
+
+      .icon {
+        width: 52rpx;
+        height: 52rpx;
+        border-radius: 50%;
+        background: $theme-color;
+        display: flex;
+        flex-shrink: 0;
+        justify-content: center;
+        align-items: center;
+        margin-right: 20rpx;
+
+        .iconfont {
+          font-size: 36rpx;
+          color: #ffffff;
         }
       }
-      .address {
+
+      .nodata {
         font-size: 28rpx;
-        color: #666666;
-        line-height: 34rpx;
-        margin-top: 10rpx;
+        color: #999999;
+      }
+
+      .hasdata {
+        .name {
+          font-size: 32rpx;
+          color: #333333;
+
+          text {
+            color: #999999;
+            font-size: 28rpx;
+            margin-left: 16rpx;
+          }
+        }
+
+        .address {
+          font-size: 28rpx;
+          color: #666666;
+          line-height: 34rpx;
+          margin-top: 10rpx;
+        }
       }
     }
   }
-}
 
-.goods-container {
-  background: #ffffff;
-  margin-top: 30rpx;
-  padding: 0 30rpx;
-  .goods {
-    display: flex;
-    padding: 30rpx 0;
-    image {
-      width: 120rpx;
-      height: 120rpx;
-    }
-    .main {
-      flex: 1;
-      margin-left: 20rpx;
-      .name {
-        font-size: 32rpx;
+  .goods-container {
+    background: #ffffff;
+    margin-top: 30rpx;
+    padding: 0 30rpx;
+
+    .goods {
+      display: flex;
+      padding: 30rpx 0;
+
+      image {
+        width: 120rpx;
+        height: 120rpx;
       }
-      .des {
-        margin-top: 12rpx;
-        font-size: 28rpx;
-        color: $reg-font;
+
+      .main {
+        flex: 1;
+        margin-left: 20rpx;
+
+        .name {
+          font-size: 32rpx;
+        }
+
+        .des {
+          margin-top: 12rpx;
+          font-size: 28rpx;
+          color: $reg-font;
+        }
+
+        .bottom {
+          display: flex;
+          justify-content: space-between;
+          align-items: center;
+          margin-top: 12rpx;
+
+          .price {
+            color: $assist-color;
+            font-weight: 500;
+            font-size: 32rpx;
+
+            text {
+              font-size: 24rpx;
+            }
+          }
+
+          ::v-deep .u-number-box {
+
+            .u-number-box__minus,
+            .u-number-box__plus {
+              width: 26px;
+            }
+          }
+        }
       }
-      .bottom {
-      	display: flex;
-      	justify-content: space-between;
-      	align-items: center;
-        margin-top: 12rpx;
-      	.price {
-      		color: $assist-color;
-      		font-weight: 500;
-      		font-size: 32rpx;
-      		text {
-      			font-size: 24rpx;
-      		}
-      	}
-      	::v-deep .u-number-box {
-      		.u-number-box__minus, .u-number-box__plus {
-      			width: 26px;
-      		}
-      	}
+    }
+
+    .total {
+      border-top: 1px solid #eaeaea;
+      height: 80rpx;
+      display: flex;
+      align-items: center;
+      justify-content: end;
+      font-size: 28rpx;
+
+      text {
+        margin-left: 12rpx;
+        color: $assist-color;
       }
     }
   }
-  .total {
-    border-top: 1px solid #eaeaea;
-    height: 80rpx;
+
+  .bottom-container {
     display: flex;
     align-items: center;
-    justify-content: end;
-    font-size: 28rpx;
-    text {
-      margin-left: 12rpx;
-      color: $assist-color;
+    justify-content: space-between;
+    padding: 20rpx 30rpx;
+
+    .left {
+      flex-shrink: 0;
+      font-size: 28rpx;
+
+      text {
+        color: $assist-color;
+      }
     }
-  }
-}
-
-.bottom-container {
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-  padding: 20rpx 30rpx;
-  .left {
-    flex-shrink: 0;
-    font-size: 28rpx;
-    text {
-      color: $assist-color;
+
+    ::v-deep .u-button {
+      width: 180rpx;
+      margin: 0;
     }
   }
-  ::v-deep .u-button {
-    width: 180rpx;
-    margin: 0;
-  }
-}
-</style>
+</style>

+ 3 - 2
src/pages/message/index.vue

@@ -15,7 +15,7 @@
             <view class="message_user_info">
               <!-- 头像 -->
               <view class="user_head">
-                <image style="width: 100%; height: 100%;" mode="aspectFill" :src="item.userPic"></image>
+                <image style="width: 100%; height: 100%;" mode="aspectFill" :src="imageUrl + item.userPic"></image>
               </view>
               <view class="user_info">
                 <!-- 姓名 -->
@@ -27,7 +27,7 @@
               </view>
               <!-- 商品图片 -->
               <view class="goods_img">
-                <image style="width: 100%; height: 100%;" mode="aspectFill" :src="item.goods_img"></image>
+                <image style="width: 100%; height: 100%;" mode="aspectFill" :src="imageUrl + item.goods_img"></image>
               </view>
             </view>
           </view>
@@ -48,6 +48,7 @@
     // #ifdef H5
     data() {
       return {
+        imageUrl: this.$imageUrl,
         scrollTop: 0,
         list: []
       }

+ 5 - 3
src/pages/message/msgView.vue

@@ -10,7 +10,8 @@
     <view class="goods_info">
       <!-- 商品图片 -->
       <view class="goods_img">
-        <image style="width: 100%; height: 100%;" mode="aspectFill" :src="goodsDetail.goodsPicUrl"></image>
+        <image v-if="goodsDetail.goodsPicUrl" style="width: 100%; height: 100%;" mode="aspectFill"
+          :src="imageUrl + goodsDetail.goodsPicUrl"></image>
       </view>
       <!-- 商品描述 -->
       <view class="goods_text">
@@ -43,14 +44,14 @@
               </view>
               <!-- 头像 -->
               <view class="msg_user_img">
-                <image style="width: 100%; height: 100%;" mode="aspectFill" :src="item.userPic"></image>
+                <image style="width: 100%; height: 100%;" mode="aspectFill" :src="imageUrl + item.userPic"></image>
               </view>
             </view>
             <!-- 左消息 -->
             <view class="msg_view" v-else>
               <!-- 头像 -->
               <view class="msg_user_img">
-                <image style="width: 100%; height: 100%;" mode="aspectFill" :src="item.userPic"></image>
+                <image style="width: 100%; height: 100%;" mode="aspectFill" :src="imageUrl + item.userPic"></image>
               </view>
               <view class="msg_view_info msg_view_info_left">
                 <view class="msg_view_conent">{{item.message}}</view>
@@ -112,6 +113,7 @@
   export default {
     data() {
       return {
+        imageUrl: this.$imageUrl,
         scrollTop: 0,
         gengduo: false,
         pam: {},

+ 146 - 146
src/pages/mine/address/list.vue

@@ -1,159 +1,159 @@
 <template>
-	<zj-page-layout
-		:hasFooter="true"
-		:isScroll="true"
-		:refresherTriggered="refresherTriggered"
-		@refresherrefresh="refresherrefresh">
-		<view class="list-container">
-			<block v-for="(item, index) in dataList" :key='index'>
-				<view class="item" @tap="chooseAddress(index)">
-					<view class="main">
-						<view class="top">
-							<view class="default" v-if="item.defaultAddr">默认</view>
-							<view class="text">{{item.province}} {{item.city}} {{item.area}} {{item.street}}</view>
-						</view>
-						<view class="address">{{item.address}}</view>
-						<view class="name">{{item.name}} {{item.phone}}</view>
-					</view>
-					<text class="iconfont icon-bianji" @tap.stop="$navPage('/pages/mine/address/form?id='+item.userAddressId)"></text>
-				</view>
-			</block>
-		</view>
+  <zj-page-layout :hasFooter="true" :isScroll="true" :refresherTriggered="refresherTriggered"
+    @refresherrefresh="refresherrefresh">
+    <view class="list-container">
+      <block v-for="(item, index) in dataList" :key='index'>
+        <view class="item" @tap="chooseAddress(index)">
+          <view class="main">
+            <view class="top">
+              <view class="default" v-if="item.defaultAddr">默认</view>
+              <view class="text">{{item.province}} {{item.city}} {{item.area}} {{item.street}}</view>
+            </view>
+            <view class="address">{{item.address}}</view>
+            <view class="name">{{item.name}} {{item.phone}}</view>
+          </view>
+          <text class="iconfont icon-bianji"
+            @tap.stop="$navPage('/pages/mine/address/form?id='+item.userAddressId)"></text>
+        </view>
+      </block>
+    </view>
 
-		<Loading
-			:type="2"
-			:loadStatus="loadStatus"
-			:dataList="dataList"
-		/>
+    <Loading :type="2" :loadStatus="loadStatus" :dataList="dataList" />
 
-		<template slot="footer">
-			<view class="footer-btn-group">
-				<u-button text="获取地址" @click="getWxAddress"></u-button>
-				<u-button text="新增地址" type="primary" @click="$navPage('/pages/mine/address/form')"></u-button>
-			</view>
-		</template>
-	</zj-page-layout>
+    <template slot="footer">
+      <view class="footer-btn-group">
+        <u-button text="获取地址" @click="getWxAddress"></u-button>
+        <u-button text="新增地址" type="primary" @click="$navPage('/pages/mine/address/form')"></u-button>
+      </view>
+    </template>
+  </zj-page-layout>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				dataList: [], // 收货地址列表
-				loadStatus: 0,
-				refresherTriggered: false, // 下拉刷新状态
-				isChoose: false, // 是否进来选择地址
-			}
-		},
-		onShow() {
-			this.getList();
-		},
-		onLoad({isChoose}) {
-			this.isChoose = isChoose;
-		},
-		methods: {
-			// 触发下拉刷新
-			async refresherrefresh(e) {
-				this.refresherTriggered = true;
-				this.dataList = [];
-				this.getList();
-			},
+  export default {
+    data() {
+      return {
+        dataList: [], // 收货地址列表
+        loadStatus: 0,
+        refresherTriggered: false, // 下拉刷新状态
+        isChoose: false, // 是否进来选择地址
+      }
+    },
+    onShow() {
+      this.getList();
+    },
+    onLoad({
+      isChoose
+    }) {
+      this.isChoose = isChoose;
+    },
+    methods: {
+      // 触发下拉刷新
+      async refresherrefresh(e) {
+        this.refresherTriggered = true;
+        this.dataList = [];
+        this.getList();
+      },
 
-			// 获取收货地址列表
-			getList() {
-				this.loadStatus = 1;
-				this.$api.get('/user/address/list',
-          {
-						pageNum: 1,
-						pageSize: -1,
-						userId: this.$store.state.user.userId
-					}).then(res => {
-					this.loadStatus = 0;
-					let list = res.data.records;
-					if(list.length < 1){
-						this.loadStatus = 2;
-					}
-					this.dataList = list;
-				}).catch(() => {
-					this.loadStatus = 2;
-				}).finally(res => {
-					this.refresherTriggered = false;
-				})
-			},
+      // 获取收货地址列表
+      getList() {
+        this.loadStatus = 1;
+        this.$api.get('/user/address/list', {
+          pageNum: 1,
+          pageSize: -1,
+          userId: this.$store.state.user.userId
+        }).then(res => {
+          this.loadStatus = 0;
+          let list = res.data.records;
+          if (list.length < 1) {
+            this.loadStatus = 2;
+          }
+          this.dataList = list;
+        }).catch(() => {
+          this.loadStatus = 2;
+        }).finally(res => {
+          this.refresherTriggered = false;
+        })
+      },
 
-			// 选择地址
-			chooseAddress(index) {
-				if(!this.isChoose) {
-					return false;
-				}
-				uni.$emit('chooseAddress', this.dataList[index]);
-				this.$backPage(1);
-			},
+      // 选择地址
+      chooseAddress(index) {
+        if (!this.isChoose) {
+          return false;
+        }
+        uni.$emit('chooseAddress', this.dataList[index]);
+        this.$backPage(1);
+      },
 
-			// 获取微信收货地址
-			getWxAddress() {
-				let that = this;
-				uni.chooseAddress({
-					success(res) {
-						let params = {
-							userId: that.$store.state.user.userId,
-							name: res.userName,
-							phone: res.telNumber,
-							province: res.provinceName,
-							city: res.cityName,
-							area: res.countyName,
-							address: res.detailInfo,
-							houseNo: '',
-						}
-						that.$navPage('/pages/mine/address/form?addressData=' + JSON.stringify(params));
-					}
-				})
-			},
-		}
-	}
+      // 获取微信收货地址
+      getWxAddress() {
+        let that = this;
+        uni.chooseAddress({
+          success(res) {
+            let params = {
+              userId: that.$store.state.user.userId,
+              name: res.userName,
+              phone: res.telNumber,
+              province: res.provinceName,
+              city: res.cityName,
+              area: res.countyName,
+              address: res.detailInfo,
+              houseNo: '',
+            }
+            that.$navPage('/pages/mine/address/form?addressData=' + JSON.stringify(params));
+          }
+        })
+      },
+    }
+  }
 </script>
 
 <style lang="scss">
-	.list-container {
-		background: #FFFFFF;
-		.item {
-			padding: 40rpx 30rpx;
-			display: flex;
-			justify-content: space-between;
-			align-items: center;
-			border-top: 1px solid #f5f5f5;
-			.main {
-				.top {
-					display: flex;
-					align-items: center;
-					.default {
-						font-size: 22rpx;
-						color: $theme-color;
-						background: #E6F0FF;
-						padding: 6rpx 8rpx;
-						line-height: 20rpx;
-						margin-right: 12rpx;
-					}
-					.text {
+  .list-container {
+    background: #FFFFFF;
 
-					}
-				}
-				.address {
-					font-size: 32rpx;
-					color: #333333;
-					line-height: 38rpx;
-					margin-top: 16rpx;
-				}
-				.name {
-					font-size: 24rpx;
-					color: $sec-font;
-					margin-top: 16rpx;
-				}
-			}
-			.iconfont {
-				font-size: 44rpx;
-				color: $sec-font;
-			}
-		}
-	}
-</style>
+    .item {
+      padding: 40rpx 30rpx;
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+      border-top: 1px solid #f5f5f5;
+
+      .main {
+        .top {
+          display: flex;
+          align-items: center;
+
+          .default {
+            font-size: 22rpx;
+            color: $theme-color;
+            background: #E6F0FF;
+            padding: 6rpx 8rpx;
+            line-height: 20rpx;
+            margin-right: 12rpx;
+          }
+
+          .text {}
+        }
+
+        .address {
+          font-size: 32rpx;
+          color: #333333;
+          line-height: 38rpx;
+          margin-top: 16rpx;
+        }
+
+        .name {
+          font-size: 24rpx;
+          color: $sec-font;
+          margin-top: 16rpx;
+        }
+      }
+
+      .iconfont {
+        font-size: 44rpx;
+        color: $sec-font;
+      }
+    }
+  }
+</style>