Эх сурвалжийг харах

feat: 首页 及 商品订单优化

DaMowang 3 жил өмнө
parent
commit
e8b39e3ab2

+ 1 - 4
src/components/goodsList.vue

@@ -52,16 +52,13 @@ export default {
             }).then((res) => {
                 if(page == 1) this.productList = []
                 if (res.code === 0) {
-                    console.log(res);
                     this.productList = [...this.productList,...res.data.data]
                 }
             });
         },
         // 跳转到商品详情页
         NavToGoodsDetail(id,type){
-            uni.navigateTo({
-                url:'/pages/product/p_details?id=' + id + '&type=' + this.type
-            })
+            this.goto("/pages/product/p_details", { id, type });
         },
     },
 };

+ 119 - 17
src/pages/index/index.vue

@@ -28,12 +28,12 @@
             <!-- 公告-end -->
 
             <!-- 金刚区 -->
-            <!-- <view class="head_area">
+            <view class="head_area">
                 <view class="area_list" v-for="(item, index) in area_list" :key="index" @click="setPageUrl(item)">
                     <image class="area_img" :src="item.url"></image>
                     <view class="area_name">{{ item.name }}</view>
                 </view>
-            </view> -->
+            </view>
             <!-- 金刚区-end -->
 
             <!-- 活动 -->
@@ -48,37 +48,60 @@
         </view>
         <view class="list_bar">
             <div class="tit">猜你喜欢</div>
-            <goodslist :long="1" type="3" ref="goodslist"/>
+            <view class="product-list">
+                <view class="product" v-for="(i, s) in productList" :key="s" @click="NavToGoodsDetail(i.id,i.type)">
+                    <view class="image-view">
+                        <image class="product-image" :src="i.original_img"></image>
+                    </view>
+                    <view :class="['product-title', 'ellipsis1']">{{ i.goods_name }}</view>
+                    <view class="product-price">
+                        <text class="product-price-original"><text class="product-unit">¥</text>{{ i.price }}</text>
+                        <!-- <text class="product-price-favour">¥{{i.originalPrice}}</text> -->
+                        <!-- <text class="product-tip">{{i.tip}}</text> -->
+                    </view>
+                    <view class="product-txt">{{ i.give_integral + "积分" }}</view>
+                </view>
+                <view class='fz_w_text mar_t20 mar_b20'>茶,让生活更美好!</view>
+            </view>
         </view>
     </div>
 </template>
 <script>
 let app=getApp();
 var appEv = app.$vm.$options;
