Browse Source

我的模块 收藏 优惠卷 登录获取个人信息

zxl 1 year ago
parent
commit
b64c0adcc3

+ 61 - 0
src/api/mine.js

@@ -0,0 +1,61 @@
+import { request } from '@/utils/request';
+
+/**
+ * 收藏接口 - 查询收藏列表
+ * @returns
+ */
+export function maintainFavoritePaging(data) {
+  return request({
+    url: '/maintain/favorite/paging',
+    method: 'get',
+    data: data,
+    header: {
+      'content-type': 'application/x-www-form-urlencoded',
+    },
+  });
+}
+
+/**
+ * 用户接口 - 获取用户信息
+ * @returns
+ */
+export function maintainUserInfo(data) {
+  return request({
+    url: '/maintain/user/info',
+    method: 'get',
+    data: data,
+    header: {
+      'content-type': 'application/x-www-form-urlencoded',
+    },
+  });
+}
+
+/**
+ * 优惠券接口 - 查询优惠券分页
+ * @returns
+ */
+export function maintainCouponPaging(data) {
+  return request({
+    url: '/maintain/coupon/paging',
+    method: 'get',
+    data: data,
+    header: {
+      'content-type': 'application/x-www-form-urlencoded',
+    },
+  });
+}
+
+/**
+ * 预约接口 - 查询用户预约列表
+ * @returns
+ */
+export function maintainReservations(data) {
+  return request({
+    url: '/maintain/reservations',
+    method: 'get',
+    data: data,
+    header: {
+      'content-type': 'application/x-www-form-urlencoded',
+    },
+  });
+}

+ 43 - 41
src/components/merchant/HotItem.vue

@@ -2,14 +2,11 @@
   <view class="container">
     <view class="content">
       <view class="img-box">
-        <image
-          :src="
+        <image :src="
             error || !loaded
               ? 'https://cdn.uviewui.com/uview/album/10.jpg'
               : item.cover
-          "
-          mode="scaleToFill"
-        ></image>
+          " mode="scaleToFill"></image>
         <view class="name u-line-1">{{ item.name }}</view>
       </view>
       <view class="pd-10">{{ item.address }}</view>
@@ -20,51 +17,56 @@
 </template>
 
 <script>
