谢杰标 2 years ago
parent
commit
96dcda97dc
1 changed files with 190 additions and 171 deletions
  1. 190 171
      pages5/scan/recommen.vue

+ 190 - 171
pages5/scan/recommen.vue

@@ -1,180 +1,199 @@
 <template>
-  <view class="scan_course">
-    <nav-bar title="商品列表" class="navbar"></nav-bar>
-    <view class="list_item" v-for="(item, index) in courseList" :key="index">
-      <view class="course_content">
-        <view class="c_title">{{ item.goodsName }}</view>
-        <view class="c_downs">
-          <view class="img">
-            <image :src="$method.splitImgHost(item.coverUrl, true)"></image>
-            <view class="time" v-if="item.year">{{
+	<view class="scan_course">
+		<nav-bar title="商品列表" class="navbar"></nav-bar>
+		<view class="list_item" v-for="(item, index) in courseList" :key="index">
+			<view class="course_content">
+				<view class="c_title">{{ item.goodsName }}</view>
+				<view class="c_downs">
+					<view class="img">
+						<image :src="$method.splitImgHost(item.coverUrl, true)"></image>
+						<view class="time" v-if="item.year">{{
               item.year ? item.year : ""
             }}</view>
-          </view>
-          <view class="text">
-            <view class="desc">
-              <view class="left">
-                <text class="mon_t">¥ {{ item.standPrice }}</text>
-                <text v-if="item.linePrice" class="sale"> ¥ </text>
-                <text v-if="item.linePrice" class="price_line"
-                  >&nbsp;{{ item.linePrice }}</text
-                >
-              </view>
-              <view class="right">
-                <view class="regiser_row" @click="toBuy(item)">立即购买</view>
-              </view>
-            </view>
-          </view>
-        </view>
-      </view>
-    </view>
-  </view>
+					</view>
+					<view class="text">
+						<view class="desc">
+							<view class="left">
+								<text class="mon_t">¥ {{ item.standPrice }}</text>
+								<text v-if="item.linePrice" class="sale"> ¥ </text>
+								<text v-if="item.linePrice" class="price_line">&nbsp;{{ item.linePrice }}</text>
+							</view>
+							<view class="right">
+								<view class="regiser_row" @click="toBuy(item)">立即购买</view>
+							</view>
+						</view>
+					</view>
+				</view>
+			</view>
+		</view>
+	</view>
 </template>
 
 <script>
-export default {
-  data() {
-    return { courseList: [] };
-  },
-  onLoad({ scene }) {
-    this.courseList = [];
-    if (option.scene) {
-      let optObj = {};
-      let arrs = decodeURIComponent(scene).split("&");
-      for (let i = 0; i < arrs.length; i++) {
-        optObj[arrs[i].split("=")[0]] = arrs[i].split("=")[1];
-      }
-      this.getCourseList(optObj.sharekey);
-    }
-  },
-  methods: {
-    getCourseList(id) {
-      this.$api.actGoodsList(id).then((res) => {
-        this.courseList = res.data.data;
-      });
-    },
-    toBuy(item) {
-      if (item.goodsType == 2) {
-        uni.navigateTo({
-          url: "/pages2/bank/detail?id=" + item.goodsId,
-        });
-      } else {
-        uni.navigateTo({
-          url:
-            "/pages3/course/detail?id=" +
-            item.goodsId +
-            "&goodsType=" +
-            item.goodsType,
-        });
-      }
-    },
-  },
-};
+	export default {
+		data() {
+			return {
+				courseList: []
+			};
+		},
+		onLoad({
+			scene
+		}) {
+			this.courseList = [];
+			if (scene) {
+				let optObj = {};
+				let arrs = decodeURIComponent(scene).split("&");
+				for (let i = 0; i < arrs.length; i++) {
+					optObj[arrs[i].split("=")[0]] = arrs[i].split("=")[1];
+				}
+				this.getCourseList(optObj.sharekey);
+			}
+		},
+		methods: {
+			getCourseList(id) {
+				this.$api.actGoodsList(id).then((res) => {
+					if (res.data.code == 200) {
+						this.courseList = res.data.data;
+					} else {
+						uni.showToast({
+							title: res.data.msg,
+							icon: "error",
+						});
+					}
+				})
+			},
+			toBuy(item) {
+				if (item.goodsType == 2) {
+					uni.navigateTo({
+						url: "/pages2/bank/detail?id=" + item.goodsId,
+					});
+				} else {
+					uni.navigateTo({
+						url: "/pages3/course/detail?id=" +
+							item.goodsId +
+							"&goodsType=" +
+							item.goodsType,
+					});
+				}
+			},
+		},
+	};
 </script>
 
 <style lang="scss" scoped>
-.scan_course {
-  padding: 32rpx 32rpx 0;
-  .list_item {
-    padding: 24rpx;
-    // height: 278rpx;
-    background: #ffffff;
-    box-shadow: 0rpx 0rpx 20rpx 1rpx rgba(1, 99, 235, 0.1);
-    border-radius: 24rpx;
-    background: #fff;
-    margin-bottom: 32rpx;
-    display: flex;
-    align-items: center;
-    .c_title {
-      font-size: 32rpx;
-      font-weight: bold;
-      margin-bottom: 24rpx;
-      font-weight: bold;
-      color: #222222;
-    }
-    .c_downs {
-      display: flex;
-    }
-    .img {
-      position: relative;
-      margin-right: 24rpx;
-      border-radius: 16rpx;
-      overflow: hidden;
-      width: 204rpx;
-      height: 120rpx;
-      image {
-        width: 100%;
-        height: 100%;
-      }
-
-      .time {
-        position: absolute;
-        bottom: 0;
-        right: 0;
-        width: 80rpx;
-        height: 32rpx;
-        background: rgba(1, 25, 45, 0.4);
-        color: #fff;
-        text-align: center;
-        line-height: 32rpx;
-        font-size: 24rpx;
-        border-radius: 10rpx 0px 10rpx 0px;
-      }
-    }
-
-    .text {
-      width: 440rpx;
-      position: relative;
-      display: flex;
-      flex-direction: column;
-      justify-content: space-between;
-      height: 120rpx;
-      .desc {
-        margin-top: 10rpx;
-        display: flex;
-        align-items: center;
-        justify-content: space-between;
-        width: 100%;
-        .left {
-          flex: 1;
-          color: #333;
-          font-size: 26rpx;
-          .mon_t {
-            font-weight: bold;
-            color: #fc3f3f;
-            font-size: 36rpx;
-          }
-          .sale {
-            color: #999999;
-            font-size: 24rpx;
-            margin-left: 8rpx;
-          }
-          .price_line {
-            color: #999999;
-            font-size: 24rpx;
-            text-decoration: line-through;
-            font-weight: 400;
-          }
-        }
-
-        .right {
-          font-size: 24rpx;
-          font-weight: bold;
-          padding-right: 20rpx;
-          .regiser_row {
-            width: 144rpx;
-            height: 52rpx;
-            line-height: 52rpx;
-            text-align: center;
-            border-radius: 16rpx;
-            background-color: #fc3f3f;
-            color: #fff;
-            font-weight: 500;
-            font-size: 26rpx;
-          }
-        }
-      }
-    }
-  }
-}
-</style>
+	.scan_course {
+		padding: 32rpx 32rpx 0;
+
+		.list_item {
+			padding: 24rpx;
+			// height: 278rpx;
+			background: #ffffff;
+			box-shadow: 0rpx 0rpx 20rpx 1rpx rgba(1, 99, 235, 0.1);
+			border-radius: 24rpx;
+			background: #fff;
+			margin-bottom: 32rpx;
+			display: flex;
+			align-items: center;
+
+			.c_title {
+				font-size: 32rpx;
+				font-weight: bold;
+				margin-bottom: 24rpx;
+				font-weight: bold;
+				color: #222222;
+			}
+
+			.c_downs {
+				display: flex;
+			}
+
+			.img {
+				position: relative;
+				margin-right: 24rpx;
+				border-radius: 16rpx;
+				overflow: hidden;
+				width: 204rpx;
+				height: 120rpx;
+
+				image {
+					width: 100%;
+					height: 100%;
+				}
+
+				.time {
+					position: absolute;
+					bottom: 0;
+					right: 0;
+					width: 80rpx;
+					height: 32rpx;
+					background: rgba(1, 25, 45, 0.4);
+					color: #fff;
+					text-align: center;
+					line-height: 32rpx;
+					font-size: 24rpx;
+					border-radius: 10rpx 0px 10rpx 0px;
+				}
+			}
+
+			.text {
+				width: 440rpx;
+				position: relative;
+				display: flex;
+				flex-direction: column;
+				justify-content: space-between;
+				height: 120rpx;
+
+				.desc {
+					margin-top: 10rpx;
+					display: flex;
+					align-items: center;
+					justify-content: space-between;
+					width: 100%;
+
+					.left {
+						flex: 1;
+						color: #333;
+						font-size: 26rpx;
+
+						.mon_t {
+							font-weight: bold;
+							color: #fc3f3f;
+							font-size: 36rpx;
+						}
+
+						.sale {
+							color: #999999;
+							font-size: 24rpx;
+							margin-left: 8rpx;
+						}
+
+						.price_line {
+							color: #999999;
+							font-size: 24rpx;
+							text-decoration: line-through;
+							font-weight: 400;
+						}
+					}
+
+					.right {
+						font-size: 24rpx;
+						font-weight: bold;
+						padding-right: 20rpx;
+
+						.regiser_row {
+							width: 144rpx;
+							height: 52rpx;
+							line-height: 52rpx;
+							text-align: center;
+							border-radius: 16rpx;
+							background-color: #fc3f3f;
+							color: #fff;
+							font-weight: 500;
+							font-size: 26rpx;
+						}
+					}
+				}
+			}
+		}
+	}
+</style>