瀏覽代碼

优惠券对接 商品详情优惠券领取对接 社区列表重构 添加社区发布

liude 1 年之前
父節點
當前提交
5ea356985c

+ 1 - 1
src/api/client/business.js

@@ -210,7 +210,7 @@ export function generateConfirmOrder(data) {
     method: 'post',
     data: data,
     header: {
-      'Content-Type': 'application/x-www-form-urlencoded',
+      'Content-Type': 'application/json',
     },
   });
 }

+ 14 - 12
src/api/client/community.js

@@ -1,4 +1,6 @@
-import { request } from '@/utils/request';
+import {
+  request
+} from '@/utils/request';
 
 /**
  * 动态信息 - 查询列表
@@ -15,17 +17,17 @@ export function clientContentList(data) {
   });
 }
 
-// // 动态评论 - 新增
-// export function addClientContent(data) {
-//   return request({
-//     url: `/maintain/client/content/add`,
-//     method: 'post',
-// 	data: data,
-//     header: {
-//       'Content-Type': 'application/json',
-//     },
-//   });
-// }
+// 动态评论 - 新增
+export function addClientContent(data) {
+  return request({
+    url: `/maintain/client/content/add`,
+    method: 'post',
+    data: data,
+    header: {
+      'Content-Type': 'application/json',
+    },
+  });
+}
 
 // /**
 //  *@description 动态信息 - 获取动态详情

+ 6 - 0
src/pages.json

@@ -116,6 +116,12 @@
             "navigationBarTitleText": "提交订单"
           }
         },
+        {
+          "path": "communityPublish",
+          "style": {
+            "navigationBarTitleText": "发布评论"
+          }
+        },
         {
           "path": "settleStatusPage",
           "style": {

+ 193 - 0
src/pages/client/clientPackage/communityPublish.vue

@@ -0,0 +1,193 @@
+<template>
+	<view class="container">
+		<view class="top-box">
+			<u--textarea border='none' v-model="textContent" count placeholder="写下自己的感受分享给更多人"></u--textarea>
+			<view class="upload-box">
+				<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
+					:maxCount="9"></u-upload>
+			</view>
+		</view>
+		<view class="item-box" @click="handlerGetLocation">
+			<view class="item-left">
+				<u-icon name="map" size='22'></u-icon>
+				<span class="fs-bold">你在哪里</span>
+				<span class="left-text">(越详细越容易被推荐噢)</span>
+			</view>
+			<view class="item-right">
+				<u-icon name="arrow-right"></u-icon>
+			</view>
+		</view>
+		<view class="btn-box">
+			<button class="btn" @click="handlerPublishBtn">发布</button>
+		</view>
+	</view>
+</template>
+
+<script>
+  import { addClientContent } from '@/api/client/community.js';
+	export default {
+		data() {
+			return {
+				textContent: '',
+				fileList1: [],
+        userId:null
+			}
+		},
+    mounted(){
+      this.userId = this.$store.state.user.userMessage.id
+    },
+		methods: {
+			// 获取当前定位
+			handlerGetLocation() {
+				wx.getLocation({
+					type: 'gcj02',
+					success(res) {
+						console.log("@@@@res", res);
+					},
+					fail(error){
+						console.log("error", error);
+					}
+				})
+			},
+      // 点击发布按钮
+      handlerPublishBtn(){
+        let params = {
+          textContent:this.textContent,
+          status:0, // 状态:0-正常;1-屏蔽
+          type:'PURE_TEXT', // 动态类型:1-纯文字;2-图片;3-视频 允许值: PURE_TEXT, PHOTO, VIDEO
+          location:'山东潍坊', // 定位
+          userId:this.userId,
+        }
+        console.log("@@@@params",params);
+        addClientContent(params).then(res=>{
+          console.log("addClientContent",res);
+          // if(res.code == 200){
+          //   uni.showToast({
+          //     title:'发布成功',
+          //     icon:'none'
+          //   })
+          //   this.textContent = ''
+          //   setTimeout(()=>{
+          //     uni.navigateBack(-1)
+          //   },1500)
+          // }else{
+          //   uni.showToast({
+          //     title:res.msg,
+          //     icon:'none'
+          //   })
+          //   return
+          // }
+        })
+      },
+			// 删除图片
+			deletePic(event) {
+				this[`fileList${event.name}`].splice(event.index, 1)
+			},
+			// 新增图片
+			async afterRead(event) {
+				// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
+				let lists = [].concat(event.file)
+				let fileListLen = this[`fileList${event.name}`].length
+				lists.map((item) => {
+					this[`fileList${event.name}`].push({
+						...item,
+						status: 'uploading',
+						message: '上传中'
+					})
+				})
+				for (let i = 0; i < lists.length; i++) {
+					const result = await this.uploadFilePromise(lists[i].url)
+					let item = this[`fileList${event.name}`][fileListLen]
+					this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
+						status: 'success',
+						message: '',
+						url: result
+					}))
+					fileListLen++
+				}
+			},
+			uploadFilePromise(url) {
+				return new Promise((resolve, reject) => {
+					let a = uni.uploadFile({
+						url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
+						filePath: url,
+						name: 'file',
+						formData: {
+							user: 'test'
+						},
+						success: (res) => {
+							setTimeout(() => {
+								resolve(res.data.data)
+							}, 1000)
+						}
+					});
+				})
+			},
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.container {
+		position: relative;
+		background-color: #F5F7F9;
+		height: 100vh;
+
+		.top-box,
+		.item-box {
+			padding: 20rpx;
+			background-color: #fff;
+			border-radius: 20rpx;
+
+			.upload-box {
+				margin-top: 20rpx;
+			}
+		}
+
+		.item-box {
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+			margin-top: 20rpx;
+
+			.item-left {
+				display: flex;
+				align-items: center;
+			}
+		}
+
+		.btn-box {
+			position: absolute;
+			bottom: 0;
+			background-color: #fff;
+			height: 100rpx;
+			padding: 20rpx;
+			width: 95%;
+			display: flex;
+			justify-content: center;
+
+			.btn {
+				width: 80%;
+				border-radius: 20rpx;
+				font-size: 28rpx;
+				color: #000;
+				background-color: #FECF4C;
+				height: 80rpx;
+				line-height: 80rpx;
+			}
+		}
+
+		.fs-bold {
+			font-weight: bold;
+			font-size: 28rpx;
+			color: #000;
+			margin-left: 10rpx;
+		}
+
+		.left-text {
+			color: #a6a7a8;
+			font-size: 28rpx;
+			margin-left: 10rpx;
+		}
+	}
+</style>

+ 4 - 2
src/pages/client/clientPackage/serviceDetail/index.scss

@@ -83,15 +83,17 @@
     width: 200px;
     height: 40px;
     display: flex;
+    justify-content: center;
     font-size: 26rpx;
     color: #fff;
     text-align: center;
     .cart {
-      width: 100px;
+      width: 150px;
       line-height: 40px;
       cursor: pointer;
       background-color: #fe9f1e;
-      border-radius: 40px 0px 0px 40px;
+      // border-radius: 40px 0px 0px 40px;
+      border-radius: 40px ;
     }
     .buy {
       width: 100px;

+ 1 - 1
src/pages/client/clientPackage/serviceDetail/index.vue

@@ -101,7 +101,7 @@
       </view>
       <view class="buyNow">
         <view class="cart" @click="handlerAddCart">加入购物车</view>
-        <view class="buy" @click="handlerImmediateBy">立即购买</view>
+        <!-- <view class="buy" @click="handlerImmediateBy">立即购买</view> -->
       </view>
     </view>
   </view>

+ 17 - 8
src/pages/client/clientPackage/uptickOrder.vue

@@ -2,7 +2,7 @@
 	<view class="container">
 
 		<view class="content-box">
-			<view class="message-box">
+			<!-- <view class="message-box">
 				<view class="message-item">
 					<view class="item-left"> 订购人电话 </view>
 					<view class="item-right">
@@ -17,7 +17,7 @@
 						<u--textarea v-model="goodsRemark" placeholder="请输入备注内容" autoHeight></u--textarea>
 					</view>
 				</view>
-			</view>
+			</view> -->
 
 
 			<view class="message-box">
@@ -139,7 +139,7 @@
 </template>
 
 <script>
-  import { generateOrder ,getCartList} from "@/api/client/business.js"
+  import { generateOrder ,getCartList , generateConfirmOrder} from "@/api/client/business.js"
   import { maintainCouponPaging } from "@/api/client/mine.js"
 	export default {
 		data() {
@@ -182,7 +182,6 @@
 		},
     mounted(){
       this.handlerInitList()
-      this.handlerInitCouponList()
     },
     onLoad(option){
       this.merchantId = option.ids
@@ -205,17 +204,27 @@
       handlerInitList(){
         getCartList(this.merchantId).then(res=>{
           this.init_list = res.data
+          this.handlerInitCouponList(res.data.cartItems)
         })
+
+
       },
       // 初始化优惠券列表
-      handlerInitCouponList(){
+      handlerInitCouponList(cartItems){
         let params = {
-          paging:'1,10',
+          cartIds:[],
           merchantId:this.merchantId
         }
-        maintainCouponPaging( params ).then(res=>{
-          console.log('@@@@res',res)
+        cartItems.map(rs=>{
+          params.cartIds.push(rs.id)
+        })
+        // 订单接口 - 根据购物车信息生成确认单信息
+        generateConfirmOrder(params).then(res=>{
+          console.log("@@@@res",res);
         })
+        // maintainCouponPaging( params ).then(res=>{
+        //   console.log('@@@@res',res)
+        // })
       },
 			// 结算按钮
 			handlerSettleBtn(){

+ 23 - 5
src/pages/client/clientUser/coupon.vue

@@ -27,11 +27,11 @@
     <!-- 优惠券可用 -->
     <view class="couponUse" v-show="lable_type == 0" :key="index" v-for="(item, index) of init_list">
       <view class="useLeft">
-        <view>{{ item.name }}</view>
-        <text>2320-07-02 ~ {{ item.expiration }}</text>
+        <view>{{ item.couponVO.name }}</view>
+        <text>到期时间 : {{ item.couponVO.dueTime }}</text>
       </view>
       <view class="useRight">
-        <view class="text">{{ item.discount * 10 }}<text>折</text></view>
+        <view class="text">{{ 10 - item.couponVO.reduce  }}<text>折</text></view>
         <view>折扣</view>
         <view class="gouUse">去使用</view>
       </view>
@@ -77,7 +77,7 @@
         lable_type: 0, // 是否可用
         queryParams: {
           size: '10', //分页信息  取值范围: 页码,分页大小
-          type: 'GIVE', //优惠券类型 允许值: GIVE(赠送), REDUCE(满减), DISCOUNT(折扣)
+          type: 'REDUCE', //优惠券类型 允许值: GIVE(赠送), REDUCE(满减), DISCOUNT(折扣)
           status: 'UNUSED', // 用户优惠券状态 UNUSED(未使用), USED(已使用), EXPIRED(已过期), CLOSED(作废)
         },
         init_list: [], //初始化列表
@@ -91,11 +91,29 @@
       // 初始化优惠卷列表
       handlerInitCouponList() {
         getUserAcceptCouponsList(this.queryParams).then(res => {
-          this.init_list = res.data.records;
+          this.init_list = res.data;
+          this.init_list.map(rs=>{
+            rs.couponVO.dueTime = this.handlerGetTime(rs.couponVO.expiration)
+          })
+          console.log('@@@@init_list',this.init_list);
           this.total = res.data.total;
         });
       },
+      handlerGetTime(e){
+        // 1707148800000
+        let time = new Date(e)
+        let year = time.getFullYear()
+        let month = time.getMonth() + 1
+        let date = time.getDate()
+        if (month < 10) {
+          month = '0' + month
+        }
+        if (date < 10) {
+          date = '0' + date
+        }
+        return year + '-' + month + '-' + date
 
+      },
       // 选择顶部导航栏
       handlerChangeTab1(e) {
         this.queryParams.type = e.type;

+ 2 - 2
src/pages/client/clientUser/mine/setting.vue

@@ -5,8 +5,8 @@
         <u-cell-group :border="false">
           <u-cell size="large" :border="false" icon="account-fill" title="个人信息" isLink
             url="/pages/client/clientUser/mine/setting/personInfo" />
-          <u-cell size="large" :border="false" icon="fingerprint" title="安全中心" isLink
-            url="/pages/client/clientUser/mine/setting/personInfo" />
+          <!-- <u-cell size="large" :border="false" icon="fingerprint" title="安全中心" isLink
+            url="/pages/client/clientUser/mine/setting/personInfo" /> -->
           <u-cell size="large" :border="false" icon="github-circle-fill" title="关于我们" isLink
             url="/pages/client/clientUser/mine/setting/aboutMine" />
           <u-cell size="large" :border="false" icon="file-text-fill" title="用户协议" isLink

+ 0 - 14
src/pages/client/tabBar/community/community.js

@@ -1,14 +0,0 @@
-export const communityList = [
-  {
-    name: '最新',
-    type: 'LATEST',
-  },
-  {
-    name: '关注',
-    type: 'ATTENTION',
-  },
-  {
-    name: '最热',
-    type: 'HOTTEST',
-  },
-];

+ 236 - 160
src/pages/client/tabBar/community/index.vue

@@ -1,170 +1,246 @@
 <template>
-  <view class="community">
-    <view>
-      <!-- 关注和推荐 -->
-      <u-navbar :autoBack="true" leftIconSize="0">
-        <view slot="center">
-          <u-tabs :list="communityList" lineWidth="32" @change="tabChange" :duration="duration" />
-        </view>
-      </u-navbar>
-
-      <!-- 消息列表 -->
-      <view class="content" :style="{ marginTop: totalHeight + 'px' }">
-        <swiper :duration="duration" style="height: 80vh">
-          <swiper-item>
-            <scroll-view
-              scroll-y="true"
-              style="height: 100%"
-              @scrolltoupper="upper"
-              @scrolltolower="lower"
-              @scroll="scroll"
-            >
-              <view class="list">
-                <comment-list :list="list" />
-              </view>
-            </scroll-view>
-          </swiper-item>
-        </swiper>
-      </view>
-      <uni-load-more :status="loadingType" />
-    </view>
+	<view class="container">
+		<u-sticky bgColor="#F8F8F8">
+			<view class="top"> </view>
+			<u-tabs :list="list1" lineWidth="30" lineColor="#f56c6c" @change='tabChange' :activeStyle="{
+			            color: '#303133',
+			            fontWeight: 'bold',
+			            transform: 'scale(1.05)',
+						fontSize:'40rpx',
+						fontStyle: 'italic'
+			        }" :inactiveStyle="{
+			            color: '#606266',
+			            transform: 'scale(1)'
+			        }" itemStyle=" padding-left: 15px; padding-right: 15px; height: 34px;">
+			</u-tabs>
+			<view class="top-bottom"> </view>
+		</u-sticky>
+
+		<view class="center-box">
+			<view class="item-box" v-for="(item,index) of initList" :key='index'>
+				<view class="item-top">
+					<view class="top-left">
+						<image class="img" src="@/static/QR57a.jpg"></image>
+					</view>
+					<view class="top-right">
+						<view class="right-title">{{ item.userDTO.nickname }}</view>
+						<view class="right-address">2天前 {{ item.location }}</view>
+					</view>
+				</view>
+
+				<u-line margin='10rpx 0'></u-line>
+
+				<view class="item-center">
+					<view class="center-text">
+						{{ item.textContent }}
+					</view>
+					<view class="center-img-box">
+						<image v-for="item of 2" class="center-img" src="@/static/QR57a.jpg"></image>
+					</view>
+				</view>
+				<view class="item-bottom">
+					<view class="bottom-item">
+						<u-icon name="thumb-up" :size='iconSize'></u-icon><span>2332</span>
+					</view>
+					<view class="bottom-item">
+						<u-icon name="heart" :size='iconSize'></u-icon><span>2332</span>
+					</view>
+					<view class="bottom-item">
+						<u-icon name="more-circle" :size='iconSize'></u-icon><span>2332</span>
+					</view>
+				</view>
+			</view>
+		</view>
+
+		<view class="flex-box">
+			<view class="flex" @click="handlerToPublish">
+				<view class="flex-icon">
+					<u-icon name="edit-pen" color='#fff' size='26'></u-icon>
+				</view>
+				<view class=""> 发布 </view>
+			</view>
+		</view>
     <tabbar currentTab="clientCommunity" />
-  </view>
+	</view>
 </template>
 
 <script>
-import CommentList from '@/components/commentList/index.vue';
-import { clientContentList } from '@/api/client/community.js';
-import { communityList } from './community';
-
-export default {
-  components: {
-    CommentList,
-  },
-  data() {
-    return {
-      communityList,
-      duration: 700,
-      scrollTop: 0,
-      old: {
-        scrollTop: 0,
-      },
-      list: [],
-      params: {
-        pageNum: 1,
-        pageSize: 10,
-        type: 'LATEST',
-        keyWord: '',
-      },
-      loadingType: '',
-    };
-  },
-
-  computed: {
-    totalHeight() {
-      return uni.getSystemInfoSync().statusBarHeight + 44;
-    },
-  },
-
-  onLoad() {
-    this.getContentList();
-  },
-
-  onShow() {
-    /* 隐藏原生的tabbar */
-    uni.hideTabBar({
-      animation: false,
-    });
-  },
-
-  /* 下拉刷新 */
-  onPullDownRefresh() {
-    this.params.pageNum = 1;
-    this.list = [];
-
-    uni.stopPullDownRefresh();
-    this.getContentList();
-  },
-
-  onReachBottom() {
-    this.getContentList('more');
-  },
-
-  methods: {
-    /* 获取初始化数据 */
-    async getContentList(type = 'refresh') {
-      if (type === 'refresh') {
-        uni.showToast({
-          title: '数据加载中~',
-          icon: 'none',
-        });
-        this.params.pageNum = 1;
-      } else if (this.loadingType === 'no-more') {
-        return;
-      }
-
-      this.loadingType = 'loading';
-
-      try {
-        let res = await clientContentList(this.params);
-
-        // if (res.code == 200 && res.data) {
-        //   this.list = res.records;
-        // } else {
-        //   uni.showToast({
-        //     title: '数据请求失败!',
-        //     icon: 'none',
-        //   });
-        // }
-        this.list = res.records;
-
-        if (this.list.length === 0) {
-          if (type === 'refresh') loadingType = 'no-data';
-          if (type === 'more') loadingType = 'no-more';
-        }
-
-        this.loadingType = loadingType;
-        this.params.pageNum++;
-        this.list = type === 'refresh' ? list : this.list.concat(list);
-
-        if (type === 'refresh') {
-          uni.hideLoading();
-        }
-      } catch (error) {
-        this.loadingType = '';
-      }
-    },
-
-    tabChange(item) {
-      this.params.type = item.type;
-      this.getContentList();
+  import { clientContentList } from '@/api/client/community.js';
+  import { intervalTime } from "@/utils/tools.js"
+	export default {
+		data() {
+			return {
+				list1: [{
+						name: '最新',
+						type: 'LATEST',
+					},
+					{
+						name: '关注',
+						type: 'ATTENTION',
+					},
+					{
+						name: '最热',
+						type: 'HOTTEST',
+					}
+				],
+				iconSize: 24,
+				duration: 700,
+        params: {
+          pageNum: 1,
+          pageSize: 10,
+          type: 'LATEST',
+          keyWord: '',
+        },
+        initList:[] , // 初始化列表
+			}
+		},
+    onShow(){
+      this.handlerInitList()
+      // let a = intervalTime(1709797137000)
     },
-
-    scroll(e) {
-      this.old.scrollTop = e.detail.scrollTop;
-    },
-
-    goTop(e) {
-      this.scrollTop = this.old.scrollTop;
-      this.$nextTick(() => {
-        this.scrollTop = 0;
-      });
-      uni.showToast({
-        icon: 'none',
-        title: '纵向滚动 scrollTop 值已被修改为 0',
-      });
-    },
-
-    upper(e) {},
-    lower(e) {},
-  },
-};
+		methods: {
+      handlerInitList(){
+        clientContentList(this.params).then(res=>{
+          this.initList = res.records
+        })
+      },
+      // 选择时间
+      // confirmTime(e) {
+      //   let time = new Date(e)
+      //   let year = time.getFullYear()
+      //   let month = time.getMonth() + 1
+      //   let date = time.getDate()
+      //   if (month < 10) {
+      //     month = '0' + month
+      //   }
+      //   if (date < 10) {
+      //     date = '0' + date
+      //   }
+      //   this.queryParams.birthday = year + '-' + month + '-' + date
+      // },
+			// 切换顶部tabbar
+			tabChange(e) {
+        this.params.type = e.type
+        this.handlerInitList()
+			},
+			// 发布按钮
+			handlerToPublish(){
+				uni.navigateTo({
+					url:"/pages/client/clientPackage/communityPublish"
+				})
+			}
+		}
+	}
 </script>
 
 <style lang="scss" scoped>
