| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- <template>
- <view>
- <!--components/recommend/recommend.wxml-->
- <template name="single_product">
- <view :class="singleTemplate.theme==2?'pdlr20':''" v-if="singleTemplate&&singleTemplate.state==0&&pageList.products.length>0">
- <view class="jishida head">
- <block v-if="singleTemplate.titleType==1&&singleTemplate.titleCon">
- <view class="titleNav pdlr20">{{singleTemplate.titleCon}}</view>
- </block>
- <block v-if="singleTemplate.titleType==2&&singleTemplate.titleCon">
- <navigator :url="'/product/list/list?title=' + singleTemplate.titleSubtitle + web"
- hover-class="none">
- <image lazy-load="true" :src="singleTemplate.titleCon + '?x-oss-process=style/w750-auto'" mode="widthFix"
- class="imgtit"></image>
- </navigator>
- </block>
- <view class="single">
- <view class="li" v-for="(item,index) in pageList.products" :key="index" @tap="goUrl" :data-id="item.id" :data-type="type" :data-index="index">
- <image :src="item.pic+ '?x-oss-process=style/w750-auto'" mode="aspectFill" class="single-img"></image>
- <view class="single-info dflex">
- <view class="single-tit flex">{{item.title}}</view>
- <!-- <button open-type="share" hover-class="none" class="s-share"><image src="../../static/pages/images/share.png"></image>分享</button> -->
- </view>
- <view class="pmoney dflex">
- <view class="price proprice dflex flex">
- <view class="money">¥<text>{{item.salePrice}}</text></view>
- <view class="zhuan dflex" v-if="about.show_membership_price==1&&item.actualPrice < item.salePrice">
- <text>VIP价</text><view class="members">¥{{item.actualPrice}}</view>
- </view>
- <view class="zhuan dflex" v-if="about.show_membership_price==1&&item.membersPrice<item.salePrice">
- <text>VIP价</text>
- <view>¥{{item.membersPrice}}</view>
- </view>
- <text class="del" v-if="about.show_membership_price!=1">
- <block v-if="item.marketPrice!=0&&item.marketPrice>item.salePrice">
- ¥{{item.marketPrice}}
- </block>
- </text>
- </view>
- <view class="yishou">已售{{item.sellStock}}</view>
- </view>
- <view class="s-btn dflex">
- <view class="s-add dflex">加入购物车</view>
- <view class="s-buy mbglinear dflex">立即购买</view>
- </view>
- </view>
- </view>
- <!-- <view class="nomore dflex" wx:if="{{hasmore}}">亲,没有更多了</view> -->
- </view>
- </view>
- </template>
- </view>
- </template>
- <script>
- const route = require("../../utils/route");
- const app = getApp();
- const req = require("../../utils/request.js"); // components/recommend/recommend.js
- export default {
- data() {
- return {
- };
- },
- components: {
- },
- props: {
- pageList: Object, //{backgroundColor:背景颜色,displayStyle: 样式模板,lineNumber:每行几个,products:产品列表}
- web: String,//地址跳转
- url: String,//地址跳转
- singleTemplate: Object, //推荐后台配置
- about: Object, //参数配置
- categoryList:Array, //分类列表
- merchant: Object
- },
- mounted(){
- // console.log(this.categoryList)
- },
- watch: {},
- methods: {
- goUrl(event) {
- console.log("qwewqe")
- let id = event.currentTarget.dataset.id
- let type = event.currentTarget.dataset.type
- let index = event.currentTarget.dataset.index
- const activity = this.pageList.products[index];
- // console.log(type, !type)
- if (!type) {
- // console.log("123", id)
- app.globalData.openPage('product/detail/detail?id=' + id + '&merchantId=' + this.merchant.id)
- } else if (type == 1) {
- app.globalData.openPage('product/groupDetail/groupDetail?acid=' + activity.id + "&id=" + activity
- .productId +
- '&merchantId=' + this.merchant.id)
- } else if (type == 4) {
- app.globalData.openPage('activity/newbornDetails/newbornDetails?acid=' + activity.id + '&id=' +
- activity.productId +
- '&merchantId=' + this.merchant.id)
- } else if (type == 5) {
- app.globalData.openPage('activity/bargain/detail/detail?acid=' + activity.id + '&id=' + activity
- .productId +
- '&merchantId=' + this.merchant.id)
- } else if (type == 3) {
- app.globalData.openPage('activity/group/detail/detail?acid=' + activity.id + '&id=' + activity
- .productId +
- '&merchantId=' + this.merchant.id)
- } else if (type == 2) {
- app.globalData.openPage('activity/seckillDetails/seckillDetails?acid=' + activity.id + '&id=' +
- activity.productId +
- '&merchantId=' + this.merchant.id)
- }
- },
- toDetail(e) {
- // let id = e.currentTarget.dataset.id;
- // app.openPage("product/detail/detail?id=" + id + '&&hideShop=' + false)
- let id = e.currentTarget.dataset.id;
- let merchantId = e.currentTarget.dataset.merchant;
- let shopId = e.currentTarget.dataset.shopid;
- if (!shopId) {
- app.globalData.openPage("product/detail/detail?id=" + id + "&merchantId=" + merchantId);
- } else {
- app.globalData.openPage("product/detail/detail?id=" + id + "&merchantId=" + merchantId + "&shopId=" + shopId);
- }
- },
- addShopCart(item) {
- let skuId = item.skuId;
- let id = item.id;
- let _ts = this;
- let params = {
- skuId: skuId,
- quantity: 1,
- merchantId: this.merchant.id,
- productId: id
- };
- route.addShopCart(params, res => {
- _ts.setData({
- isUpdate: !_ts.isUpdate
- });
- req.msg('加入购物车成功');
- });
- }
- }
- };
- </script>
- <style>
- @import "./single.css";
- </style>
|