Browse Source

起订数量

master
xpz2018 5 years ago
parent
commit
46a2603a37
5 changed files with 20 additions and 11 deletions
  1. 10
      pages/mall/index.wxs
  2. 7
      pages/mall/order-info/index.js
  3. 6
      pages/mall/order-info/index.wxml
  4. 6
      pages/mall/order-info/index.wxss
  5. 2
      utils/request.js

10
pages/mall/index.wxs

@ -53,10 +53,18 @@ function isVideoUrl(url){
return false
}
function minNumber(order, num){
if(order && parseInt(order.minBuyNum) > 0){
return Number(order.minBuyNum)
}
return num
}
module.exports = {
formatePrice: formatePrice,
formateWeight: formateWeight,
formateDate: formateDate,
formateText: formateText,
isVideoUrl: isVideoUrl
isVideoUrl: isVideoUrl,
minNumber: minNumber
}

7
pages/mall/order-info/index.js

@ -14,6 +14,7 @@ Page({
backStr: '返回',
orderInfo: null,
matchTag: null,
imageHeight: 0,
sukList: [],
imgList: [],
form: {
@ -38,7 +39,8 @@ Page({
}
this.setData({
token: app.globalData.token,
isIPhoneX: app.globalData.isIPhoneX
isIPhoneX: app.globalData.isIPhoneX,
imageHeight: float.accDiv(float.accMul(750, 9), 16),
})
event.on('EventMessage', this, this.onEvent)
if (options.id) {
@ -72,6 +74,9 @@ Page({
} else {
imgList = result.data.imgList
}
if(Number(result.data.minBuyNum) > 1){
this.data.form.number = parseInt(result.data.minBuyNum)
}
this.setData({
['form.productId']: options.id,
orderInfo: result.data,

6
pages/mall/order-info/index.wxml

@ -6,11 +6,11 @@
</cu-custom>
<view wx:if="{{orderInfo}}">
<swiper class="screen-swiper square-dot" style="min-height:400rpx" indicator-dots="true" indicator-color="#FFFFFF" indicator-active-color="#008AFF" bindchange="bindchange">
<swiper class="screen-swiper square-dot" style="min-height:{{imageHeight}}rpx" indicator-dots="true" indicator-color="#FFFFFF" indicator-active-color="#008AFF" bindchange="bindchange">
<swiper-item wx:for="{{imgList}}" wx:key="index">
<view wx:if="{{formate.isVideoUrl(item)}}" bindtap="videoTouch">
<view class="video-cnt">
<video id="video" src="{{item}}" style="width:100%;min-height:400rpx" bindplay="bindplay" bindpause="bindpause" bindended="bindended" show-center-play-btn="{{false}}" controls="{{false}}" muted />
<video id="video" src="{{item}}" style="width:100%;min-height:{{imageHeight}}rpx" bindplay="bindplay" bindpause="bindpause" bindended="bindended" show-center-play-btn="{{false}}" controls="{{false}}" muted />
</view>
<view class="play-btn" style="width:80rpx;height:80rpx" catchtap="videoTap" wx:if="{{controls}}">
<image src="{{status == 0 ? '/assets/image/video_play.png' : '/assets/image/video_pause.png'}}"/>
@ -49,7 +49,7 @@
</view>
<view class="bg-white flex flex-justify" style="height:100rpx;;padding: 0rpx 32rpx">
<view class="text-gray" style="font-size:28rpx">购买数量</view>
<wux-input-number value="{{form.number}}" controlled="{{true}}" disabled="{{false}}" color="stable" min="{{1}}" max="{{form.stockNumber||orderInfo.stockNumber}}" bind:change="onNumChange" />
<wux-input-number value="{{form.number}}" controlled="{{true}}" disabled="{{false}}" color="stable" min="{{formate.minNumber(orderInfo, 1)}}" max="{{form.stockNumber||orderInfo.stockNumber}}" bind:change="onNumChange" />
</view>
<view class="bg-white" style="padding:32rpx;margin-top:32rpx">

6
pages/mall/order-info/index.wxss

@ -3,10 +3,6 @@
margin-top: 18rpx;
}
.swiper {
height: 450rpx;
}
.detail-price {
font-size: 32rpx;
font-family: DINAlternate-Bold, DINAlternate;
@ -73,7 +69,7 @@ button::after {
left: 0;
z-index: -1 !important;
width: 100%;
height: 400rpx;
height: 100%;
}
.play-btn {

2
utils/request.js

@ -21,7 +21,7 @@ function fun(url, method, data, header) {
if (typeof result.data === "object") {
if (result.data.code === 0) {
resolve(result.data)
} else if (result.data.code === 666) {
} else if (result.data.code === 401) {
app.globalData.token = null
event.emit('EventMessage', {
what: 666,

Loading…
Cancel
Save