aXin-0810 9 ماه پیش
والد
کامیت
c1f79ed720
2فایلهای تغییر یافته به همراه134 افزوده شده و 118 حذف شده
  1. 13 4
      src/packageMaterial/pages/apply/pay.vue
  2. 121 114
      src/packageMine/pages/collection.vue

+ 13 - 4
src/packageMaterial/pages/apply/pay.vue

@@ -172,10 +172,19 @@ export default {
                 })
               })
           } else {
-            // 公众号支付
-            // weixinPay(res.data, function (res) {
-            //   that.paySuccess()
-            // })
+            this.$api
+              .get('/material/salses/pay', {
+                key: this.payNo,
+                salesId: this.orderId,
+                payType: 'W02',
+                openid: ''
+              })
+              .then(res => {
+                // 公众号支付
+                weixinPay(JSON.parse(res?.data?.codeUrl || {}), function (res) {
+                  that.paySuccess()
+                })
+              })
           }
         })
       } else {

+ 121 - 114
src/packageMine/pages/collection.vue

@@ -1,138 +1,145 @@
 <template>
   <!-- #ifdef H5 -->
-	<view>
-		<zj-page-layout
-			:hasFooter="true"
-			:isScroll="true"
-			:refresherTriggered="refresherTriggered"
-			@refresherrefresh="refresherrefresh"
-			@scrolltolower="scrolltolower">
-			<view class="list-container">
-				<view class="goods-item" v-for="(item, index) in dataList" :key='index' @tap="toGoodsDetail(item.goodsId)" @longpress="handleDelete(item.goodsFavoriteId)">
-					<image :src="item.imgUrl" mode="aspectFill"></image>
-					<view class="main">
-						<view class="name">{{item.goodsName}}</view>
-						<view class="bottom">
-							<view class="price"><text>¥</text>{{item.goodsPrice | priceFilter}}</view>
-						</view>
-					</view>
-				</view>
-			</view>
+  <view>
+    <zj-page-layout
+      :hasFooter="true"
+      :isScroll="true"
+      :refresherTriggered="refresherTriggered"
+      @refresherrefresh="refresherrefresh"
+      @scrolltolower="scrolltolower"
+    >
+      <view class="list-container">
+        <view
+          class="goods-item"
+          v-for="(item, index) in dataList"
+          :key="index"
+          @tap="toGoodsDetail(item.goodsId)"
+          @longpress="handleDelete(item.goodsFavoriteId)"
+        >
+          <image :src="item.imgUrl" mode="aspectFill"></image>
+          <view class="main">
+            <view class="name">{{ item.goodsName }}</view>
+            <view class="bottom">
+              <view class="price"><text>¥</text>{{ item.goodsPrice | priceFilter }}</view>
+            </view>
+          </view>
+        </view>
+      </view>
 
-			<Loading
-				:loadStatus="loadStatus"
-				:dataList="dataList"
-			/>
-		</zj-page-layout>
-	</view>
+      <Loading :loadStatus="loadStatus" :dataList="dataList" />
+    </zj-page-layout>
+  </view>
   <!-- #endif -->
   <!-- #ifndef H5 -->
-  <web-view :src="webViewHref(`/packageMine/pages/collection`, pam,crossPagePam)" @message="crossPage.$listener"></web-view>
+  <web-view
+    :src="webViewHref(`/packageMine/pages/collection`, pam, crossPagePam)"
+    @message="crossPage.$listener"
+  ></web-view>
   <!-- #endif -->
 </template>
 
 <script>
-  // #ifdef H5
-	export default {
-		data() {
-			return {
-				dataList: [],
-				pageNum: 1,
-				loadStatus: 0,
-				refresherTriggered: false, // 下拉刷新状态
+ // #ifdef H5
+export default {
+	data() {
+		return {
+			dataList: [],
+			pageNum: 1,
+			loadStatus: 0,
+			refresherTriggered: false, // 下拉刷新状态
+		}
+	},
+
+	onLoad() {
+		this.getList();
+	},
+
+	methods: {
+		// 获取商品列表
+		getList() {
+			this.loadStatus = 1;
+			this.$api.get('/goods/favorite/query', {
+         pageNum: this.pageNum,
+         pageSize: 10,
+         userId: this.$store.state.user.userId,
+			}).then(res => {
+				this.loadStatus = 0;
+				let list = res.data.list;
+				if (list.length < 10) {
+				  this.loadStatus = 2;
+				}
+				this.dataList = this.dataList.concat(list);
+			}).catch(() => {
+				this.loadStatus = 2;
+			}).finally(res => {
+				this.refresherTriggered = false;
+			})
+		},
+
+		// 滚动到底部
+		scrolltolower(e) {
+			if (this.loadStatus === 0) {
+				this.pageNum++;
+				this.getList();
 			}
 		},
 
-		onLoad() {
+		// 触发下拉刷新
+		async refresherrefresh(e) {
+			this.refresherTriggered = true;
+			this.refreshList();
+		},
+
+		refreshList() {
+			this.dataList = [];
+			this.pageNum = 1;
 			this.getList();
 		},
 
-		methods: {
-			// 获取商品列表
-			getList() {
-				this.loadStatus = 1;
-				this.$api.get('/goods/favorite/query', {
-          pageNum: this.pageNum,
-          pageSize: 10,
-          userId: this.$store.state.user.userId,
+		// 删除
+		handleDelete(id) {
+			this.$modal({
+				content: '确定要取消收藏吗?',
+			}).then(() => {
+				this.$api.post('/goods/favorite/del', {
+					goodFavoriteId: id
 				}).then(res => {
-					this.loadStatus = 0;
-					let list = res.data.list;
-					if (list.length < 10) {
-					  this.loadStatus = 2;
-					}
-					this.dataList = this.dataList.concat(list);
-				}).catch(() => {
-					this.loadStatus = 2;
-				}).finally(res => {
-					this.refresherTriggered = false;
+					this.$successToast('取消收藏成功');
+					this.refreshList();
 				})
-			},
-
-			// 滚动到底部
-			scrolltolower(e) {
-				if (this.loadStatus === 0) {
-					this.pageNum++;
-					this.getList();
-				}
-			},
-
-			// 触发下拉刷新
-			async refresherrefresh(e) {
-				this.refresherTriggered = true;
-				this.refreshList();
-			},
-
-			refreshList() {
-				this.dataList = [];
-				this.pageNum = 1;
-				this.getList();
-			},
-
-			// 删除
-			handleDelete(id) {
-				this.$modal({
-					content: '确定要取消收藏吗?',
-				}).then(() => {
-					this.$api.post('/goods/favorite/del', {
-						goodFavoriteId: id
-					}).then(res => {
-						this.$successToast('取消收藏成功');
-						this.refreshList();
-					})
-				}).catch(() => {})
-			},
+			}).catch(() => {})
+		},
 
-      toGoodsDetail(id) {
-        this.$navToPage({
-          url: `/packageGoods/pages/detail?id=${id}`
-        })
-      },
-		}
+     toGoodsDetail(id) {
+       this.$navToPage({
+         url: `/packageGoods/pages/detail?id=${id}`
+       })
+     },
 	}
-  // #endif
-  // #ifndef H5
-  export default {
-    data() {
-      return {
-        pam: {},
-      }
-    },
+}
+ // #endif
+ // #ifndef H5
+ export default {
+   data() {
+     return {
+       pam: {},
+     }
+   },
 
-    onLoad(pam) {
-      this.pam = pam;
-    },
-  }
-  // #endif
+   onLoad(pam) {
+     this.pam = pam;
+   },
+ }
+ // #endif
 </script>
 
 <style lang="scss">
-	.list-container {
-		padding: 1rpx 20rpx;
-		.goods-item {
-			@include zj-card;
-			padding: 20rpx;
-			margin-top: 20rpx;
-		}
-	}
+.list-container {
+  padding: 1rpx 20rpx;
+  .goods-item {
+    @include zj-card;
+    padding: 20rpx;
+    margin-top: 20rpx;
+  }
+}
 </style>