Browse Source

特产详情

master
jiazhipeng 8 months ago
parent
commit
8b025eb6d5
  1. 2
      pages/info/postProductInfo/index.js
  2. 5
      pages/info/postProductInfo/index.wxml
  3. 5
      pages/info/postProductInfo/index.wxss
  4. 17
      pages/info/sceneProductInfo/index.js
  5. 7
      project.private.config.json
  6. 74
      utils/util.js

2
pages/info/postProductInfo/index.js

@ -11,7 +11,7 @@ Page({
* 页面的初始数据
*/
data: {
autoPlay: true,
autoPlay: false,
fixed: false,
type: 1,
top: 0,

5
pages/info/postProductInfo/index.wxml

@ -3,10 +3,11 @@
<title title="产品详情"></title>
<view class="iconfont icon-fenxiang" bindtap="share"></view>
<image wx:for="{{info.sku}}" style="{{aniSkuIndex==index?('top:'+cartTop+'px;'):('top:'+top+'px;'+cartImgInfo)}}" class="headimg{{aniSkuIndex==index?' active':''}}" src="{{info.headimg}}" mode="aspectFill"></image>
<swiper class="swiper" indicator-dots="{{true}}" wx:if="{{info}}" autoplay="{{autoPlay}}" interval="{{2000}}" duration="{{300}}">
<swiper class="swiper" wx:if="{{info}}" autoplay="{{autoPlay}}" interval="{{2000}}" duration="{{300}}">
<block wx:if="{{info.videourl}}" wx:key="*this">
<swiper-item>
<video bindplay="playVideo" src="{{info.videourl}}" controls></video>
<video bindplay="playVideo" src="{{info.videourl}}" autoplay="{{true}}" muted="{{true}}"
play-btn-position="center" enable-play-gesture="{{true}}"></video>
<!-- <image src="{{info.headimg}}" mode="aspectFill"></image> -->
</swiper-item>
</block>

5
pages/info/postProductInfo/index.wxss

@ -5,12 +5,12 @@ page {
.swiper {
width: 100%;
height: 420rpx;
height: 750rpx;
}
.swiper image,
.swiper video {
height: 420rpx;
height: 750rpx;
display: block;
width: 100%;
}
@ -20,7 +20,6 @@ page {
background: white;
position: relative;
z-index: 1;
margin-top: -20rpx;
padding: 20rpx 40rpx;
}

17
pages/info/sceneProductInfo/index.js

@ -826,6 +826,12 @@ Page({
}
console.log(app.globalData.product);
console.log(ticket_type);
// todo 判断是否组合产品
// this.getComposeSku()
// return
if (ticket_type != 2) {
let today = util.formatDate(new Date()),
end_date = util.formatDate(new Date(new Date().getTime() + 30 * 24 * 60 * 60 * 1000));
@ -1029,6 +1035,17 @@ Page({
})
},
// 组合产品获取购买的sku
getComposeSku () {
commonApi.user_post("product/get_sku_compose_list", {
sku_id: "190720"
}).then(res => {
if (res&&Array.isArray(res.data)&&res.data.length>0) {
util.orderByShoppingCart(res.data,app)
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

7
project.private.config.json

@ -6,6 +6,13 @@
"condition": {
"miniprogram": {
"list": [
{
"name": "pages/info/postProductInfo/index",
"pathName": "pages/info/postProductInfo/index",
"query": "id=108419",
"launchMode": "default",
"scene": null
},
{
"name": "pages/pbService/web/index",
"pathName": "pages/pbService/web/index",

74
utils/util.js

@ -561,6 +561,79 @@ const detailPagePoint = function (url, res) {
}
// app 要传进来 util 获取不到
const orderByShoppingCart = function (listData, app) {
let productType,flag,isCar;
commonApi.user_post('wx/get_user_keep', {
jumpurl: '/pages/user/cartlist/list',
title: '购物车',
type: 'mini'
}).then(res => {
if (res.data.subscribe == 0) {
this.setData({
wxqrcode: res.data.qrcode,
showQrCode: true
})
} else {
app.globalData.couponInfo = null;
let list = listData, product = [], product1 = []
list.map(item => {
// item.product.type="post";
if (item.product.type == 'post') {
product.push({
product: item.product,
sku: item.sku,
productNum: item.num
})
} else {
product1.push(item)
app.globalData.list = product1
}
if (item.product.type.includes('post')) {
productType = 'post'
}
})
if (product.length == 0 && product1.length == 0) {
wx.showToast({
title: '请先选择产品',
icon: 'none'
})
return;
}
if (product.length > 0 && product1.length > 0) {
flag = "mix";
isCar = "multiple"
}
if (product1.length > 1) {
isCar = "multiple"
} else {
isCar = "single"
}
console.log(product1,'product1');
app.globalData.listName = null
if (product1.length>0) {
app.globalData.listName = 'car'
}
app.globalData.postProduct = product;
if (app.globalData.list) {
app.globalData.index = 0
app.globalData.product = app.globalData.list[app.globalData.index]
}
if (productType == 'post') {
wx.navigateTo({
url: '/pages/order/postOrder/index?from=cart&flag=' + flag,
})
} else {
wx.navigateTo({
url: '/subPackages/gwcOrder/index?isCar=' + isCar,
})
}
}
})
}
module.exports = {
formatTime: formatTime,
@ -586,4 +659,5 @@ module.exports = {
getGlobalPagePoint: getGlobalPagePoint,
clearGlobalPagePoint: clearGlobalPagePoint,
detailPagePoint: detailPagePoint,
orderByShoppingCart: orderByShoppingCart,
}

Loading…
Cancel
Save