Commit 23a4f5817e6041d6f3a8b99540b88bb7a3bb9577

Authored by 王强
1 parent 77386572

“优选”页面,商品部分套用接口完成~

src/components/goodsItem_1/goodsItem_1.less
... ... @@ -12,7 +12,8 @@
12 12 height: 200px;
13 13 .simg {
14 14 display: block;
15   - width: 200px;
  15 + width: 200px;
  16 + height: 200px;
16 17 }
17 18 }
18 19 .title {
... ... @@ -52,7 +53,8 @@
52 53 height: 170px;
53 54 .simg {
54 55 display: block;
55   - width: 170px;
  56 + width: 170px;
  57 + height: 170px;
56 58 }
57 59 }
58 60 .title {
... ... @@ -62,4 +64,4 @@
62 64 margin-top: 10px;
63 65 }
64 66 }
65   -}
66 67 \ No newline at end of file
  68 +}
... ...
src/components/goodsItem_2/goodsItem_2.less
... ... @@ -21,6 +21,7 @@
21 21 .simg {
22 22 display: block;
23 23 width: 200px;
  24 + height: 200px;
24 25 }
25 26 }
26 27 }
... ...
src/components/goodsItem_3/goodsItem_3.less
... ... @@ -24,7 +24,8 @@
24 24 overflow: hidden;
25 25 .simg {
26 26 display: block;
27   - width: 240px;
  27 + width: 240px;
  28 + height: 240px;
28 29 }
29 30 }
30 31 .content-box {
... ... @@ -92,5 +93,5 @@
92 93 }
93 94 }
94 95 }
95   - }
96   -}
97 96 \ No newline at end of file
  97 + }
  98 +}
... ...
src/components/goodsItem_3/goodsItem_3.vue
... ... @@ -17,7 +17,8 @@
17 17 <div class="price">{{item.price}}</div>
18 18 </div>
19 19 <div class="buttons-box">
20   - <div class="btn btn-primary" @click.stop.prevent @click="primary(item)">{{item.primaryText}}</div>
  20 + <!-- <div class="btn btn-primary" @click.stop.prevent @click="primary(item)">{{item.primaryText}}</div> -->
  21 + <div class="btn btn-primary" @click.stop.prevent @click="primary(item)">立即购买</div>
