jiazhipeng 3 months ago
parent
commit
80052e0e64
  1. 2
      app.js
  2. 6
      pages/info/sceneProductInfo/index.js
  3. 80
      pages/order/WineSceneOrder/index.js
  4. 3
      pages/order/WineSceneOrder/index.json
  5. 17
      pages/order/WineSceneOrder/index.wxml
  6. 20
      pages/order/WineSceneOrder/index.wxss
  7. 5
      pages/order/components/address/index.js
  8. 2
      pages/order/components/address/index.wxml
  9. 193
      pages/order/components/coupon/index.js
  10. 8
      pages/order/components/coupon/index.wxml
  11. 18
      pages/order/components/coupon/index.wxss
  12. 313
      pages/order/components/smoothlyOrder/index.js
  13. 6
      pages/order/components/smoothlyOrder/index.json
  14. 80
      pages/order/components/smoothlyOrder/index.wxml
  15. 254
      pages/order/components/smoothlyOrder/index.wxss
  16. 70
      pages/order/food/index.js
  17. 3
      pages/order/food/index.json
  18. 19
      pages/order/food/index.wxml
  19. 19
      pages/order/food/index.wxss
  20. 108
      pages/order/postOrder/index.js
  21. 3
      pages/order/postOrder/index.json
  22. 21
      pages/order/postOrder/index.wxml
  23. 19
      pages/order/postOrder/index.wxss
  24. 83
      pages/order/roadOrder/index.js
  25. 3
      pages/order/roadOrder/index.json
  26. 18
      pages/order/roadOrder/index.wxml
  27. 20
      pages/order/roadOrder/index.wxss
  28. 69
      pages/order/showOrderNew/index.js
  29. 3
      pages/order/showOrderNew/index.json
  30. 19
      pages/order/showOrderNew/index.wxml
  31. 20
      pages/order/showOrderNew/index.wxss
  32. 48
      project.private.config.json
  33. 8
      utils/util.js

2
app.js

