Sfoglia il codice sorgente

用户 修改bug 首页推荐< 4 ; 购物车数量不回显 ;我的生日不回显

liude 1 anno fa
parent
commit
c426d434c4

+ 5 - 6
src/api/login.js

@@ -40,7 +40,7 @@ export function getSmsCodeByPhone(data) {
   return request({
     url: '/maintain/sms/captcha',
     method: 'post',
-    data:data
+    data: data
   });
 }
 
@@ -62,11 +62,10 @@ export function loginByPhoneAndSmsCode(data) {
  * @param {*} data
  * @returns
  */
-export function logout(data){
+export function logout(data) {
   return request({
-    url:'/maintain/logout',
-    method:'post',
-    data:data
+    url: '/maintain/logoff',
+    method: 'post',
+    data: data
   })
 }
-

+ 14 - 11
src/components/settleBottomBtn/settleBottomBtn.vue

@@ -72,9 +72,9 @@
         default: ''
       }
     },
-    watch:{
-      goodsCateList(newValue){
-        if(newValue.length == 0){
+    watch: {
+      goodsCateList(newValue) {
+        if (newValue.length == 0) {
           this.pop_show = false
         }
       }
@@ -84,10 +84,13 @@
         let price = 0
         let originalPrice = 0
         this.goodsCateList.map(rs => {
-          price += Number((rs.price).toFixed(2) * rs.quantity)
-          originalPrice += Number((rs.originalPrice).toFixed(2) * rs.quantity)
+          price += Number(rs.price) * Number(rs.quantity)
+          originalPrice += Number(rs.originalPrice) * Number(rs.quantity)
         })
-        return { price , originalPrice }
+        return {
+          price,
+          originalPrice
+        }
       },
       allNumb() {
         let allNumber = 0
@@ -99,14 +102,14 @@
     },
     methods: {
       // 点击打开pop
-      handlerOpenPop(){
-        if(!this.goodsCateList.length){
+      handlerOpenPop() {
+        if (!this.goodsCateList.length) {
           uni.showToast({
-            title:'购物车商品为空',
-            icon:'none'
+            title: '购物车商品为空',
+            icon: 'none'
           })
           return
-        }else{
+        } else {
           this.pop_show = true
         }
       },

+ 31 - 20
src/pages/client/clientPackage/storeDetail.vue

@@ -160,7 +160,9 @@
   } from "@/api/client/mine.js"
   import GainCoupon from '@/pages/client/clientPackage/serviceDetail/GainCoupon.vue';
   import settleBottomBtn from "@/components/settleBottomBtn/settleBottomBtn.vue"
-  import { mapGetters } from 'vuex';
+  import {
+    mapGetters
+  } from 'vuex';
   export default {
     components: {
       settleBottomBtn,
@@ -171,7 +173,7 @@
         show: false,
         merchant: {},
         goods: [],
-        swiperList: [ ],
+        swiperList: [],
         categoryList: [{
           name: '全部',
           id: 0
@@ -190,7 +192,7 @@
           merchantId: '',
           mobile: '',
           appointTime: '',
-		  goodsName:''
+          goodsName: ''
         },
         template_time: '',
         ids: null, // 商家id
@@ -201,18 +203,22 @@
       this.ids = option.id
       this.queryParams.id = option.id;
     },
-	mounted(){
-	  let { latitude , longitude , region } = this.location
-	  this.queryParams.latitude = latitude
-	  this.queryParams.longitude = longitude
-	  this.queryParams.region = region
-	  this.handlerInitList();
-	},
+    mounted() {
+      let {
+        latitude,
+        longitude,
+        region
+      } = this.location
+      this.queryParams.latitude = latitude
+      this.queryParams.longitude = longitude
+      this.queryParams.region = region
+      this.handlerInitList();
+    },
     onShow() {
       this.handletInitShopCarList()
     },
     computed: {
-	  ...mapGetters(['location'])
+      ...mapGetters(['location'])
     },
     watch: {
       reserve_show(newValue) {
@@ -229,14 +235,18 @@
       handletInitShopCarList() {
         this.swiperList = []
         getCartList(this.ids).then(res => {
+          let {
+            merchantDTO,
+            cartItems
+          } = res.data
           // 商品轮播图
-          res.data.merchantDTO.banners.map(rs=>{
+          merchantDTO.banners.map(rs => {
             this.swiperList.push(rs.url)
           })
-          if (res.data.cartItems.length == 0) {
+          if (cartItems.length == 0) {
             this.goodsCateList = []
           } else {
-            this.goodsCateList = res.data.cartItems
+            this.goodsCateList = cartItems
           }
         })
         accountTotIdGetConponList(this.ids, {
@@ -265,17 +275,18 @@
       handlerMakeCall() {
         uni.makePhoneCall({
           phoneNumber: this.merchant.mobile,
-          success:res=>{
-            console.log("@@@res",res)
-          },fail:err =>{
-            console.log("@@@err",err)
+          success: res => {
+            console.log("@@@res", res)
+          },
+          fail: err => {
+            console.log("@@@err", err)
           }
         });
       },
       // 点击跳转到商品详情
       handlerSkipGoodsDetail(item, index) {
-		console.log("@@@@item",item.id)
-		console.log("this.queryParams.id",this.queryParams.id)
+        console.log("@@@@item", item.id)
+        console.log("this.queryParams.id", this.queryParams.id)
         uni.navigateTo({
           url: `/pages/client/clientPackage/serviceDetail/index?id=${item.id}&shopId=${this.queryParams.id}`,
         });

+ 218 - 209
src/pages/client/clientUser/mine/setting/personInfo.vue

@@ -1,231 +1,240 @@
 <template>
-	<view class="ccontainer">
-		<view class="item-box">
-			<view class="item-left"> 头像 : </view>
-			<view class="item-right flex-end">
-				<image @click="handlerUploadImg" class="img" :src="uoloadImg"></image>
-			</view>
-		</view>
-		<view class="item-box">
-			<view class="item-left"> 昵称 : </view>
-			<view class="item-right">
-				<u--input placeholder="请输入内容" border="none" v-model="queryParams.nickname"></u--input>
-			</view>
-		</view>
-		<view class="item-box">
-			<view class="item-left"> 性别 : </view>
-			<view class="item-right">
-				<view class="sex-item">
-					<view class="item" v-for=" (item,index) of sexList" :class="current == index ? 'act-sex' : ''"
-						:key="index" @click="handlerSelectGender(item)"> {{ item.name }} </view>
-				</view>
-			</view>
-		</view>
-		<view class="item-box">
-			<view class="item-left"> 生日 : </view>
-			<view class="item-right right-time-box" @click="timeShow = true">
-				<view class="time-left" :class="queryParams.birthday ? '' : 'gray-color'">
-					{{ queryParams.birthday ? queryParams.birthday : '请选择您的生日' }}
-				</view>
-				<view class="time-right">
-					<u-icon name="arrow-right"></u-icon>
-				</view>
-			</view>
-		</view>
-
-		<u-datetime-picker :show="timeShow" v-model="time_value" mode="date" @cancel='timeShow = false'
-			@confirm='confirmTime' :minDate="0" :maxDate='maxDataTime'></u-datetime-picker>
-
-		<view class="btn-box">
-			<button class="btn" @click="handlerSubmitBtn">提交</button>
-		</view>
-	</view>
+  <view class="ccontainer">
+    <view class="item-box">
+      <view class="item-left"> 头像 : </view>
+      <view class="item-right flex-end">
+        <image @click="handlerUploadImg" class="img" :src="uoloadImg"></image>
+      </view>
+    </view>
+    <view class="item-box">
+      <view class="item-left"> 昵称 : </view>
+      <view class="item-right">
+        <u--input placeholder="请输入内容" border="none" v-model="queryParams.nickname"></u--input>
+      </view>
+    </view>
+    <view class="item-box">
+      <view class="item-left"> 性别 : </view>
+      <view class="item-right">
+        <view class="sex-item">
+          <view class="item" v-for=" (item,index) of sexList" :class="current == index ? 'act-sex' : ''" :key="index"
+            @click="handlerSelectGender(item)"> {{ item.name }} </view>
+        </view>
+      </view>
+    </view>
+    <view class="item-box">
+      <view class="item-left"> 生日 : </view>
+      <view class="item-right right-time-box" @click="timeShow = true">
+        <view class="time-left" :class="queryParams.birthday ? '' : 'gray-color'">
+          {{ queryParams.birthday ? queryParams.birthday : '请选择您的生日' }}
+        </view>
+        <view class="time-right">
+          <u-icon name="arrow-right"></u-icon>
+        </view>
+      </view>
+    </view>
+
+    <u-datetime-picker :show="timeShow" v-model="time_value" mode="date" @cancel='timeShow = false'
+      @confirm='confirmTime' :minDate="0" :maxDate='maxDataTime'></u-datetime-picker>
+
+    <view class="btn-box">
+      <button class="btn" @click="handlerSubmitBtn">提交</button>
+    </view>
+  </view>
 </template>
 
 <script>
-	import { getUserInfo } from '@/api/user';
-  import { uploadFile } from "@/utils/upload"
-	export default {
-		data() {
-			return {
-				queryParams: {
-					avatar: '', // 头像
-					gender: '', //性别
-					birthday: '', //生日
-					nickname: '', //昵称
-				},
-				time_value: '',
-				timeShow: false,
-				sexList: [{
-						id: 0,
-						name: '男',
-            type:'MALE'
-					},
-					{
-						id: 1,
-						name: '女',
-            type:'FEMALE'
-					}
-				],
-				current: 0,
-        uoloadImg:'',
-        maxDataTime:0
-			}
-		},
-		mounted(){
+  import {
+    getUserInfo
+  } from '@/api/user';
+  import {
+    uploadFile
+  } from "@/utils/upload"
+  export default {
+    data() {
+      return {
+        queryParams: {
+          avatar: '', // 头像
+          gender: '', //性别
+          birthday: '', //生日
+          nickname: '', //昵称
+        },
+        time_value: '',
+        timeShow: false,
+        sexList: [{
+            id: 0,
+            name: '男',
+            type: 'MALE'
+          },
+          {
+            id: 1,
+            name: '女',
+            type: 'FEMALE'
+          }
+        ],
+        current: 0,
+        uoloadImg: '',
+        maxDataTime: 0
+      }
+    },
+    mounted() {
       this.maxDataTime = new Date().getTime()
-			getUserInfo().then(res=>{
-        let { avatar , nickname , gender } = res.data
+      getUserInfo().then(res => {
+        let {
+          avatar,
+          nickname,
+          gender,
+          birthday
+        } = res.data
         this.uoloadImg = avatar
-				this.queryParams.avatar = avatar
-				this.queryParams.nickname = nickname
-        if(gender){
-          for(let key in gender){
-            this.sexList.map(rs=>{
-              if(key == rs.type){
+        this.queryParams.avatar = avatar
+        this.queryParams.nickname = nickname
+        this.queryParams.birthday = uni.$u.timeFormat(birthday, 'yyyy-mm-dd');
+        if (gender) {
+          for (let key in gender) {
+            this.sexList.map(rs => {
+              if (key == rs.type) {
                 this.current = rs.id
               }
             })
           }
         }
-			})
-		},
-		methods: {
-			// 选择性别
-			handlerSelectGender(item) {
-				this.current = item.id
-			},
-			// 选择时间
-			confirmTime(e) {
+      })
+    },
+    methods: {
+      // 选择性别
+      handlerSelectGender(item) {
+        this.current = item.id
+      },
+      // 选择时间
+      confirmTime(e) {
         this.queryParams.birthday = uni.$u.timeFormat(e.value, 'yyyy-mm-dd');
         this.timeShow = false
-			},
-			// 上传头像
-			async handlerUploadImg() {
-				try {
-					const res = await uni.showActionSheet({
-						itemList: ['拍照', '从相册选择'],
-					});
-					if (res.tapIndex === 0) {
-						// 用户选择拍照
-						this.takeOrChoosePhoto(0);
-					} else if (res.tapIndex === 1) {
-						// 用户选择从相册选择
-						this.takeOrChoosePhoto(1);
-					}
-				} catch (error) {
-				}
-			},
-			// 拍照
-			takeOrChoosePhoto(idx) {
-			  uni.chooseImage({
-			    sourceType: idx == 0 ? ['camera'] : ['album'],
-			    count: 1,
-			    success: res => {
-			      const tempFilePaths = res.tempFilePaths;
-			      // 调用上传图片的方法
-			      this.uploadAvatar(tempFilePaths[0]);
-			    },
-			    fail: error => {
-			      console.error(error);
-			    },
-			  });
-			},
-			// 上传头像
-			uploadAvatar(filePath) {
+      },
+      // 上传头像
+      async handlerUploadImg() {
+        try {
+          const res = await uni.showActionSheet({
+            itemList: ['拍照', '从相册选择'],
+          });
+          if (res.tapIndex === 0) {
+            // 用户选择拍照
+            this.takeOrChoosePhoto(0);
+          } else if (res.tapIndex === 1) {
+            // 用户选择从相册选择
+            this.takeOrChoosePhoto(1);
+          }
+        } catch (error) {}
+      },
+      // 拍照
+      takeOrChoosePhoto(idx) {
+        uni.chooseImage({
+          sourceType: idx == 0 ? ['camera'] : ['album'],
+          count: 1,
+          success: res => {
+            const tempFilePaths = res.tempFilePaths;
+            // 调用上传图片的方法
+            this.uploadAvatar(tempFilePaths[0]);
+          },
+          fail: error => {
+            console.error(error);
+          },
+        });
+      },
+      // 上传头像
+      uploadAvatar(filePath) {
         this.uoloadImg = filePath
-        uploadFile(filePath).then(res=>{
+        uploadFile(filePath).then(res => {
           this.queryParams.avatar = JSON.parse(res.data).data.url;
         })
-			  this.$forceUpdate(); // 手动触发组件的重新渲染
-			},
-
-			// 点击提交按钮
-			handlerSubmitBtn() {
-				this.queryParams.gender = this.sexList[this.current].type
-        this.$store.dispatch('UpdateUserInfo',this.queryParams).then(res=>{
-          setTimeout(()=>{
+        this.$forceUpdate(); // 手动触发组件的重新渲染
+      },
+
+      // 点击提交按钮
+      handlerSubmitBtn() {
+        this.queryParams.gender = this.sexList[this.current].type
+        this.$store.dispatch('UpdateUserInfo', this.queryParams).then(res => {
+          setTimeout(() => {
             uni.navigateBack(-1)
-          },1500)
+          }, 1500)
         })
-			}
-		}
-	}
+      }
+    }
+  }
 </script>
 
 <style lang="scss" scoped>
-	.ccontainer {
-		padding: 20rpx;
-		box-sizing: border-box;
-		font-size: 28rpx;
-
-		.item-box {
-			display: flex;
-			padding: 20rpx;
-			box-shadow: 0 5rpx 15rpx 0rpx rgba(0, 0, 0, 0.1);
-			border-radius: 20rpx;
-			margin-bottom: 20rpx;
-			align-items: center;
-
-			.item-left {
-				margin-right: 20rpx;
-				width: 13%;
-			}
-
-			.item-right {
-				width: 87%;
-
-				.img {
-					width: 80rpx;
-					height: 80rpx;
-					border-radius: 50%;
-				}
-
-				.sex-item {
-					display: flex;
-
-					.item {
-						padding: 20rpx 30rpx;
-						background-color: #F7F7F7;
-						border-radius: 10rpx;
-						text-align: center;
-						font-size: 28rpx;
-					}
-
-					.act-sex {
-						border: 2rpx solid #5992BB;
-						background-color: #5992BB;
-						color: #fff !important;
-					}
-				}
-			}
-
-			.right-time-box {
-				display: flex;
-				justify-content: space-between;
-			}
-
-			.flex-end {
-				display: flex;
-				justify-content: flex-end;
-			}
-		}
-
-		.btn-box {
-			margin-top: 100rpx;
-
-			.btn {
-				border-radius: 20rpx;
-				padding: 10rpx;
-				font-size: 28rpx;
-				color: #fff;
-				background: linear-gradient(to right, #e8cbc0, #636fa4);
-				box-shadow: 0 5rpx 15rpx 0 rgba(99, 111, 164, 0.2);
-			}
-		}
-	}
-
-	.gray-color {
-		color: #D2D5DB;
-	}
+  .ccontainer {
+    padding: 20rpx;
+    box-sizing: border-box;
+    font-size: 28rpx;
+
+    .item-box {
+      display: flex;
+      padding: 20rpx;
+      box-shadow: 0 5rpx 15rpx 0rpx rgba(0, 0, 0, 0.1);
+      border-radius: 20rpx;
+      margin-bottom: 20rpx;
+      align-items: center;
+
+      .item-left {
+        margin-right: 20rpx;
+        width: 13%;
+      }
+
+      .item-right {
+        width: 87%;
+
+        .img {
+          width: 80rpx;
+          height: 80rpx;
+          border-radius: 50%;
+        }
+
+        .sex-item {
+          display: flex;
+
+          .item {
+            padding: 20rpx 30rpx;
+            background-color: #F7F7F7;
+            border-radius: 10rpx;
+            text-align: center;
+            font-size: 28rpx;
+          }
+
+          .act-sex {
+            border: 2rpx solid #5992BB;
+            background-color: #5992BB;
+            color: #fff !important;
+          }
+        }
+      }
+
+      .right-time-box {
+        display: flex;
+        justify-content: space-between;
+      }
+
+      .flex-end {
+        display: flex;
+        justify-content: flex-end;
+      }
+    }
+
+    .btn-box {
+      margin-top: 100rpx;
+
+      .btn {
+        border-radius: 20rpx;
+        padding: 10rpx;
+        font-size: 28rpx;
+        color: #fff;
+        background: linear-gradient(to right, #e8cbc0, #636fa4);
+        box-shadow: 0 5rpx 15rpx 0 rgba(99, 111, 164, 0.2);
+      }
+    }
+  }
+
+  .gray-color {
+    color: #D2D5DB;
+  }
 </style>

+ 18 - 8
src/pages/client/tabBar/home/index.vue

@@ -4,7 +4,7 @@
       <!-- 顶部导航 -->
       <view class="nav-bar">
         <u-navbar :bgColor="'#ffffff'" :placeholder="true">
-          <view slot="left" @click="manualGetLocation">
+          <view slot="left" @click.stop="manualGetLocation">
             <text>{{ nowAddress }}</text>
             <text class="iconfont icon-chevron-down" />
           </view>
@@ -40,8 +40,8 @@
           <view>
             <u-grid :border="false" col="2">
               <u-grid-item @click="$Router.push(`/pages/client/clientPackage/storeDetail?id=${item.id}`)"
-                v-for="item in homeData.recommends" :key="item.id">
-                <recommend-item :item="item"></recommend-item>
+                v-for="(item,index) in homeData.recommends" :key="item.id">
+                <recommend-item v-if="index < 4" :item="item"></recommend-item>
               </u-grid-item>
             </u-grid>
           </view>
@@ -60,8 +60,8 @@
           <view>
             <u-grid :border="false" col="2">
               <u-grid-item @click="$Router.push(`/pages/client/clientPackage/storeDetail?id=${item.id}`)"
-                v-for="item in homeData.nears" :key="item.id">
-                <hot-item :item="item"></hot-item>
+                v-for="(item,index) in homeData.nears" :key="item.id">
+                <hot-item v-if="index < 4" :item="item"></hot-item>
               </u-grid-item>
             </u-grid>
           </view>
@@ -194,7 +194,7 @@
             longitude: longitude,
             latitude: latitude,
             region: res.data.id,
-			address:res.data.name
+            address: res.data.name
           });
         })
       },
@@ -228,8 +228,18 @@
             this.queryParams.latitude = latitude.toFixed(5);
             this.handlerGetRegion(longitude.toFixed(5), latitude.toFixed(5))
           },
-          fail: function(err) {
-            console.log('取消按钮', err)
+          fail: err => {
+            uni.showModal({
+              title: '提示',
+              content: '这是一个模态弹窗',
+              success: function(res) {
+                if (res.confirm) {
+                  console.log('用户点击确定');
+                } else if (res.cancel) {
+                  console.log('用户点击取消');
+                }
+              }
+            });
           }
         });
       },

+ 24 - 13
src/utils/request.js

@@ -1,12 +1,20 @@
 import axios from "axios";
-import { UniAdapter } from 'uniapp-axios-adapter'
+import {
+  UniAdapter
+} from 'uniapp-axios-adapter'
 import store from '@/store'
-import { getAccessToken, setAccessToken, setRefreshToken, refreshToken, isRefreshRequest } from "./auth"
+import {
+  getAccessToken,
+  setAccessToken,
+  setRefreshToken,
+  refreshToken,
+  isRefreshRequest
+} from "./auth"
 
 // 每次请求都创建一个新的实例
 const instance = axios.create({
-  baseURL: "https://test.api.chelvc.com",
-  // baseURL: "https://358175z5l5.yicp.fun",
+  // baseURL: "https://test.api.chelvc.com",
+  baseURL: "http://192.168.68.77:11000",
   timeout: 10000,
   adapter: UniAdapter
 });
@@ -33,11 +41,14 @@ instance.interceptors.request.use((config) => {
 
 instance.interceptors.response.use(async (res) => {
   uni.hideLoading()
-  const { code,data } = res.data
-  if (data&&data.accessToken) {
+  const {
+    code,
+    data
+  } = res.data
+  if (data && data.accessToken) {
     setAccessToken(data.accessToken)
   }
-  if (data&&data.refreshToken) {
+  if (data && data.refreshToken) {
     setRefreshToken(data.refreshToken)
   }
   // 未知错误
@@ -101,13 +112,13 @@ instance.interceptors.response.use(async (res) => {
     })
     return res.data
   }
-  if(code === 'TOKEN_CHANGED'){
+  if (code === 'TOKEN_CHANGED') {
     uni.showModal({
-      title:'提示',
-      content:res.data.messsage,
-      showCancel:false,
-      success:(res)=>{
-        if(res.confirm){
+      title: '提示',
+      content: res.data.messsage,
+      showCancel: false,
+      success: (res) => {
+        if (res.confirm) {
           // 小程序用户跳转到我的页面 , 登录状态为未登录
 
         }