-import goodslist from "@/components/goodsList"; //商品列表
+// import goodslist from "@/components/goodsList"; //商品列表
 import swiperBanner from "@/components/swiperBanner"; //轮播
 import { get, post } from "@/request/api.js";
 export default {
     name: "Appindex",
     components: {
-        goodslist, //商品列表
+        // goodslist, //商品列表
         swiperBanner, //轮播
     },
     data() {
         return {
             BannerImg: [], // 轮播图列表
             not_list: [], // 公告列表
-            area_list: [], // 金刚区
-            spc_list: [], //活动列表
-            // goodslistUrl: "ShuZiTeaYW/shop/getGoodsLikeByUserId", //首页商品列表
+             // 金刚区
+            area_list: [
+                 {name: "零售区", url: "https://teaclub.oss-cn-chengdu.aliyuncs.com/menu/cart.png", type:1},
+                 {name: "批发区", url: "https://teaclub.oss-cn-chengdu.aliyuncs.com/menu/wholesale.png", type:2},
+                 {name: "精品优选", url: "https://teaclub.oss-cn-chengdu.aliyuncs.com/menu/preferred.png", type:3},
+                 {name: "今日值买", url: "https://teaclub.oss-cn-chengdu.aliyuncs.com/menu/integral.png", type:4}
+            ],
+            spc_list: [
+                {url: "https://teaclub.oss-cn-chengdu.aliyuncs.com/ShuZiTea/ShuZiTeaHT/202210/f70cd8e0-e468-45eb-a9f7-2c42713cd607.jpg"},
+                {url: "https://teaclub.oss-cn-chengdu.aliyuncs.com/ShuZiTea/ShuZiTeaHT/202210/b13c0186-fdfc-4b87-b466-5c9fc336cc54.jpg"},
+                {url: "https://teaclub.oss-cn-chengdu.aliyuncs.com/ShuZiTea/ShuZiTeaHT/202210/49886d9c-ce5a-49ca-a281-12910541344f.jpg"}
+            ], //活动列表
+            productList: [], //商品数据
         };
     },
-    onLoad(option) {},
+    onLoad(option) {
+        },
     onLaunch() {},
     onShow() {
-        this.$nextTick(()=>{
-            this.$refs.goodslist.loadData();
-        })
+        this.loadData()
         this.getBanner(); //获取轮播图
         this.getAnnounce(); //获取公告列表
         // this.getImageTwo(); //金刚区
@@ -86,10 +109,22 @@ export default {
     },
     onHide() {},
     methods: {
+        loadData() {
+            post("goods/indexGoods").then((res) => {
+                if (res.code === 0) {
+                    this.productList = res.data.data;
+                }
+            });
+        },
+        // 跳转到商品详情页
+        NavToGoodsDetail(id, type) {
+            this.goto("/pages/product/p_details", { id, type });
+        },
         // 获取轮播图
         getBanner() {
             post("banner").then((res) => {
                 if (res.code === 0) {
+                    this.BannerImg = []
                     res.data.data.forEach(e => {
                         if(e.image) this.BannerImg.push(e.image)
                     });
@@ -132,11 +167,18 @@ export default {
         },
         // 金刚区跳转
         setPageUrl(item){
-            if(item.showType == 1){
-                this.goto('/pages/product/productRetail')
-            }else if(item.showType == 2){
-                this.goto('/pages/product/productWholesale')
-            }else{
+            if(item.type == 1){
+                this.goto('/pages/product/productRetail',{type:item.type})
+            }else if(item.type == 2){
+                this.goto('/pages/product/productWholesale',{type:item.type})
+            }
+            // else if(item.type == 3){
+            //     this.goto('/pages/product/productRetail',{type:item.type})
+            // }
+            // else if(item.type == 4){
+            //     this.goto('/pages/product/productRetail',{type:item.type})
+            // }
+            else{
                 appEv.errTips('此功能暂未开放!')
                 return false
             }
@@ -268,4 +310,64 @@ export default {
         font-weight: bold;
     }
 }
+.product-list {
+  padding: 0 20rpx;
+  display: flex;
+  width: 100%;
+  flex-wrap: wrap;
+  flex-direction: row;
+  .product {
+    width: 50%;
+    padding: 20rpx 10rpx;
+    display: flex;
+    flex-direction: column;
+  }
+
+  .product-image {
+    border-radius: 10rpx 10rpx 0 0;
+    width: 100%;
+    height: 260rpx;
+    object-fit: cover;
+  }
+
+  .product-title {
+    width: 100%;
+    overflow: hidden;
+    line-height: 1.5;
+  }
+
+  .product-price {
+    color: #121212;
+    font-size: 28rpx;
+    position: relative;
+  }
+
+  .product-price-original {
+    color: #18bb88;
+  }
+
+  .product-price-favour {
+    color: #888888;
+    text-decoration: line-through;
+    margin-left: 10upx;
+  }
+
+  .product-tip {
+    position: absolute;
+    right: 10upx;
+    background-color: #ff3333;
+    color: #ffffff;
+    padding: 0 10upx;
+    border-radius: 5upx;
+  }
+
+  .product-unit {
+    font-size: 24rpx;
+  }
+
+  .product-txt {
+    font-size: 22rpx;
+    color: #787878;
+  }
+}
 </style>

+ 15 - 38
src/pages/product/p_details.vue

@@ -16,7 +16,7 @@
 		
 		<!-- 价格信息栏 -->
 		<view class="price_info flex_r flex_ac flex_jb">
-			<view class="price" :class="type == 2 ? 'samll' : ''">¥{{detail.cost_price}}</view>
+			<view class="price" :class="type == 2 ? 'samll' : ''">¥{{type == 2 ?detail.trade_price:detail.cost_price}}</view>
 			<view class="price_span flex_r flex_ac flex_je">
 				<view class="triangle"></view>
 				<view class="span_conten flex_r flex_ac flex_jc">{{goodsDa.type == 1 ? "零售专区" : goodsDa.type == 2 ? "批发专区" : goodsDa.type == 3 ? "精品专区" : "今日值买"}}</view>
@@ -154,6 +154,7 @@ import authorizeModule from '@/components/authorize-module/index'
 			};
 		},
 		onLoad:function(e){
+			this.type = e.type
 			this.goodsDa = e;
 			this.userinfo = uni.getStorageSync('userinfo');
 			this.loadData(e)
@@ -198,11 +199,11 @@ import authorizeModule from '@/components/authorize-module/index'
 					return
 				}
 				if(this.btnIndex == 0){
-					if(this.type != 1){
+					// if(this.type != 1){
 						this.toPayOrder()
-					}else{
-						this.SetCartGoodsList()
-					}
+					// }else{
+					// 	this.SetCartGoodsList()
+					// }
 				}else{
 					this.toPayOrder()
 				}
@@ -210,37 +211,19 @@ import authorizeModule from '@/components/authorize-module/index'
 			},
 			// 创建购买订单
 			toPayOrder:function(){
-				console.log(this.pfway);
 				this.goto("/pages/to-pay-list/index",{
 					...this.goodsDa,
 					is_sell: this.pfway,
 					num: this.buyNum,
 				})
-				
-				// let that = this;
-				// let url
-				// if(this.type == 1){
-				// 	url = '/pages/to-pay-list/index?count=' + this.buyNum + '&goodsId=' + this.goodsId + '&goodsType=1&ojsType=1'
-				// }else if(this.type == 2){
-				// 	url = '/pages/to-pay-list/index?count=' + this.buyNum + '&goodsType=2&goodsId=' + this.goodsId + '&ojsType=' + this.pfway + '&payType=2';
-				// }else if(this.type == 3){
-				// 	url = '/pages/to-pay-list/index?count=1&goodsType=4&ojsType=1&goodsPId=' + this.id
-				// }else if(this.type == 4){
-				// 	url = '/pages/to-pay-list/index?count=' + this.buyNum + '&goodsType=3&ojsType=1&goodsId=' + this.detail.goodsId
-				// }else if(this.type == 7){
-				// 	url = '/pages/to-pay-list/index?count=' + this.buyNum + '&goodsType=7&ojsType=1&goodsId=' + this.detail.goodsId
-				// }
-				// uni.navigateTo({
-				// 	url:url
-				// })
 			},
 			// 添加到购物车
 			SetCartGoodsList:function(){
 				let that = this;
 				let data = {
-					goodsId:this.goodsId,
-					buyCount:this.buyNum,
-					specialArea:this.type
+					goodsId: this.goodsId,
+					buyCount: this.buyNum,
+					specialArea: this.type
 				}
                 u_post("ShuZiTeaYW/shop/conShoppingCart",data).then(res => {
                     if(res.status == 200){
@@ -254,15 +237,15 @@ import authorizeModule from '@/components/authorize-module/index'
                 })
 			},
 			// 购买数量更改
-			bindChange:function(e){
+			bindChange(e){
 				this.buyNum = e;
 			},
 			// 更改批发方式
-			setWay:function(e){
+			setWay(e){
 				this.pfway = e;
 			},
 			// 点击同意协议
-			checkboxChange:function(e){
+			checkboxChange(e){
 				let index = e.detail.value.indexOf('1');
 				if(index != -1){
 					this.checked = true
@@ -271,15 +254,9 @@ import authorizeModule from '@/components/authorize-module/index'
 				}
 			},
 			// 点击底部主页购物车等按钮
-			onClick:function(e){
-				if(e.index == 0){
-					uni.switchTab({
-						url:'/pages/szw-goods-list/index'
-					})
-				}else if(e.index == 1){
-					uni.switchTab({
-						url:'/pages/szw-cart-list/index'
-					})
+			onClick(e){
+				if(e.index === 0){
+					uni.switchTab({url:"/pages/index/index"})
 				}
 			},
 			// 点击立即购买或加入购物车

+ 23 - 33
src/pages/product/productRetail.vue

@@ -2,16 +2,16 @@
     <view class="container">
         <!-- 商品列表 -->
         <view class="goods_con flex_r flex_ac flex_wrap">
-            <view class="goods" v-for="(item,index) in goods" :key="index" @tap="NavToGoodsDetail(item.goodsId,1)">
-                <image class="goods_img" :src="item.goodsThumbnailUrl" mode=""></image>
+            <view class="goods" v-for="(item,index) in goods" :key="index" @tap="NavToGoodsDetail(item.id)">
+                <image class="goods_img" :src="item.original_img" mode=""></image>
                 <view class="goods_info">
-                    <view class="info_title">{{item.goodsName}}</view>
-                    <view class="info_msg ellipsis">{{item.goodsMsg}}</view>
+                    <view class="info_title">{{item.goods_name}}</view>
+                    <!-- <view class="info_msg ellipsis">{{item.goodsMsg}}</view> -->
                     <view class="info_option flex_r flex_ac flex_jb">
                         <view class="info_price"><text>¥</text>{{item.price}}</view>
                         <!-- <image class="info_cart" src="/static/cart.png" mode="" @tap.stop="OpenShopping(index)"></image> -->
                     </view>
-                    <view class="info_hint">赠送{{item.fanIntegral}}</view>
+                    <view class="info_hint">赠送 {{item.give_integral ? item.give_integral + ' 积分' : item.give_cha_bao + ' 茶宝'}}</view>
                 </view>
             </view>
         </view>
@@ -58,43 +58,33 @@ export default {
             goods: [], // 商品列表
             goodsIndex: '', // 选中猜你喜欢的下标
             buyNum: 1, // 购买数量
-            checked: false, // 是否同意协议 
+            checked: false, // 是否同意协议
+            type: '',
         };
     },
-    onLoad: function(e) {
-        // 推荐人ID
-        if (e.agentId) {
-            app.globalData.agentId = e.agentId;
-        }
-        if (e && e.scene) {
-            var scene = decodeURIComponent(e.scene).split("&");
-            if (scene.length > 0) {
-                var agentId = scene[0].split(":");
-                app.globalData.agentId = agentId[1] && agentId[1] != '' ? agentId[1] : app.globalData.agentId;
-                var goodsId = scene[1].split(":");
-                this.goods_id = goodsId[1] && goodsId[1] != '' ? goodsId[1] : ''
-            }
-        }
+    onLoad(e) {
+        this.type = e.type
     },
-    onShow: function() {
+    onShow() {
         page = 1;
         this.goods = [];
         this.loadData()
     },
     methods: {
-        loadData: function() {
+        loadData() {
             let that = this;
             let data = {
-                page: page
+                page: page,
+                type: this.type
             }
-            u_post("ShuZiTeaYW/shop/selecthRetail", data).then(res => {
-                if (res.status == 200) {
-                    let obj = res.goods
+            post("goods/goodsList", data).then(res => {
+                if (res.code === 0) {
+                    let obj = res.data.data
+                    if(page == 1) that.goods = []
                     if (obj.length > 0) {
-                    	that.goods = [ ...that.goods, ...obj ]
-                        // for (var i in obj) {
-                        //     that.goods.push(obj[i])
-                        // }
+                        obj.forEach(e => {
+                            that.goods.push(e)
+                        });
                     } else {
                         page = -1;
                         appEv.errTips('暂无更多')
@@ -107,13 +97,13 @@ export default {
             })
         },
         // 跳转到商品详情页
-        NavToGoodsDetail: function(id, type) {
+        NavToGoodsDetail(id, type) {
             uni.navigateTo({
-                url: '/pages/product/p_details?id=' + id + '&type=' + type
+                url: '/pages/product/p_details?id=' + id + '&type=' + this.type
             })
         },
         // 打开加入购物车窗口
-        OpenShopping: function(index) {
+        OpenShopping(index) {
             this.checked = false
             this.goodsIndex = this.goods[index]
             this.$refs.shopping.open()

+ 26 - 36
src/pages/product/productWholesale.vue

@@ -1,11 +1,11 @@
 <template>
     <view class="container">
         <!-- 批发专区 -->
-        <view class="who_list flex_r" v-for="(item,index) in who_list" :key="index" @tap="NavToGoodsDetail(item.goodsId,2)">
-            <image class="list_img" :src="item.goodsThumbnailUrl"></image>
+        <view class="who_list flex_r" v-for="(item,index) in who_list" :key="index" @tap="NavToGoodsDetail(item.id)">
+            <image class="list_img" :src="item.original_img"></image>
             <view class="list_info flex_c flex_jb">
-                <view class="info_name">{{item.goodsName}}</view>
-                <view class="info_msg">{{item.purchasePrice}}</view>
+                <view class="info_name">{{item.goods_name}}</view>
+                <view class="info_msg">{{item.price}}</view>
                 <view class="info_btn_con flex_r flex_je">
                     <view class="info_btn flex_r flex_ac flex_jc">购买</view>
                 </view>
@@ -24,45 +24,35 @@ import { get, post, u_post } from "@/request/api.js";
 export default {
     data() {
         return {
-            who_list: [] // 批发商品列表
+            who_list: [], // 批发商品列表
+            type: '',
         };
     },
-    onLoad: function(options) {
-        // 推荐人ID
-        if (options.agentId) {
-            app.globalData.agentId = options.agentId;
-        }
-        if (options && options.scene) {
-            var scene = decodeURIComponent(options.scene).split("&");
-            if (scene.length > 0) {
-                var agentId = scene[0].split(":");
-                app.globalData.agentId = agentId[1] && agentId[1] != '' ? agentId[1] : app.globalData.agentId;
-                var goodsId = scene[1].split(":");
-                this.goods_id = goodsId[1] && goodsId[1] != '' ? goodsId[1] : ''
-            }
-        }
+    onLoad(e) {
+        this.type = e.type
     },
-    onShow: function() {
+    onShow() {
         page = 1;
         this.who_list = []
         this.loadData()
     },
     methods: {
-        loadData: function() {
+        loadData() {
             let that = this;
             uni.showLoading({ mask: true })
             let data = {
-                page: page
+                page: page,
+                type: this.type
             }
-            u_post("ShuZiTeaYW/shop/selectWholesale", data).then(res => {
+            post("goods/goodsList", data).then(res => {
                 uni.hideLoading()
-                if (res.status == 200) {
-                    let obj = res.goods
+                if (res.code === 0) {
+                    let obj = res.data.data
+                    if(page == 1) that.who_list = []
                     if (obj.length > 0) {
-                    	that.who_list = [ ...that.who_list, ...obj ]
-                        // for (var i in obj) {
-                        //     that.who_list.push(obj[i])
-                        // }
+                        obj.forEach(e => {
+                            that.who_list.push(e)
+                        });
                     } else {
                         page = -1;
                         appEv.errTips('暂无更多')
@@ -74,19 +64,19 @@ export default {
             })
         },
         // 跳转到商品详情页
-        NavToGoodsDetail: function(id, type) {
+        NavToGoodsDetail: function(id) {
             uni.navigateTo({
-                url: '/pages/product/p_details?id=' + id + '&type=' + type
+                url: '/pages/product/p_details?id=' + id + '&type=' + this.type
             })
         }
     },
+    
     onShareAppMessage: function() {
-        var path = '/pages/wholesale-list/index?agentId=1';
-
-        if (app.globalData.systemUserInfo && app.globalData.systemUserInfo.userId) {
-            path = '/pages/wholesale-list/index?agentId=' + app.globalData.systemUserInfo.userId;
+        let userinfo = uni.getStorageSync('userinfo');
+        var path = '/pages/product/productWholesale?agentId=1';
+        if (userinfo.user_id) {
+            path = '/pages/product/productWholesale?agentId=' + userinfo.user_id;
         }
-
         var title = `茶,让生活更美好!`;
         return {
             title: title,

+ 40 - 85
src/pages/sign/index.vue

@@ -5,12 +5,11 @@
         <!-- 页面标题-end -->
         <!-- 用户信息 -->
         <view class="userinfo flex_r flex_ac">
-            <span v-if="!userinfo.headimgurl" class="iconfont">&#xe630;</span>
-            <image v-else class="user_img" :src="userinfo.headimgurl" mode=""></image>
+            <image class="user_img" :src="userinfo.head_pic" mode=""></image>
             <view class="user_info flex_c flex_jc">
-                <view class="user_name">{{userinfo.headimgurl}}</view>
+                <view class="user_name">{{ userinfo.nickname }}</view>
                 <view class="level_con flex_r flex_ac">
-                    <view class="level">{{userinfo.level_name}}</view>
+                    <view class="level">{{ userinfo.level_name }}</view>
                 </view>
             </view>
             <!-- <view class="record flex_r flex_ac flex_jc" @tap="NavToSignList">积分记录</view> -->
@@ -37,26 +36,9 @@
             </view>
         </view>
         <!-- 签到信息-end -->
-        <!-- 积分兑好礼 -->
-        <view class="integral mar_t30" v-if="list.length != 0 && list[0] != ''">
-            <view class="inte_title flex_r flex_ae flex_jb">
-                积分兑好礼
-                <view class="more flex_r flex_ac" @tap="goToIntegralList">更多
-                    <text class="not_ico iconfont">&#xe62e;</text>
-                    <!-- <image class="more_img" src="/static/sgin/more.png" mode=""></image> -->
-                </view>
-            </view>
-            <view class="inte_con mar_t30 flex_r flex_ac">
-                <view class="inte_goods" v-for="(item,index) in list" :key="index" @tap="openConversion(item.goodsId)">
-                    <image class="goods_img" :src="item.goodsThumbnailUrl" mode=""></image>
-                    <view class="goods_name ellipsis">{{item.goodsName}}</view>
-                    <view class="goods_price">{{item.integral}}<text>积分</text></view>
-                </view>
-            </view>
-        </view>
-        <!-- 积分兑好礼-end -->
+        
         <!-- 精品推荐 -->
-        <view class="Boutique" v-if="goods.length != 0 && goods[0] != ''">
+        <view class="Boutique" v-if="goods.length">
             <view class="bou_head flex_r flex_ac flex_jc">
                 <image class="bou_img" src="/static/sgin/left.png" mode=""></image>
                 <view class="bou_title">精品推荐</view>
@@ -64,20 +46,17 @@
             </view>
             <view class="bou_con flex_r flex_ac flex_wrap">
                 <view class="bou_list" v-for="(item,index) in goods" :key="index" @tap="openConversion(item.goodsId)">
-                    <image class="bou_l_img" :src="item.goodsThumbnailUrl" mode=""></image>
+                    <image class="bou_l_img" :src="item.original_img" mode=""></image>
                     <view class="bou_l_con">
-                        <view class="bou_l_name ellipsis">{{item.goodsName}}</view>
-                        <!-- <view class="bou_l_info flex_r flex_ae mar_t16">
-							<view class="bou_l_price flex_r flex_ae"><text>¥</text>450</view>
-							<view class="bou_l_cost">¥414</view>
-						</view> -->
-                        <view class="bou_l_msg">{{item.integral}}积分可兑换</view>
+                        <view class="bou_l_name ellipsis">{{item.goods_name}}</view>
+                        <view class="bou_l_msg">{{item.give_cha_bao}}茶宝</view>
                     </view>
                 </view>
             </view>
         </view>
         <view class='fz_w_text mar_b20 mar_t20'>茶,让生活更美好!</view>
         <!-- 精品推荐-end -->
+
         <!-- 兑换弹窗 -->
         <uni-popup type="center" ref="conversion">
             <view class="const_con">
@@ -119,7 +98,7 @@
         </uni-popup>
         <!-- 兑换弹窗-end -->
         <!-- 授权 -->
-        <authorize-module v-if="showAuth" :shopInfo="shopInfo" @authSuccess="onAuthSuccess" @onGotUserInfo="onGotUserInfo"></authorize-module>
+        <!-- <authorize-module v-if="showAuth" :shopInfo="shopInfo" @authSuccess="onAuthSuccess" @onGotUserInfo="onGotUserInfo"></authorize-module> -->
         <!-- 授权-end -->
     </view>
 </template>
@@ -129,16 +108,18 @@ let page = 1;
 let app = getApp();
 var appEv = app.$vm.$options;
 import uniPopup from '@/components/uni-popup/uni-popup.vue'
-import authorizeModule from '@/components/authorize-module/index'
+// import authorizeModule from '@/components/authorize-module/index'
 import { get, post, u_post } from "@/request/api.js";
 export default {
-    components: { uniPopup, authorizeModule },
+    components: { 
+        uniPopup,
+        // authorizeModule
+    },
     data() {
         return {
             integerInfo: {}, // 积分详情
             userInof: {}, // 用户详情
             timer: '00:00:00', // 倒计时
-            list: [], // 积分兑好礼
             goods: [], // 精品推荐
             haveGoods: false, // 是否有商品
             way_list: [], //兑换方式
@@ -147,7 +128,7 @@ export default {
             pay_way: 0, //选中的支付方式
             isShow: false, // 是否显示现金支付
             goodsId: '', // 选中的商品Id
-            showAuth: false, //是否显示授权弹窗
+            // showAuth: false, //是否显示授权弹窗
             shopInfo: {}, // 商户信息
             userinfo:undefined, //用户信息
             todaySign:0, //今日签到数
@@ -158,24 +139,11 @@ export default {
     onShow: function() {
         this.timer = '00:00:00'
         this.userinfo = uni.getStorageSync("userinfo")
-        console.log( this.userinfo,' this.userinfo');
+
+        console.log("this.userinfo",this.userinfo);
         this.loadData()
-        // this.goodsDay()
-        // this.getInteGoods()
-        // this.integralMethodChange()
-        // let userId = app.globalData.systemUserInfo && app.globalData.systemUserInfo.userId ? app.globalData.systemUserInfo.userId : '';
-        if (!this.userinfo || this.userinfo == '' || this.userinfo == undefined) {
-            this.showAuth = true
-            appEv.authorizeUserInfo(res => {
-                if (res) {
-                    this.showAuth = false
-                    this.shopInfo = app.globalData.shopInfo
-                }
-            }, true)
-        } else {
-            this.showAuth = false
-            this.shopInfo = app.globalData.shopInfo
-        }
+
+        this.goodsDay()
     },
     onHide: function() {
         clearInterval(tim)
@@ -194,15 +162,15 @@ export default {
             })
         },
         //授权并登录
-        onAuthSuccess: function() {
-            var that = this;
-            uni.showLoading({ mask: true })
-            appEv.setData((res) => {
-                uni.hideLoading()
-                that.loadData()
-                that.showAuth = false
-            });
-        },
+        // onAuthSuccess: function() {
+        //     var that = this;
+        //     uni.showLoading({ mask: true })
+        //     appEv.setData((res) => {
+        //         uni.hideLoading()
+        //         that.loadData()
+        //         that.showAuth = false
+        //     });
+        // },
         // 距可以签到倒计时
         setTime() {
             var date;
@@ -220,13 +188,12 @@ export default {
                 let sec = parseInt(timer % 60) > 9 ? parseInt(timer % 60) : '0' + parseInt(timer % 60)
                 
                 date = hour + ':' + min + ':' + sec;
-                console.log(date);
+                // console.log(date);
                 this.timer = date
             }, 999)
         },
         // 签到
         setSignIn() {
-            console.log("走了这里");
             post("user/doSign").then(res => {
                 if (res.status == 200) {
                     appEv.errTips(res.msg)
@@ -236,34 +203,22 @@ export default {
                 }
             })
         },
-        // 获取积分兑好礼商品列表
-        getInteGoods: function() {
-            let that = this;
-            let data = {
-                page: 1,
-                limit: 3
-            }
-            post("ShuZiTeaIntegral/integral/goods", data).then(res => {
-                if (res.status == 200) {
-                    that.list = res.goods
-                } else {
-                    appEv.errTips(res.msg)
-                }
-            })
-        },
+
         // 获取精品推荐
         goodsDay: function() {
             let that = this;
             let data = {
                 page: page,
-                limit: 10
+                type: 3
             }
-            post("ShuZiTeaIntegral/integral/goodsDay", data).then(res => {
-                if (res.status == 200) {
-                    let obj = res.goods
-                    that.goods = []
+            post("goods/goodsList", data).then(res => {
+                if (res.code === 0) {
+                    let obj = res.data.data
+                    if(page == 1) that.goods = []
                     if (obj.length > 0) {
-                        that.goods = [...that.goods,...obj]
+                        obj.forEach(e => {
+                            that.goods.push(e)
+                        });
                     } else {
                         if (page == 1) {
                             that.haveGoods = true
@@ -439,7 +394,7 @@ page {
 
 .user_name {
     font-size: 30rpx;
-    color: #fff;
+    color: #333;
     font-family: "SourceHanSansSC-Medium";
     font-weight: 500;
     margin-bottom: 18rpx;

+ 6 - 6
src/pages/to-pay-list/index.vue

@@ -56,14 +56,14 @@
                     <view class="list_name flex_r flex_jb"><text>茶</text><text>宝</text></view>
                     <view class="list_con p_color">(可用{{userinfo.cha_bao}})</view>
                 </view>
-                <view class="list_con">{{basicsInfo.goodsTeaInt}}茶宝</view>
+                <view class="list_con">{{goodsInfo.treasure_price }} 茶宝</view>
             </view>
             <view class="order_list flex_r flex_ac flex_jb" v-if="Data.type == 2">
                 <view class="flex_r flex_ac">
                     <view class="list_name flex_r flex_jb"><text>批</text><text>发</text><text>积</text><text>分</text></view>
-                    <view class="list_con p_color">(可用{{basicsInfo.integral}})</view>
+                    <view class="list_con p_color">(可用{{userinfo.integral}})</view>
                 </view>
-                <view class="list_con">{{basicsInfo.goodsPfInt}}批发积分</view>
+                <view class="list_con">{{goodsInfo.trade_num}} 批发积分</view>
             </view>
             <view class="order_list flex_r flex_ac flex_jb" v-if="Data.type != 5">
                 <view class="list_name flex_r flex_jb"><text>商</text><text>品</text><text>金</text><text>额</text></view>
@@ -140,7 +140,8 @@ export default {
                             this.freight = res.data.freight;
                         }
                         // 计算待支付
-                        let a = (this.goodsInfo.cost_price * this.Data.num + parseFloat(this.freight)) * 100;
+                        let p = this.Data.type == 2 ? this.goodsInfo.trade_price : this.goodsInfo.cost_price;
+                        let a = (p * this.Data.num + parseFloat(this.freight)) * 100;
                         let b = (a - this.userinfo.user_money * 100) / 100;
                         this.obligation = b > 0 ? b : 0
                     })
@@ -187,9 +188,8 @@ export default {
                 address_id: this.DefaultAddress.id,
                 trade_type: type
             }).then(res => {
-				console.log(res);
                 if (res.code === 0) {
-					if(res.data.length){
+					if(res.data.length !== 0){
 						toPayOpre.toPay(res.data, (rea) => {
 							if (!rea) {
 								// 支付成功