Browse Source

no message

master
xpz2018 6 years ago
parent
commit
1d6e93bc4a
12 changed files with 87 additions and 60 deletions
  1. 2
      app.js
  2. BIN
      assets/image/icon_adv.jpg
  3. 4
      components/button/index.wxss
  4. 1
      components/tab/index.js
  5. 3
      pages/mall/order-info/index.js
  6. 10
      pages/mall/order-info/index.wxml
  7. 53
      pages/mall/order-offer/index.js
  8. 46
      pages/mall/order-offer/index.wxml
  9. 2
      pages/mall/order-offer/index.wxss
  10. 18
      pages/mall/order-result/index.js
  11. 2
      pages/mall/order-result/index.wxml
  12. 6
      pages/mall/shops/index.wxml

2
app.js

@ -1,7 +1,7 @@
//app.js
App({
//----------------------------------------------globalData--------------------------------------
release: 0,
release: 1,
httpUrl: 'https://api-test.qniao.cn',
tmplIds: ['kg0T1ve0FpYrEtZ4ExbypHm8mtS7OJaehvqN_T9ypoI'],
globalData: {

BIN
assets/image/icon_adv.jpg

Before After
Width: 960  |  Height: 360  |  Size: 181 KiB

4
components/button/index.wxss

@ -362,7 +362,7 @@
background-color: #dfdfdf!important;
color: #fff!important
}
/*
.wux-button--tag,
.wux-button--tag--disabled {
border-color: transparent!important;
@ -392,4 +392,4 @@
.wux-button--tag.wux-button--hover {
background-color: #999999!important;
color: #fff!important
}
} */

1
components/tab/index.js

@ -70,7 +70,6 @@ Component({
if (this.data.scroll) { // 超出滚动的情况
// 保持滚动后当前 item '尽可能' 在屏幕中间
let scrollLeft = itemLeft - (this.data.windowWidth - itemWidth) / 2;
console.log('scrollLeft>>>' + scrollLeft)
this.setData({
tabCur: tabCur,
scrollLeft: scrollLeft,

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

@ -60,7 +60,7 @@ Page({
console.log('mall>>order>>onEvent', message)
if(message.what == 1 && util.isEmpty(this.data.token)){
this.setData({ token: app.globalData.token })
} else if(message.what == 10 && message.arg == 1){
} else if(message.what == 10){
wx.navigateBack()
}
},
@ -180,6 +180,7 @@ Page({
const element = this.data.orderInfo.skuList[index];
if(this.checkSkuPrice(this.data.matchTag, element)){
this.data.form.unitPrice = Number(element.price)
this.data.form.monthPrice = Number(element.groupMonthPrice)
this.data.form.stockNumber = Number(element.stockNumber)
// 如果当前的数量大于所选规格的库存数量,那么就设置成库存数量;
if(this.data.form.number > this.data.form.stockNumber){

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

@ -5,7 +5,7 @@
</cu-custom>
<view wx:if="{{orderInfo}}">
<swiper class="screen-swiper round-dot" style="min-height:400rpx" indicator-dots="true" circular="true" autoplay="true" interval="5000" duration="500">
<swiper class="screen-swiper square-dot" style="min-height:400rpx" indicator-dots="true" circular="true" autoplay="true" interval="5000" duration="500">
<swiper-item wx:for="{{orderInfo.imgList}}" wx:key="index" bindtap="viewImage" data-url="{{orderInfo.imgList[index]}}">
<image src="{{item}}" mode='aspectFill'></image>
</swiper-item>
@ -24,9 +24,9 @@
<view class="bg-white" style="padding:0rpx 32rpx 32rpx 32rpx">
<view wx:for-item="sukItem" wx:for="{{orderInfo.attributeList}}" wx:key="sukIndex" style="padding-top:12rpx">
<view class="text-gray" style="font-size:28rpx">选择{{sukItem.name}}</view>
<view class="flex flex-wrap" style="margin-top:16rpx">
<view wx:for-item="item" wx:for="{{sukItem.values}}" wx:key="index" style="margin-right:24rpx">
<wux-button size="tag" disabled="{{item.disabled}}" outline="{{!item.select}}" type="tag" data-suk="{{sukItem.id}}" data-index="{{item.id}}" bind:click="tagClick">{{item.val}}</wux-button>
<view class="flex flex-wrap">
<view wx:for-item="item" wx:for="{{sukItem.values}}" wx:key="index" style="margin-right:24rpx;margin-top:16rpx">
<wux-button size="tag" disabled="{{item.disabled}}" outline="{{item.select}}" type="{{item.select?'positive':'stable'}}" data-suk="{{sukItem.id}}" data-index="{{item.id}}" bind:click="tagClick">{{item.val}}</wux-button>
</view>
</view>
</view>
@ -47,7 +47,7 @@
<view class="bg-white">
<view style="height:1px;width:100%;background-color:#F3F3F3;margin-left:32rpx"></view>
</view>
<view class="bg-white" style="padding:32rpx;margin-top:32rpx" wx:if="{{orderInfo.groupSummary}}">
<view class="bg-white" style="padding:32rpx;" wx:if="{{orderInfo.groupSummary}}">
<view class="text-black" style="font-size:32rpx">拼团说明</view>
<view class="text-gray" style="font-size:28rpx;margin-top:32rpx">{{orderInfo.groupSummary}}</view>
</view>

53
pages/mall/order-offer/index.js

@ -19,10 +19,11 @@ Page({
onLoad: function (options) {
if (options.json) {
var form = JSON.parse(options.json)
form.payType = 1
form.payType = form.sellMode == 1 ? 1 : 3
// form.totalPrice = float.accAdd(float.accMul(form.unitPrice, form.number), form.dividePrice)
form.totalPrice = float.accMul(form.unitPrice, form.number).toFixed(2)
form.preAmount = float.accMul(float.accMul(form.unitPrice, form.number), 0.1).toFixed(2)
form.monthAmount = float.accMul(form.monthPrice, form.number).toFixed(2)
this.setData({
form: form,
isIPhoneX: app.globalData.isIPhoneX
@ -41,15 +42,8 @@ Page({
},
checkMode: function (e) {
var preAmount = 0
if (e.currentTarget.dataset.index == 1) {
preAmount = float.accMul(float.accMul(this.data.form.unitPrice, this.data.form.number), 0.1).toFixed(2)
} else if (e.currentTarget.dataset.index == 2) {
preAmount = float.accMul(this.data.form.unitPrice, this.data.form.number).toFixed(2)
}
this.setData({
['form.payType']: Number(e.currentTarget.dataset.index),
['form.preAmount']: preAmount
['form.payType']: Number(e.currentTarget.dataset.index)
})
},
@ -84,9 +78,19 @@ Page({
data.number = this.data.form.number
data.sellMode = Number(this.data.form.sellMode)
data.payType = Number(this.data.form.payType)
data.realPrice = data.payType == 1 ? this.data.form.preAmount : 0
data.unitPrice = this.data.form.unitPrice
data.totalPrice = this.data.form.totalPrice
if (data.payType == 1) {
data.realPrice = this.data.form.preAmount
data.unitPrice = this.data.form.unitPrice
data.totalPrice = this.data.form.totalPrice
} else if (data.payType == 2 || data.payType == 4) {
data.realPrice = this.data.form.totalPrice
data.totalPrice = this.data.form.totalPrice
data.unitPrice = this.data.form.unitPrice
} else if (data.payType == 3) {
data.realPrice = 0
data.unitPrice = this.data.form.monthPrice
data.totalPrice = this.data.form.monthAmount
}
data.mobile = this.data.addressInfo.telNumber
data.realName = this.data.addressInfo.userName
data.address = this.data.addressInfo.provinceName + this.data.addressInfo.cityName + this.data.addressInfo.countyName + this.data.addressInfo.detailInfo
@ -98,9 +102,7 @@ Page({
request.post('/bxe-mall/order', data).then(result => {
//成功回调
wx.hideLoading()
if (data.payType == 1) {
this.requestPayment(result.data.wxpay)
} else {
if (data.payType == 3) {
wx.requestSubscribeMessage({
tmplIds: app.tmplIds,
complete(res) {
@ -109,26 +111,29 @@ Page({
})
}
})
} else {
this.requestPayment(result.data.wxpay)
}
}).catch(err => {
//异常回调
wx.hideLoading()
if (data.payType == 2) {
wx.redirectTo({
url: '/pages/mall/order-result/index?type=0&message=' + err
})
}
util.showToast(err)
})
},
// 微信支付流程
requestPayment: function (data) {
data.success = function(res){
data.success = function (res) {
util.showToast('订单支付成功')
wx.redirectTo({
url: '/pages/mall/order-result/index?type=2'
wx.requestSubscribeMessage({
tmplIds: app.tmplIds,
complete(res) {
wx.redirectTo({
url: '/pages/mall/order-result/index?type=2'
})
}
})
}
data.fail = function(res){
data.fail = function (res) {
util.showToast('订单支付失败')
}
wx.requestPayment(data)

46
pages/mall/order-offer/index.wxml

@ -33,10 +33,8 @@
</wux-image>
<view style="flex:1;margin-left:24rpx">
<view class="page-name">{{form.name}}</view>
<view style="height:60rpx">
<view class="page-outline">{{form.outline}}</view>
<view class="page-outline" style="margin-top: 8rpx">{{form.summary}}</view>
</view>
<view class="page-outline">{{form.outline}}</view>
<view class="page-outline" style="margin-top: 4rpx">{{form.summary}}</view>
</view>
</view>
<view class="flex flex-justify" style="height:60rpx;margin-top:12rpx">
@ -51,14 +49,26 @@
<view class="offer-label">购买数量</view>
<view class="offer-val">{{form.number}}</view>
</view>
<view class="flex flex-justify" style="height:60rpx">
<!-- <view class="flex flex-justify" style="height:60rpx">
<view class="offer-label">运费</view>
<view class="offer-val">¥{{form.dividePrice}}</view>
</view>
<view class="flex flex-justify" style="height:60rpx">
<view class="offer-label" style="color:#333333;font-size:28rpx">{{form.payType == 1 ? '预付金额' : '应付金额'}}</view>
</view> -->
<view class="flex flex-justify" style="height:60rpx" wx:if="{{form.payType == 1}}">
<view class="offer-label" style="color:#333333;font-size:28rpx">预付金额</view>
<view class="offer-val" style="color:#008AFF;font-size:28rpx">¥{{form.preAmount}}</view>
</view>
<view class="flex flex-justify" style="height:60rpx" wx:if="{{form.payType == 2}}">
<view class="offer-label" style="color:#333333;font-size:28rpx">应付金额</view>
<view class="offer-val" style="color:#008AFF;font-size:28rpx">¥{{form.totalPrice}}</view>
</view>
<view class="flex flex-justify" style="height:60rpx" wx:if="{{form.payType == 3 || form.payType == 4}}">
<view class="offer-label" style="color:#333333;font-size:28rpx">月结金额</view>
<view class="offer-val" style="color:#008AFF;font-size:28rpx">¥{{form.monthAmount}}</view>
</view>
<view class="flex flex-justify" style="height:60rpx" wx:if="{{form.payType == 4}}">
<view class="offer-label" style="color:#333333;font-size:28rpx">现结金额</view>
<view class="offer-val" style="color:#008AFF;font-size:28rpx">¥{{form.totalPrice}}</view>
</view>
</view>
<view class="margin-top header-box" style="padding:32rpx">
@ -66,17 +76,27 @@
<text class="cuIcon-titles text-blue"></text>
<view style="color:black;font-size:32rpx">付款方式</view>
</view>
<view class="flex flex-justify" style="height:80rpx" data-index="1" bindtap="checkMode">
<view class="flex flex-justify" style="height:80rpx" data-index="1" bindtap="checkMode" wx:if="{{form.sellMode == 1}}">
<view class="flex align-end">
<text style="font-size:28rpx">预付定金</text>
<text class="offer-hint" style="margin-left:10rpx">预付款10%,余款货到付款</text>
</view>
<text class="cuIcon-{{form.payType==1?'roundcheckfill':'roundcheck'}} text-{{form.payType==1?'blue':'grey'}}" style="font-size:36rpx"></text>
</view>
<view class="flex flex-justify" style="height:80rpx" data-index="2" bindtap="checkMode">
<view class="flex flex-justify" style="height:80rpx" data-index="2" bindtap="checkMode" wx:if="{{form.sellMode == 1}}">
<view style="font-size:28rpx">全额支付</view>
<text class="cuIcon-{{form.payType==2?'roundcheckfill':'roundcheck'}} text-{{form.payType==2?'blue':'grey'}}" style="font-size:36rpx"></text>
</view>
<view class="flex flex-justify" style="height:80rpx" data-index="3" bindtap="checkMode" wx:if="{{form.sellMode == 2}}">
<view class="flex align-end">
<text style="font-size:28rpx">月结付款</text>
</view>
<text class="cuIcon-{{form.payType==3?'roundcheckfill':'roundcheck'}} text-{{form.payType==3?'blue':'grey'}}" style="font-size:36rpx"></text>
</view>
<view class="flex flex-justify" style="height:80rpx" data-index="4" bindtap="checkMode" wx:if="{{form.sellMode == 2}}">
<view style="font-size:28rpx">现结付款</view>
<text class="cuIcon-{{form.payType==4?'roundcheckfill':'roundcheck'}} text-{{form.payType==4?'blue':'grey'}}" style="font-size:36rpx"></text>
</view>
</view>
</view>
@ -90,8 +110,10 @@
</button>
<view class="flex align-end">
<!-- <view class="text-gray" style="font-size:12px">共{{form.number}}{{form.unit}}</view> -->
<view class="text-black" style="font-size:32rpx;margin-left:24rpx">合计:</view>
<view class="text-blue" style="font-size:32rpx">¥{{form.totalPrice}}</view>
<view class="text-black" style="font-size:32rpx;margin-left:24rpx">合计:¥</view>
<view class="text-blue" style="font-size:32rpx" wx:if="{{form.payType == 1}}">{{form.preAmount}}</view>
<view class="text-blue" style="font-size:32rpx" wx:elif="{{form.payType == 2 || form.payType == 4}}">{{form.totalPrice}}</view>
<view class="text-blue" style="font-size:32rpx" wx:elif="{{form.payType == 3}}">{{form.monthAmount}}</view>
<button class="cu-btn offer-btn" bindtap="offerProject">立即购买</button>
</view>
</view>

2
pages/mall/order-offer/index.wxss

@ -86,7 +86,7 @@ button::after {
.page-outline {
margin-top: 8rpx;
font-size: 28rpx;
font-size: 26rpx;
font-family: PingFang-SC-Regular, PingFang-SC;
font-weight: 400;
color: rgba(51, 51, 51, 1);

18
pages/mall/order-result/index.js

@ -32,9 +32,9 @@ Page({
msg = options.message
}
this.setData({
['icon.type']: 'success',
['icon.color']: '#008AFF',
['buttons[0].type']: 'positive',
['icon.type']: 'warn',
['icon.color']: '#ef473a',
['buttons[0].type']: 'light',
title: '支付失败',
label: '订单提交失败',
message: msg
@ -45,9 +45,9 @@ Page({
msg = options.message
}
this.setData({
['icon.type']: 'warn',
['icon.color']: '#ef473a',
['buttons[0].type']: 'light',
['icon.type']: 'success',
['icon.color']: '#008AFF',
['buttons[0].type']: 'positive',
title: '下单成功',
label: '订单提交成功',
message: msg
@ -58,9 +58,9 @@ Page({
msg = options.message
}
this.setData({
['icon.type']: 'warn',
['icon.color']: '#ef473a',
['buttons[0].type']: 'light',
['icon.type']: 'success',
['icon.color']: '#008AFF',
['buttons[0].type']: 'positive',
title: '支付成功',
label: '订单提交成功',
message: msg

2
pages/mall/order-result/index.wxml

@ -4,4 +4,4 @@
<view slot="content" style="color:black;font-size:26rpx">{{title}}</view>
</cu-custom>
<wux-result icon="{{ icon }}" title="{{label}}" label="{{message}}" buttons="{{ buttons }}" fixed bind:click="onClick" />
<wux-result icon="{{ icon }}" title="{{label}}" buttons="{{ buttons }}" fixed bind:click="onClick" />

6
pages/mall/shops/index.wxml

@ -102,7 +102,7 @@
</view>
<view wx:else style="padding: 0rpx 24rpx">
<image src="https://image.weilanwl.com/img/4x3-1.jpg" class="swiper-image" mode="aspectFill" lazy-load="{{true}}" style="margin-top:24rpx"></image>
<image src="/assets/image/icon_adv.jpg" class="swiper-image" mode="aspectFill" style="margin-top:24rpx"></image>
<view wx:if="{{cheapList.length}}">
<view class="flex nav-li">
<view class="shadow">特价</view>
@ -124,10 +124,10 @@
<page-list dataList="{{pageItem}}"></page-list>
</view>
<!--加载更多的UI-->
<wux-divider dashed wx:if="{{form.pageNum>1}}">
<wux-divider wx:if="{{form.pageNum>1}}">
<view class="loadmore">
<text class="icon--refresher" wx:if="{{!finished}}"></text>
<text class="text-sg" style="margin-left:8rpx">{{finished?'到底了':'加载中...'}}</text>
<text class="text-sm" style="margin-left:8rpx">{{finished?'到底啦~':'加载中...'}}</text>
</view>
</wux-divider>
</view>
Loading…
Cancel
Save