-.list {
-  min-height: 100vh;
-  padding: 10rpx 20rpx;
-  background-color: #ffffff;
-}
+	.container {
+		background-color: #F8F8F8;
+		min-height: calc(100vh - 140rpx);
+		padding: 0 0 40rpx;
+
+		.top {
+			height: 100rpx;
+		}
+
+		.top-bottom {
+			height: 20rpx;
+		}
+
+		.center-box {
+			margin: 30rpx auto 0;
+			width: 95%;
+			font-size: 28rpx;
+
+			.item-box {
+				padding: 20rpx;
+				border-radius: 20rpx;
+				box-sizing: border-box;
+				margin-bottom: 20rpx;
+				box-shadow: 0 5rpx 15rpx 0 rgba(0, 0, 0, 0.2);
+				background-color: #fff;
+
+				.item-top {
+					display: flex;
+					align-items: center;
+
+					.top-left {
+						.img {
+							width: 90rpx;
+							height: 90rpx;
+							border-radius: 50%;
+						}
+					}
+
+					.top-right {
+						margin-left: 20rpx;
+
+						.right-title {
+							font-weight: bold;
+							font-size: 34rpx;
+						}
+
+						.right-address {
+							color: #959595;
+							font-style: italic;
+							font-weight: bold;
+							font-size: 24rpx;
+						}
+					}
+				}
+
+				.item-center {
+					.center-text {
+						font-size: 32rpx;
+					}
+
+					.center-img-box {
+						margin-top: 20rpx;
+						display: grid;
+						grid-template-columns: 32% 32% 32%;
+						gap: 4% 1%;
+
+						.center-img {
+							width: 200rpx;
+							height: 200rpx;
+						}
+					}
+				}
+
+				.item-bottom {
+					display: flex;
+					margin-top: 40rpx;
+					justify-content: space-between;
+
+					.bottom-item {
+						display: flex;
+						align-items: center;
+					}
+				}
+			}
+		}
+
+		.flex-box {
+			width: 120rpx;
+			height: 120rpx;
+			border-radius: 50%;
+			background-color: #000;
+			position: fixed;
+			bottom: 15%;
+			right: 5%;
+			box-shadow: 0 5rpx 15rpx 0 rgba(0, 0, 0, 0.5);
+			padding: 10rpx;
+			box-sizing: border-box;
+			text-align: center;
+			.flex {
+				color: #fff;
+				font-size:26rpx;
+				font-weight: bold;
+				.flex-icon{
+					display: flex;
+					justify-content: center;
+				}
+			}
+		}
+	}
 </style>