21 22 </div>
22 23 </div>
23 24 </div>
... ... @@ -29,12 +30,12 @@
29 30 export default {
30 31 data: function () {
31 32 return {
32   -
  33 +
33 34 }
34 35 },
35 36 props: ["item"],
36 37 methods: {
37   -
  38 +
38 39 /**
39 40 * 点击跳转
40 41 * @param {object} item [数据对象]
... ... @@ -57,4 +58,4 @@
57 58 <!-- Add "scoped" attribute to limit CSS to this component only -->
58 59 <style rel="stylesheet/less" lang="less" scoped>
59 60 @import './goodsItem_3';
60   -</style>
61 61 \ No newline at end of file
  62 +</style>
... ...
src/components/style_7/style_7.vue
1 1 <template>
2 2 <div class="style-7-com" v-if="styles">
3 3 <div class="com">
4   -
  4 +
5 5 <!-- 引入标题 -->
6 6 <title-box v-if="styles.simg" @more="more"
7 7 :titles="{
... ... @@ -39,7 +39,7 @@
39 39 export default {
40 40 data: function () {
41 41 return {
42   -
  42 +
43 43 }
44 44 },
45 45 props: ["styles"],
... ... @@ -48,7 +48,7 @@
48 48 horizList
49 49 },
50 50 methods: {
51   -
  51 +
52 52 /**
53 53 * 更多
54 54 * @param {object} item [数据对象]
... ... @@ -87,4 +87,4 @@
87 87 <!-- Add "scoped" attribute to limit CSS to this component only -->
88 88 <style rel="stylesheet/less" lang="less" scoped>
89 89 @import './style_7';
90   -</style>
91 90 \ No newline at end of file
  91 +</style>
... ...
src/components/textTitleBox/textTitleBox.vue
... ... @@ -4,7 +4,7 @@
4 4 <div class="title-box">
5 5 <div class="title">{{titles.title}}</div>
6 6 </div>
7   - <div class="more-box" @click="more(titles)">
  7 + <div class="more-box" v-if="titles.more" @click="more(titles.more)">
8 8 <div class="more-text">更多</div>
9 9 </div>
10 10 </div>
... ...
src/pages/mall/mall.vue
1 1 <template>
2 2 <div class="mall-box">
3   -
  3 +
4 4 <!--轮播-->
5 5 <swiper v-if="banner"
6 6 :swipers="banner">
7 7 </swiper>
8   -
  8 +
9 9 <!--导航-->
10 10 <swiperItem v-if="navs"
11 11 :navs="navs">
12 12 </swiperItem>
13   -
  13 +
14 14 <!-- 遍历ads,输出列表数据 -->
15 15 <div class="ads-box">
16 16 <div class="ads" v-for="(item, index) in ads" :key="index">
17   -
  17 +
18 18 <!--优惠专区-->
19 19 <discountZone v-if="item.style == '1'" @more="toDetail" @toDetail="toDetail"
20 20 :discountZoneInfo="item">
21 21 </discountZone>
22   -
  22 +
23 23 <!--天天特惠-->
24 24 <preferential v-if="item.style == '2'" @more="toDetail" @toDetail="toDetail"
25 25 :preferentialInfo="item">
26 26 </preferential>
27   -
  27 +
28 28 <!--视听专区-->
29 29 <videoArea v-if="item.style == '13'" @more="toDetail" @toDetail="toDetail"
30 30 :videoAreaInfo="item">
... ... @@ -48,7 +48,7 @@
48 48 import preferential from "@/components/preferential/preferential";
49 49 import videoArea from "@/components/videoArea/videoArea";
50 50 import style7 from "@/components/style_7/style_7";
51   -
  51 +
52 52 export default {
53 53 name: 'mall',
54 54 data() {
... ... @@ -99,7 +99,7 @@
99 99  
100 100 // 加载完成
101 101 Indicator.close();
102   -
  102 +
103 103 // 返回处理
104 104 if (res.code == 200) {
105 105  
... ... @@ -107,7 +107,7 @@
107 107 let { data: datas } = res;
108 108  
109 109 /* 获取优选库精选活动数据 开始 */
110   -
  110 +
111 111 // 设置标题
112 112 this.$set(this, "title", datas.title);
113 113  
... ... @@ -125,6 +125,9 @@
125 125 if (datas.ads && datas.ads.length) {
126 126 this.$set(this, "ads", datas.ads);
127 127 }
  128 +
  129 + /* 获取优选库精选活动数据 结束 */
  130 +
128 131 } else if (res.code == 400) {
129 132  
130 133 // 获取优选库精选活动失败
... ... @@ -175,11 +178,9 @@
175 178 * @param {object} item [数据对象]
176 179 */
177 180 addCart(item) {
178   -
179   -
180   - console.log("addCartA", item);
181   -
182 181  
  182 + // 通用跳转
  183 + this.jump(item);
183 184 }
184 185 },
185 186 head: {
... ...
src/pages/optimization/optimization.less 0 → 100644
  1 +@charset "UTF-8";
  2 +
  3 +.optimization-box {
  4 + .goods-list-box {
  5 + background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(249, 249, 249, 1) 10%, rgba(249, 249, 249, 1) 100%);
  6 + padding-top: 50px;
  7 + .components-box {
  8 + margin-bottom: 50px;
  9 + &:last-child {
  10 + margin-bottom: 0;
  11 + }
  12 + }
  13 + }
  14 +}
... ...
src/pages/optimization/optimization.vue 0 → 100644
  1 +<template>
  2 + <div class="optimization-box">
  3 +
  4 + <!-- 已关注达人列表(4条) -->
  5 +
  6 +
  7 +
  8 +
  9 +
  10 + <!-- 商品部分 -->
  11 + <div class="goods-list-box">
  12 +
  13 + <!-- 商品样式 2 横排flex -->
  14 + <horiz-list-flex class="components-box" v-if="hotGoods && hotGoods.length" @jump="jump"
  15 + :lists="hotGoods"
  16 + com="2"
  17 + pid="2"
  18 + :flags="{
  19 + icon: [
  20 + 'static/img/icon_n1.png',
  21 + 'static/img/icon_n2.png',
  22 + 'static/img/icon_n3.png'
  23 + ]
  24 + }">
  25 +
  26 + <!-- 标题 -->
  27 + <text-title-box slot="title-box" @more="more"
  28 + :titles="{
  29 + title: '热销商品',
  30 + more: hotGoodsMore
  31 + }">
  32 + </text-title-box>
  33 + </horiz-list-flex>
  34 +
  35 + <!-- 商品样式 3 滑动 -->
  36 + <horiz-list class="components-box" v-if="newGoods && newGoods.length" @jump="jump" @primary="primary"
  37 + :lists="newGoods"
  38 + com="3">
  39 +
  40 + <!-- 标题 -->
  41 + <text-title-box slot="title-box" @more="more"
  42 + :titles="{
  43 + title: '最新上架',
  44 + more: newGoodsMore
  45 + }">
  46 + </text-title-box>
  47 + </horiz-list>
  48 +
  49 + <!-- 商品样式 2 滑动 -->
  50 + <horiz-list class="components-box" v-if="newBuyGoods && newBuyGoods.length" @jump="jump"
  51 + :lists="newBuyGoods"
  52 + com="2"
  53 + pid="1">
  54 +
  55 + <!-- 标题 -->
  56 + <text-title-box slot="title-box"
  57 + :titles="{
  58 + title: '最近购买'
  59 + }">
  60 + </text-title-box>
  61 + </horiz-list>
  62 +
  63 + <!-- 商品样式 3 滑动 -->
  64 + <horiz-list class="components-box" v-if="recommendGoods && recommendGoods.length" @jump="jump" @primary="primary"
  65 + :lists="recommendGoods"
  66 + com="3">
  67 +
  68 + <!-- 标题 -->
  69 + <text-title-box slot="title-box"
  70 + :titles="{
  71 + title: '猜你喜欢'
  72 + }">
  73 + </text-title-box>
  74 + </horiz-list>
  75 + </div>
  76 + </div>
  77 +</template>
  78 +
  79 +<script>
  80 +
  81 + // 引入组件
  82 + import { Toast, Indicator } from "mint-ui";
  83 + import horizList from "@/components/horizList/horizList";
  84 + import horizListFlex from "@/components/horizListFlex/horizListFlex";
  85 + import textTitleBox from "@/components/textTitleBox/textTitleBox";
  86 +
  87 + export default {
  88 + data () {
  89 + return {
  90 + title: "",
  91 + hotGoods: null, // 热销商品
  92 + hotGoodsMore: null, // 热销商品更多
  93 + newGoods: null, // 最新上架
  94 + newGoodsMore: null, // 最新上架更多
  95 + newBuyGoods: null, // 最新购买
  96 + recommendGoods: null // 猜你喜欢
  97 + }
  98 + },
  99 + components: {
  100 + horizList,
  101 + horizListFlex,
  102 + textTitleBox,
  103 +
  104 +
  105 + },
  106 + created() {
  107 +
  108 + // 设置标题
  109 + this.$set(this, "title", "优选");
  110 +
  111 + // 优选页面接口
  112 + this.fansShopMessageList();
  113 + },
  114 + methods: {
  115 +
  116 + /**
  117 + * 优选页面接口
  118 + */
  119 + fansShopMessageList() {
  120 +
  121 + // 校验登录
  122 + if (this.$parent.checkLogin()) {
  123 +
  124 + // 加载中提示
  125 + Indicator.open("加载中...");
  126 +
  127 + // 获取证书请求接口
  128 + this.http("/Api/" + this.getApiVersion().dynamic + "/fansShopMessageList", {
  129 + uid: (this.$route.query.uid || this.getStore("uid"))
  130 + }, this.fansShopMessageListCallback, {
  131 + method: "post"
  132 + }
  133 + );
  134 + }
  135 + },
  136 +
  137 + /**
  138 + * 优选页面接口回调
  139 + * @param {object} res [服务器返回数据]
  140 + * @param {object} ext [扩展参数]
  141 + */
  142 + fansShopMessageListCallback(res, ext) {
  143 +
  144 + // 加载完成
  145 + Indicator.close();
  146 +
  147 + // 返回处理
  148 + if (res.code == 200) {
  149 +
  150 + // 解构数据
  151 + let { data: datas } = res;
  152 +
  153 + /* 获取优选库“优选”数据 开始 */
  154 +
  155 + // 获取“热销商品”
  156 + if (datas.hotGoods && datas.hotGoods.length) {
  157 +
  158 + // 设置“热销商品”数据
  159 + this.$set(this, "hotGoods", datas.hotGoods);
  160 +
  161 + // 判断“热销商品”更多
  162 + if (datas.hotGoodsMore) {
  163 +
  164 + // 设置“热销商品”更多
  165 + this.$set(this, "hotGoodsMore", datas.hotGoodsMore);
  166 + }
  167 + }
  168 +
  169 + // 获取“最新上架”
  170 + if (datas.newGoods && datas.newGoods.length) {
  171 +
  172 + // 设置“最新上架”数据
  173 + this.$set(this, "newGoods", datas.newGoods);
  174 +
  175 + // 判断“最新上架”更多
  176 + if (datas.newGoodsMore) {
  177 +
  178 + // 设置“最新上架”更多
  179 + this.$set(this, "newGoodsMore", datas.newGoodsMore);
  180 + }
  181 + }
  182 +
  183 + // 获取“最近购买”
  184 + if (datas.newBuyGoods && datas.newBuyGoods.length) {
  185 +
  186 + // 设置“最近购买”数据
  187 + this.$set(this, "newBuyGoods", datas.newBuyGoods);
  188 + }
  189 +
  190 + // 获取“猜你喜欢”
  191 + if (datas.recommendGoods && datas.recommendGoods.length) {
  192 +
  193 + // 设置“猜你喜欢”数据
  194 + this.$set(this, "recommendGoods", datas.recommendGoods);
  195 + }
  196 +
  197 + /* 获取优选库“优选”数据 结束 */
  198 +
  199 + } else if (res.code == 400) {
  200 +
  201 + // 获取优选失败
  202 + Toast(res.message);
  203 + } else {
  204 +
  205 + // 获取优选失败
  206 + Toast("获取优选失败");
  207 + }
  208 + },
  209 +
  210 + /**
  211 + * 跳转
  212 + * @param {object} item [数据对象]
  213 + */
  214 + jump(item) {
  215 +
  216 + // 判断并调用通用跳转
  217 + if (typeof this.$parent.gotoDetail === "function") {
  218 +
  219 + // 构造跳转详情页参数
  220 + let options = {
  221 + type: "2",
  222 + to: item.id,
  223 + shop_type: item.shop_type
  224 + }
  225 +
  226 + this.$parent.gotoDetail(options);
  227 + }
  228 + },
  229 +
  230 + /**
  231 + * 主按钮点击事件
  232 + * @param {object} item [数据对象]
  233 + */
  234 + primary(item) {
  235 +
  236 + // 调用详情
  237 + this.jump(item);
  238 + },
  239 +
  240 + /**
  241 + * 更多
  242 + * @param {object} item [数据对象]
  243 + */
  244 + more(item) {
  245 +
  246 +
  247 + console.log("more", item);
  248 +
  249 +
  250 +
  251 + // 判断并调用通用跳转
  252 + if (typeof this.$parent.gotoDetail === "function") {
  253 + this.$parent.gotoDetail(item);
  254 + }
  255 + }
  256 + },
  257 + head: {
  258 + title () {
  259 + return {
  260 + inner: this.title
  261 + }
  262 + }
  263 + },
  264 + watch: {
  265 +
  266 + // 设置页面标题
  267 + title(newVal) {
  268 + if (this.$store.state.browser.toLowerCase() == "qq" && this.$store.state.deviceType.toLowerCase() == "iphone") {
  269 + this.$iFrame.insertIFrame(newVal);
  270 + } else {
  271 + this.$emit("updateHead");
  272 + }
  273 + }
  274 + },
  275 + mounted() {
  276 +
  277 + }
  278 + }
  279 +</script>
  280 +
  281 +<!-- Add "scoped" attribute to limit CSS to this component only -->
  282 +<style rel="stylesheet/less" lang='less' scoped>
  283 + @import "optimization";
  284 +</style>
... ...
src/router/index.js
... ... @@ -39,6 +39,17 @@ const router = new Router({
39 39 }
40 40 },
41 41 {
  42 + // 优选库“优选”页面
  43 + path: "/optimization",
  44 + name: "optimization",
  45 + component: resolve => {
  46 + require(["@/pages/optimization/optimization"], resolve);
  47 + },
  48 + meta: {
  49 + requireAuth: false
  50 + }
  51 + },
  52 + {
42 53 // 优选库商城活动页
43 54 path: "/com",
44 55 name: "com",
... ...