-export default {
-  props: {
-    item: {
-      type: Object,
-      default: () => {},
+  export default {
+    props: {
+      item: {
+        type: Object,
+        default: () => {},
+      },
     },
-  },
-  filters: {
-    mToKm(v) {
-      return (Number(v) / 1000).toFixed(2) + 'km';
+    filters: {
+      mToKm(v) {
+        return (Number(v) / 1000).toFixed(2) + 'km';
+      },
     },
-  },
-};
+  };
 </script>
 
 <style lang="scss" scoped>
-.container {
-  width: 100%;
-  padding: 20rpx;
-  box-sizing: border-box;
-  .content {
-    background-color: #ffffff;
+  .container {
     width: 100%;
-    height: 100%;
-    .img-box {
-      position: relative;
-      height: 240rpx;
-      image {
-        width: calc(50vw - 30rpx);
+    padding: 20rpx;
+    box-sizing: border-box;
+
+    .content {
+      background-color: #ffffff;
+      width: 100%;
+      height: 100%;
+
+      .img-box {
+        position: relative;
         height: 240rpx;
+
+        image {
+          width: calc(50vw - 30rpx);
+          height: 240rpx;
+        }
+
+        .name {
+          width: 100%;
+          position: absolute;
+          bottom: 0;
+          left: 0;
+          background-color: rgba(0, 0, 0, 0.2);
+          color: #ffffff;
+          padding: 10rpx;
+          box-sizing: border-box;
+        }
       }
-      .name {
-        width: 100%;
-        position: absolute;
-        bottom: 0;
-        left: 0;
-        background-color: rgba(0, 0, 0, 0.2);
-        color: #ffffff;
+
+      .pd-10 {
         padding: 10rpx;
-        box-sizing: border-box;
       }
     }
-    .pd-10 {
-      padding: 10rpx;
-    }
   }
-}
-</style>
+</style>

+ 17 - 20
src/components/service/index.vue

@@ -1,29 +1,26 @@
 <template>
   <view>
-    <view class="sort">
-      <!-- <u-tabs :list="list1" @click="click" lineWidth="30" lineColor="#5992bb" :activeStyle="{
-          color: '#5992bb',
-          fontWeight: 'bold',
-        }" :inactiveStyle="{
-          color: '#000',
-        }" itemStyle="padding-left: 15px; padding-right: 15px; height: 40px;" /> -->
-
-      <view class="list">
+    <view class="sort" >
+      <view class="list" v-for="(item,index) of item">
         <!-- <Image src="../../static/logo.png" @tap="$Router.push('/pages/business/service/index')" /> -->
-        <img class="img" src="@/static/logo.png" alt="">
+        <image class="img" :src="
+            error || !loaded
+              ? 'https://cdn.uviewui.com/uview/album/10.jpg'
+              : item.logo
+          " mode="scaleToFill" @click="$Router.push(`/pages/business/detail?id=${item.id}`)"></image>
         <view>
-          <view class="item-text">途虎养车洗车机(贵州省贵阳市云岩区)</view>
+          <view class="item-text">{{ item.address }}</view>
           <view class="item-flex">
             <view class="star">
-              <u-rate :count="count" v-model="value" :size="14" />
+              <u-rate :count="item.score" :size="14" />
               <text class="line">|</text>
-              <text class="points">4.93分</text>
+              <text class="points">{{ item.score }}分</text>
             </view>
-            <view>989单</view>
+            <view>{{ item.sale }}单</view>
           </view>
           <view class="list-item">
-            <view class="item-l">保安中心区美容洗车</view>
-            <view class="item-r">2.7KM</view>
+            <view class="item-l">{{ item.name }}</view>
+            <view class="item-r">{{ item.distance }}KM</view>
           </view>
           <!-- <view class="list-item">
             <view>
@@ -43,21 +40,19 @@
           </view> -->
         </view>
       </view>
-
       <!-- 预约弹出框的实现 -->
-      <u-popup :show="show" mode="center" @close="close" @open="open" :round="20">
+      <!-- <u-popup :show="show" mode="center" @close="close" @open="open" :round="20">
         <view class="popupContent">
           <text class="popupItem">预约服务</text>
           <view class="server">
             <view class="popup-title">时间</view>
-            <!-- 点击时间的弹框 -->
 			<u-picker mode="time" v-model="show"></u-picker>
             <view class="popup-title">联系方式</view>
             <u-input placeholder="请输入联系方式" border="bottom" clearable />
           </view>
           <u-button type="primary" shape="circle" size="small" text="确定"/>
         </view>
-      </u-popup>
+      </u-popup> -->
     </view>
   </view>
 </template>
@@ -73,6 +68,8 @@
         value:10
       };
     },
+    props:['item'],
+
     methods: {
       click(item) {
         console.log('item', item);

+ 54 - 17
src/pages/business/detail.vue

@@ -45,30 +45,67 @@
 
 <script>
 	import service from '@/components/service'
-	import {
-		getSellerDetails
-	} from '@/api/business.js'
-
+	import { getSellerDetails } from '@/api/business.js'
+  import { getCurrentLocation } from '@/api/home';
 	export default {
-		onLoad(option) {
-			getSellerDetails(option.id).then(res => {
-				this.merchant = res.data.merchant
-				this.goods = res.data.goods,
-				this.list3 = res.data.merchant.banners.map(h => h.url)
-			})
-		},
-		components: {
-			service,
-		},
 		data() {
 			return {
 				merchant: {},
 				goods: [],
 				count: 5,
 				value: 3,
-				list3: [],
+				list3: [],
+
+        queryParams:{  //请求参数
+          id:null,//商家ID
+          region:null,//地区编码
+          longitude:null,//经度
+          latitude:null,//纬度
+        }
 			};
-		},
+		},
+    components: {
+    	service,
+    },
+    onLoad(option) {
+      this.queryParams.id = option.id
+    	this.handlerInitLocation()
+    },
+    methods:{
+      // 获取当前经纬度
+      handlerInitLocation(){
+        uni.getLocation({
+        	type: 'gcj02',
+        	success: res => {
+        		this.queryParams.longitude = res.longitude;
+        		this.queryParams.latitude = res.latitude;
+            let point = {
+              latitude: res.latitude,
+              longitude: res.longitude
+            }
+            getCurrentLocation(point).then(rc=>{
+              this.queryParams.region = rc.data.id
+              this.handlerInitList()
+            })
+        	},
+        	fail: (rs) => {
+            uni.showToast({
+              title:rs,
+              icon:'none'
+            })
+        	}
+        });
+      },
+      // 初始化列表
+      handlerInitList(){
+        getSellerDetails(this.queryParams.id).then(res => {
+          console.log('res',res);
+        	// this.merchant = res.data.merchant
+        	// this.goods = res.data.goods,
+        	// this.list3 = res.data.merchant.banners.map(h => h.url)
+        })
+      }
+    }
 	};
 </script>
 
@@ -167,4 +204,4 @@
 			}
 		}
 	}
-</style>
+</style>

+ 6 - 4
src/pages/business/hot/index.vue

@@ -1,6 +1,7 @@
 <template>
   <view class="container">
-    <serviceItem v-for="item of 5"></serviceItem>
+    <serviceItem :item='init_list'></serviceItem>
+    <u-empty v-if="init_list.length == 0" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" > </u-empty>
   </view>
 </template>
 
@@ -31,9 +32,9 @@
         	type: 'gcj02',
         	success: res => {
         		this.queryParams.longitude = res.longitude;
-        		this.queryParams.latitude = res.longitude;
+        		this.queryParams.latitude = res.latitude;
             let point = {
-              latitude: res.longitude,
+              latitude: res.latitude,
               longitude: res.longitude
             }
             getCurrentLocation(point).then(rc=>{
@@ -52,7 +53,8 @@
       // 初始化列表信息
       handlerInitList(){
         getHomePageApi(this.queryParams).then(res=>{
-          console.log('getHomePageApi',res);
+          this.init_list = res.data.recommends
+          // this.total = res.data.nears.total
         })
       }
     }

+ 45 - 2
src/pages/business/nearby/index.vue

@@ -1,19 +1,62 @@
 <template>
   <view class="container">
-    <serviceItem v-for="item of 5"></serviceItem>
+    <serviceItem :item='init_list'></serviceItem>
+    <u-empty v-if="init_list.length == 0" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" > </u-empty>
   </view>
 </template>
 
 <script>
+  import { getHomePageApi,getCurrentLocation } from '@/api/home';
   import serviceItem from '@/components/service/index.vue';
   export default{
     data(){
       return{
-
+        queryParams:{
+          region:null,//地区编码
+          longitude:null,//经度
+          latitude:null,//纬度
+        },
+        init_list:[]
       }
     },
     components:{
       serviceItem
+    },
+    mounted() {
+      this.handlerInitLocation()
+    },
+    methods:{
+      // 获取当前经纬度
+      handlerInitLocation(){
+        uni.getLocation({
+        	type: 'gcj02',
+        	success: res => {
+        		this.queryParams.longitude = res.longitude;
+        		this.queryParams.latitude = res.latitude;
+            let point = {
+              latitude: res.latitude,
+              longitude: res.longitude
+            }
+            getCurrentLocation(point).then(rc=>{
+              this.queryParams.region = rc.data.id
+              this.handlerInitList()
+            })
+        	},
+        	fail: (rs) => {
+            uni.showToast({
+              title:rs,
+              icon:'none'
+            })
+        	}
+        });
+      },
+      // 初始化列表信息
+      handlerInitList(){
+        getHomePageApi(this.queryParams).then(res=>{
+          this.init_list = res.data.nears
+          this.total = res.data.nears.total
+        })
+      }
     }
   }
 </script>

+ 16 - 9
src/pages/tabbar/mine/index.vue

@@ -2,7 +2,7 @@
   <view class="container">
     <view class="head-wrap">
       <view class="content">
-        <view class="avatar-wrap" @tap="$Router.push('/pages/user/personalCenter/index')">
+        <view class="avatar-wrap" @tap="$Router.push('/pages/user/info/index')">
           <u-avatar :src="user_info.avatar" size="80"></u-avatar>
         </view>
         <view>
@@ -77,7 +77,7 @@
         <u-cell-group :border="false">
           <u-cell size="large" :border="false" icon="setting-fill" title="我的团队" isLink url="" @tap="$Router.push('/pages/user/mygroup/index')"></u-cell>
           <u-cell size="large" :border="false" icon="setting-fill" title="关于我们" isLink url="" @tap="$Router.push('/pages/user/aboutmy/index')"></u-cell>
-          <u-cell size="large" :border="false" icon="setting-fill" title="隐私条款" isLink url="" @tap="$Router.push('/pages/user/privacypolicy/index')"></u-cell>
+          <!-- <u-cell size="large" :border="false" icon="setting-fill" title="隐私条款" isLink url="" @tap="$Router.push('/pages/user/privacypolicy/index')"></u-cell> -->
           <u-cell size="large" :border="false" icon="setting-fill" title="客服中心" isLink url="" @tap="$Router.push('/pages/user/servicecenter/index')"></u-cell>
         </u-cell-group>
       </view>
@@ -85,10 +85,8 @@
   </view>
 </template>
 <script>
-  import {
-    mapGetters
-  } from 'vuex';
-
+  // import { mapGetters } from 'vuex';
+  import { maintainUserInfo } from "@/api/mine.js"
   export default {
     data() {
       return {
@@ -148,14 +146,23 @@
             title: '可提现',
           },
         ],
+        user_info:[] // 个人信息
       };
     },
-
     computed: {
-      ...mapGetters(['user_info']),
+      // ...mapGetters(['user_info']),
+    },
+    mounted() {
+      this.handlerInitUserMessage()
     },
-
     methods: {
+      // 获取当前用户信息
+      handlerInitUserMessage(){
+        maintainUserInfo().then(res=>{
+          this.user_info = res.data
+          // this.$store.dispatch("SET_MERCGANT_ID",res.data.id)
+        })
+      },
       gotoOrder(item) {
         if (item.order) {
           this.$Router.push('/pages/order/order');

+ 16 - 1
src/pages/user/appoint/index.vue

@@ -25,15 +25,30 @@
 </template>
 
 <script>
+  import { maintainReservations } from "@/api/mine.js"
   export default {
     data() {
       return {
         show: false,
         title: '取消预约',
-        content: '你确定要取消当前预约吗?'
+        content: '你确定要取消当前预约吗?',
+
+        queryParams:{
+          size:10
+        },
+        
+        init_list:[]//初始化列表
       };
     },
+    mounted() {
+      this.handlerInitList()
+    },
     methods: {
+      handlerInitList(){
+        maintainReservations(this.queryParams).then(res=>{
+          console.log('res',res);
+        })
+      },
       confirm() {
         console.log(1111111111);
         this.show = false;

+ 48 - 3
src/pages/user/collect/list.vue

@@ -9,15 +9,60 @@
 
 <script>
   import service from '@/components/service'
+  import { maintainFavoritePaging } from "@/api/mine.js"
+  import { getCurrentLocation } from '@/api/home';
+
   export default {
     components: {
       service,
     },
     data() {
-      return {};
+      return {
+        queryParams:{
+          paging:"1,10",
+          type:'MERCHANT',
+          region:null,//地区编码
+          longitude:null,//经度
+          latitude:null,//纬度
+        },
+        init_list:[]
+      };
+    },
+    onLoad() {
+      this.handlerInitLocation()
+    },
+    methods: {
+      // 获取当前经纬度
+      handlerInitLocation(){
+        uni.getLocation({
+        	type: 'gcj02',
+        	success: res => {
+        		this.queryParams.longitude = res.longitude;
+        		this.queryParams.latitude = res.latitude;
+            let point = {
+              latitude: res.latitude,
+              longitude: res.longitude
+            }
+            getCurrentLocation(point).then(rc=>{
+              this.queryParams.region = rc.data.id
+              this.handlerInitList()
+            })
+        	},
+        	fail: (rs) => {
+            uni.showToast({
+              title:rs,
+              icon:'none'
+            })
+        	}
+        });
+      },
+      // 初始化列表信息
+      handlerInitList(){
+        maintainFavoritePaging(this.queryParams).then(res=>{
+          console.log('getHomePageApi',res);
+        })
+      }
     },
-    onLoad() {},
-    methods: {},
   };
 </script>
 

+ 64 - 20
src/pages/user/coupon/index.vue

@@ -1,11 +1,21 @@
 <template>
   <view class="container">
+    <!-- 顶部导航栏 -->
+    <view class="top-tab">
+      <u-tabs class="tab" :list="list" @click="handlerChangeTab1"
+      :activeStyle="{
+            color: '#fff',
+            fontWeight: 'bold',
+            transform: 'scale(1.05)'
+        }"
+        :inactiveStyle="{
+            color: '#fff',
+            transform: 'scale(1)'
+        }"
+        itemStyle="height: 34px; width:20%;" lineColor="#D89A4C"></u-tabs>
+    </view>
+
     <!-- 优惠券的可用和失效 -->
-    <!-- <view class="top-tab">
-      <u-tabs class="tab" :list="list" @click="click"></u-tabs>
-    </view> -->
-    
-    
     <view class="use">
       <u-tabs :list="list2" lineWidth="100" lineColor="#347caf" :scrollable="false" :activeStyle="{
           color: '#347caf',
@@ -20,19 +30,21 @@
     </view>
 
     <!-- 优惠券可用 -->
-    <view class="couponUse" v-show="lable_type == 0">
+    <view class="couponUse" v-show="lable_type == 0" v-for="(item,index) of init_list">
       <view class="useLeft">
-        <view>满500减100元</view>
-        <text>2320-07-02 ~ 202-08-03</text>
+        <view>{{ item.name }}</view>
+        <text>2320-07-02 ~ {{ item.expiration	}}</text>
       </view>
       <view class="useRight">
-        <view class="text">2<text>折</text></view>
+        <view class="text">{{ item.discount * 10 }}<text>折</text></view>
         <view>折扣</view>
         <view class="gouUse">去使用</view>
       </view>
     </view>
+
+    <u-empty v-if="total == 0" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png"> </u-empty>
     <!-- 优惠券失效 -->
-    <view class="couponDisUse couponUse" v-show="lable_type == 1" v-for="item of 3">
+    <!-- <view class="couponDisUse couponUse" v-show="lable_type == 1" v-for="item of 3">
       <view class="useLeft">
         <view>满500减100元</view>
         <text>2320-07-02 ~ 202-08-03</text>
@@ -42,50 +54,82 @@
         <view>折扣</view>
         <view class="gouUse">去使用</view>
       </view>
-    </view>
+    </view> -->
   </view>
 </template>
 
 <script>
+  import { maintainCouponPaging } from "@/api/mine.js"
+  import { mapState } from "vuex"
   export default {
     data() {
       return {
         list: [{
             id: 0,
             name: '通用',
+            type:''
           },
           {
             id: 1,
             name: '满减',
+            type:'REDUCE'
           },
           {
             id: 2,
             name: '折扣',
+            type:'DISCOUNT'
           },
           {
             id: 3,
             name: '赠送',
+            type:'GIVE'
           },
         ],
         list2: [{
             name: '可用',
+            type:'ONLINE'
           },
           {
             name: '失效',
+            type:'OFFLINE'
           },
         ],
         lable_type: 0, // 是否可用
+        queryParams:{
+          paging:"1,10",//分页信息  取值范围: 页码,分页大小
+          keyword:'',//关键字
+          couponType:'',//优惠券类型 允许值: GIVE(赠送), REDUCE(满减), DISCOUNT(折扣)
+          couponStatus:'ONLINE',// 优惠券状态 允许值: ONLINE(已上线), OFFLINE(已下线)
+          couponClaimType:'',//优惠券领取方式 允许值: FREE(免费领取), ACTIVITY(活动领取)
+          merchantId:'',//商家ID
+        },
+
+        init_list:[],//初始化列表
+        total:0
       };
     },
+    mounted() {
+      this.handlerInitCouponList()
+      // console.log('merchantId',this.$store.state.merchantId);
+    },
     methods: {
-      sectionChange() {},
-      click() {
-
+      // 初始化优惠卷列表
+      handlerInitCouponList(){
+        maintainCouponPaging(this.queryParams).then(res=>{
+          this.init_list = res.data.records
+          this.total = res.data.total
+        })
       },
-      // 点击选择tab栏
+      // 选择顶部导航栏
+      handlerChangeTab1(e){
+        this.queryParams.couponType = e.type
+        this.handlerInitCouponList()
+      },
+      // 点击选择下层tab栏 选择是否可用
       handlerSelectTab(e){
-        console.log('e',e);
         this.lable_type = e.index
+        this.queryParams.couponStatus = e.type
+        this.handlerInitCouponList()
       }
     },
   };
@@ -97,10 +141,9 @@
     background-color: #efefef;
 
     .top-tab {
-      .tab {
-        display: flex;
-        justify-content: space-between;
-      }
+      width: 100%;
+      background-color: #347CAF;
+      padding: 20rpx 0;
     }
 
     .use {
@@ -170,4 +213,5 @@
       }
     }
   }
+
 </style>

+ 1 - 1
src/pages/user/info/index.vue

@@ -9,7 +9,7 @@
       <view class="info-box">
         <view class="info-avatar">
           <Image src="https://cdn.uviewui.com/uview/album/1.jpg" />
-          <view class="edit" @tap="$Router.push('/pages/user/editData/index')">
+          <view class="edit" @tap="$Router.push('/pages/user/info/update')">
             <u-icon name="edit-pen" color="#4688b6" />
             <view> 编辑资料</view>
           </view>

+ 2 - 2
src/pages/user/privacypolicy/index.vue

@@ -1,6 +1,6 @@
 <template>
   <view class="container">
-    <view class="title">
+   <!-- <view class="title">
       概述
     </view>
     <view class="text">
@@ -33,7 +33,7 @@
     </view>
     <view class="text">
       我们将非常重视您的个人信息保护。在您使用我们的服务前,请您仔细阅读并了解<隐私条款>。我们将严格按照本隐私条款使用和保护您的个人信息
-    </view>
+    </view> -->
   </view>
 </template>
 

+ 4 - 0
src/store/modules/user.js

@@ -7,12 +7,16 @@ import { getUserInfo } from '../../api/user';
 export default {
   state: () => ({
     user_info: getCache('user_info') || {},
+    merchantId:null , //商家ID
   }),
   mutations: {
     SET_USER_INFO(state, data) {
       state.user_info = data;
       setCache('user_info', state.user_info);
     },
+    SET_MERCGANT_ID(state,data){
+      state.merchantId = data;
+    }
   },
   actions: {
     GetUserInfo({ commit }) {