Quellcode durchsuchen

feat: 对接我的地址

Moss vor 1 Jahr
Ursprung
Commit
8efc85d497

+ 1 - 1
src/filters/index.js

@@ -53,7 +53,7 @@ export function dateToHHmmss(date) {
 }
 
 export function priceFilter2(val) {
-  if(val == 0) return '面议';
+  if(val === 0) return '面议';
 	if(!val) return '-';
 	val = Number(val);
 	return val.toFixed(2);

+ 0 - 6
src/pages.json

@@ -109,12 +109,6 @@
       }
     },
     {
-      "path": "pages/mine/myIssue/detail",
-      "style": {
-        "navigationBarTitleText": "订单详情"
-      }
-    },
-    {
       "path": "pages/goods/list",
       "style": {
         "navigationBarTitleText": "商品列表"

+ 18 - 45
src/pages/mine/address/form.vue

@@ -50,13 +50,13 @@
 					<view class="r" @tap="getLocation"><text class="iconfont icon-dingwei1"></text>定位</view>
 				</view>
 			</view>
-			<view class="row">
+			<!-- <view class="row">
 				<view class="title">门牌号</view>
 				<view class="right input"><input type="text" placeholder="请输入门牌号" maxlength="15" v-model="formData.houseNo"></view>
-			</view>
+			</view> -->
 			<view class="row mt20">
 				<view class="title">设为默认</view>
-				<view class="right default"><switch @change="switchChange" color="#3D8FFD" v-model="formData.defaultAddr" :checked="formData.defaultAddr" style="transform:scale(0.7)" /></view>
+				<view class="right default"><switch @change="switchChange" color="#01C30B" v-model="formData.defaultAddr" :checked="formData.defaultAddr" style="transform:scale(0.7)" /></view>
 			</view>
 		</view>
 
@@ -70,7 +70,6 @@
 </template>
 
 <script>
-	import {mapState} from 'vuex';
 	import {getArea} from '@/common/utils/util.js';
 
 	export default {
@@ -88,16 +87,13 @@
 					area: '',
 					street: '',
 					address: '',
-					houseNo: '',
+					// houseNo: '',
 					defaultAddr: false,
 				},
 				canClickSave: true, // 能否点击提交
 				clipboard: '',
 			}
 		},