+ 6 - 0
src/pages/client/tabBar/home/index.vue

@@ -102,6 +102,7 @@
 
 <script>
 import { getCurrentLocation, getHomePageApi, getSwiperListApi } from '@/api/client/home';
+import { maintainUserInfo } from '@/api/client/mine.js';
 import { mapGetters } from 'vuex';
 import RecommendItem from '@/components/merchant/RecommendItem.vue';
 import HotItem from '@/components/merchant/HotItem.vue';
@@ -232,6 +233,11 @@ export default {
         .catch(err => {
           console.log(err);
         });
+
+      // 获取个人信息的userId
+      maintainUserInfo().then(res=>{
+        this.$store.commit('SET_USER_MESSAGE',res.data)
+      })
     },
 
     // 手动选择城市

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

@@ -8,6 +8,7 @@ export default {
   state: () => ({
     user_info: getCache('user_info') || {},
     merchantId: null, //商家ID
+    userMessage:{}
   }),
   mutations: {
     SET_USER_INFO(state, data) {
@@ -16,6 +17,11 @@ export default {
     },
     SET_MERCGANT_ID(state, data) {
       state.merchantId = data;
+    },
+    // 获取用户信息
+    SET_USER_MESSAGE(state,value){
+      console.log('@@@value',value);
+      state.userMessage = value
     }
   },
   actions: {

+ 2 - 2
src/utils/request.js

@@ -3,8 +3,8 @@ import {
 } from '@/utils/system';
 import store from '@/store';
 
- // const BASE_URL = 'http://192.168.68.77:11000';
- const BASE_URL = 'http://192.168.43.175:11000';
+ const BASE_URL = 'http://192.168.68.77:11000';
+ // const BASE_URL = 'http://192.168.43.175:11000';
 // const BASE_URL = 'https://test.api.chelvc.com';
 const TIME_OUT = 60000;
 const errStatus = {

+ 37 - 2
src/utils/tools.js

@@ -3,10 +3,18 @@ export function buildTree(data) {
 
   data.forEach(item => {
     const code = item.type.code;
-    const node = { icon: item.icon, id: item.id, name: item.name };
+    const node = {
+      icon: item.icon,
+      id: item.id,
+      name: item.name
+    };
 
     if (!tree[code]) {
-      tree[code] = { code: code, description: item.type.description, children: [node] };
+      tree[code] = {
+        code: code,
+        description: item.type.description,
+        children: [node]
+      };
     } else {
       tree[code].children.push(node);
     }
@@ -14,3 +22,30 @@ export function buildTree(data) {
 
   return Object.values(tree);
 }
+
+export function intervalTime( endTime) {
+  // var timestamp=new Date().getTime(); //计算当前时间戳
+  var date1 = new Date().getTime() //计算当前时间戳 (毫秒级)
+
+  var date2 = endTime; //结束时间
+  // var date3 = date2.getTime() - date1.getTime(); //时间差的毫秒数
+  var date3 = (date1 - date2) * 1000; //时间差的毫秒数
+  //计算出相差天数
+  var days = Math.floor(date3 / (24 * 3600 * 1000));
+  if (days < 0) {
+    days = days * (-1)
+  }
+  //计算出小时数
+  var leave1 = date3 % (24 * 3600 * 1000); //计算天数后剩余的毫秒数
+  var hours = Math.floor(leave1 / (3600 * 1000));
+  //计算相差分钟数
+  var leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数
+  var minutes = Math.floor(leave2 / (60 * 1000));
+
+  //计算相差秒数
+  var leave3 = leave2 % (60 * 1000); //计算分钟数后剩余的毫秒数
+  var seconds = Math.round(leave3 / 1000);
+  console.log(days + "天 " + hours + "小时 ")
+  // return   days + "天 " + hours + "小时 " + minutes + " 分钟" + seconds + " 秒"
+  return days + "天 " + hours + "小时 "
+}