Просмотр исходного кода

Merge branch 'main' of https://gitlab.com/tea28/client

hejie 3 лет назад
Родитель
Сommit
7cb174d94d
4 измененных файлов с 43 добавлено и 21 удалено
  1. 1 1
      src/components/goodsList.vue
  2. 11 5
      src/pages/index/index.vue
  3. 20 13
      src/pages/to-pay-list/index.vue
  4. 11 2
      src/request/request.js

+ 1 - 1
src/components/goodsList.vue

@@ -41,7 +41,7 @@ export default {
     },
     onShow(){},
     created() {
-        this.loadData();
+        // this.loadData();
     },
     mounted () {},
     methods: {

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

@@ -48,7 +48,7 @@
         </view>
         <view class="list_bar">
             <div class="tit">猜你喜欢</div>
-            <goodslist :long="1" type="3" />
+            <goodslist :long="1" type="3" ref="goodslist"/>
         </view>
     </div>
 </template>
@@ -76,7 +76,10 @@ export default {
     onLoad(option) {},
     onLaunch() {},
     onShow() {
-        // this.getBanner(); //获取轮播图
+        this.$nextTick(()=>{
+            this.$refs.goodslist.loadData();
+        })
+        this.getBanner(); //获取轮播图
         // this.getAnnounce(); //获取公告列表
         // this.getImageTwo(); //金刚区
         // this.getImage(); //获取活动列表
@@ -85,9 +88,12 @@ export default {
     methods: {
         // 获取轮播图
         getBanner() {
-            post("ShuZiTeaYW/shop/play").then((res) => {
-                if (res.status == 200) {
-                    this.BannerImg = res.list;
+            post("banner").then((res) => {
+                if (res.code === 0) {
+                    res.data.data.forEach(e => {
+                        if(e.image) this.BannerImg.push(e.image)
+                    });
+                    // this.BannerImg = res.list;
                 }
             });
         },

+ 20 - 13
src/pages/to-pay-list/index.vue

@@ -187,20 +187,27 @@ export default {
                 address_id: this.DefaultAddress.id,
                 trade_type: type
             }).then(res => {
+				console.log(res);
                 if (res.code === 0) {
-                    toPayOpre.toPay(res.data, (rea) => {
-                        if (!rea) {
-                            // 支付成功
-                            appEv.errTips('支付成功')
-                            uni.switchTab({
-                                url: "/pages/szw-order-list/index",
-                            });
-
-                        } else {
-                            // 支付失败
-                            appEv.errTips('支付已取消')
-                        }
-                    });
+					if(res.data.length){
+						toPayOpre.toPay(res.data, (rea) => {
+							if (!rea) {
+								// 支付成功
+								appEv.errTips('支付成功')
+								setTimeout(() => {
+									this.goto("/pages/szw-order-list/index")
+								}, 1500);
+							} else {
+								// 支付失败
+								appEv.errTips('支付已取消')
+							}
+						});
+					}else{
+						appEv.errTips('支付成功')
+						setTimeout(() => {
+							this.goto("/pages/szw-order-list/index")
+						}, 1500);
+					}
                 }
             })
         },

+ 11 - 2
src/request/request.js

@@ -1,4 +1,5 @@
 import host from "./config.js"
+import { goto } from '@/utils/myfun.js';
 
 export default ({ url, method, params, header, baseURL }) => {
 	baseURL = baseURL ? baseURL : host.Hhost;
@@ -47,9 +48,17 @@ uni.addInterceptor('request', {
 				icon: "none",
 			});
 			setTimeout(() => {
-				uni.reLaunch({
-				  url: "/pages/my/index"
+				// #ifdef  H5
+				goto("/pages/my/login")
+				// #endif
+				// #ifdef  APP
+				goto("/pages/my/login")
+				// #endif
+				// #ifdef  MP-WEIXIN
+				uni.switchTab({
+					url: "/pages/my/index"
 				});
+				// #endif
 			}, 1500);
 		}
 	},