Commit 12c9a7d7f0bad14bdce011ded548889cb9222257

Authored by zhiyangdu
1 parent 079efa5d

新增商品详情页更多页面

src/pages/morePoints/morePoints.less 0 → 100644
  1 +@charset "UTF-8";
  2 +
  3 +.gift_zone_detail{
  4 + width: 100%;
  5 + min-height: 100vh;
  6 + // background: #B62128 url("https://wjj.ys1.cnliveimg.com/769/h5/H5activity/kapai/detail-top.png") no-repeat center top;
  7 + background-size: 100%;
  8 + overflow: hidden;
  9 + .column-list-box{
  10 + margin-top:40px;
  11 + }
  12 + .no_more{
  13 + width:100%;
  14 + height: 37px;
  15 + font-size: 26px;
  16 + font-weight: 400;
  17 + color: #333;
  18 + line-height: 37px;
  19 + letter-spacing: 1px;
  20 + text-align: center;
  21 + margin-top:10px;
  22 + // margin-bottom: 60px;
  23 + }
  24 +}
0 25 \ No newline at end of file
... ...
src/pages/morePoints/morePoints.vue 0 → 100644
  1 +<template>
  2 +<div class="gift_zone_detail">
  3 + <!-- <call-app-box
  4 + class="call-app-box"
  5 + :style="'padding-top: ' + $parent.top.value + 'px'"
  6 + ref="callApp"
  7 + v-if="!isCNLive.value"
  8 + :callApps="$parent.callApps"
  9 + >
  10 + </call-app-box> -->
  11 + <back-box
  12 + v-if="isCNLive.value"
  13 + :class="{'hide': $route.query.hideBack == true}"
  14 + class="back-box"
  15 + :style="'padding-top: ' + $parent.top.value + 'px'"
  16 + @back="back"
  17 + :backs="backs"
  18 + >
  19 + </back-box>
  20 + <!-- pl -->
  21 + <div class="pl" :style="'padding-top: ' + $parent.top.value + 'px'" :class="{'is-cnlive': isCNLive.value, 'is-open-app': $parent.isOpenApp.value, 'hide': $route.query.hideBack == true}"></div>
  22 + <!-- 商品样式 7 列表 -->
  23 + <div class="gift_main_box" v-if="phyicalGoods && phyicalGoods.list && phyicalGoods.list.length" infinite-scroll-immediate-check="true" v-infinite-scroll="loadMore" infinite-scroll-disabled="loading" :infinite-scroll-distance="distance">
  24 + <column-list-box class="column-list-box" v-if="phyicalGoods && phyicalGoods.list && phyicalGoods.list.length" @jump="toDetail"
  25 + :lists="phyicalGoods.list"
  26 + :goodType="$route.query.type"
  27 + com="7">
  28 + </column-list-box>
  29 + </div>
  30 + <!-- 没有更多了 -->
  31 + <div v-if="isNoMore" class="no_more">
  32 + — 没有更多了 —
  33 + </div>
  34 +</div>
  35 +</template>
  36 +
  37 +<script>
  38 +// import callAppBox from "@/components/callAppBox/callAppBox";
  39 +import backBox from "@/components/backBox/backBox";
  40 +import { Toast, Indicator } from "mint-ui";
  41 +import columnListBox from "@/components/columnListBox/columnListBox";
  42 +export default {
  43 + name: 'morePoints',
  44 + data () {
  45 + return {
  46 + backs: null, // 后退按钮组
  47 + loading: true,
  48 + distance: 50,
  49 + phyicalGoods: { list: [] }, // 实物商品
  50 + page: 1,
  51 + isNoMore: false
  52 + }
  53 + },
  54 + //部件
  55 + components: {
  56 + backBox,
  57 + columnListBox,
  58 + // callAppBox
  59 + },
  60 + //静态
  61 + props: [
  62 + ],
  63 + //对象内部的属性监听,也叫深度监听
  64 + head: {
  65 + title () {
  66 + return {
  67 + inner: this.title
  68 + }
  69 + }
  70 + },
  71 + //属性的结果会被缓存,除非依赖的响应式属性变化才会重新计算。主要当作属性来使用;
  72 + computed: {
  73 + },
  74 + //方法表示一个具体的操作,主要书写业务逻辑;
  75 + methods: {
  76 + /**
  77 + * 上拉加载
  78 + */
  79 + loadMore () {
  80 + this.$set(this, "page", ++this.page);
  81 + this.getIntegralNewGoodsList(this.page);
  82 + },
  83 + /**
  84 + * 加载积分商城商品更多
  85 + * @param {int} page [页码]
  86 + * @param {int}type [类型1为实物 2为虚拟物品 3为红包]
  87 + */
  88 + getIntegralNewGoodsList (page) {
  89 +
  90 + // 判断必须参数
  91 + if (this.$route.query.type) {
  92 +
  93 + // 加载中
  94 + this.$set(this, "loading", true);
  95 +
  96 + // 加载中提示
  97 + Indicator.open("加载中...");
  98 +
  99 + // 请求接口
  100 + this.http("/Api/" + (this.getApiVersion().LuckDraw) + "/integralNewGoodsList", {
  101 + type: this.$route.query.type,
  102 + // uid: this.getStore("uid"),
  103 + page: page || 1
  104 + }, this.getIntegralNewGoodsListCallback, {
  105 + method: "POST"
  106 + });
  107 + }
  108 + },
  109 +
  110 + /**
  111 + * 礼品专区详情页回调
  112 + * @param {object} res [服务器返回数据]
  113 + * @param {object} ext [扩展参数]
  114 + */
  115 + getIntegralNewGoodsListCallback (res, ext) {
  116 +
  117 + // 加载完成
  118 + Indicator.close();
  119 +
  120 + // 返回处理
  121 + if (res.code == 200) {
  122 + // 解构数据
  123 + let { data: datas } = res;
  124 + /*设置标题 */
  125 + // this.$set(this, "title", datas.title);
  126 + this.$set(this.backs, 'title', datas.title);
  127 + /* 获取商品数据 开始 */
  128 + if (datas.goods && datas.goods.length) {
  129 + // 设置列表
  130 + this.$set(this.phyicalGoods, "list", [...this.phyicalGoods.list, ...datas.goods]);
  131 + // 设置还有需要加载的内容
  132 + this.$set(this, "loading", false);
  133 + } else {
  134 + this.isNoMore = true; // 没有更多了
  135 + // 没有需要加载的内容,停止上拉加载
  136 + this.$set(this, "loading", true);
  137 + }
  138 + /* 获取抽奖记录数据 结束 */
  139 +
  140 + } else if (res.code == 400) {
  141 +
  142 + // 获取抽奖记录失败
  143 + Toast(res.message);
  144 + } else {
  145 +
  146 + // 获取抽奖记录失败
  147 + Toast("获取专区礼包失败");
  148 + }
  149 + },
  150 +
  151 + /**
  152 + * 跳转商品详情
  153 + * @param {Object} item [数据对象]
  154 + */
  155 + toDetail (item) {
  156 + if (this.isCNLive.value) {
  157 + // this.$router.push({
  158 + // path: "/goodDetails",
  159 + // query: {
  160 + // goodsId: item.id,
  161 + // uid: this.getStore("uid")
  162 + // }
  163 + // })
  164 + // 通用跳转跳转到商品详情页新打开webview
  165 + if (typeof this.$parent.gotoDetail === 'function') {
  166 +
  167 + // 设置跳转参数
  168 + let params = {
  169 + type: '5',
  170 + to: window.location.origin + '/html/select_good/1/#/goodDetails?goodsId=' + item.id,
  171 + shop_type: ''
  172 + };
  173 +
  174 + // 页面跳转
  175 + this.$parent.gotoDetail(params);
  176 + }
  177 + } else {
  178 + this.$parent.callApp();
  179 + }
  180 + },
  181 +
  182 + /**
  183 + * 后退
  184 + */
  185 + back () {
  186 + // 返回先隐藏弹框
  187 +
  188 + // 判断是否有处理函数
  189 + if (typeof this.$parent.back === 'function') {
  190 + // 隐藏通用浮层
  191 + this.$parent.$refs.showModal.hideLayer();
  192 + // 后退
  193 + this.$parent.back();
  194 + } else {
  195 +
  196 + // 后退
  197 + window.history.go(-1);
  198 + }
  199 + },
  200 +
  201 + /**
  202 + * 分享
  203 + */
  204 + toShare () {
  205 + // 判断分享
  206 + if (typeof this.$parent.toShare === 'function') {
  207 + this.$parent.toShare(46, this.$route.query.goodsId, "");
  208 + }
  209 + },
  210 +
  211 + },
  212 + //请求数据
  213 + created () {
  214 + // 抽奖记录
  215 + this.getIntegralNewGoodsList(this.page);
  216 +
  217 + // 判断是否在App内
  218 + if (this.isCNLive.value) {
  219 +
  220 + // 添加后退按钮组“后退”和“分享”按钮
  221 + this.$set(this, 'backs', {
  222 + funcs: {
  223 + back: {
  224 + icon: "static/img/icon_back.png"
  225 + },
  226 + funcArray: [
  227 + {
  228 + icon: "static/img/icon_share.png",
  229 + func: this.toShare
  230 + }
  231 + ]
  232 + }
  233 + });
  234 + }
  235 + },
  236 + mounted () {
  237 + }
  238 +}
  239 +</script>
  240 +
  241 +<style rel="stylesheet/less" lang="less" scoped>
  242 +@import 'morePoints';
  243 +</style>
  244 +
... ...
src/router/index.js
... ... @@ -243,9 +243,7 @@ const router = new Router({
243 243 path: "/labourUnion",
244 244 name: "labourUnion",
245 245 component: resolve => {
246   - require([
247   - "@/pages/labourUnion/labourUnion"
248   - ], resolve);
  246 + require(["@/pages/labourUnion/labourUnion"], resolve);
249 247 },
250 248 meta: {
251 249 requireAuth: false
... ... @@ -267,6 +265,17 @@ const router = new Router({
267 265 }
268 266 },
269 267 {
  268 + // 积分商城商品数据更多页
  269 + path: "/morePoints",
  270 + name: "morePoints",
  271 + component: resolve => {
  272 + require(["@/pages/morePoints/morePoints"], resolve);
  273 + },
  274 + meta: {
  275 + requireAuth: false
  276 + }
  277 + },
  278 + {
270 279 // 积分商城兑换记录与其他积分商城共用
271 280 path: "/pointsExchangeRecords",
272 281 name: "pointsExchangeRecords",
... ...