@ -39,7 +39,7 @@ App({
// 获取前端配置文件 // 获取前端配置文件
commonApi._post("pbservice/Other/getClientConfig", {unique_key: "wechatxcx"}).then(res => { commonApi._post("pbservice/Other/getClientConfig", {unique_key: "wechatxcx"}).then(res => {
let data = JSON.parse(res.data); let data = JSON.parse(res.data);
data.isTest = data.isTest160? true : false; data.isTest = data.isTest162? true : false;
data.indexSeason = null data.indexSeason = null
this.globalData.configJson = data this.globalData.configJson = data
}).then(() => { }).then(() => {

6
pages/info/sceneProductInfo/index.js

@ -75,6 +75,12 @@ Page({
util.back() util.back()
return; return;
} }
if(options.id) {
let tempUrl = util.detailDomain+`/ScenicDetail?id=${options.id}`
wx.navigateTo({
url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(tempUrl),
})
}
if (options.retailId) { if (options.retailId) {
this.setData({ this.setData({
retailId: options.retailId retailId: options.retailId

80
pages/order/WineSceneOrder/index.js

@ -42,7 +42,11 @@ Page({
showDate:false, showDate:false,
showDate2:false, showDate2:false,
showYhq:null, showYhq:null,
couponFlag:false couponFlag:false,
smoothlyTotal: 0,
maxCouponObject: null,
couponCom: null
}, },
/** /**
@ -77,7 +81,8 @@ Page({
} }
this.setData({singlePrice: this.data.product.sku.price}) this.setData({singlePrice: this.data.product.sku.price})
this.showAllPrice() // this.showAllPrice()
this.totalPrice(this.data.singlePrice)
console.log(this.data); console.log(this.data);
console.log(this.data.product.product.ZTPoint) console.log(this.data.product.product.ZTPoint)
@ -86,7 +91,22 @@ Page({
}, },
// 子组件发生改变时更新价格
handleUpdateTotalPrice(e) {
this.setData({
smoothlyTotal: e.detail.total
});
// 重新计算总价
this.totalPrice(this.data.singlePrice)
},
// 调用子组件清除优惠券方法
callOtherCompMethod: function(e) {
console.log(this.selectAllComponents("#coupon")[0])
this.selectAllComponents("#coupon")[0].setNullCoupon()
this.setData({
coupon:null
})
},
showBookingInfo: function (e) { showBookingInfo: function (e) {
this.setData({ this.setData({
bookingInfo: this.data.product.sku.sku_model, bookingInfo: this.data.product.sku.sku_model,
@ -230,15 +250,22 @@ Page({
this.totalPrice(this.data.singlePrice) this.totalPrice(this.data.singlePrice)
}, },
totalPrice(price) { totalPrice(price) {
let allPrice let allPrice = this.data.singlePrice * this.data.productNum
let prices = allPrice
// 顺手购价格
if (!this.data.coupon) {
allPrice += this.data.smoothlyTotal || 0;
}
if (this.data.coupon) { if (this.data.coupon) {
if (this.data.coupon.activity.discount_type == 'pricebreak') { if (this.data.coupon.activity.discount_type == 'pricebreak') {
allPrice = this.data.singlePrice * this.data.productNum - this.data.coupon.activity.money allPrice = allPrice - this.data.coupon.activity.money
} else { } else {
allPrice =(this.data.singlePrice * this.data.productNum * this.data.coupon.activity.fold)/ 10 allPrice =(allPrice * this.data.coupon.activity.fold)/ 10
} }
} else { } else {
allPrice = this.data.singlePrice * this.data.productNum allPrice = allPrice
} }
// allPrice = price * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0) // allPrice = price * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0)
@ -254,10 +281,40 @@ Page({
}) })
} }
console.log('singlePrice',this.data.singlePrice); console.log('singlePrice',this.data.singlePrice);
const smoothlyComp = this.selectComponent("#smoothlyOrderComp");
const skuIds = []
skuIds.push(this.data.product.sku.id)
if(smoothlyComp) {
// 检查是否有选中的顺手购商品
const hasSkuIds = smoothlyComp.hasSelectedGoods();
if(hasSkuIds) {
skuIds.push(...smoothlyComp.emitSkuIds())
}
}
this.setData({
maxCouponObject: {
price: prices,
skuIds: skuIds.toString()
}
})
}, },
order:function() { order:function() {
const smoothlyComp = this.selectComponent("#smoothlyOrderComp");
if(smoothlyComp) {
// 检查是否有选中的顺手购商品
const hasSelected = smoothlyComp.hasSelectedGoods();
if(hasSelected && !smoothlyComp.data.address) {
wx.showToast({
title: '请选择收货地址',
icon: 'none'
})
return;
}
}
let linkmanList = this.data.linkmanList, productNum = this.data.productNum, date = this.data.date, time = this.data.time, remark = this.data.remark, product = this.data.product; let linkmanList = this.data.linkmanList, productNum = this.data.productNum, date = this.data.date, time = this.data.time, remark = this.data.remark, product = this.data.product;
let linkmanIds = []; let linkmanIds = [];
@ -282,6 +339,12 @@ Page({
team_id: app.globalData.team_id, team_id: app.globalData.team_id,
} }
// 顺手购下单参数
if(smoothlyComp && smoothlyComp.emitOrder() && smoothlyComp.emitOrder().length) {
data.product_list.push(...smoothlyComp.emitOrder())
}
if (app.globalData.from) { if (app.globalData.from) {
data.system_name = app.globalData.from; data.system_name = app.globalData.from;
} }
@ -383,7 +446,8 @@ Page({
this.setData({ this.setData({
coupon:e.detail coupon:e.detail
}) })
this.showAllPrice() // this.showAllPrice()
this.totalPrice(this.data.singlePrice)
}, },
/** /**

3
pages/order/WineSceneOrder/index.json

@ -3,6 +3,7 @@
"title":"/pages/component/TitleHeader", "title":"/pages/component/TitleHeader",
"contact":"../components/contact/index", "contact":"../components/contact/index",
"coupon":"../components/coupon/index", "coupon":"../components/coupon/index",
"notice":"/pages/component/notice/notice" "notice":"/pages/component/notice/notice",
"smoothly-order": "/pages/order/components/smoothlyOrder/index"
} }
} }

17
pages/order/WineSceneOrder/index.wxml

@ -38,10 +38,17 @@
<coupon bind:getNewCoupon = 'getNewCoupon' wx:if="{{!kjId && !gp_id && type!='activity' && product && product.isGroup!=1 && isCar=='single' && type!='museum' && showYhq}}" id="coupon" <coupon bind:getNewCoupon = 'getNewCoupon' wx:if="{{!kjId && !gp_id && type!='activity' && product && product.isGroup!=1 && isCar=='single' && type!='museum' && showYhq}}" id="coupon"
money="{{singlePrice * productNum}}" sku="{{product.sku.id}}" couponFlag="{{couponFlag}}"></coupon> money="{{singlePrice * productNum}}" sku="{{product.sku.id}}" couponFlag="{{couponFlag}}" maxCouponObject="{{maxCouponObject}}"></coupon>
<!-- 顺手购组件 -->
<smoothly-order
wx:if="{{product.product.id && !coupon.id}}"
id="smoothlyOrderComp"
productId="{{product.product.id}}"
bind:callOtherComp="callOtherCompMethod"
bind:updateTotalPrice="handleUpdateTotalPrice"
></smoothly-order>
<view style="height:200rpx"></view>
<view class="fixed-bottom" > <view class="fixed-bottom" >
<view class="fixed-price-box" ><text>合计:</text> <view class="fixed-price-box" ><text>合计:</text>
<text class="price">¥{{price}}</text> <text class="price">¥{{price}}</text>
@ -51,4 +58,8 @@
<notice bookingInfo="{{bookingInfo}}" skuName="{{bookingInfoTitle}}" wx:if="{{bookingInfo}}" bind:close="closeMask"> <notice bookingInfo="{{bookingInfo}}" skuName="{{bookingInfoTitle}}" wx:if="{{bookingInfo}}" bind:close="closeMask">
</notice> </notice>
<!-- <view class="tishi" wx-if="{{coupon.id && smoothlyTotal > 0}}">
<image src="https://static.ticket.sz-trip.com/jundaosuzhou/images/thyh/user/tanhaos.png" mode="aspectFill"></image>
购买须知:使用优惠券的组合订单均不支持部分退款
</view> -->
</view> </view>

20
pages/order/WineSceneOrder/index.wxss

@ -1,6 +1,7 @@
/* pages/.wxss */ /* pages/.wxss */
page { page {
background: #f6f6f6; background: #f6f6f6;
padding-bottom: 150rpx;
} }
.group-order { .group-order {
@ -451,3 +452,22 @@ page {
content: "¥"; content: "¥";
font-size: 24rpx; font-size: 24rpx;
} }
.tishi {
width: 100%;
height: 67rpx;
background: #FFDEDE;
font-weight: bold;
font-size: 27rpx;
color: #D62828;
display: flex;
align-items: center;
position: fixed;
left: 0;
bottom: 113rpx;
}
.tishi image {
width: 26.67rpx;
height: 26.67rpx;
margin: 0 12rpx 0 26rpx;
}

5
pages/order/components/address/index.js

@ -11,7 +11,10 @@ Component({
addGlobalClass: true addGlobalClass: true
}, },
properties: { properties: {
showSelect: {
type: Boolean,
value: true
},
}, },
/** /**

2
pages/order/components/address/index.wxml

@ -1,4 +1,4 @@
<view class="address-box"> <view class="address-box" wx:if="{{showSelect}}">
<view class="box-title"> <view class="box-title">
<view style="flex:1">收货地址</view> <view style="flex:1">收货地址</view>
<view class="contact-add" bindtap="showLinkman" wx:if="{{selectLinkman}}"><text class="iconfont icon-add-select"></text>选择</view> <view class="contact-add" bindtap="showLinkman" wx:if="{{selectLinkman}}"><text class="iconfont icon-add-select"></text>选择</view>

193
pages/order/components/coupon/index.js

@ -2,93 +2,112 @@
import commonApi from "../../../../utils/https/common" import commonApi from "../../../../utils/https/common"
let app = getApp() let app = getApp()
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
money:{ money: {
type:String, type: String,
value:"0" value: "0"
}, },
sku:{ sku: {
type:String, type: String,
value:"" value: ""
}, },
couponFlag:{ couponFlag: {
type:Boolean, type: Boolean,
value:false, value: false,
observer(nv, ov) { observer(nv, ov) {
console.log(nv,ov) console.log(nv, ov)
if (nv) { if (nv) {
app.globalData.couponInfo = null app.globalData.couponInfo = null
this.setData({ this.setData({
coupon:null coupon: null
}) })
} }
} }
} },
}, maxCouponObject: {
type: Object,
value: null,
observer(nv, ov) {
console.log(111, nv, ov)
this.getMaxPrice()
}
}
},
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
coupon:null coupon: null,
}, maxCouponPrice: 0
pageLifetimes: { },
show: function() { pageLifetimes: {
this.getMaxCoupon() show: function() {
} this.getMaxCoupon()
}, }
lifetimes:{ },
attached(){ lifetimes: {
}, attached() {},
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
setNullCoupon:function(){ setNullCoupon: function() {
app.globalData.couponInfo = null console.log(44154)
this.setData({ app.globalData.couponInfo = null
coupon:null this.setData({
}) coupon: null
}, })
getMaxCoupon(){ },
// console.log(app.globalData.couponInfo); getMaxCoupon() {
console.log(this.data.coupon); // console.log(app.globalData.couponInfo);
if (app.globalData.couponInfo===false) { console.log(this.data.coupon);
this.setData({ if (app.globalData.couponInfo === false) {
coupon:null this.setData({
}) coupon: null
this.triggerEvent('getNewCoupon',null); })
}else{ this.triggerEvent('getNewCoupon', null);
commonApi.user_post('coupon/use_max_coupon_list',{ } else {
money:this.data.money, commonApi.user_post('coupon/use_max_coupon_list', {
sku_ids:this.data.sku money: this.data.money,
}).then(res=>{ sku_ids: this.data.sku
if (app.globalData.couponInfo&&app.globalData.couponInfo.hasOwnProperty('SubCoupon')) { }).then(res => {
this.setData({ if (app.globalData.couponInfo && app.globalData.couponInfo.hasOwnProperty(
coupon:app.globalData.couponInfo 'SubCoupon')) {
}) this.setData({
this.triggerEvent('getNewCoupon',app.globalData.couponInfo); coupon: app.globalData.couponInfo
console.log("我用的原来的数据"); })
}else{ this.triggerEvent('getNewCoupon', app.globalData.couponInfo);
console.log("我用的新的数据"); console.log("我用的原来的数据");
console.log('123123132',res.data); } else {
if ( Object.keys(res.data).length!=0) { console.log("我用的新的数据");
app.globalData.couponInfo = res.data console.log('123123132', res.data);
this.setData({ if (Object.keys(res.data).length != 0) {
coupon:res.data app.globalData.couponInfo = res.data
}) this.setData({
console.log(this.data.coupon); coupon: res.data
this.triggerEvent('getNewCoupon',res.data); })
} console.log(this.data.coupon);
} this.triggerEvent('getNewCoupon', res.data);
}) }
} }
})
} }
}, },
getMaxPrice() {
commonApi.user_post('coupon/use_max_coupon_list', {
money: this.data.maxCouponObject.price,
sku_ids: this.data.maxCouponObject.skuIds
}).then(res => {
this.setData({
maxCouponPrice: res.data.activity.money
})
})
}
},
}) })

8
pages/order/components/coupon/index.wxml

@ -2,14 +2,18 @@
<navigator url="/pages/order/coupon/index?money={{money}}&sku={{sku}}&sourceFrom={{sourceFrom}}" class="box"> <navigator url="/pages/order/coupon/index?money={{money}}&sku={{sku}}&sourceFrom={{sourceFrom}}" class="box">
<view class="box-title"> <view class="box-title">
<view style="flex:1">优惠券</view> <view style="flex:1">优惠券</view>
<!-- <view class="coupon-left" wx:if="{{maxCouponPrice > 0 && maxCouponPrice != coupon.activity.money}}">
¥{{maxCouponPrice / 100}}优惠券可用
</view> -->
<view wx:if="{{coupon}}"> <view wx:if="{{coupon}}">
<view wx:if="{{coupon.activity.discount_type == 'pricebreak'}}"> <view wx:if="{{coupon.activity.discount_type == 'pricebreak'}}">
-{{coupon.activity.money/100}} -{{coupon.activity.money/100}}
</view> </view>
<view wx:else> <view wx:else>
{{coupon.activity.fold}}折 {{coupon.activity.fold}}折
</view> </view>
</view> </view>
<view class="coupon-btn" wx:else>请选择</view> <!-- <view class="coupon-btn" wx:else>请选择</view> -->
<view class="coupon-btn">></view>
</view> </view>
</navigator> </navigator>

18
pages/order/components/coupon/index.wxss

@ -8,17 +8,27 @@
height: 113rpx; height: 113rpx;
margin: 0 20rpx; margin: 0 20rpx;
font-size: 31rpx; font-size: 31rpx;
color: #000; color: #E30000;
font-weight: 500; font-weight: 500;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.coupon-btn { .coupon-btn {
width: 138rpx; width: 50rpx;
line-height: 56rpx; line-height: 56rpx;
border: 1px solid #333333; /* border: 1px solid #333333; */
border-radius: 29rpx; border-radius: 29rpx;
text-align: center; text-align: center;
font-size: 28rpx; font-size: 28rpx;
color: #000; color: #333333;
}
.coupon-left {
line-height: 40rpx;
background: #FFDEDE;
border-radius: 13rpx;
padding: 0 18rpx;
font-weight: 500;
font-size: 24rpx;
color: #E30000;
margin-right: 20rpx;
} }

313
pages/order/components/smoothlyOrder/index.js

@ -0,0 +1,313 @@
import commonApi from "../../../../utils/https/common"
let app = getApp()
Component({
properties: {
productId: {
type: [String, Number],
value: ''
},
postId: {
type: [String, Number],
value: ''
},
type: {
type: String,
value: ''
}
},
data: {
addressList: [],
addressIndex: -1,
address: null,
smoothlyList: [],
sommthlyIndex: 0,
showAddressPopup: false,
showItem: null,
showSkuPopup: false,
content: ''
},
lifetimes: {
attached() {
this.setData({
sommthlyIndex: 0
})
this.getList()
// 组件初始化时,通知父组件重置价格为 0
this.triggerEvent('updateTotalPrice', {
total: 0
});
}
},
observers: {
'type': function(newVal, oldVal) {
// 当从邮寄切换到自提时
if (oldVal === 'post' && newVal !== 'post') {
// 重置所有商品邮费
const smoothlyList = this.data.smoothlyList.map(item => ({
...item,
postMoney: 0
}))
this.setData({
smoothlyList,
addressIndex: -1
})
// 重新计算总价
this.calculateTotalPrice()
} else if (newVal === 'post') {
// 切换到邮寄时重新计算邮费
this.showPostMoney()
}
},
'postId': function(newVal, oldVal) {
// 只有当当前是邮寄类型时,才重新计算邮费
if (this.data.type === 'post' && newVal !== oldVal) {
this.showPostMoney()
}
}
},
onload() {
this.couponCom = this.selectAllComponents("#coupon")[0];
},
methods: {
// 查看规格信息
showSkuInfo(e) {
console.log(e)
this.setData({
showItem: e.currentTarget.dataset.item,
showSkuPopup: true,
content: e.currentTarget.dataset.item.content
})
console.log(this.data.showItem)
},
closePopup() {
this.setData({
showSkuPopup: false
})
},
// 是否有选中商品
hasSelectedGoods() {
return this.data.smoothlyList.some(item => (item.buyNum || 0) > 0);
},
// 规格id
emitSkuIds() {
let skuIds = []
this.data.smoothlyList.forEach(item => {
if (item.buyNum > 0) {
skuIds.push(item.sku_id)
}
});
return skuIds;
},
// 下单参数
emitOrder() {
let orderList = []
this.data.smoothlyList.forEach(item => {
if (item.buyNum > 0) {
orderList.push({
type: item.type,
product_id: item.id,
sku_id: item.sku_id,
post: this.data.type == 'post' ? this.data.postId : (this.data.address ?
this.data
.address.id : ''),
product_num: item.buyNum,
use_type: 0,
is_batch_shipment: 0,
})
}
})
return orderList
},
switchSmoothlyList() {
const {
smoothlyList,
sommthlyIndex
} = this.data
// 重置当前商品数量
smoothlyList[sommthlyIndex].buyNum = 0
// 更新索引
const newIndex = sommthlyIndex < smoothlyList.length - 1 ? sommthlyIndex + 1 : 0
this.setData({
smoothlyList,
sommthlyIndex: newIndex
})
this.showPostMoney().then(() => {
this.calculateTotalPrice()
})
},
setNullCoupons() {
if (app.globalData.couponInfo != null) {
wx.showToast({
title: '订单价格发生变化,请重新选择优惠券',
icon: 'none'
})
this.triggerEvent('callOtherComp', {
methodName: 'setNullCoupon', // 要调用的子组件B的方法名
});
}
},
setAddress(e) {
console.log(e.detail);
this.setData({
address: e.detail
})
this.showPostMoney().then(() => {
this.calculateTotalPrice()
})
},
showAddress() {
const childComp = this.selectComponent('#addressComp');
if (!childComp) {
wx.showToast({
title: '组件未加载完成',
icon: 'none'
});
return;
}
childComp.showLinkman()
},
showImg(img) {
if (!img) {
return img
}
if (img.indexOf('https://') != -1 || img.indexOf('http://') != -1) {
return img;
} else {
// return "https://test.api.cloud.sz-trip.com"+img
return "https://static.ticket.sz-trip.com" + img;
}
},
getList() {
commonApi.user_post('product/get_convenient_purchase', {
page: 1,
limit: 100,
product_id: this.data.productId
}).then(res => {
if (res.data) {
const smoothlyList = res.data.map(i => ({
...i,
headimg: this.showImg(i.headimg),
buyNum: 0,
postMoney: 0
}));
this.setData({
smoothlyList
});
}
})
},
showPostMoney() {
const {
type,
postId,
addressList,
addressIndex,
smoothlyList
} = this.data
if (type == 'post') {
if (!postId) return Promise.resolve()
} else {
if (!this.data.address) return Promise.resolve()
}
const promises = smoothlyList.map(item => {
if (item.buyNum > 0) {
return commonApi.user_post("order/get_post_price", {
sku_id: item.sku_id,
num: item.buyNum,
consignee_id: type == 'post' ? postId : (this.data.address ? this.data
.address.id : '')
}).then(res => {
if (res.code == 1) {
// 更新对应商品的邮费
const newList = [...smoothlyList]
const idx = newList.findIndex(i => i.sku_id === item.sku_id)
console.log(res.data.price)
if (idx > -1) {
newList[idx].postMoney = res.data.price
this.setData({
smoothlyList: newList
})
}
}
})
}
return Promise.resolve()
})
return Promise.all(promises)
},
decreaseSkuNum(e) {
const item = e.currentTarget.dataset.item
const {
smoothlyList
} = this.data
if (item.buyNum > 0) {
// 找到对应商品并更新数量
const newList = smoothlyList.map(i => {
if (i.sku_id === item.sku_id) {
return {
...i,
buyNum: i.buyNum - 1
}
}
return i
})
this.setData({
smoothlyList: newList
})
this.setNullCoupons()
this.showPostMoney().then(() => {
this.calculateTotalPrice()
})
}
},
increaseSkuNum(e) {
const item = e.currentTarget.dataset.item
const {
smoothlyList
} = this.data
// 找到对应商品并更新数量
const newList = smoothlyList.map(i => {
if (i.sku_id === item.sku_id) {
return {
...i,
buyNum: i.buyNum + 1
}
}
return i
})
this.setData({
smoothlyList: newList
})
this.showPostMoney().then(() => {
this.calculateTotalPrice()
})
},
// 计算总价
calculateTotalPrice() {
let total = 0;
this.data.smoothlyList.forEach(item => {
if (item.buyNum > 0) {
const itemPrice = parseFloat(item.price) * item.buyNum;
total += itemPrice + item.postMoney;
}
});
this.triggerEvent('updateTotalPrice', {
total
});
return total;
},
}
})

6
pages/order/components/smoothlyOrder/index.json

@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"address":"../../components/address/index"
}
}

80
pages/order/components/smoothlyOrder/index.wxml

@ -0,0 +1,80 @@
<wxs src="/utils/filter.wxs" module="tool" />
<view class="container" wx:if="{{smoothlyList.length > 0}}">
<view class="box">
<view class="top-title flex-between">
顺手带一件
<view bindtap="switchSmoothlyList" class="refresh-btn">
<image src="https://static.ticket.sz-trip.com/jundaosuzhou/images/smoothlyOrder/refresh.png" mode="widthFix"></image>
换一换
</view>
</view>
<!-- 邮寄不显示收货地址 -->
<view wx:if="{{type !== 'post'}}">
<view class="address-box flex-between" wx:if="{{!address}}" bindtap="showAddress">
<view style="display: flex;align-items: center;">
<image src="https://static.ticket.sz-trip.com/jundaosuzhou/images/smoothlyOrder/location.png"
class="location" mode="widthFix"></image>
收货地址 点击填写收货地址
</view>
<image src="https://static.ticket.sz-trip.com/jundaosuzhou/images/smoothlyOrder/rightIcon.png"
class="rightIcon" mode="widthFix"></image>
</view>
<view class="address-boxs flex-between" bindtap="showAddress" wx:else>
<image src="https://static.ticket.sz-trip.com/jundaosuzhou/images/smoothlyOrder/location.png"
class="location" mode="widthFix"></image>
<view class="content">
<view class="left">收货地址</view>
<view class="right">
<view class="top">
{{address.name}}<text>{{address.tel}}</text>
</view>
<view class="bottom text-overflowRows">
{{address.address}}
</view>
</view>
</view>
<image src="https://static.ticket.sz-trip.com/jundaosuzhou/images/smoothlyOrder/rightIcon.png"
class="rightIcon" mode="widthFix"></image>
</view>
</view>
<view class="product-item" wx:for="{{smoothlyList}}" wx:key="index"
bindtap="showSkuInfo" data-item="{{item}}" wx:if="{{sommthlyIndex == index}}">
<image src="{{item.headimg}}" class="product-img" mode="aspectFill"></image>
<view class="product-content">
<view class="title-boxs flex-between">
<view class="title">{{item.title}}</view>
<image src="https://static.ticket.sz-trip.com/jundaosuzhou/images/smoothlyOrder/right.png" mode="widthFix"></image>
</view>
<view class="subtitle" wx:if="{{item.sku_name}}">{{item.sku_name}}</view>
<view class="flex-between">
<view class="price">{{item.price / 100}}<text
wx:if="{{item.postMoney > 0}}">(另需运费¥{{item.postMoney / 100}})</text></view>
<view class="product-btn flex-between">
<image src="https://static.ticket.sz-trip.com/jundaosuzhou/images/combinedLine/del.png"
catchtap="decreaseSkuNum" data-item="{{item}}" wx:if="{{item.buyNum > 0}}" mode="widthFix" />
<view wx:else></view>
<view style="width: 100%;text-align: center;" wx:if="{{item.buyNum > 0}}">{{item.buyNum}}
</view>
<view wx:else></view>
<image src="https://static.ticket.sz-trip.com/jundaosuzhou/images/combinedLine/add.png"
catchtap="increaseSkuNum" data-item="{{item}}" mode="widthFix" />
</view>
</view>
</view>
</view>
</view>
<address bind:setAddress="setAddress" showSelect="{{false}}" id="addressComp"></address>
<view wx:if="{{showSkuPopup}}" class="sku-box">
<view class="sku-popup" wx:if="{{showItem}}">
<view class="sku-name"><span></span> 产品详情 <span bindtap="closePopup">X</span></view>
<view class="sku-content">
<rich-text nodes="{{tool.formateRichText(content)}}"></rich-text>
<!-- tool.formateRichText(showItem.content) -->
</view>
</view>
</view>
</view>

254
pages/order/components/smoothlyOrder/index.wxss

@ -0,0 +1,254 @@
.flex-between {
display: flex;
justify-content: space-between;
align-items: center;
}
.container {
width: 750rpx;
}
.box {
width: 700rpx;
background: #FFFFFF;
border-radius: 9.33rpx;
padding: 0 21.33rpx 46.67rpx;
margin: 0 auto;
box-sizing: border-box;
}
.top-title {
height: 110rpx;
font-weight: bold;
font-size: 30.67rpx;
color: #000000;
display: flex;
justify-content: space-between;
align-items: center;
}
.refresh-btn {
font-weight: bold;
font-size: 28rpx;
color: #0B898E;
display: flex;
align-items: center;
}
.refresh-btn image {
width: 32rpx;
margin-right: 13.33rpx;
}
.address-box {
width: 655.33rpx;
height: 80rpx;
background: rgba(11, 137, 142, .06);
border-radius: 13.33rpx;
padding: 0 21.33rpx;
font-weight: 500;
font-size: 26.67rpx;
color: #0B898E;
display: flex;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
}
.address-box .location {
width: 42.67rpx;
margin-right: 26.67rpx;
}
.address-box .rightIcon {
width: 20rpx;
}
.address-boxs {
width: 655.33rpx;
height: 133.33rpx;
background: #F7F7F7;
border-radius: 13.33rpx;
padding: 13.33rpx 21.33rpx;
display: flex;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
}
.address-boxs .location {
width: 42.67rpx;
margin-right: 26.67rpx;
}
.address-boxs .content {
display: flex;
align-items: center;
margin-right: 33.33rpx;
}
.address-boxs .content .left {
font-weight: 500;
font-size: 26.67rpx;
color: #000000;
}
.address-boxs .content .right {
width: 333.33rpx;
margin-left: 16.67rpx;
}
.address-boxs .content .right .top {
font-weight: 400;
font-size: 30.67rpx;
color: #000000;
}
.address-boxs .content .right .top text {
font-weight: 500;
font-size: 24rpx;
color: #666666;
margin-left: 33.33rpx;
}
.address-boxs .content .right .bottom {
margin-top: 6.67rpx;
font-weight: 500;
font-size: 24rpx;
color: #666666;
}
.address-boxs .rightIcon {
width: 33.33rpx;
}
.product-item {
height: 153.33rpx;
display: flex;
width: 100%;
margin-top: 40rpx;
}
.product-item .product-img {
width: 153.33rpx;
height: 153.33rpx;
border-radius: 13.33rpx;
margin-right: 20rpx;
}
.product-item .product-content {
flex: 1;
height: 153.33rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.product-item .product-content .title-boxs {
display: flex;
justify-content: space-between;
align-items: center;
}
.product-item .product-content .title-boxs .title {
width: 445.33rpx;
font-weight: 500;
font-size: 28rpx;
color: #000000;
}
.product-item .product-content .title-boxs image {
width: 20rpx;
}
.product-item .product-content .subtitle {
font-weight: 500;
font-size: 24rpx;
color: #999999;
}
.product-item .product-content .price {
font-weight: 500;
font-size: 33.33rpx;
color: #E30000;
}
.product-item .product-content .price::before {
content: '¥';
font-size: 24rpx;
}
.product-item .product-content .price text {
font-weight: 500;
font-size: 24rpx;
color: #E30000;
margin-left: 6.67rpx;
}
.product-item .product-content .product-btn {
width: 160rpx;
font-weight: bold;
font-size: 28rpx;
color: #111111;
display: flex;
justify-content: space-between;
align-items: center;
}
.product-item .product-content .product-btn image {
width: 46.67rpx;
flex-shrink: 0;
}
.sku-box {
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.3);
position: fixed;
z-index: 99;
left: 0;
bottom: 0;
}
.sku-popup {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
height: 60vh;
background-color: #fff;
padding: 20rpx;
box-sizing: border-box;
overflow-x: hidden;
}
.sku-name {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 35rpx;
font-weight: bold;
height: 80rpx;
padding: 0 20rpx;
box-sizing: border-box;
}
.sku-name span {
font-weight: 400;
}
.sku-content {
width: 100%;
height: 50vh;
overflow-y: auto;
overflow-x: hidden;
max-width: 100%;
}
.sz-xcx-fwb-img {
width: 100% !important;
height: auto !important;
display: block !important;
margin: 0 auto !important;
object-fit: contain !important;
max-width: 100% !important;
}

70
pages/order/food/index.js

@ -16,6 +16,9 @@ Page({
showNoticeFlag:false, showNoticeFlag:false,
coupon:null, coupon:null,
price: 0, price: 0,
smoothlyTotal: 0,
maxCouponObject: null,
couponCom: null
}, },
/** /**
@ -37,6 +40,21 @@ Page({
console.log(app.globalData.product) console.log(app.globalData.product)
this.showAllPrice() this.showAllPrice()
}, },
// 子组件发生改变时更新价格
handleUpdateTotalPrice(e) {
this.setData({
smoothlyTotal: e.detail.total
});
// 重新计算总价
this.showAllPrice();
},
// 调用子组件清除优惠券方法
callOtherCompMethod: function(e) {
this.couponCom.setNullCoupon()
this.setData({
coupon:null
})
},
showNotice:function(){ showNotice:function(){
this.setData({ this.setData({
showNoticeFlag:true showNoticeFlag:true
@ -58,15 +76,24 @@ Page({
showAllPrice () { showAllPrice () {
console.log('couponInfo',app.globalData.couponInfo); console.log('couponInfo',app.globalData.couponInfo);
let price let price = this.data.product.sku.price * this.data.productNum
let allPrice = 0
allPrice = price
// 顺手购价格
if (!this.data.coupon) {
price += this.data.smoothlyTotal || 0;
}
if (this.data.coupon) { if (this.data.coupon) {
if (this.data.coupon.activity.discount_type == 'pricebreak') { if (this.data.coupon.activity.discount_type == 'pricebreak') {
price = this.data.product.sku.price * this.data.productNum - this.data.coupon.activity.money price = price - this.data.coupon.activity.money
} else { } else {
price =(this.data.product.sku.price * this.data.productNum * this.data.coupon.activity.fold)/ 10 price =(price * this.data.coupon.activity.fold)/ 10
} }
} else { } else {
price = this.data.product.sku.price * this.data.productNum price = price
} }
if (price >0) { if (price >0) {
this.setData({ price:price/100}) this.setData({ price:price/100})
@ -74,6 +101,22 @@ Page({
this.setData({ price:0 }) this.setData({ price:0 })
} }
const smoothlyComp = this.selectComponent("#smoothlyOrderComp");
const skuIds = []
skuIds.push(this.data.product.sku.id)
if(smoothlyComp) {
// 检查是否有选中的顺手购商品
const hasSkuIds = smoothlyComp.hasSelectedGoods();
if(hasSkuIds) {
skuIds.push(...smoothlyComp.emitSkuIds())
}
}
this.setData({
maxCouponObject: {
price: allPrice,
skuIds: skuIds.toString()
}
})
}, },
/** /**
@ -116,6 +159,19 @@ Page({
}) })
}, },
order:function(){ order:function(){
const smoothlyComp = this.selectComponent("#smoothlyOrderComp");
if(smoothlyComp) {
// 检查是否有选中的顺手购商品
const hasSelected = smoothlyComp.hasSelectedGoods();
if(hasSelected && !smoothlyComp.data.address) {
wx.showToast({
title: '请选择收货地址',
icon: 'none'
})
return;
}
}
// if(!this.data.user){ // if(!this.data.user){
// wx.showToast({ // wx.showToast({
// title: '请输入联系人', // title: '请输入联系人',
@ -143,6 +199,12 @@ Page({
source:"WECHATXCX", source:"WECHATXCX",
coupon_id:this.data.coupon?this.data.coupon.id:null coupon_id:this.data.coupon?this.data.coupon.id:null
}; };
// 顺手购下单参数
if(smoothlyComp && smoothlyComp.emitOrder() && smoothlyComp.emitOrder().length) {
product_list.push(...smoothlyComp.emitOrder())
}
if(app.globalData.from){ if(app.globalData.from){
data.system_name = app.globalData.from; data.system_name = app.globalData.from;
} }

3
pages/order/food/index.json

@ -2,6 +2,7 @@
"usingComponents": { "usingComponents": {
"title":"/pages/component/TitleHeader", "title":"/pages/component/TitleHeader",
"notice":"/pages/component/notice/notice", "notice":"/pages/component/notice/notice",
"coupon":"/pages/order/components/coupon/index" "coupon":"/pages/order/components/coupon/index",
"smoothly-order": "/pages/order/components/smoothlyOrder/index"
} }
} }

19
pages/order/food/index.wxml

@ -28,8 +28,18 @@
<input type="number" value="{{tel}}" bindinput="telInput" placeholder="请输入手机号"></input> <input type="number" value="{{tel}}" bindinput="telInput" placeholder="请输入手机号"></input>
</view> </view>
</view> </view>
<coupon id="coupon" bind:getNewCoupon = 'getNewCoupon' money="{{product.sku.price * productNum}}" sku="{{product.sku.id}}"></coupon> <coupon id="coupon" bind:getNewCoupon = 'getNewCoupon' money="{{product.sku.price * productNum}}" sku="{{product.sku.id}}" maxCouponObject="{{maxCouponObject}}"></coupon>
<view style="height:113rpx"></view>
<!-- 顺手购组件 -->
<smoothly-order
wx:if="{{product.product.id && !coupon.id}}"
id="smoothlyOrderComp"
productId="{{product.product.id}}"
bind:callOtherComp="callOtherCompMethod"
bind:updateTotalPrice="handleUpdateTotalPrice"
></smoothly-order>
<view style="height:200rpx"></view>
<view class="fixed-bottom" wx:if="{{product}}"> <view class="fixed-bottom" wx:if="{{product}}">
<!-- <view class="fixed-price-box"><text>订单金额:</text><text class="price">¥{{((product.sku.price * productNum - (coupon?coupon.activity.money:0))>0?(product.sku.price * productNum - (coupon?coupon.activity.money:0)):0) / 100}}</text></view> --> <!-- <view class="fixed-price-box"><text>订单金额:</text><text class="price">¥{{((product.sku.price * productNum - (coupon?coupon.activity.money:0))>0?(product.sku.price * productNum - (coupon?coupon.activity.money:0)):0) / 100}}</text></view> -->
<view class="fixed-price-box"><text>订单金额:</text><text class="price">¥{{price}}</text></view> <view class="fixed-price-box"><text>订单金额:</text><text class="price">¥{{price}}</text></view>
@ -37,3 +47,8 @@
<view class="fixed-btn" bindtap="order">提交订单</view> <view class="fixed-btn" bindtap="order">提交订单</view>
</view> </view>
<notice bind:close="closeNotice" wx:if="{{showNoticeFlag}}" bookingInfo="{{product.sku.sku_model}}" skuName="{{product.sku.sku_name}}"></notice> <notice bind:close="closeNotice" wx:if="{{showNoticeFlag}}" bookingInfo="{{product.sku.sku_model}}" skuName="{{product.sku.sku_name}}"></notice>
<!-- <view class="tishi" wx-if="{{coupon.id && smoothlyTotal > 0}}">
<image src="https://static.ticket.sz-trip.com/jundaosuzhou/images/thyh/user/tanhaos.png" mode="aspectFill"></image>
购买须知:使用优惠券的组合订单均不支持部分退款
</view> -->

19
pages/order/food/index.wxss

@ -133,3 +133,22 @@ margin-top: 30rpx;
font-size: 36rpx; font-size: 36rpx;
margin-left: 10rpx; margin-left: 10rpx;
} }
.tishi {
width: 100%;
height: 67rpx;
background: #FFDEDE;
font-weight: bold;
font-size: 27rpx;
color: #D62828;
display: flex;
align-items: center;
position: fixed;
left: 0;
bottom: 113rpx;
}
.tishi image {
width: 26.67rpx;
height: 26.67rpx;
margin: 0 12rpx 0 26rpx;
}

108
pages/order/postOrder/index.js

@ -29,12 +29,16 @@ Page({
showYhq:null, showYhq:null,
pickupIndex: null, pickupIndex: null,
smoothlyTotal: 0,
maxCouponObject: null
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
console.log(this.data.product)
this.setData({ this.setData({
from: options.from, from: options.from,
kjId: app.globalData.kjId, kjId: app.globalData.kjId,
@ -45,8 +49,25 @@ Page({
showYhq:app.globalData.listName?false:true showYhq:app.globalData.listName?false:true
}) })
this.handleProduct() this.handleProduct()
console.log(this.data.product)
}, },
// 子组件发生改变时更新价格
handleUpdateTotalPrice(e) {
this.setData({
smoothlyTotal: e.detail.total
});
console.log(123456)
// 重新计算总价
this.changePrice();
},
// 调用子组件清除优惠券方法
callOtherCompMethod: function(e) {
this.couponCom.setNullCoupon()
this.setData({
coupon: null
})
},
handleProduct () { handleProduct () {
app.globalData.postProduct.forEach((item,index) => { app.globalData.postProduct.forEach((item,index) => {
item.keyIndex = index item.keyIndex = index
@ -195,6 +216,15 @@ Page({
}, },
minus: function (e) { minus: function (e) {
if(this.data.coupon){
wx.showToast({
title: '订单价格发生变化,请重新选择优惠券',
icon: 'none'
})
}
this.couponCom.setNullCoupon()
app.globalData.couponInfo = null;
let index = e.currentTarget.dataset.index, product = this.data.product; let index = e.currentTarget.dataset.index, product = this.data.product;
let productNum = product[index].productNum; let productNum = product[index].productNum;
if (productNum <= 1) return; if (productNum <= 1) return;
@ -218,7 +248,8 @@ Page({
this.changePrice() this.changePrice()
}, },
changePrice: function () { changePrice: function () {
let product = this.data.product, price = 0; let product = this.data.product, price = 0, allPrice = 0;
product.map(item => { product.map(item => {
price = price + item.sku.price * item.productNum; price = price + item.sku.price * item.productNum;
if (this.data.allowance_data && this.data.select_allowance && this.data.allowance_price) { if (this.data.allowance_data && this.data.select_allowance && this.data.allowance_price) {
@ -226,24 +257,62 @@ Page({
price -= this.data.allowance_price * item.productNum < spread_price ? this.data.allowance_price * item.productNum : spread_price price -= this.data.allowance_price * item.productNum < spread_price ? this.data.allowance_price * item.productNum : spread_price
} }
}) })
if (this.data.coupon && this.data.showPrice != price) {
wx.showToast({ allPrice = price
title: '订单价格发生变化,请重新选择优惠券',
icon: 'none' // 顺手购价格
}) if (!this.data.coupon) {
app.globalData.couponInfo = null; price += this.data.smoothlyTotal || 0;
if (!this.data.kjId && !this.data.gp_id) { }
this.couponCom.setNullCoupon()
} // if (this.data.coupon && this.data.showPrice != price) {
this.setData({ // wx.showToast({
coupon: null // title: '订单价格发生变化,请重新选择优惠券',
}) // icon: 'none'
} // })
// app.globalData.couponInfo = null;
// if (!this.data.kjId && !this.data.gp_id) {
// this.couponCom.setNullCoupon()
// }
// this.setData({
// coupon: null
// })
// }
this.setData({ this.setData({
showPrice: app.globalData.kjId ? 0 : price showPrice: app.globalData.kjId ? 0 : price
}) })
const smoothlyComp = this.selectComponent("#smoothlyOrderComp");
const skuIds = []
skuIds.push(this.data.sku_id)
if(smoothlyComp) {
// 检查是否有选中的顺手购商品
const hasSkuIds = smoothlyComp.hasSelectedGoods();
if(hasSkuIds) {
skuIds.push(...smoothlyComp.emitSkuIds())
}
}
this.setData({
maxCouponObject: {
price: allPrice,
skuIds: skuIds.toString()
}
})
}, },
order: function () { order: function () {
// 顺手带一件是否选择收货地址
const smoothlyComp = this.selectComponent("#smoothlyOrderComp");
if(smoothlyComp && this.data.product[0].user_select_type == 1) {
// 检查是否有选中的顺手购商品
const hasSelected = smoothlyComp.hasSelectedGoods();
if(hasSelected && !smoothlyComp.data.address) {
wx.showToast({
title: '请选择收货地址',
icon: 'none'
})
return;
}
}
for(let info of this.data.product) { for(let info of this.data.product) {
if (info.user_select_type == 0) { if (info.user_select_type == 0) {
@ -327,6 +396,12 @@ Page({
gp_id: app.globalData.gp_id, gp_id: app.globalData.gp_id,
team_id: app.globalData.team_id team_id: app.globalData.team_id
}; };
// 顺手购下单参数
if(smoothlyComp && smoothlyComp.emitOrder() && smoothlyComp.emitOrder().length) {
product_list.push(...smoothlyComp.emitOrder())
}
if (this.data.select_allowance) data.is_allowance = 1 if (this.data.select_allowance) data.is_allowance = 1
if (app.globalData.from) { if (app.globalData.from) {
data.system_name = app.globalData.from; data.system_name = app.globalData.from;
@ -348,10 +423,11 @@ Page({
data.channel = ZTPointProduct.product.ZTPoint data.channel = ZTPointProduct.product.ZTPoint
} }
console.log(app.globalData.list,this.data.flag) console.log(app.globalData.list,this.data.flag)
if(!app.globalData.list || app.globalData.list.length == 0){ if(!app.globalData.list || app.globalData.list.length == 0){
// 判断混合下单 // 判断混合下单
let use_type = product_list[0].use_type let use_type = product_list[0].use_type
if (product_list.some(x=>x.use_type!=use_type)) { if (product_list.some(x=>x.use_type!=use_type) && !(smoothlyComp && smoothlyComp.emitOrder() && smoothlyComp.emitOrder().length)) {
app.globalData.productPrice = (this.data.showPrice + this.data.postFee - (this.data.coupon?this.data.coupon.activity.money:0))/100; app.globalData.productPrice = (this.data.showPrice + this.data.postFee - (this.data.coupon?this.data.coupon.activity.money:0))/100;
app.globalData.createDate = data app.globalData.createDate = data
wx.redirectTo({ wx.redirectTo({
@ -509,6 +585,8 @@ Page({
this.setData({ this.setData({
coupon:e.detail coupon:e.detail
}) })
this.changePrice()
}, },
/** /**

3
pages/order/postOrder/index.json

@ -2,6 +2,7 @@
"usingComponents": { "usingComponents": {
"title":"/pages/component/TitleHeader", "title":"/pages/component/TitleHeader",
"address":"../components/address/index", "address":"../components/address/index",
"coupon":"../components/coupon/index" "coupon":"../components/coupon/index",
"smoothly-order": "/pages/order/components/smoothlyOrder/index"
} }
} }

21
pages/order/postOrder/index.wxml

@ -114,8 +114,20 @@
</view> </view>
</view> </view>
</view> </view>
<coupon bind:getNewCoupon = 'getNewCoupon' id="coupon" wx:if="{{!kjId && !gp_id && flag!='mix' && showYhq}}" money="{{showPrice + postFee}}" sku="{{sku_id}}"></coupon> <coupon bind:getNewCoupon = 'getNewCoupon' id="coupon" wx:if="{{!kjId && !gp_id && flag!='mix' && showYhq}}" money="{{showPrice + postFee}}" sku="{{sku_id}}" maxCouponObject="{{maxCouponObject}}"></coupon>
<view style="height:113rpx"></view>
<!-- 顺手购组件 -->
<smoothly-order
wx:if="{{product.length > 0 && flag!='mix' && showYhq && !coupon.id}}"
id="smoothlyOrderComp"
productId="{{product[0].product.id}}"
bind:callOtherComp="callOtherCompMethod"
bind:updateTotalPrice="handleUpdateTotalPrice"
type="{{product[0].user_select_type == 0 ? 'post' : ''}}"
postId="{{address.id}}"
></smoothly-order>
<view style="height:200rpx"></view>
<view class="fixed-bottom" wx:if="{{product}}"> <view class="fixed-bottom" wx:if="{{product}}">
<view class="fixed-price-box" wx:if="{{!prizeId}}"> <view class="fixed-price-box" wx:if="{{!prizeId}}">
<view wx:if="{{coupon && showYhq}}"> <view wx:if="{{coupon && showYhq}}">
@ -144,3 +156,8 @@
<rich-text nodes="{{allowance_data.content}}"></rich-text> <rich-text nodes="{{allowance_data.content}}"></rich-text>
</view> </view>
</view> </view>
<!-- <view class="tishi" wx-if="{{coupon.id && smoothlyTotal > 0}}">
<image src="https://static.ticket.sz-trip.com/jundaosuzhou/images/thyh/user/tanhaos.png" mode="aspectFill"></image>
购买须知:使用优惠券的组合订单均不支持部分退款
</view> -->

19
pages/order/postOrder/index.wxss

@ -1,6 +1,7 @@
/* pages/order/post/index.wxss */ /* pages/order/post/index.wxss */
page { page {
background: #f6f6f6; background: #f6f6f6;
padding-bottom: 150rpx;
} }
.sendwayArea{ .sendwayArea{
@ -312,3 +313,21 @@ page {
height: 26.67rpx; height: 26.67rpx;
margin-right: 12rpx; margin-right: 12rpx;
} }
.tishi {
width: 100%;
height: 67rpx;
background: #FFDEDE;
font-weight: bold;
font-size: 27rpx;
color: #D62828;
display: flex;
align-items: center;
position: fixed;
left: 0;
bottom: 113rpx;
}
.tishi image {
width: 26.67rpx;
height: 26.67rpx;
margin: 0 12rpx 0 26rpx;
}

83
pages/order/roadOrder/index.js

@ -22,13 +22,16 @@ Page({
price:0, price:0,
coupon:app.globalData.couponInfo, coupon:app.globalData.couponInfo,
sku_ids:"", sku_ids:"",
prizeId:null prizeId:null,
smoothlyTotal: 0,
maxCouponObject: null
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.couponCom = this.selectAllComponents("#coupon")[0];
this.setData({ this.setData({
prizeId:wx.getStorageSync('prizeId') prizeId:wx.getStorageSync('prizeId')
}) })
@ -54,8 +57,66 @@ Page({
console.log(this.data) console.log(this.data)
// 获取默认联系人 // 获取默认联系人
this.getLinkmanList() this.getLinkmanList()
// this.showAllPrice()
}, },
// 子组件发生改变时更新价格
handleUpdateTotalPrice(e) {
this.setData({
smoothlyTotal: e.detail.total
});
// 重新计算总价
this.showAllPrice();
},
// 调用子组件清除优惠券方法
callOtherCompMethod: function(e) {
this.couponCom.setNullCoupon()
this.setData({
coupon: null,
})
},
showAllPrice() {
let price = app.globalData.product.price
let allPrice = price
// 顺手购价格
if (!this.data.coupon) {
price += this.data.smoothlyTotal || 0;
}
if (this.data.coupon) {
if (this.data.coupon.activity.discount_type == 'pricebreak') {
price = price - this.data.coupon.activity.money
} else {
price =(price * this.data.coupon.activity.fold)/ 10
}
} else {
price = price
}
if (price >0) {
this.setData({ price:price/100})
}else {
this.setData({ price:0 })
}
const smoothlyComp = this.selectComponent("#smoothlyOrderComp");
const skuIds = []
skuIds.push(this.data.sku_ids)
console.log(skuIds)
if(smoothlyComp) {
// 检查是否有选中的顺手购商品
const hasSkuIds = smoothlyComp.hasSelectedGoods();
if(hasSkuIds) {
skuIds.push(...smoothlyComp.emitSkuIds())
}
}
this.setData({
maxCouponObject: {
price: allPrice,
skuIds: skuIds.toString()
}
})
console.log(this.data.maxCouponObject)
},
showLinkman:function(e){ showLinkman:function(e){
if(!this.data.linkmanFlag) { if(!this.data.linkmanFlag) {
let skuIndex = e.currentTarget.dataset.index,linkmans = this.data.linkmans[skuIndex],linkmanList = this.data.linkmanList; let skuIndex = e.currentTarget.dataset.index,linkmans = this.data.linkmans[skuIndex],linkmanList = this.data.linkmanList;
@ -200,6 +261,19 @@ Page({
}) })
}, },
order:function(){ order:function(){
const smoothlyComp = this.selectComponent("#smoothlyOrderComp");
if(smoothlyComp) {
// 检查是否有选中的顺手购商品
const hasSelected = smoothlyComp.hasSelectedGoods();
if(hasSelected && !smoothlyComp.data.address) {
wx.showToast({
title: '请选择收货地址',
icon: 'none'
})
return;
}
}
let sku = this.data.sku,product = this.data.product,linkmans = this.data.linkmans,product_list = [],reserve_mobile = this.data.reserve_mobile; let sku = this.data.sku,product = this.data.product,linkmans = this.data.linkmans,product_list = [],reserve_mobile = this.data.reserve_mobile;
if(!reserve_mobile) { if(!reserve_mobile) {
wx.showToast({ wx.showToast({
@ -246,6 +320,12 @@ Page({
if(orderFlag==false){ if(orderFlag==false){
return; return;
} }
// 顺手购下单参数
if(smoothlyComp && smoothlyComp.emitOrder() && smoothlyComp.emitOrder().length) {
product_list.push(...smoothlyComp.emitOrder())
}
let data = { let data = {
product_list:product_list, product_list:product_list,
coupon_id:this.data.coupon?this.data.coupon.id:null, coupon_id:this.data.coupon?this.data.coupon.id:null,
@ -281,6 +361,7 @@ Page({
this.setData({ this.setData({
coupon:e.detail coupon:e.detail
}) })
this.showAllPrice()
}, },
// 一日游合同确认签字 // 一日游合同确认签字
// ondayConfirm:function(){ // ondayConfirm:function(){

3
pages/order/roadOrder/index.json

@ -1,6 +1,7 @@
{ {
"usingComponents": { "usingComponents": {
"title":"/pages/component/TitleHeader", "title":"/pages/component/TitleHeader",
"coupon":"/pages/order/components/coupon/index" "coupon":"/pages/order/components/coupon/index",
"smoothly-order": "/pages/order/components/smoothlyOrder/index"
} }
} }

18
pages/order/roadOrder/index.wxml

@ -29,7 +29,16 @@
<input type="text" bindinput="inputRemark" placeholder="选填"></input> <input type="text" bindinput="inputRemark" placeholder="选填"></input>
</view> </view>
</view> </view>
<coupon bind:getNewCoupon = 'getNewCoupon' money="{{price}}" sku="{{sku_ids}}"></coupon> <coupon id="coupon" bind:getNewCoupon = 'getNewCoupon' money="{{price}}" sku="{{sku_ids}}" maxCouponObject="{{maxCouponObject}}"></coupon>
<!-- 顺手购组件 -->
<smoothly-order
wx:if="{{product.id && !coupon.id}}"
id="smoothlyOrderComp"
productId="{{product.id}}"
bind:callOtherComp="callOtherCompMethod"
bind:updateTotalPrice="handleUpdateTotalPrice"
></smoothly-order>
<!-- <view class="user-box"> <!-- <view class="user-box">
<view class="user-item" style="border:none"> <view class="user-item" style="border:none">
<image lazy-load style="width:32rpx" src="https://static.ticket.sz-trip.com/xcxImages/other/hetong.png" mode="widthFix"></image> <image lazy-load style="width:32rpx" src="https://static.ticket.sz-trip.com/xcxImages/other/hetong.png" mode="widthFix"></image>
@ -40,7 +49,7 @@
<view style="height:113rpx"></view> <view style="height:113rpx"></view>
<view class="fixed-bottom"> <view class="fixed-bottom">
<view class="order-all-price" wx:if="{{prizeId}}">订单金额:<text>¥0</text></view> <view class="order-all-price" wx:if="{{prizeId}}">订单金额:<text>¥0</text></view>
<view class="order-all-price" wx:else>订单金额:<text>¥{{((price - (coupon?coupon.activity.money:0))>0?(price - (coupon?coupon.activity.money:0)):0)/100}}</text></view> <view class="order-all-price" wx:else>订单金额:<text>¥{{price}}</text></view>
<view class="order-btn" bindtap="order">去支付</view> <view class="order-btn" bindtap="order">去支付</view>
</view> </view>
<view class="mask" style="align-items:flex-end" wx:if="{{linkmanFlag}}"> <view class="mask" style="align-items:flex-end" wx:if="{{linkmanFlag}}">
@ -65,3 +74,8 @@
</view> </view>
</view> </view>
</view> </view>
<!-- <view class="tishi" wx-if="{{coupon.id && smoothlyTotal > 0}}">
<image src="https://static.ticket.sz-trip.com/jundaosuzhou/images/thyh/user/tanhaos.png" mode="aspectFill"></image>
购买须知:使用优惠券的组合订单均不支持部分退款
</view> -->

20
pages/order/roadOrder/index.wxss

@ -1,6 +1,7 @@
/* pages/order/roadOrder/index.wxss */ /* pages/order/roadOrder/index.wxss */
page { page {
background: #f6f6f6; background: #f6f6f6;
padding-bottom: 150rpx;
} }
.top-box { .top-box {
padding: 30rpx 47rpx; padding: 30rpx 47rpx;
@ -185,3 +186,22 @@ page {
box-shadow: 0px 0px 16rpx 0px rgba(6, 0, 1, 0.1); box-shadow: 0px 0px 16rpx 0px rgba(6, 0, 1, 0.1);
z-index: 1; z-index: 1;
} }
.tishi {
width: 100%;
height: 67rpx;
background: #FFDEDE;
font-weight: bold;
font-size: 27rpx;
color: #D62828;
display: flex;
align-items: center;
position: fixed;
left: 0;
bottom: 113rpx;
}
.tishi image {
width: 26.67rpx;
height: 26.67rpx;
margin: 0 12rpx 0 26rpx;
}

69
pages/order/showOrderNew/index.js

@ -46,6 +46,8 @@ Page({
showDate2:false, showDate2:false,
showYhq:null, showYhq:null,
couponFlag:false, couponFlag:false,
smoothlyTotal: 0,
maxCouponObject: null
}, },
/** /**
@ -115,6 +117,21 @@ Page({
// showDate: true, // showDate: true,
// }) // })
// }, // },
// 子组件发生改变时更新价格
handleUpdateTotalPrice(e) {
this.setData({
smoothlyTotal: e.detail.total
});
// 重新计算总价
this.totalPrice(this.data.singlePrice)
},
// 调用子组件清除优惠券方法
callOtherCompMethod: function(e) {
this.selectAllComponents("#coupon")[0].setNullCoupon()
this.setData({
coupon: null,
})
},
hideDate: function () { hideDate: function () {
this.setData({ this.setData({
showDate: false showDate: false
@ -281,15 +298,20 @@ Page({
this.totalPrice(this.data.singlePrice) this.totalPrice(this.data.singlePrice)
}, },
totalPrice(price) { totalPrice(price) {
let allPrice let allPrice = this.data.singlePrice * this.data.productNum
let prices = allPrice
// 顺手购价格
if (!this.data.coupon) {
allPrice += this.data.smoothlyTotal || 0;
}
if (this.data.coupon) { if (this.data.coupon) {
if (this.data.coupon.activity.discount_type == 'pricebreak') { if (this.data.coupon.activity.discount_type == 'pricebreak') {
allPrice = this.data.singlePrice * this.data.productNum - this.data.coupon.activity.money allPrice = allPrice - this.data.coupon.activity.money
} else { } else {
allPrice =(this.data.singlePrice * this.data.productNum * this.data.coupon.activity.fold)/ 10 allPrice =(allPrice * this.data.coupon.activity.fold)/ 10
} }
} else { } else {
allPrice = this.data.singlePrice * this.data.productNum allPrice = allPrice
} }
// allPrice = price * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0) // allPrice = price * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0)
@ -305,6 +327,23 @@ Page({
}) })
} }
console.log('singlePrice',this.data.singlePrice); console.log('singlePrice',this.data.singlePrice);
const smoothlyComp = this.selectComponent("#smoothlyOrderComp");
const skuIds = []
skuIds.push(this.data.product.sku.id)
if(smoothlyComp) {
// 检查是否有选中的顺手购商品
const hasSkuIds = smoothlyComp.hasSelectedGoods();
if(hasSkuIds) {
skuIds.push(...smoothlyComp.emitSkuIds())
}
}
this.setData({
maxCouponObject: {
price: prices,
skuIds: skuIds.toString()
}
})
}, },
changeDate: function (e) { changeDate: function (e) {
console.log('打印',e); console.log('打印',e);
@ -372,6 +411,19 @@ Page({
this.hideDate() this.hideDate()
}, },
order:function() { order:function() {
const smoothlyComp = this.selectComponent("#smoothlyOrderComp");
if(smoothlyComp) {
// 检查是否有选中的顺手购商品
const hasSelected = smoothlyComp.hasSelectedGoods();
if(hasSelected && !smoothlyComp.data.address) {
wx.showToast({
title: '请选择收货地址',
icon: 'none'
})
return;
}
}
let linkmanList = this.data.linkmanList, productNum = this.data.productNum, date = this.data.date, time = this.data.time, remark = this.data.remark, product = this.data.product; let linkmanList = this.data.linkmanList, productNum = this.data.productNum, date = this.data.date, time = this.data.time, remark = this.data.remark, product = this.data.product;
let linkmanIds = []; let linkmanIds = [];
if (linkmanList.length==0 && this.data.is_authentication == 1) { if (linkmanList.length==0 && this.data.is_authentication == 1) {
@ -432,6 +484,12 @@ Page({
team_id: app.globalData.team_id, team_id: app.globalData.team_id,
linkmanList:this.data.is_authentication == 1?this.data.linkmanList:[] linkmanList:this.data.is_authentication == 1?this.data.linkmanList:[]
} }
// 顺手购下单参数
if(smoothlyComp && smoothlyComp.emitOrder() && smoothlyComp.emitOrder().length) {
data.product_list.push(...smoothlyComp.emitOrder())
}
if (app.globalData.from) { if (app.globalData.from) {
data.system_name = app.globalData.from; data.system_name = app.globalData.from;
} }
@ -609,7 +667,8 @@ Page({
coupon:e.detail coupon:e.detail
}) })
this.showAllPrice() // this.showAllPrice()
this.totalPrice(this.data.singlePrice)
}, },
/** /**

3
pages/order/showOrderNew/index.json

@ -4,6 +4,7 @@
"contact":"../components/contact/index", "contact":"../components/contact/index",
"coupon":"../components/coupon/index", "coupon":"../components/coupon/index",
"notice":"/pages/component/notice/notice", "notice":"/pages/component/notice/notice",
"date":"/pages/order/components/date" "date":"/pages/order/components/date",
"smoothly-order": "/pages/order/components/smoothlyOrder/index"
} }
} }

19
pages/order/showOrderNew/index.wxml

@ -46,11 +46,26 @@
</view> --> </view> -->
<coupon bind:getNewCoupon = 'getNewCoupon' wx:if="{{!kjId && !gp_id && type!='activity' && product && product.isGroup!=1 && isCar=='single' && type!='museum' && showYhq}}" id="coupon" <coupon bind:getNewCoupon = 'getNewCoupon' wx:if="{{!kjId && !gp_id && type!='activity' && product && product.isGroup!=1 && isCar=='single' && type!='museum' && showYhq}}" id="coupon"
money="{{singlePrice * productNum}}" sku="{{product.sku.id}}" couponFlag="{{couponFlag}}"></coupon> money="{{singlePrice * productNum}}" sku="{{product.sku.id}}" couponFlag="{{couponFlag}}" maxCouponObject="{{maxCouponObject}}"></coupon>
<!-- 顺手购组件 -->
<smoothly-order
wx:if="{{product.product.id && !coupon.id}}"
id="smoothlyOrderComp"
productId="{{product.product.id}}"
bind:callOtherComp="callOtherCompMethod"
bind:updateTotalPrice="handleUpdateTotalPrice"
></smoothly-order>
<view style="{{type=='museum' || type=='activity'?'height:138rpx':'height:113rpx'}}"></view>
<view style="{{type=='museum' || type=='activity'?'height:188rpx':'height:163rpx'}}"></view>
<!-- <view class="tishi" wx-if="{{coupon.id && smoothlyTotal > 0}}">
<image src="https://static.ticket.sz-trip.com/jundaosuzhou/images/thyh/user/tanhaos.png" mode="aspectFill"></image>
购买须知:使用优惠券的组合订单均不支持部分退款
</view> -->
<view class="fixed-bottom"> <view class="fixed-bottom">
<view class="fixed-price-box" wx:if="{{kjId || prizeId}}"><text>合计:</text><text class="price">¥0</text></view> <view class="fixed-price-box" wx:if="{{kjId || prizeId}}"><text>合计:</text><text class="price">¥0</text></view>
<view class="fixed-price-box" wx:else><text>合计:</text> <view class="fixed-price-box" wx:else><text>合计:</text>

20
pages/order/showOrderNew/index.wxss

@ -1,6 +1,7 @@
/* pages/.wxss */ /* pages/.wxss */
page { page {
background: #f6f6f6; background: #f6f6f6;
padding-bottom: 150rpx;
} }
.group-order { .group-order {
@ -455,3 +456,22 @@ text-align: center;
content: "¥"; content: "¥";
font-size: 24rpx; font-size: 24rpx;
} }
.tishi {
width: 100%;
height: 67rpx;
background: #FFDEDE;
font-weight: bold;
font-size: 27rpx;
color: #D62828;
display: flex;
align-items: center;
position: fixed;
left: 0;
bottom: 113rpx;
}
.tishi image {
width: 26.67rpx;
height: 26.67rpx;
margin: 0 12rpx 0 26rpx;
}

48
project.private.config.json

@ -6,12 +6,54 @@
"condition": { "condition": {
"miniprogram": { "miniprogram": {
"list": [ "list": [
{
"name": "pages/info/postProductInfo/index",
"pathName": "pages/info/postProductInfo/index",
"query": "id=464726",
"scene": null,
"launchMode": "default"
},
{
"name": "pages/info/roadInfo/index",
"pathName": "pages/info/roadInfo/index",
"query": "id=463608",
"launchMode": "default",
"scene": null
},
{
"name": "pages/info/roadInfo/index",
"pathName": "pages/info/roadInfo/index",
"query": "id=463608",
"launchMode": "default",
"scene": null
},
{
"name": "pages/info/showInfo/index",
"pathName": "pages/info/showInfo/index",
"query": "id=465394",
"launchMode": "default",
"scene": null
},
{
"name": "pages/info/postProductInfo/index",
"pathName": "pages/info/postProductInfo/index",
"query": "id=460201&ZTPoint=%E7%94%84%E9%80%89%E6%99%AF%E9%85%92%E5%A5%97%E9%A4%90",
"launchMode": "default",
"scene": null
},
{
"name": "subPackages/foodNew/index",
"pathName": "subPackages/foodNew/index",
"query": "id=914667",
"launchMode": "default",
"scene": null
},
{ {
"name": "pages/info/roadInfo/index", "name": "pages/info/roadInfo/index",
"pathName": "pages/info/roadInfo/index", "pathName": "pages/info/roadInfo/index",
"query": "id=457033", "query": "id=457033",
"scene": null, "launchMode": "default",
"launchMode": "default" "scene": null
}, },
{ {
"name": "pages/info/roadInfo/index", "name": "pages/info/roadInfo/index",
@ -109,5 +151,5 @@
}, },
"projectname": "%E8%8B%8F%E5%B7%9E%E6%96%87%E6%97%85", "projectname": "%E8%8B%8F%E5%B7%9E%E6%96%87%E6%97%85",
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"libVersion": "3.9.3" "libVersion": "3.7.12"
} }

8
utils/util.js

@ -207,7 +207,7 @@ const gotoDetail = (item,isPagePoint,queryStr="") =>{
} }
console.log(item) console.log(item)
let tempUrl = ''
switch(item.type){ switch(item.type){
case "tenscenic": case "tenscenic":
@ -221,7 +221,9 @@ const gotoDetail = (item,isPagePoint,queryStr="") =>{
pagePointData.event='ticket_detail_click' pagePointData.event='ticket_detail_click'
pagePoint(pagePointData,1) pagePoint(pagePointData,1)
} }
// tempUrl = detailDomain+`/ScenicDetail?id=${item.scene_id || item.id}`
wx.navigateTo({ wx.navigateTo({
// url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(tempUrl),
url: '/pages/info/sceneProductInfo/index?id='+(item.scene_id || item.id)+queryStr url: '/pages/info/sceneProductInfo/index?id='+(item.scene_id || item.id)+queryStr
}) })
break; break;
@ -310,7 +312,7 @@ const gotoDetail = (item,isPagePoint,queryStr="") =>{
break; break;
case "movie": case "movie":
// 产品 电影票 // 产品 电影票
let tempUrl = 'https://m.cloud.sz-trip.com'+`/MovieInfo?id=${item.third_id || item.id}`+'&title='+item.title+queryStr tempUrl = 'https://m.cloud.sz-trip.com'+`/MovieInfo?id=${item.third_id || item.id}`+'&title='+item.title+queryStr
wx.navigateTo({ wx.navigateTo({
url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(tempUrl), url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(tempUrl),
// url: '/pages/list/movieticket/list/info/index?id='+(item.third_id || item.id)+'&title='+item.title // url: '/pages/list/movieticket/list/info/index?id='+(item.third_id || item.id)+'&title='+item.title
@ -328,7 +330,9 @@ const gotoDetail = (item,isPagePoint,queryStr="") =>{
pagePointData.event='ticket_detail_click' pagePointData.event='ticket_detail_click'
pagePoint(pagePointData,1) pagePoint(pagePointData,1)
} }
// tempUrl = detailDomain+`/ScenicDetail?id=${item.scene_id || item.id}`
wx.navigateTo({ wx.navigateTo({
// url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(tempUrl),
url: '/pages/info/sceneProductInfo/index?id='+(item.scene_id || item.id)+queryStr url: '/pages/info/sceneProductInfo/index?id='+(item.scene_id || item.id)+queryStr
}) })
break; break;

Loading…
Cancel
Save