Browse Source

库存修改 推荐商品一部分

master
caichunsheng 4 years ago
parent
commit
129b8b8586
  1. 145
      pages/info/postProductInfo/index.js
  2. 53
      pages/info/postProductInfo/index.wxml
  3. 58
      pages/info/postProductInfo/index.wxss
  4. 2
      pages/info/sceneProductInfo/index.js
  5. 42
      pages/user/order/postOrderInfo/index.js
  6. 17
      pages/user/order/postOrderInfo/index.wxml
  7. 53
      pages/user/order/postOrderInfo/index.wxss

145
pages/info/postProductInfo/index.js

@ -30,7 +30,8 @@ Page({
shareImg: null,
showShareFlag: false,
allowance_data: null,
showAllowance: false
showAllowance: false,
tjList: [], //推荐商品列表
},
/**
@ -108,6 +109,20 @@ Page({
})
})
commonApi._post("product/get_product_by_type", {
offset: 0,
limit: 6,
rand: true,
type: 'post'
}).then(res => {
try {
this.setData({
tjList: res.data.list
})
} catch (error) {
console.log(error);
}
})
},
changeAllowance: function () {
this.setData({
@ -263,64 +278,64 @@ Page({
if (res && res.code != 1) {
return;
} else {
if (this.data.skuFlag == 'order') {
util.pagePoint({
event: 'product_order',
param: {
id: this.data.info.id,
type: this.data.info.type
}
}, 1)
wx.setStorageSync('login_from', 'product_order_login')
wx.setStorageSync('order_from', 'product_order_submit')
app.globalData.couponInfo = null;
// 购买
let product = [{
product: this.data.info,
sku: this.data.info.sku[this.data.skuIndex],
productNum: this.data.producNum
}];
app.globalData.postProduct = product;
app.globalData.retailId = this.data.retailId;
wx.navigateTo({
url: '/pages/order/postOrder/index',
})
} else {
commonApi.user_post("cart/add_sku", {
sku_id: this.data.info.sku[this.data.skuIndex].id,
num: this.data.producNum
}).then(res => {
if (res.code == 1) {
commonApi.user_post('cart/get_list', {}).then(res => {
this.setData({
cartCount: res.data.length
})
if (this.data.skuFlag == 'order') {
util.pagePoint({
event: 'product_order',
param: {
id: this.data.info.id,
type: this.data.info.type
}
}, 1)
wx.setStorageSync('login_from', 'product_order_login')
wx.setStorageSync('order_from', 'product_order_submit')
app.globalData.couponInfo = null;
// 购买
let product = [{
product: this.data.info,
sku: this.data.info.sku[this.data.skuIndex],
productNum: this.data.producNum
}];
app.globalData.postProduct = product;
app.globalData.retailId = this.data.retailId;
wx.navigateTo({
url: '/pages/order/postOrder/index',
})
// 加动效
this.setData({
skuFlag: null,
aniSkuIndex: this.data.skuIndex,
cartImgInfo: null
} else {
commonApi.user_post("cart/add_sku", {
sku_id: this.data.info.sku[this.data.skuIndex].id,
num: this.data.producNum
}).then(res => {
if (res.code == 1) {
commonApi.user_post('cart/get_list', {}).then(res => {
this.setData({
cartCount: res.data.length
})
})
// 加动效
this.setData({
skuFlag: null,
aniSkuIndex: this.data.skuIndex,
cartImgInfo: null
})
setTimeout(() => {
this.setData({
aniSkuIndex: -1
})
wx.showModal({
title: "提示",
content: "去购物车结算?",
success: function (res) {
if (res.confirm) {
wx.navigateTo({
url: '/pages/user/cartlist/list',
})
}
}
})
}, 650)
}
})
setTimeout(() => {
this.setData({
aniSkuIndex: -1
})
wx.showModal({
title: "提示",
content: "去购物车结算?",
success: function (res) {
if (res.confirm) {
wx.navigateTo({
url: '/pages/user/cartlist/list',
})
}
}
})
}, 650)
}
})
}
}
})
@ -592,6 +607,24 @@ Page({
ctx.fillText(row[b], x, y + b * 40 * ratio, canvasWidth);
}
},
gotoDetail: function (e) {
let item = e.currentTarget.dataset.item;
util.pagePoint({
event: 'recommend_click',
param: {
id: item.id,
type: item.type
}
}, 1)
if (item.type == 'travels') {
// 游记做特殊处理 其他都按照原来的来
wx.navigateTo({
url: '/pages/info/strategyInfo/index?id=' + item.s_id,
})
} else {
util.gotoDetail(item);
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

53
pages/info/postProductInfo/index.wxml

@ -2,10 +2,8 @@
<wxs src="../../../utils/filter.wxs" module="tool" />
<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}}">
<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}}">
<block wx:if="{{info.videourl}}" wx:key="*this">
<swiper-item>
<video bindplay="playVideo" src="{{info.videourl}}" controls></video>
@ -54,22 +52,20 @@
</view>
<view class="box">
<view class="box-top">
<text class="iconfont icon-tiwen"></text><text>游客点评</text><text class="score"
wx:if="{{info && info.rate && commentTotal>0}}">{{info.rate}}分</text>
<navigator url="/pages/list/comments/index?productid={{id}}" style="display: inline;"> <text class="all-comment-num">共{{commentTotal}}条 <text style="font-family: fangsong; font-weight: bold;color: #000;">></text></text>
</navigator>
<text class="iconfont icon-tiwen"></text><text>游客点评</text><text class="score" wx:if="{{info && info.rate && commentTotal>0}}">{{info.rate}}分</text>
<navigator url="/pages/list/comments/index?productid={{id}}" style="display: inline;"> <text class="all-comment-num">共{{commentTotal}}条 <text style="font-family: fangsong; font-weight: bold;color: #000;">></text></text>
</navigator>
</view>
<view class="empty-box" wx:if="{{!comment || comment.length==0}}">
<view>这里空空如也,快去点评吧!</view>
<!-- <navigator url="/pages/ask/index?id={{id}}" class="empty-btn">去点评</navigator> -->
</view>
<navigator wx:for="{{comment}}" wx:for-index="index" url="/pages/list/comments/index?productid={{id}}&&index={{index}}" class="product-comment">
<navigator wx:for="{{comment}}" wx:for-index="index" url="/pages/list/comments/index?productid={{id}}&&index={{index}}" class="product-comment">
<view class="product-comment-top">
<image src="{{item.user.avatar}}" mode="aspectFill"></image>
<view class="comment-info">
<view class="nickname">{{item.nickname}}</view>
<view class="iconfont"><text wx:for="{{item.rate}}" class="icon-xingxing"></text><text
wx:for="{{5 - item.rate}}" style="color:#999" class="icon-xingxing"></text></view>
<view class="iconfont"><text wx:for="{{item.rate}}" class="icon-xingxing"></text><text wx:for="{{5 - item.rate}}" style="color:#999" class="icon-xingxing"></text></view>
</view>
<!-- <view class="comment-date">{{item.create_time}}</view> -->
</view>
@ -78,9 +74,9 @@
<view class="img-box" wx:for="{{item.img_list}}" wx:for-index="index" wx:for-item="img" mode="scaleToFill" data-img="{{img}}" data-list="{{item.img_list}}">
<image wx:if="{{index<6}}" class="imgs" src="{{img}}" bindtap="imgsc">
</image>
<view class="all" wx:if="{{index==5}}" >
<view>共{{item.img_list.length}}张</view>
<view>查看全部</view>
<view class="all" wx:if="{{index==5}}">
<view>共{{item.img_list.length}}张</view>
<view>查看全部</view>
</view>
</view>
</view>
@ -88,6 +84,26 @@
</navigator>
<navigator url="/pages/list/comments/index?productid={{id}}" wx:if="{{comment.length>0}}" class="more-comment-btn">
查看全部点评<text class="iconfont icon-you"></text></navigator>
</view>
<view class="proad">
<view class="proad-title">
<image mode="aspectFill" src="https://static.ticket.sz-trip.com/uploads/20221027/93dd0ad8fade0ad845e6b67512b4e61b.png"></image>
</view>
<view class="pro-list">
<view class="proitem" wx:for="{{tjList}}" bindtap="gotoDetail" data-item="{{item}}">
<view class="item-hd">
<image src="{{item.headimg}}"></image>
</view>
<view class="item-bm">
<view class="protitle textOver">{{item.title}}</view>
<view class="pro-price">
{{item.price/100}}
</view>
</view>
</view>
</view>
</view>
<view style="height:140rpx"></view>
<view class="fixed-bottom">
@ -107,8 +123,7 @@
</view>
</view>
<!-- 购物车悬浮框 -->
<navigator url="/pages/user/cartlist/list" catchtap="pagePoint" data-event='product_cart_click' class="cart-box"
id="cart">
<navigator url="/pages/user/cartlist/list" catchtap="pagePoint" data-event='product_cart_click' class="cart-box" id="cart">
<image src="https://sz-qd.oss-cn-hangzhou.aliyuncs.com/xcxImages/info/cart.png" mode="widthFix"></image>
<view class="cart-num">{{cartCount}}</view>
</navigator>
@ -127,8 +142,7 @@
</view>
</view>
<view class="sku-names">
<view bindtap="selectSku" data-index="{{index}}" class="sku-name-item textOver{{index==skuIndex?' active':''}}"
wx:for="{{info.sku}}">{{item.sku_name}}</view>
<view bindtap="selectSku" data-index="{{index}}" class="sku-name-item textOver{{index==skuIndex?' active':''}}" wx:for="{{info.sku}}">{{item.sku_name}}</view>
</view>
<view class="number-box">
<text>数量</text>
@ -162,8 +176,7 @@
<image src="https://sz-qd.oss-cn-hangzhou.aliyuncs.com/xcxImages/info/ok.png" mode="widthFix"></image>
</view>
</view>
<image style="width:36rpx" src="https://sz-qd.oss-cn-hangzhou.aliyuncs.com/xcxImages/info/arrow2.png"
mode="widthFix"></image>
<image style="width:36rpx" src="https://sz-qd.oss-cn-hangzhou.aliyuncs.com/xcxImages/info/arrow2.png" mode="widthFix"></image>
<view style="position:relative">
<image class="img" src="https://sz-qd.oss-cn-hangzhou.aliyuncs.com/xcxImages/info/code.png" mode="widthFix">
</image>

58
pages/info/postProductInfo/index.wxss

@ -842,4 +842,62 @@ page {
color: #666;
font-size: 24rpx;
margin-top: 8rpx;
}
.proad{
margin: 20rpx;
}
.proad-title{
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 16rpx;
}
.proad-title image{
width: 292rpx;
height: 34rpx;
}
.pro-list{
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
}
.proitem{
width: 226rpx;
height: 234rpx;
background: #FFFFFF;
border-radius: 10rpx;
margin-top: 20rpx;
}
.item-hd image{
width: 226rpx;
height: 130rpx;
border-radius: 10rpx 10rpx 0px 0px;
}
.item-bm{
padding: 8rpx 12rpx;
}
.protitle{
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
color: #000000;
}
.pro-price{
color: #D62828;
font-weight: 500;
font-size: 30rpx;
}
.pro-price:before {
display: inline-block;
content:"¥";
color: #D62828;
font-size: 20rpx;
}
.pro-price:after {
display: inline-block;
content:'起';
color: #999999;
font-size: 10px;
}

2
pages/info/sceneProductInfo/index.js

@ -250,7 +250,7 @@ Page({
// },
selectSku: function (e) {
console.log(e.currentTarget.dataset.item);
if (e.currentTarget.dataset.item.stock == 0) {
if (e.currentTarget.dataset.item.stock == 0 && e.currentTarget.dataset.item.is_third_stock!=1) {
wx.showToast({
title: "该商品暂无库存",
icon: 'none'

42
pages/user/order/postOrderInfo/index.js

@ -20,7 +20,9 @@ Page({
minute:"",
second:"",
id:null,
pay_methods:app.globalData.pay_methods
pay_methods:app.globalData.pay_methods,
tjList:[],
showLoading:true
},
/**
@ -30,7 +32,23 @@ Page({
this.setData({
id:options.id
})
commonApi._post("product/get_product_by_type", {
offset: 0,
limit: 6,
rand: true,
type:"venue,post,line,ticket"
}).then(res => {
this.setData({
showLoading:false
})
try {
this.setData({
tjList: res.data.list
})
} catch (error) {
console.log(error);
}
})
},
close:function(){
let _this = this,info = _this.data.info;
@ -189,6 +207,25 @@ Page({
this.daojishi(time);
},1000)
},
gotoDetail: function (e) {
let item = e.currentTarget.dataset.item;
util.pagePoint({
event: 'recommend_click',
param: {
id: item.id,
type: item.type
}
}, 1)
if (item.type == 'travels') {
// 游记做特殊处理 其他都按照原来的来
wx.navigateTo({
url: '/pages/info/strategyInfo/index?id=' + item.s_id,
})
} else {
util.gotoDetail(item);
}
},
/**
* 生命周期函数--监听页面显示
*/
@ -234,7 +271,6 @@ Page({
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**

17
pages/user/order/postOrderInfo/index.wxml

@ -12,6 +12,23 @@
<view class="box-title" style="margin-top:15rpx"><text style="margin-right:20rpx">{{info.order_product_list[0].consignee_info.name}}</text><text>{{info.order_product_list[0].consignee_info.tel}}</text></view>
<view style="font-size:26rpx;color:#333;line-height:50rpx"><text style="color:#0B898E;margin-right:10rpx" class="iconfont icon-location"></text>{{info.order_product_list[0].consignee_info.address}}</view>
</view>
<view class="box">
<view class="tj-title">商品推荐</view>
<view wx:if="{{showLoading}}">加载中...</view>
<view class="tj-list" wx:else>
<view class="proitem" wx:for="{{tjList}}" bindtap="gotoDetail" data-item="{{item}}">
<view class="item-hd">
<image src="{{item.headimg}}"></image>
</view>
<view class="item-bm">
<view class="protitle textOver">{{item.title}}</view>
<view class="pro-price">
{{item.price/100}}
</view>
</view>
</view>
</view>
</view>
<view class="box" wx:if="{{info}}" style="padding-bottom:0">
<view wx:if="{{info.order_product_list && info.order_product_list.length>0}}" class="product-info" wx:for="{{info.order_product_list}}">
<view class="product-info-top">

53
pages/user/order/postOrderInfo/index.wxss

@ -291,4 +291,57 @@ page {
font-size: 24rpx;
color: #999;
margin-top: 30rpx;
}
.tj-title{
font-size: 30rpx;
font-family: PingFang SC;
font-weight: 500;
color: #333333;
}
.tj-list{
display: flex;
align-items: center;
overflow-x: scroll;
overflow-y: hidden;
}
.proitem{
width: 226rpx;
height: 234rpx;
background: #F5F5F5;
border-radius: 10rpx;
margin-top: 20rpx;
margin-right: 20rpx;
}
.item-hd image{
width: 226rpx;
height: 130rpx;
border-radius: 10rpx 10rpx 0px 0px;
}
.item-bm{
padding: 8rpx 12rpx;
}
.protitle{
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
color: #000000;
}
.pro-price{
color: #D62828;
font-weight: 500;
font-size: 30rpx;
}
.pro-price:before {
display: inline-block;
content:"¥";
color: #D62828;
font-size: 20rpx;
}
.pro-price:after {
display: inline-block;
content:'起';
color: #999999;
font-size: 10px;
}
Loading…
Cancel
Save