-		computed:{
-			...mapState(['userInfo', 'isLogin', 'userId'])
-		},
 		onLoad({id, addressData}) {
 			this.editId = id;
 			if(id) {
@@ -115,7 +111,7 @@
 					city: addressData.city,
 					area: addressData.area,
 					address: addressData.address,
-					houseNo: addressData.houseNo,
+					// houseNo: addressData.houseNo,
 					defaultAddr: addressData.defaultAddr,
 				}
 				this.regionValue = [addressData.province, addressData.city, addressData.area];
@@ -125,13 +121,8 @@
 		methods: {
 			async getRegion(address) {
 				const result = new Promise((resolve, reject) => {
-					this.$axios({
-						url: '/lbs/amap/region/query2',
-						method: 'post',
-						server: 'pc',
-						params: {
-							address
-						}
+					this.$api.post('/lbs/amap/region/query2', {
+						address
 					}).then(res => {
 						resolve(res.data);
 					})
@@ -242,15 +233,10 @@
 				return rs;
 			},
 
-
 			// 获取地址信息
 			getAddressData() {
-				this.$axios({
-					url: '/user/address/detail',
-					method: 'get',
-					params: {
-						userAddressId: this.editId
-					}
+				this.$api.get('/user/address/detail', {
+					userAddressId: this.editId
 				}).then(res => {
 					this.formData = {
 						name: res.data.name,
@@ -259,7 +245,7 @@
 						city: res.data.city,
 						area: res.data.area,
 						address: res.data.address,
-						houseNo: res.data.houseNo,
+						// houseNo: res.data.houseNo,
 						defaultAddr: res.data.defaultAddr,
 					}
 					this.regionValue = [res.data.province, res.data.city, res.data.area];
@@ -333,14 +319,10 @@
 
 			// 获取街道列表
 			getStreetList(street) {
-				this.$axios({
-					url: '/common/street',
-					method: 'get',
-					params: {
-						province: this.regionValue[0],
-						city: this.regionValue[1],
-						area: this.regionValue[2],
-					}
+				this.$api.get('/user/address/street', {
+          province: this.regionValue[0],
+          city: this.regionValue[1],
+          area: this.regionValue[2],
 				}).then(res => {
 					this.streetList = res.data;
 					if(street) {
@@ -409,7 +391,7 @@
 				if(!this.vailateData())return;
 
 				let params = this.formData;
-				params.userId = this.userId;
+				params.userId = this.$store.state.user.userId;
 				let url = '';
 				if(this.editId) {
 					params.userAddressId = this.editId;
@@ -417,12 +399,7 @@
 				}else {
 					url = '/user/address/save';
 				}
-				this.$axios({
-					url: url,
-					type: 'json',
-					params,
-					isLoading: 1,
-				}).then(res => {
+				this.$api.post(url, params).then(res => {
 					this.$successToast(this.editId? '编辑成功':'添加成功');
 					this.$backPage(1, 1000);
 				})
@@ -433,12 +410,8 @@
 				this.$modal({
 					content: '确定要删除该地址吗?',
 				}).then(() => {
-					this.$axios({
-						url: '/user/address/del',
-						params: {
-							userAddressId: this.editId
-						},
-						isLoading: 1,
+					this.$api.post('/user/address/del', {
+						userAddressId: this.editId
 					}).then(res => {
 						this.$successToast('删除成功');
 						this.$backPage(1, 1000);

+ 4 - 9
src/pages/mine/address/list.vue

@@ -12,7 +12,7 @@
 							<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}}{{item.houseNo}}</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>
@@ -36,8 +36,6 @@
 </template>
 
 <script>
-	import {mapState} from 'vuex';
-
 	export default {
 		data() {
 			return {
@@ -47,9 +45,6 @@
 				isChoose: false, // 是否进来选择地址
 			}
 		},
-		computed:{
-			...mapState(['userInfo', 'isLogin', 'userId'])
-		},
 		onShow() {
 			this.getList();
 		},
@@ -67,11 +62,11 @@
 			// 获取收货地址列表
 			getList() {
 				this.loadStatus = 1;
-				this.$api.get('/user/address/list', 
+				this.$api.get('/user/address/list',
           {
 						pageNum: 1,
 						pageSize: -1,
-						userId: this.userId
+						userId: this.$store.state.user.userId
 					}).then(res => {
 					this.loadStatus = 0;
 					let list = res.data.records;
@@ -101,7 +96,7 @@
 				uni.chooseAddress({
 					success(res) {
 						let params = {
-							userId: that.userId,
+							userId: that.$store.state.user.userId,
 							name: res.userName,
 							phone: res.telNumber,
 							province: res.provinceName,

+ 5 - 5
src/pages/mine/index.vue

@@ -50,10 +50,10 @@
         <view class="stats-container card">
           <view class="top">
             <view class="left">我买到的</view>
-            <view class="right" @tap="navToPage(`/pages/mine/myBuy/list`)">全部<text class="iconfont icon-jinru"></text></view>
+            <view class="right" @tap="navToPage(`/pages/mine/myBuy/list?tab=`)">全部<text class="iconfont icon-jinru"></text></view>
           </view>
           <view class="stats">
-            <view class="item" v-for="(item, index) in buyStats" :key="index" @tap="navToPage(`/pages/mine/myBuy/list`)">
+            <view class="item" v-for="(item, index) in buyStats" :key="index" @tap="navToPage(`/pages/mine/myBuy/list?tab=${item.tab}`)">
               <view class="icon">
                 <text class="iconfont" :class="item.icon"></text>
                 <u-badge max="99" :value="item.num" :absolute="true" :offset="[-4, -4]"></u-badge>
@@ -98,9 +98,9 @@ export default {
         { name: '已下架', tab: 2, icon: 'icon-xiangji', num: 0 },
       ],
       buyStats: [
-        { name: '待付款', icon: 'icon-xiangji', num: 0 },
-        { name: '待发货', icon: 'icon-xiangji', num: 0 },
-        { name: '待收货', icon: 'icon-xiangji', num: 0 },
+        { name: '待付款', tab: 1, icon: 'icon-xiangji', num: 0 },
+        { name: '待发货', tab: 2, icon: 'icon-xiangji', num: 0 },
+        { name: '待收货', tab: 3, icon: 'icon-xiangji', num: 0 },
       ],
 
       pageList: [

+ 107 - 37
src/pages/mine/myBuy/detail.vue

@@ -1,53 +1,123 @@
 <template>
-  <zj-page-layout
-  	:hasFooter="true"
-  	:isScroll="true"
-  	:refresherTriggered="refresherTriggered"
-  	@refresherrefresh="refresherrefresh">
+  <!-- #ifdef H5 -->
+  <view>
+    <Loading
+    	:type="3"
+    	:loadStatus="loadStatus"
+    	:showText="errorText"
+    />
+    <zj-page-layout
+      v-if="detail"
+    	:hasFooter="true"
+    	:isScroll="true"
+    	:refresherTriggered="refresherTriggered"
+    	@refresherrefresh="refresherrefresh">
 
-    <view class="address-container">
-      <view class="icon"><text class="iconfont icon-dingwei1"></text></view>
-      <view class="hasdata">
-        <view class="name">莫先生<text>13686123123</text></view>
-        <view class="address ellipsis-2">广东省广州市</view>
+      <view class="address-container">
+        <view class="icon"><text class="iconfont icon-dingwei1"></text></view>
+        <view class="hasdata">
+          <view class="name">{{detail.userName}}<text>{{detail.phone}}</text></view>
+          <view class="address ellipsis-2">{{detail.address}}</view>
+        </view>
       </view>
-    </view>
 
-    <view class="goods-container">
-      <view class="title">商品信息</view>
-      <view class="goods">
-        <image src="@/static/user/other_book.png"></image>
-        <view class="main">
-          <view class="name">商品名称</view>
-          <view class="des">商品描述</view>
-          <view class="price"><text>¥18.00</text>x2</view>
+      <view class="goods-container">
+        <view class="title">商品信息</view>
+        <view class="goods">
+          <image :src="imageUrl + detail.goodsPicUrl"></image>
+          <view class="main">
+            <view class="name">{{detail.goodsTitle}}</view>
+            <view class="des">{{detail.content}}</view>
+            <view class="price"><text>{{detail.goodsAmount | priceFilter2}}</text>数量:{{detail.num}}</view>
+          </view>
         </view>
+        <view class="total">订单总金额<text>{{detail.price | priceFilter2}}</text></view>
       </view>
-      <view class="total">订单总金额<text>¥1200.00</text></view>
-    </view>
-
-    <view class="order-container">
-      <view class="title">订单信息</view>
-      <view class="row">订单编号:1234321232</view>
-      <view class="row">创建时间:1234321232</view>
-      <view class="row">付款时间:1234321232</view>
-      <view class="row">支付方式:1234321232</view>
-      <view class="row">支付单号:1234321232</view>
-      <view class="row">发货时间:1234321232</view>
-      <view class="row">收货时间:1234321232</view>
-    </view>
 
-    <template slot="footer">
-      <view class="bottom-container">
-        <u-button text="取消订单" shape="circle"></u-button>
+      <view class="order-container">
+        <view class="title">订单信息</view>
+        <view class="row">订单编号:{{detail.orderId}}</view>
+        <view class="row">创建时间:{{detail.createTime}}</view>
+        <view class="row">付款时间:{{detail.payTime}}</view>
+        <view class="row">支付方式:{{detail.payType | payTypeFilter}}</view>
+        <view class="row">支付单号:{{detail.transactionId}}</view>
+        <view class="row">发货时间:{{detail.logisticsTime}}</view>
+        <view class="row">收货时间:{{detail.completeTime}}</view>
       </view>
-    </template>
 
-  </zj-page-layout>
+      <template slot="footer">
+        <view class="bottom-container">
+          <u-button text="取消订单" shape="circle"></u-button>
+        </view>
+      </template>
+
+    </zj-page-layout>
+  </view>
+  <!-- #endif -->
+  <!-- #ifndef H5 -->
+  <web-view :src="webViewHref('/pages/mine/myBuy/detail', pam)"></web-view>
+  <!-- #endif -->
 </template>
 
 <script>
+  // #ifdef H5
+  export default {
+    filters: {
+      payTypeFilter(val) {
+        const MAP = {
+          WECHAT: '微信支付'
+        }
+        return MAP[val];
+      }
+    },
+
+    data() {
+      return {
+        id: null,
+        detail: null,
+        imageUrl: this.$imageUrl,
+        loadStatus: 0,
+				errorText: '',
+        refresherTriggered: false,
+      }
+    },
 
+    onLoad({id}) {
+      this.id = id;
+      this.getDetail();
+    },
+
+    methods: {
+      getDetail() {
+        this.$api.post('/orderPay/detail', {
+          orderId: this.id
+        }).then(res => {
+					this.detail = res.data;
+					this.loadStatus = 0;
+					this.getLogisticsData();
+				}).catch(res => {
+					this.errorText = res.message;
+					this.loadStatus = 2;
+				}).finally(res => {
+					this.refresherTriggered = false;
+				})
+      }
+    }
+  }
+  // #endif
+  // #ifndef H5
+  export default {
+    data() {
+      return {
+        pam: {},
+      }
+    },
+  
+    onLoad(pam) {
+      this.pam = pam;
+    },
+  }
+  // #endif
 </script>
 
 <style lang="scss" scoped>

+ 18 - 7
src/pages/mine/myBuy/list.vue

@@ -11,7 +11,7 @@
         <u-tabs
         	:scrollable="false"
         	:list="tabList"
-        	:current="curTab"
+        	:current="tabCurrent"
         	@click="changeTab"
         	lineColor="#01C30B"
         	:activeStyle="{
@@ -58,7 +58,7 @@
   </zj-page-layout>
   <!-- #endif -->
   <!-- #ifndef H5 -->
-  <web-view :src="webViewHref('/pages/mine/myBuy/list')"></web-view>
+  <web-view :src="webViewHref(`/pages/mine/myBuy/list`, pam)"></web-view>
   <!-- #endif -->
 </template>
 
@@ -79,7 +79,7 @@
 
     data() {
       return {
-        imgUrl: this.$imageUrl,
+        imageUrl: this.$imageUrl,
         tabList: [
           {name: '全部', value: 1},
           {name: '待付款', value: 2},
@@ -88,7 +88,7 @@
           {name: '已收货', value: 5},
           {name: '售后中', value: 6},
         ],
-        curTab: 0,
+        tabCurrent: 0,
         dataList: [],
         pageNum: 1,
         loadStatus: 0,
@@ -96,14 +96,15 @@
       }
     },
 
-    async onLoad() {
+    async onLoad({tab}) {
+      this.tabCurrent = tab ? Number(tab) : 0;
       await this.getList();
     },
 
     methods: {
       //获取列表数据
       async getList() {
-        this.$api.post('/goodsAdmin/list', {
+        this.$api.post('/orderPay/list', {
           pageNum: this.pageNum,
           pageSize: 10,
           params: [{
@@ -140,7 +141,7 @@
       	this.pageNum = 1;
       	this.getList();
       },
-      
+
       toDetail(id) {
         this.$navToPage({
           url: `/pages/mine/myBuy/detail?id=${id}`
@@ -151,7 +152,17 @@
   }
   // #endif
   // #ifndef H5
+  export default {
+    data() {
+      return {
+        pam: {},
+      }
+    },
 
+    onLoad(pam) {
+      this.pam = pam;
+    },
+  }
   // #endif
 </script>
 

+ 0 - 175
src/pages/mine/myIssue/detail.vue

@@ -1,175 +0,0 @@
-<template>
-  <zj-page-layout
-  	:hasFooter="true"
-  	:isScroll="true"
-  	:refresherTriggered="refresherTriggered"
-  	@refresherrefresh="refresherrefresh">
-
-    <view class="address-container">
-      <view class="icon"><text class="iconfont icon-dingwei1"></text></view>
-      <view class="hasdata">
-        <view class="name">莫先生<text>13686123123</text></view>
-        <view class="address ellipsis-2">广东省广州市</view>
-      </view>
-    </view>
-
-    <view class="goods-container">
-      <view class="title">商品信息</view>
-      <view class="goods">
-        <image src="@/static/user/other_book.png"></image>
-        <view class="main">
-          <view class="name">商品名称</view>
-          <view class="des">商品描述</view>
-          <view class="price"><text>¥18.00</text>x2</view>
-        </view>
-      </view>
-      <view class="total">订单总金额<text>¥1200.00</text></view>
-    </view>
-
-    <view class="order-container">
-      <view class="title">订单信息</view>
-      <view class="row">订单编号:1234321232</view>
-      <view class="row">创建时间:1234321232</view>
-      <view class="row">付款时间:1234321232</view>
-      <view class="row">支付方式:1234321232</view>
-      <view class="row">支付单号:1234321232</view>
-      <view class="row">发货时间:1234321232</view>
-      <view class="row">收货时间:1234321232</view>
-    </view>
-
-    <template slot="footer">
-      <view class="bottom-container">
-        <u-button text="取消订单" shape="circle"></u-button>
-      </view>
-    </template>
-
-  </zj-page-layout>
-</template>
-
-<script>
-
-</script>
-
-<style lang="scss" scoped>
-.address-container {
-  background: #FFFFFF;
-  display: flex;
-  align-items: center;
-  height: 150rpx;
-  padding: 0 20rpx;
-  margin-top: 30rpx;
-  .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;
-    }
-  }
-  .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: 30rpx 30rpx 0;
-  .title {
-    font-weight: 500;
-  }
-  .goods {
-    display: flex;
-    padding: 30rpx 0;
-    image {
-      width: 120rpx;
-      height: 120rpx;
-    }
-    .main {
-      flex: 1;
-      margin-left: 20rpx;
-      .name {
-        font-size: 32rpx;
-      }
-      .des {
-        margin-top: 12rpx;
-        font-size: 28rpx;
-        color: $reg-font;
-      }
-      .price {
-        margin-top: 12rpx;
-      	text {
-      		color: $assist-color;
-      		font-weight: 500;
-      		font-size: 32rpx;
-          margin-right: 12rpx;
-      	}
-      }
-    }
-  }
-  .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;
-    }
-  }
-}
-
-.order-container {
-  background: #ffffff;
-  margin-top: 30rpx;
-  padding: 30rpx;
-  .title {
-    font-weight: 500;
-    margin-bottom: 20rpx;
-  }
-  .row {
-    margin-top: 12rpx;
-    font-size: 28rpx;
-    text {
-      color: $assist-color;
-    }
-  }
-}
-
-.bottom-container {
-  padding: 20rpx 30rpx;
-  display: flex;
-  align-items: center;
-  justify-content: flex-end;
-  .u-button {
-    width: auto;
-    height: 60rpx;
-    margin: 0;
-    margin-left: 20rpx;
-  }
-}
-
-</style>

+ 10 - 1
src/pages/mine/myIssue/list.vue

@@ -65,7 +65,7 @@
   </view>
   <!-- #endif -->
   <!-- #ifndef H5 -->
-  <web-view :src="webViewHref('/pages/mine/myIssue/list')"></web-view>
+  <web-view :src="webViewHref(`/pages/mine/myIssue/list`, pam)"></web-view>
   <!-- #endif -->
 </template>
 
@@ -195,6 +195,15 @@
     components: {
       zjDialogDeliver
     },
+    data() {
+      return {
+        pam: {},
+      }
+    },
+    
+    onLoad(pam) {
+      this.pam = pam;
+    },
   }
   // #endif
 </script>

+ 12 - 3
src/pages/mine/parse.vue

@@ -10,7 +10,7 @@
   </zj-page-layout>
   <!-- #endif -->
   <!-- #ifndef H5 -->
-  <web-view :src="webViewHref('/pages/mine/parse')"></web-view>
+  <web-view :src="webViewHref(`/pages/mine/parse`, pam)"></web-view>
   <!-- #endif -->
 </template>
 
@@ -54,10 +54,19 @@
 			},
 		},
 	}
-  
+
   // #endif
   // #ifndef H5
-  
+  export default {
+    data() {
+      return {
+        pam: {},
+      }
+    },
+    onLoad(pam) {
+      this.pam = pam;
+    }
+  }
   // #endif
 </script>