Browse Source

强制关注,电影下单页调整

master
nige 3 years ago
parent
commit
b4edfb6d4e
  1. 102
      pages/info/hotelProductInfo/index.js
  2. 4
      pages/info/hotelProductInfo/index.json
  3. 9
      pages/info/hotelProductInfo/index.wxml
  4. 57
      pages/info/museumInfo/index.js
  5. 4
      pages/info/museumInfo/index.json
  6. 4
      pages/info/museumInfo/index.wxml
  7. 1331
      pages/info/postProductInfo/index.js
  8. 4
      pages/info/postProductInfo/index.json
  9. 4
      pages/info/postProductInfo/index.wxml
  10. 933
      pages/info/roadInfo/index.js
  11. 4
      pages/info/roadInfo/index.json
  12. 4
      pages/info/roadInfo/index.wxml
  13. 1580
      pages/info/sceneProductInfo/index.js
  14. 5
      pages/info/sceneProductInfo/index.json
  15. 4
      pages/info/sceneProductInfo/index.wxml
  16. 473
      pages/list/movieticket/list/ticket/index.js
  17. 3
      pages/list/movieticket/list/ticket/index.json
  18. 4
      pages/list/movieticket/list/ticket/index.wxml
  19. 42
      pages/order/components/wxqrCode/index.js
  20. 4
      pages/order/components/wxqrCode/index.json
  21. 13
      pages/order/components/wxqrCode/index.wxml
  22. 70
      pages/order/components/wxqrCode/index.wxss
  23. 9
      pages/order/movie/index.wxml
  24. 8
      pages/order/movie/index.wxss
  25. 688
      pages/user/cartlist/list.js
  26. 3
      pages/user/cartlist/list.json
  27. 4
      pages/user/cartlist/list.wxml

102
pages/info/hotelProductInfo/index.js

@ -37,7 +37,9 @@ Page({
roomInfo: null, roomInfo: null,
retailId: "", retailId: "",
shareImg: null, shareImg: null,
showShareFlag: false showShareFlag: false,
showQrCode: false,
wxqrcode: null
}, },
/** /**
@ -127,44 +129,72 @@ Page({
}) })
}, },
order: function (e) { order: function (e) {
let item = e.currentTarget.dataset.item; console.log(this.data.sceneInfo);
item.startDate = this.data.startDate; commonApi.user_post('wx/get_user_keep', {
item.endDate = this.data.endDate; jumpurl: '/pages/info/hotelProductInfo/index?id=' + this.data.id,
item.startDateText = this.data.startDateText; title: this.data.sceneInfo.title,
item.endDateText = this.data.endDateText; type: 'mini'
item.startDay = this.getDay(item.startDate); }).then(res => {
item.endDay = this.getDay(item.endDate); if (res.data.subscribe == 0) {
item.days = this.data.days; this.setData({
app.globalData.product = item; wxqrcode: res.data.qrcode,
app.globalData.couponInfo = null; showQrCode: true
wx.navigateTo({ })
url: '/pages/order/hotel/index', } else {
let item = e.currentTarget.dataset.item;
item.startDate = this.data.startDate;
item.endDate = this.data.endDate;
item.startDateText = this.data.startDateText;
item.endDateText = this.data.endDateText;
item.startDay = this.getDay(item.startDate);
item.endDay = this.getDay(item.endDate);
item.days = this.data.days;
app.globalData.product = item;
app.globalData.couponInfo = null;
wx.navigateTo({
url: '/pages/order/hotel/index',
})
}
}) })
}, },
orderMt: function (e) { orderMt: function (e) {
let item = e.currentTarget.dataset.item, product = e.currentTarget.dataset.product; commonApi.user_post('wx/get_user_keep', {
item.startDate = this.data.startDate; jumpurl: '/pages/info/hotelProductInfo/index?id=' + this.data.id,
item.endDate = this.data.endDate; title: this.data.sceneInfo.title,
item.startDateText = this.data.startDateText; type: 'mini'
item.endDateText = this.data.endDateText; }).then(res => {
item.startDay = this.getDay(item.startDate); if (res.data.subscribe == 0) {
item.endDay = this.getDay(item.endDate); this.setData({
item.days = this.data.days; wxqrcode: res.data.qrcode,
item.id = item.sku_id; showQrCode: true
// item.product_id = product.real_room_id; })
item.sku_name = product.room_name; } else {
item.sku_model = {}; let item = e.currentTarget.dataset.item, product = e.currentTarget.dataset.product;
item.sku_model.area = product.useable_area + "m²"; item.startDate = this.data.startDate;
item.sku_model.bed_type = item.bed_type; item.endDate = this.data.endDate;
item.sku_model.breakfast = item.breakfast; item.startDateText = this.data.startDateText;
item.sku_model.max_room_num = item.max_room_num; item.endDateText = this.data.endDateText;
app.globalData.product = item; item.startDay = this.getDay(item.startDate);
app.globalData.retailId = this.data.retailId; item.endDay = this.getDay(item.endDate);
// return; item.days = this.data.days;
app.globalData.couponInfo = null; item.id = item.sku_id;
wx.navigateTo({ // item.product_id = product.real_room_id;
url: '/pages/order/hotel/index', item.sku_name = product.room_name;
}) item.sku_model = {};
item.sku_model.area = product.useable_area + "m²";
item.sku_model.bed_type = item.bed_type;
item.sku_model.breakfast = item.breakfast;
item.sku_model.max_room_num = item.max_room_num;
app.globalData.product = item;
app.globalData.retailId = this.data.retailId;
// return;
app.globalData.couponInfo = null;
wx.navigateTo({
url: '/pages/order/hotel/index',
})
}})
}, },
getDay: function (date) { getDay: function (date) {
let d = new Date(date.replace(/-/g, '/')).getDay(); let d = new Date(date.replace(/-/g, '/')).getDay();

4
pages/info/hotelProductInfo/index.json

@ -1,6 +1,8 @@
{ {
"usingComponents": { "usingComponents": {
"title":"/pages/component/TitleHeader", "title":"/pages/component/TitleHeader",
"common-image":"/pages/component/commonImage/index" "common-image":"/pages/component/commonImage/index",
"code":"../../order/components/wxqrCode/index"
} }
} }

9
pages/info/hotelProductInfo/index.wxml

@ -53,8 +53,9 @@
<common-image src="{{item.img_list[0]}}" mode="aspectFill"></common-image> <common-image src="{{item.img_list[0]}}" mode="aspectFill"></common-image>
<view class="product-info textOver"> <view class="product-info textOver">
<view class="title textOver"><view class="textOver">{{item.room_name}}</view></view> <view class="title textOver"><view class="textOver">{{item.room_name}}</view></view>
<view class="subtitle textOver2">{{item.useable_area?(item.useable_area+'m²'):''}} <text wx:for="{{item.bed_info}}">{{item.bedDesc}}{{item.bedType}}x{{item.bedCount}}</text> {{item.window?item.window:''}}</view> <!-- <view class="subtitle textOver2">{{item.useable_area?(item.useable_area+'m²'):''}} <text wx:for="{{item.bed_info}}">{{item.bedDesc}}{{item.bedType}}x{{item.bedCount}}</text> {{item.window?item.window:''}}</view> -->
<view class="mt-price">{{item.low_price>0?item.low_price/100:'0'}}</view> <view class="subtitle textOver2">{{item.useable_area?(item.useable_area+'m²'):''}} {{item.window?item.window:''}} <text>{{item.capacity?item.capacity+'人入住':''}}</text></view>
<view class="mt-price">{{item.low_price>0?item.low_price/100:'0'}}</view>
</view> </view>
<view class="product-right"> <view class="product-right">
<image class="product-arrow-img" bindtap="getSkuList" data-id="{{item.real_room_id}}" data-index="{{index}}" src="https://static.ticket.sz-trip.com/xcxImages/info/arrow{{activeSkuIndex==index?'1':''}}.png" mode="widthFix"></image> <image class="product-arrow-img" bindtap="getSkuList" data-id="{{item.real_room_id}}" data-index="{{index}}" src="https://static.ticket.sz-trip.com/xcxImages/info/arrow{{activeSkuIndex==index?'1':''}}.png" mode="widthFix"></image>
@ -216,4 +217,6 @@
</view> </view>
<view class="save-btn" bindtap="save">保存到相册</view> <view class="save-btn" bindtap="save">保存到相册</view>
</view> </view>
</view> </view>
<code showModel="{{showQrCode}}" qrcode = "{{wxqrcode}}">
</code>

57
pages/info/museumInfo/index.js

@ -26,7 +26,9 @@ Page({
retailId: "", retailId: "",
isGroup: null, isGroup: null,
shareImg: null, shareImg: null,
showShareFlag: false showShareFlag: false,
showQrCode:false,
wxqrcode:null
}, },
/** /**
@ -399,27 +401,38 @@ Page({
}) })
}, },
order: function () { order: function () {
this.data.isGroup = null commonApi.user_post('wx/get_user_keep', {
if(this.data.product.product.flag!=1 || this.data.product.sku.flag=='off') return; jumpurl: '/pages/info/museumInfo/index?id='+this.data.id,
if(this.data.isGroup){ title:this.data.info.title,
// 如果是团队预约的话 是需要判断是否需要审核的 type: 'mini'
commonApi.user_post("team_order/is_apply",{ }).then(res => {
id:this.data.id if (res.data.subscribe == 0) {
}).then(res=>{ this.setData({
// 0 无需资质申请 1 需要资质申请跳转资质申请页面 wxqrcode: res.data.qrcode,
if(res && res.data==1){ showQrCode: true
wx.navigateTo({ })
url: '/pages/group/apply/index?id='+this.data.id, } else {
}) this.data.isGroup = null
return; if(this.data.product.product.flag!=1 || this.data.product.sku.flag=='off') return;
} if(this.data.isGroup){
this.realOrder() // 如果是团队预约的话 是需要判断是否需要审核的
}) commonApi.user_post("team_order/is_apply",{
} id:this.data.id
else { }).then(res=>{
this.realOrder() // 0 无需资质申请 1 需要资质申请跳转资质申请页面
} if(res && res.data==1){
wx.navigateTo({
url: '/pages/group/apply/index?id='+this.data.id,
})
return;
}
this.realOrder()
})
}
else {
this.realOrder()
}
}})
}, },
order1: function () { order1: function () {
this.data.isGroup = 1 this.data.isGroup = 1

4
pages/info/museumInfo/index.json

@ -1,6 +1,8 @@
{ {
"usingComponents": { "usingComponents": {
"title":"/pages/component/TitleHeader", "title":"/pages/component/TitleHeader",
"date":"/pages/order/components/date/index" "date":"/pages/order/components/date/index",
"code":"../../order/components/wxqrCode/index"
} }
} }

4
pages/info/museumInfo/index.wxml

@ -99,4 +99,6 @@
</view> </view>
<view class="save-btn" bindtap="save">保存到相册</view> <view class="save-btn" bindtap="save">保存到相册</view>
</view> </view>
</view> </view>
<code showModel="{{showQrCode}}" qrcode = "{{wxqrcode}}">
</code>

1331
pages/info/postProductInfo/index.js

File diff suppressed because it is too large

4
pages/info/postProductInfo/index.json

@ -1,5 +1,7 @@
{ {
"usingComponents": { "usingComponents": {
"title":"/pages/component/TitleHeader" "title":"/pages/component/TitleHeader",
"code":"../../order/components/wxqrCode/index"
} }
} }

4
pages/info/postProductInfo/index.wxml

@ -203,4 +203,6 @@
<view class="rule-title">{{allowance_data.title}}</view> <view class="rule-title">{{allowance_data.title}}</view>
<rich-text nodes="{{allowance_data.content}}"></rich-text> <rich-text nodes="{{allowance_data.content}}"></rich-text>
</view> </view>
</view> </view>
<code showModel="{{showQrCode}}" qrcode = "{{wxqrcode}}">
</code>

933
pages/info/roadInfo/index.js

@ -7,500 +7,515 @@ import util from '../../../utils/util'
let app = getApp() let app = getApp()
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
fixed: false, fixed: false,
type: 1, type: 1,
top: 0, top: 0,
info: null, info: null,
comment: [], comment: [],
commentTotal: 0, commentTotal: 0,
retailId: "", retailId: "",
retailSkuId: "", retailSkuId: "",
shareImg: null, shareImg: null,
showShareFlag: false showShareFlag: false,
}, showQrCode: false,
wxqrcode: null
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
let rect = wx.getMenuButtonBoundingClientRect(); let rect = wx.getMenuButtonBoundingClientRect();
let height = (rect.top - device.statusBarHeight) * 2 + rect.height + device.statusBarHeight; let height = (rect.top - device.statusBarHeight) * 2 + rect.height + device.statusBarHeight;
this.setData({
top: height,
id: options.id
})
if (options.retailId) {
this.setData({
retailId: options.retailId
})
}
let api = commonApi._post;
if (wx.getStorageSync("jstrip_token")) {
api = commonApi.user_post;
}
api("product/get_product_detail", {
id: options.id
}).then(res => {
res.data.display_tags = (res.data.display_tags ? res.data.display_tags.split(",") : []).splice(0, 2);
if (options.skuid) {
let sku = res.data.sku.find(item => item.id == options.skuid);
res.data.sku = [sku];
this.setData({ this.setData({
retailSkuId: options.skuid top: height,
}) id: options.id
}
res.data.flag = res.data.sku.find(item=>item.flag=='on')?res.data.flag:0
this.setData({
info: res.data
})
this.BroswerRecord()
})
commonApi._post("product/product_comment_list", {
product_id: options.id,
offset: 0,
limit: 3
}).then(res => {
res.data.list.map(item => {
item.rate = Number(item.rate)
})
this.setData({
commentTotal: res.data.total,
comment: res.data.list
})
})
},
BroswerRecord: function () {
setTimeout(() => {
if (app.globalData.uuid) {
commonApi._post('browse/browse_record', {
type: "goods",
title: this.data.info.title,
drive: "mini",
source_id: this.data.info.id,
url: "/pages/info/cardInfo/index?id=" + this.data.info.id,
uuid: app.globalData.uuid
}).then(res => {
}) })
} if (options.retailId) {
else { this.setData({
this.BroswerRecord(); retailId: options.retailId
} })
}, 500)
},
changeMenu: function (e) {
let index = e.currentTarget.dataset.index, that = this;
const query = wx.createSelectorQuery(); //创建节点查询器
query.select("#box" + index).boundingClientRect() //选择toViewid获取位置信息
query.selectViewport().scrollOffset() //获取页面查询位置的
query.exec(function (res) {
let scrollTop = res[0].top + res[1].scrollTop - 110 * ratio - that.data.top;
wx.pageScrollTo({
scrollTop: scrollTop + 4,
duration: 0
})
that.setData({
type: index
})
})
},
onPageScroll: function (e) {
let that = this, height = this.data.top;
let topHeight = height;
wx.createSelectorQuery().select('#menus').boundingClientRect(function (rect) {
console.log(rect.top, topHeight)
if (rect.top <= topHeight) {
// 此时应该把menus固定在顶部
that.setData({
fixed: true
})
}
else {
that.setData({
fixed: false
})
}
// 滚动时判断滚动到哪个部分了
const query = wx.createSelectorQuery(); //创建节点查询器
query.select("#box1").boundingClientRect() //选择toViewid获取位置信息
query.select("#box2").boundingClientRect() //选择toViewid获取位置信息
query.select("#box3").boundingClientRect() //选择toViewid获取位置信息
query.select("#box4").boundingClientRect() //选择toViewid获取位置信息
let minHeight = that.data.fixed ? (110 * ratio + height) : topHeight;
query.exec(function (res) {
if (res[3].top < minHeight) {
that.setData({
type: 4
})
}
else if (res[2].top < minHeight) {
that.setData({
type: 3
})
}
else if (res[1].top < minHeight) {
that.setData({
type: 2
})
} }
else { let api = commonApi._post;
that.setData({ if (wx.getStorageSync("jstrip_token")) {
type: 1 api = commonApi.user_post;
})
} }
}) api("product/get_product_detail", {
}).exec() id: options.id
}).then(res => {
res.data.display_tags = (res.data.display_tags ? res.data.display_tags.split(",") : []).splice(0, 2);
}, if (options.skuid) {
order: function () { let sku = res.data.sku.find(item => item.id == options.skuid);
app.globalData.couponInfo = null; res.data.sku = [sku];
app.globalData.product = { this.setData({
product: this.data.info retailSkuId: options.skuid
} })
app.globalData.retailId = this.data.retailId; }
util.pagePoint({ res.data.flag = res.data.sku.find(item => item.flag == 'on') ? res.data.flag : 0
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')
wx.navigateTo({
url: '/pages/order/road/index?id=' + this.data.info.id + (this.data.retailSkuId ? ('&skuid=' + this.data.retailSkuId) : '')
})
},
pagePoint:function(e){
util.pagePoint(e)
},
// 分享
share: function () {
if (!wx.getStorageSync("jstrip_token")) {
util.pagePoint({
event:'product_share_login',
param:{
id:that.data.info.id,
type:that.data.info.type
}
},1)
commonApi.user_post("user/getMyInfo", {}).then(res => {
}) this.setData({
return; info: res.data
} })
if (!this.data.shareImg) { this.BroswerRecord()
wx.showToast({ })
title: '图片生成中,稍后再试', commonApi._post("product/product_comment_list", {
icon: 'none' product_id: options.id,
}) offset: 0,
return; limit: 3
} }).then(res => {
this.setData({ res.data.list.map(item => {
showShareFlag: !this.data.showShareFlag item.rate = Number(item.rate)
}) })
}, this.setData({
// 保存 commentTotal: res.data.total,
save() { comment: res.data.list
let url = this.data.shareImg, that = this; })
wx.authorize({ })
/* 这个就是保存相册的 */ },
scope: 'scope.writePhotosAlbum', BroswerRecord: function () {
success() { setTimeout(() => {
wx.saveImageToPhotosAlbum({ if (app.globalData.uuid) {
filePath: url, commonApi._post('browse/browse_record', {
success(res) { type: "goods",
wx.showToast({ title: this.data.info.title,
title: '保存成功', drive: "mini",
icon: "success" source_id: this.data.info.id,
url: "/pages/info/cardInfo/index?id=" + this.data.info.id,
uuid: app.globalData.uuid
}).then(res => {})
} else {
this.BroswerRecord();
}
}, 500)
},
changeMenu: function (e) {
let index = e.currentTarget.dataset.index,
that = this;
const query = wx.createSelectorQuery(); //创建节点查询器
query.select("#box" + index).boundingClientRect() //选择toViewid获取位置信息
query.selectViewport().scrollOffset() //获取页面查询位置的
query.exec(function (res) {
let scrollTop = res[0].top + res[1].scrollTop - 110 * ratio - that.data.top;
wx.pageScrollTo({
scrollTop: scrollTop + 4,
duration: 0
}) })
that.setData({ that.setData({
showShareFlag: !that.data.showShareFlag type: index
}) })
})
},
onPageScroll: function (e) {
let that = this,
height = this.data.top;
let topHeight = height;
wx.createSelectorQuery().select('#menus').boundingClientRect(function (rect) {
console.log(rect.top, topHeight)
if (rect.top <= topHeight) {
// 此时应该把menus固定在顶部
that.setData({
fixed: true
})
} else {
that.setData({
fixed: false
})
}
// 滚动时判断滚动到哪个部分了
const query = wx.createSelectorQuery(); //创建节点查询器
query.select("#box1").boundingClientRect() //选择toViewid获取位置信息
query.select("#box2").boundingClientRect() //选择toViewid获取位置信息
query.select("#box3").boundingClientRect() //选择toViewid获取位置信息
query.select("#box4").boundingClientRect() //选择toViewid获取位置信息
let minHeight = that.data.fixed ? (110 * ratio + height) : topHeight;
query.exec(function (res) {
if (res[3].top < minHeight) {
that.setData({
type: 4
})
} else if (res[2].top < minHeight) {
that.setData({
type: 3
})
} else if (res[1].top < minHeight) {
that.setData({
type: 2
})
} else {
that.setData({
type: 1
})
}
})
}).exec()
},
order: function () {
commonApi.user_post('wx/get_user_keep', {
jumpurl: '/pages/info/roadInfo/index?id=' + this.data.id,
title: this.data.info.title,
type: 'mini'
}).then(res => {
if (res.data.subscribe == 0) {
this.setData({
wxqrcode: res.data.qrcode,
showQrCode: true
})
} else {
app.globalData.couponInfo = null;
app.globalData.product = {
product: this.data.info
}
app.globalData.retailId = this.data.retailId;
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')
wx.navigateTo({
url: '/pages/order/road/index?id=' + this.data.info.id + (this.data.retailSkuId ? ('&skuid=' + this.data.retailSkuId) : '')
})
}
})
},
pagePoint: function (e) {
util.pagePoint(e)
},
// 分享
share: function () {
if (!wx.getStorageSync("jstrip_token")) {
util.pagePoint({ util.pagePoint({
event:'product_share_save', event: 'product_share_login',
param:{ param: {
id:that.data.info.id, id: that.data.info.id,
type:that.data.info.type type: that.data.info.type
} }
},1) }, 1)
}, commonApi.user_post("user/getMyInfo", {}).then(res => {
fail(res) {
})
return;
}
if (!this.data.shareImg) {
wx.showToast({ wx.showToast({
title: '保存失败', title: '图片生成中,稍后再试',
icon: 'none' icon: 'none'
}) })
} return;
}
this.setData({
showShareFlag: !this.data.showShareFlag
}) })
}, },
complete(res) { // 保存
console.log(res); save() {
/* 这里判断一下如果没有授权重新打开设置选项 */ let url = this.data.shareImg,
wx.getSetting({ that = this;
success(res) { wx.authorize({
if (!res.authSetting['scope.writePhotosAlbum']) { /* 这个就是保存相册的 */
/* 打开设置的方法 */ scope: 'scope.writePhotosAlbum',
// opensit(); success() {
wx.showToast({ wx.saveImageToPhotosAlbum({
title: '请打开权限后再试', filePath: url,
icon: 'none' success(res) {
}) wx.showToast({
title: '保存成功',
icon: "success"
})
that.setData({
showShareFlag: !that.data.showShareFlag
})
util.pagePoint({
event: 'product_share_save',
param: {
id: that.data.info.id,
type: that.data.info.type
}
}, 1)
},
fail(res) {
wx.showToast({
title: '保存失败',
icon: 'none'
})
}
})
},
complete(res) {
console.log(res);
/* 这里判断一下如果没有授权重新打开设置选项 */
wx.getSetting({
success(res) {
if (!res.authSetting['scope.writePhotosAlbum']) {
/* 打开设置的方法 */
// opensit();
wx.showToast({
title: '请打开权限后再试',
icon: 'none'
})
}
}
});
} }
}
}); });
}
});
}, },
// 绘制海报 // 绘制海报
drawImg: function () { drawImg: function () {
var that = this, userinfo = wx.getStorageSync('jstrip_userInfo'); var that = this,
if (!userinfo) { userinfo = wx.getStorageSync('jstrip_userInfo');
// 去登录 if (!userinfo) {
return false; // 去登录
} return false;
const ctx = wx.createCanvasContext('imageCanvas');
// const device = wx.getSystemInfoSync();
// const ratio = device.screenWidth / 750;
// 先获取到图片信息
let promise2 = new Promise(function (resolve, reject) {
wx.getImageInfo({
src: that.data.info.headimg,
success: function (res) {
resolve(res);
},
fail: function (res) {
reject(res);
}
})
})
let promise3 = new Promise(function (resolve, reject) {
let userid = wx.getStorageSync('jstrip_userid')
new QRCode('myQrcode', {
text: 'https://m.cloud.sz-trip.com/LineDetail?id=' + that.data.info.id + '&sharedUserId=' + userid + '&channel=-1',
width: 500,
height: 500,
padding: 12, // 生成二维码四周自动留边宽度,不传入默认为0
correctLevel: QRCode.CorrectLevel.H, // 二维码可辨识度
callback: (res) => {
resolve(res);
} }
}) const ctx = wx.createCanvasContext('imageCanvas');
}) // const device = wx.getSystemInfoSync();
//成功得到图片信息后,开始绘图 // const ratio = device.screenWidth / 750;
Promise.all([promise2, promise3]).then(imgs => { // 先获取到图片信息
ctx.save(); let promise2 = new Promise(function (resolve, reject) {
ctx.beginPath(); //开始绘制 wx.getImageInfo({
that.handleBorderRect(ctx, 0, 0, 551 * ratio, 407 * ratio, 25 * ratio, '#ccc') src: that.data.info.headimg,
ctx.clip();//画好了圆 剪切 原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内 这也是我们要save上下文的原因 success: function (res) {
ctx.drawImage(imgs[0].path, 0, 0, 551 * ratio, 407 * ratio); resolve(res);
ctx.restore(); },
ctx.save(); fail: function (res) {
that.handleBorderRect2(ctx, 0, 407 * ratio, 551 * ratio, 236 * ratio, 25 * ratio, '#fff') reject(res);
ctx.restore(); }
// 绘制二维码 })
ctx.drawImage(imgs[1].path, 373 * ratio, 495 * ratio, 137 * ratio, 137 * ratio); })
// 开始文字绘制 let promise3 = new Promise(function (resolve, reject) {
ctx.setFillStyle("#000"); let userid = wx.getStorageSync('jstrip_userid')
ctx.setFontSize(30 * ratio); //字大小 new QRCode('myQrcode', {
ctx.setTextAlign('left'); //是否居中显示,参考点画布中线 text: 'https://m.cloud.sz-trip.com/LineDetail?id=' + that.data.info.id + '&sharedUserId=' + userid + '&channel=-1',
that.drawText(ctx, that.data.info.title, 25 * ratio, 450 * ratio, 480 * ratio, ratio); width: 500,
// 售价 height: 500,
ctx.setFillStyle("#D62828"); padding: 12, // 生成二维码四周自动留边宽度,不传入默认为0
ctx.setFontSize(40 * ratio); //字大小 correctLevel: QRCode.CorrectLevel.H, // 二维码可辨识度
ctx.setTextAlign('left'); //是否居中显示,参考点画布中线 callback: (res) => {
let price = that.data.info.price ? ("¥" + (that.data.info.price / 100)) : '免费'; resolve(res);
let width = ctx.measureText(price).width; }
ctx.fillText(price, 25 * ratio, 620 * ratio);
// 副标题
ctx.setFillStyle("#999999");
ctx.setFontSize(28 * ratio); //字大小
ctx.setTextAlign('left'); //是否居中显示,参考点画布中线
let subtitle = that.data.info.display_tags[0];
if (subtitle.length > 10) {
subtitle = subtitle.substr(0, 10) + '...'
}
ctx.fillText(subtitle, 25 * ratio, 540 * ratio);
// ctx.draw();
// 划线价
// ctx.setFillStyle("#999999");
// ctx.setFontSize(32 * ratio); //字大小
// ctx.setTextAlign('left'); //是否居中显示,参考点画布中线
// let market_price = "¥" + (Number(that.data.info.market_price) / 100)
// ctx.fillText(market_price, 40 * ratio + width, 620 * ratio);
// let market_price_width = ctx.measureText(market_price).width;
// 划线
// ctx.beginPath()
// ctx.setLineWidth(1)
// ctx.moveTo(40 * ratio + width, 608 * ratio)
// ctx.lineTo(45 * ratio + width + market_price_width, 608 * ratio)
// ctx.stroke();
// 长按识别二维码
// ctx.setFillStyle("#666");
// ctx.setFontSize(22 * ratio); //字大小
// ctx.setTextAlign('left'); //是否居中显示,参考点画布中线
// ctx.fillText("长按识别二维码", 404*ratio, 710*ratio);
// 长按图片转发或保存
// ctx.setFillStyle("#000");
// ctx.setFontSize(24 * ratio); //字大小
// ctx.setTextAlign('left'); //是否居中显示,参考点画布中线
// ctx.fillText("长按图片保存到本地",(592*ratio - ctx.measureText("长按图片保存到本地").width)/2, 740*ratio);
ctx.draw();
// 转为图片
setTimeout(() => {
wx.canvasToTempFilePath({
x: 0,
y: 0,
canvasId: 'imageCanvas',
success: function (res) {
that.setData({
shareImg: res.tempFilePath
}) })
},
fail(err) {
console.log('agdgjgdajhg', err)
}
}) })
}, 500) //成功得到图片信息后,开始绘图
return false; Promise.all([promise2, promise3]).then(imgs => {
}).catch(err => { ctx.save();
console.log("this err", err) ctx.beginPath(); //开始绘制
}) that.handleBorderRect(ctx, 0, 0, 551 * ratio, 407 * ratio, 25 * ratio, '#ccc')
}, ctx.clip(); //画好了圆 剪切 原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内 这也是我们要save上下文的原因
// 圆角矩形 ctx.drawImage(imgs[0].path, 0, 0, 551 * ratio, 407 * ratio);
handleBorderRect(ctx, x, y, w, h, r, color) { ctx.restore();
ctx.beginPath(); ctx.save();
ctx.moveTo(x + w, y + h); that.handleBorderRect2(ctx, 0, 407 * ratio, 551 * ratio, 236 * ratio, 25 * ratio, '#fff')
ctx.lineTo(x, y + h) ctx.restore();
// 左上角 // 绘制二维码
ctx.arc(x + r, y + r, r, Math.PI, 1.5 * Math.PI); ctx.drawImage(imgs[1].path, 373 * ratio, 495 * ratio, 137 * ratio, 137 * ratio);
ctx.moveTo(x + r, y); // 开始文字绘制
ctx.lineTo(x + w - r, y); ctx.setFillStyle("#000");
ctx.lineTo(x + w, y + r); ctx.setFontSize(30 * ratio); //字大小
// 右上角 ctx.setTextAlign('left'); //是否居中显示,参考点画布中线
ctx.arc(x + w - r, y + r, r, 1.5 * Math.PI, 2 * Math.PI); that.drawText(ctx, that.data.info.title, 25 * ratio, 450 * ratio, 480 * ratio, ratio);
ctx.lineTo(x + w, y + h); // 售价
ctx.lineTo(x + w - r, y + h); ctx.setFillStyle("#D62828");
ctx.fillStyle = color; ctx.setFontSize(40 * ratio); //字大小
ctx.fill(); ctx.setTextAlign('left'); //是否居中显示,参考点画布中线
ctx.closePath(); let price = that.data.info.price ? ("¥" + (that.data.info.price / 100)) : '免费';
}, let width = ctx.measureText(price).width;
handleBorderRect2(ctx, x, y, w, h, r, color) { ctx.fillText(price, 25 * ratio, 620 * ratio);
ctx.beginPath(); // 副标题
ctx.moveTo(x, y); ctx.setFillStyle("#999999");
ctx.lineTo(x + w, y) ctx.setFontSize(28 * ratio); //字大小
// 右下角 ctx.setTextAlign('left'); //是否居中显示,参考点画布中线
ctx.arc(x + w - r, y + h - r, r, 0, 0.5 * Math.PI); let subtitle = that.data.info.display_tags[0];
ctx.lineTo(x + r, y + h); if (subtitle.length > 10) {
ctx.lineTo(x, y + h - r); subtitle = subtitle.substr(0, 10) + '...'
// 左下角 }
ctx.arc(x + r, y + h - r, r, 0.5 * Math.PI, Math.PI); ctx.fillText(subtitle, 25 * ratio, 540 * ratio);
ctx.lineTo(x, y); // ctx.draw();
ctx.lineTo(x, y); // 划线价
ctx.fillStyle = color; // ctx.setFillStyle("#999999");
ctx.fill(); // ctx.setFontSize(32 * ratio); //字大小
ctx.closePath(); // ctx.setTextAlign('left'); //是否居中显示,参考点画布中线
}, // let market_price = "¥" + (Number(that.data.info.market_price) / 100)
// 绘制两行文字 // ctx.fillText(market_price, 40 * ratio + width, 620 * ratio);
drawText: function (ctx, str, x, y, canvasWidth, ratio) { // let market_price_width = ctx.measureText(market_price).width;
let row = [], temp = "", chr = str.split(""); // 划线
for (var a = 0; a < chr.length; a++) { // ctx.beginPath()
if (ctx.measureText(temp).width < canvasWidth) { // ctx.setLineWidth(1)
temp += chr[a]; // ctx.moveTo(40 * ratio + width, 608 * ratio)
} // ctx.lineTo(45 * ratio + width + market_price_width, 608 * ratio)
else { // ctx.stroke();
a--; //这里添加了a-- 是为了防止字符丢失,效果图中有对比 // 长按识别二维码
// ctx.setFillStyle("#666");
// ctx.setFontSize(22 * ratio); //字大小
// ctx.setTextAlign('left'); //是否居中显示,参考点画布中线
// ctx.fillText("长按识别二维码", 404*ratio, 710*ratio);
// 长按图片转发或保存
// ctx.setFillStyle("#000");
// ctx.setFontSize(24 * ratio); //字大小
// ctx.setTextAlign('left'); //是否居中显示,参考点画布中线
// ctx.fillText("长按图片保存到本地",(592*ratio - ctx.measureText("长按图片保存到本地").width)/2, 740*ratio);
ctx.draw();
// 转为图片
setTimeout(() => {
wx.canvasToTempFilePath({
x: 0,
y: 0,
canvasId: 'imageCanvas',
success: function (res) {
that.setData({
shareImg: res.tempFilePath
})
},
fail(err) {
console.log('agdgjgdajhg', err)
}
})
}, 500)
return false;
}).catch(err => {
console.log("this err", err)
})
},
// 圆角矩形
handleBorderRect(ctx, x, y, w, h, r, color) {
ctx.beginPath();
ctx.moveTo(x + w, y + h);
ctx.lineTo(x, y + h)
// 左上角
ctx.arc(x + r, y + r, r, Math.PI, 1.5 * Math.PI);
ctx.moveTo(x + r, y);
ctx.lineTo(x + w - r, y);
ctx.lineTo(x + w, y + r);
// 右上角
ctx.arc(x + w - r, y + r, r, 1.5 * Math.PI, 2 * Math.PI);
ctx.lineTo(x + w, y + h);
ctx.lineTo(x + w - r, y + h);
ctx.fillStyle = color;
ctx.fill();
ctx.closePath();
},
handleBorderRect2(ctx, x, y, w, h, r, color) {
ctx.beginPath();
ctx.moveTo(x, y);
ctx.lineTo(x + w, y)
// 右下角
ctx.arc(x + w - r, y + h - r, r, 0, 0.5 * Math.PI);
ctx.lineTo(x + r, y + h);
ctx.lineTo(x, y + h - r);
// 左下角
ctx.arc(x + r, y + h - r, r, 0.5 * Math.PI, Math.PI);
ctx.lineTo(x, y);
ctx.lineTo(x, y);
ctx.fillStyle = color;
ctx.fill();
ctx.closePath();
},
// 绘制两行文字
drawText: function (ctx, str, x, y, canvasWidth, ratio) {
let row = [],
temp = "",
chr = str.split("");
for (var a = 0; a < chr.length; a++) {
if (ctx.measureText(temp).width < canvasWidth) {
temp += chr[a];
} else {
a--; //这里添加了a-- 是为了防止字符丢失,效果图中有对比
row.push(temp);
temp = "";
}
}
row.push(temp); row.push(temp);
temp = "";
}
}
row.push(temp);
//如果数组长度大于2 则截取前两个 //如果数组长度大于2 则截取前两个
if (row.length > 2) { if (row.length > 2) {
var rowCut = row.slice(0, 2); var rowCut = row.slice(0, 2);
var rowPart = rowCut[1]; var rowPart = rowCut[1];
var test = ""; var test = "";
var empty = []; var empty = [];
for (var a = 0; a < rowPart.length; a++) { for (var a = 0; a < rowPart.length; a++) {
if (ctx.measureText(test).width < canvasWidth - 30 * ratio) { if (ctx.measureText(test).width < canvasWidth - 30 * ratio) {
test += rowPart[a]; test += rowPart[a];
} else {
break;
}
}
empty.push(test);
var group = empty[0] + "..." //这里只显示两行,超出的用...表示
rowCut.splice(1, 1, group);
row = rowCut;
} }
else { for (var b = 0; b < row.length; b++) {
break; ctx.fillText(row[b], x, y + b * 40 * ratio, canvasWidth);
} }
} },
empty.push(test);
var group = empty[0] + "..."//这里只显示两行,超出的用...表示
rowCut.splice(1, 1, group);
row = rowCut;
}
for (var b = 0; b < row.length; b++) {
ctx.fillText(row[b], x, y + b * 40 * ratio, canvasWidth);
}
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () { onReady: function () {
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
if (!wx.getStorageSync('jstrip_token')) { if (!wx.getStorageSync('jstrip_token')) {
return; return;
} }
if (this.data.info && this.data.info.id) { if (this.data.info && this.data.info.id) {
this.drawImg() this.drawImg()
} } else {
else { setTimeout(() => {
setTimeout(() => { this.onShow()
this.onShow() }, 200)
}, 200) }
} },
},
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function () { onHide: function () {
}, },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () { onUnload: function () {
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () { onPullDownRefresh: function () {
}, },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function () {
}, },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { onShareAppMessage: function () {
} }
}) })

4
pages/info/roadInfo/index.json

@ -1,5 +1,7 @@
{ {
"usingComponents": { "usingComponents": {
"title":"/pages/component/TitleHeader" "title":"/pages/component/TitleHeader",
"code":"../../order/components/wxqrCode/index"
} }
} }

4
pages/info/roadInfo/index.wxml

@ -118,4 +118,6 @@
</view> </view>
<view class="save-btn" bindtap="save">保存到相册</view> <view class="save-btn" bindtap="save">保存到相册</view>
</view> </view>
</view> </view>
<code showModel="{{showQrCode}}" qrcode = "{{wxqrcode}}">
</code>

1580
pages/info/sceneProductInfo/index.js

File diff suppressed because it is too large

5
pages/info/sceneProductInfo/index.json

@ -1,6 +1,9 @@
{ {
"usingComponents": { "usingComponents": {
"title":"/pages/component/TitleHeader", "title":"/pages/component/TitleHeader",
"notice":"/pages/component/notice/notice" "notice":"/pages/component/notice/notice",
"code":"../../order/components/wxqrCode/index"
} }
} }

4
pages/info/sceneProductInfo/index.wxml

@ -251,4 +251,6 @@
<view class="rule-title">{{info.allowance.title}}</view> <view class="rule-title">{{info.allowance.title}}</view>
<rich-text nodes="{{info.allowance.content}}"></rich-text> <rich-text nodes="{{info.allowance.content}}"></rich-text>
</view> </view>
</view> </view>
<code showModel="{{showQrCode}}" qrcode = "{{wxqrcode}}">
</code>

473
pages/list/movieticket/list/ticket/index.js

@ -4,252 +4,269 @@ import commonApi from "../../../../../utils/https/common"
import util from "../../../../../utils/util" import util from "../../../../../utils/util"
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
id:null, id: null,
dates:[], dates: [],
days:['周日','周一','周二','周三','周四','周五','周六'], days: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
dateIndex:0, dateIndex: 0,
areas:[], areas: [],
areaIndex:0, areaIndex: 0,
lat:"", lat: "",
lon:"", lon: "",
sort:'distance', sort: 'distance',
list:[], list: [],
title:"", title: "",
page:1, page: 1,
isMore:true isMore: true,
}, showQrCode: false,
wxqrcode: null
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
pagePoint(e) { pagePoint(e) {
util.pagePoint(e) util.pagePoint(e)
}, },
onLoad: function (options) { onLoad: function (options) {
this.setData({
id:options.id,
title:options.title
})
commonApi._post("act/get_suzhou_areas").then(res=>{
res.data.unshift({
area_id:"",
area_title:"苏州"
})
this.setData({
areas:res.data
})
})
this.initDate();
wx.getLocation({
type: 'gcj02',
success:(res)=>{
this.setData({ this.setData({
lat:res.latitude, id: options.id,
lon:res.longitude title: options.title
})
commonApi._post("act/get_suzhou_areas").then(res => {
res.data.unshift({
area_id: "",
area_title: "苏州"
})
this.setData({
areas: res.data
})
})
this.initDate();
wx.getLocation({
type: 'gcj02',
success: (res) => {
this.setData({
lat: res.latitude,
lon: res.longitude
})
this.getList()
},
fail: () => {
this.getList()
}
})
},
changeSort: function (e) {
let sort = e.currentTarget.dataset.sort;
this.setData({
sort: this.data.sort == sort ? null : sort,
list: [],
page: 1,
isMore: true
})
if (this.data.sort == 'distance' && !this.data.lon) {
wx.getLocation({
type: 'gcj02',
success: (res) => {
this.setData({
lat: res.latitude,
lon: res.longitude
})
this.getList()
},
fail: () => {
this.getList()
}
})
} else {
this.getList()
}
},
changeDateIndex: function (e) {
this.setData({
dateIndex: e.currentTarget.dataset.index,
list: [],
page: 1,
isMore: true
}) })
this.getList() this.getList()
}, },
fail:()=>{ changeArea: function (e) {
this.setData({
areaIndex: e.detail.value,
list: [],
page: 1,
isMore: true
})
this.getList() this.getList()
} },
}) initDate: function () {
}, let today = new Date(util.formatDate(new Date()).replace(/-/g, '/')).getTime(),
changeSort:function(e){ single = 24 * 60 * 60 * 1000,
let sort = e.currentTarget.dataset.sort; dates = [];
this.setData({ for (let i = 0; i < 7; i++) {
sort:this.data.sort==sort?null:sort, let item = new Date(today + i * single);
list:[], let name = this.data.days[item.getDay()]
page:1, if (i == 0) {
isMore:true name = "今天"
}) } else if (i == 1) {
if(this.data.sort=='distance' && !this.data.lon){ name = "明天"
wx.getLocation({ }
type: 'gcj02', dates.push({
success:(res)=>{ date: util.formatDate(item),
this.setData({ dateShort: util.formatDate(item).substr(5, 5),
lat:res.latitude, name: name
lon:res.longitude })
})
this.getList()
},
fail:()=>{
this.getList()
} }
})
}
else {
this.getList()
}
},
changeDateIndex:function(e){
this.setData({
dateIndex:e.currentTarget.dataset.index,
list:[],
page:1,
isMore:true
})
this.getList()
},
changeArea:function(e){
this.setData({
areaIndex:e.detail.value,
list:[],
page:1,
isMore:true
})
this.getList()
},
initDate:function(){
let today = new Date(util.formatDate(new Date()).replace(/-/g,'/')).getTime(),single = 24 * 60 * 60 *1000,dates=[];
for(let i=0;i<7;i++){
let item = new Date(today+i * single);
let name = this.data.days[item.getDay()]
if(i==0){
name="今天"
}
else if(i==1){
name="明天"
}
dates.push({
date:util.formatDate(item),
dateShort:util.formatDate(item).substr(5,5),
name:name
})
}
this.setData({
dates:dates
})
console.log(dates)
},
getList:function(){
if(!this.data.isMore) return
commonApi._post("Cinema/getCinemaListByShowId",{
third_id:this.data.id,
show_date:this.data.dates[this.data.dateIndex].date,
city_code:this.data.areas[this.data.areaIndex]?this.data.areas[this.data.areaIndex].area_id:"",
lon:this.data.lon,
lat:this.data.lat,
is_price_sort:this.data.sort=='price'?true:false,
is_distance_sort:this.data.sort=='distance',
page:this.data.page,
pageSize:10
}).then(res=>{
res.data.map(item=>{
if(item.distance>1000){
item.distanceText = (item.distance/1000).toFixed(2) + 'km';
}
else if(item.distance>0){
item.distanceText = (item.distance).toFixed(2) + 'm';
}
})
let list = this.data.list;
this.setData({
list:list.concat(res.data),
page:this.data.page+1
})
if(res.data.length<10){
this.setData({ this.setData({
isMore:false dates: dates
}) })
} console.log(dates)
console.log(res) },
}) getList: function () {
}, if (!this.data.isMore) return
selectMovieSeat(e){ commonApi._post("Cinema/getCinemaListByShowId", {
let info = e.currentTarget.dataset.info third_id: this.data.id,
let index = e.currentTarget.dataset.index show_date: this.data.dates[this.data.dateIndex].date,
console.log(index); city_code: this.data.areas[this.data.areaIndex] ? this.data.areas[this.data.areaIndex].area_id : "",
console.log(info.schedules); lon: this.data.lon,
const areaInfo = JSON.parse(info.schedules[index].schedule_area).map(item => ({...item, price:item.areaPrice,areaId:item.seatAreaId})); lat: this.data.lat,
let planData = { is_price_sort: this.data.sort == 'price' ? true : false,
areaInfo, is_distance_sort: this.data.sort == 'distance',
fee:info.schedules[index].service_fee, page: this.data.page,
movieName: this.data.title, pageSize: 10
planId : info.schedules[index].schedule_id, }).then(res => {
planTime : info.schedules[index].show_time, res.data.map(item => {
type:'WECHATXCX', if (item.distance > 1000) {
remake : '' item.distanceText = (item.distance / 1000).toFixed(2) + 'km';
} } else if (item.distance > 0) {
let show_id = info.schedules[index].show_id item.distanceText = (item.distance).toFixed(2) + 'm';
let cinema_id = info.schedules[index].cinema_id }
// let schedule_id = info.schedule_id })
console.log(info); let list = this.data.list;
commonApi._post('Cinema/getProductAndSku',{ this.setData({
show_id, list: list.concat(res.data),
cinema_id, page: this.data.page + 1
}).then(res=>{ })
app.globalData.product ={ if (res.data.length < 10) {
product:res.data, this.setData({
info:{ isMore: false
hallName:info.schedules[index].hall_name, })
cinemaName:info.title, }
show_date:info.schedules[index].show_date, console.log(res)
show_time:info.schedules[index].show_time, })
close_time:info.schedules[index].close_time, },
movieName:this.data.title, selectMovieSeat(e) {
start_end_time:info.schedules[index].show_time, commonApi.user_post('wx/get_user_keep', {
show_version:info.schedules[index].show_version, jumpurl: '/pages/list/movieticket/list/ticket/index?id=' + this.data.id,
selectSeatInfo:null, title: this.data.title,
schedule_id:info.schedules[index].schedule_id type: 'mini'
} }).then(res => {
} if (res.data.subscribe == 0) {
console.log(planData); this.setData({
wx.navigateTo({ wxqrcode: res.data.qrcode,
url:"/pages/list/movieticket/list/web/index?planData="+ JSON.stringify(planData), showQrCode: true
}) })
}) } else {
}, let info = e.currentTarget.dataset.info
/** let index = e.currentTarget.dataset.index
* 生命周期函数--监听页面初次渲染完成 console.log(index);
*/ console.log(info.schedules);
onReady: function () { const areaInfo = JSON.parse(info.schedules[index].schedule_area).map(item => ({
...item,
price: item.areaPrice,
areaId: item.seatAreaId
}));
let planData = {
areaInfo,
fee: info.schedules[index].service_fee,
movieName: this.data.title,
planId: info.schedules[index].schedule_id,
planTime: info.schedules[index].show_time,
type: 'WECHATXCX',
remake: ''
}
let show_id = info.schedules[index].show_id
let cinema_id = info.schedules[index].cinema_id
// let schedule_id = info.schedule_id
console.log(info);
commonApi._post('Cinema/getProductAndSku', {
show_id,
cinema_id,
}).then(res => {
app.globalData.product = {
product: res.data,
info: {
hallName: info.schedules[index].hall_name,
cinemaName: info.title,
show_date: info.schedules[index].show_date,
show_time: info.schedules[index].show_time,
close_time: info.schedules[index].close_time,
movieName: this.data.title,
start_end_time: info.schedules[index].show_time,
show_version: info.schedules[index].show_version,
selectSeatInfo: null,
schedule_id: info.schedules[index].schedule_id
}
}
console.log(planData);
wx.navigateTo({
url: "/pages/list/movieticket/list/web/index?planData=" + JSON.stringify(planData),
})
})
}})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function () { onHide: function () {
}, },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () { onUnload: function () {
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () { onPullDownRefresh: function () {
}, },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function () {
this.getList() this.getList()
}, },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { onShareAppMessage: function () {
} }
}) })

3
pages/list/movieticket/list/ticket/index.json

@ -1,5 +1,6 @@
{ {
"usingComponents": { "usingComponents": {
"title":"/pages/component/TitleHeader" "title":"/pages/component/TitleHeader",
"code":"../../../../order/components/wxqrCode/index"
} }
} }

4
pages/list/movieticket/list/ticket/index.wxml

@ -43,4 +43,6 @@
<image mode="widthFix" src="https://static.ticket.sz-trip.com/xcxImages/other/nodata.png"></image> <image mode="widthFix" src="https://static.ticket.sz-trip.com/xcxImages/other/nodata.png"></image>
<view>暂无内容</view> <view>暂无内容</view>
</view> </view>
</view> </view>
<code showModel="{{showQrCode}}" qrcode = "{{wxqrcode}}">
</code>

42
pages/order/components/wxqrCode/index.js

@ -0,0 +1,42 @@
// pages/order/components/coupon/index.js
let app = getApp()
Component({
/**
* 组件的属性列表
*/
properties: {
showModel:{
type:Boolean,
value:false
},
qrcode:{
type:String,
value:null
}
},
/**
* 组件的初始数据
*/
data: {
},
pageLifetimes: {
show: function() {
console.log(123123);
}
},
/**
* 组件的方法列表
*/
methods: {
submit: function() {
this.setData({
showModel:false
})
}
}
})

4
pages/order/components/wxqrCode/index.json

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

13
pages/order/components/wxqrCode/index.wxml

@ -0,0 +1,13 @@
<view class="mask" catchtouchmove="preventTouchMove" wx:if="{{showModel}}"></view>
<view class="modalDlg" wx:if="{{showModel}}">
<view class="img-box">
<image class="codeImg" src="{{qrcode}}" show-menu-by-longpress="{{true}}"></image>
</view>
<view class="text-box">
扫码关注<text>【君到苏州】</text> 微信公众号
</view>
<view class="more">
查看更多旅游资讯
</view>
<image bindtap="submit" class="close" src="https://static.ticket.sz-trip.com/uploads/20230619/c62511826c880bddc20f98011a87a5a9.png" mode=""/>
</view>

70
pages/order/components/wxqrCode/index.wxss

@ -0,0 +1,70 @@
.mask{
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background: #000;
z-index: 9000;
opacity: 0.7;
}
.modalDlg{
width: 500rpx;
height: 660rpx;
background-image:url('https://static.ticket.sz-trip.com/uploads/20230619/12a423ee9510a8e5c9c92696e52fcc3c.png') ;
background-size: 100% 100%;
position: fixed;
top: 50%;
left: 0;
z-index: 9999;
margin: -370rpx 125rpx;
background-color: #fff;
border-radius: 36rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.img-box{
width: 300rpx;
height: 300rpx;
background: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
margin-top: 79rpx;
}
.img-box image{
width: 310rpx;
height: 310rpx;
border-radius: 10rpx;
}
.text-box{
width: 300rpx;
font-size: 30rpx;
font-family: PingFang SC;
font-weight: bold;
color: #FFFFFF;
text-align: center;
margin-top: 40rpx;
}
.text-box text{
color: rgba(255, 255, 85, 1);
}
.more{
margin-top: 80rpx;
font-size: 30rpx;
font-family: PingFang SC;
font-weight: bold;
color: #0B898E;
}
.close{
position: absolute;
bottom: -120rpx;
left: 50%;
height: 80rpx;
width: 80rpx;
transform: translate(-40rpx,0);
}

9
pages/order/movie/index.wxml

@ -11,11 +11,6 @@
<view>{{product.info.hallName}} <text wx:if="{{product.info.selectSeatInfo}}">{{product.info.selectSeatInfo.seatInfo}}</text></view> <view>{{product.info.hallName}} <text wx:if="{{product.info.selectSeatInfo}}">{{product.info.selectSeatInfo.seatInfo}}</text></view>
</view> </view>
</view> </view>
<view class="tel-box">
<text>手机号码:</text>
<input value="{{tel}}" type="number" bindinput="changeTel" placeholder="输入您的手机号"></input>
</view>
</view> </view>
<view class="tips"> <view class="tips">
@ -32,6 +27,10 @@
</view> </view>
</view> </view>
</view> </view>
<view class="tel-box">
<text>手机号码:</text>
<input value="{{tel}}" type="number" bindinput="changeTel" placeholder="输入您的手机号"></input>
</view>
<coupon money="{{price}}" sku="{{product.product.sku_info.id}}"></coupon> <coupon money="{{price}}" sku="{{product.product.sku_info.id}}"></coupon>

8
pages/order/movie/index.wxss

@ -14,7 +14,7 @@ page {
display: flex; display: flex;
padding-top: 30rpx; padding-top: 30rpx;
padding-bottom: 41rpx; padding-bottom: 41rpx;
border-bottom: 1rpx solid #ccc; /* border-bottom: 1rpx solid #ccc; */
font-size: 27rpx; font-size: 27rpx;
color: #999; color: #999;
justify-content: space-between; justify-content: space-between;
@ -42,7 +42,11 @@ page {
align-items: center; align-items: center;
height: 126rpx; height: 126rpx;
font-size: 31rpx; font-size: 31rpx;
justify-content: space-between; justify-content: space-between;
margin: 30rpx 25rpx;
background: white;
border-radius: 9rpx;
padding: 0 20rpx;
} }
.tel-box>text { .tel-box>text {
color: #000; color: #000;

688
pages/user/cartlist/list.js

@ -1,6 +1,6 @@
// pages/user/cartlist/list.js // pages/user/cartlist/list.js
const device = wx.getSystemInfoSync(), const device = wx.getSystemInfoSync(),
rect = wx.getMenuButtonBoundingClientRect(); // 获取设备信息 rect = wx.getMenuButtonBoundingClientRect(); // 获取设备信息
const ratio = 750 / device.windowWidth; const ratio = 750 / device.windowWidth;
console.log(rect) console.log(rect)
const width = device.windowWidth // 示例为一个与屏幕等宽的正方形裁剪框 const width = device.windowWidth // 示例为一个与屏幕等宽的正方形裁剪框
@ -10,357 +10,373 @@ import util from '../../../utils/util'
let app = getApp() let app = getApp()
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
menuWidth: width - rect.right + rect.width + 6, menuWidth: width - rect.right + rect.width + 6,
list: [], list: [],
allChecked: false, allChecked: false,
allPrice: 0, allPrice: 0,
productType: '', productType: '',
manageFlag: false, manageFlag: false,
flag: false, //判断订单是否同时有商品和票 flag: false, //判断订单是否同时有商品和票
isCar:'single',//判断是否购物车 isCar: 'single', //判断是否购物车
}, showQrCode: false,
wxqrcode: null
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
wx.removeStorageSync('linkMan') wx.removeStorageSync('linkMan')
this.getList(); this.getList();
}, },
manage: function () { manage: function () {
let list = this.data.list; let list = this.data.list;
list.map(item => { list.map(item => {
item.checked = 0; item.checked = 0;
})
this.setData({
manageFlag: !this.data.manageFlag,
allChecked: 0,
list: list,
allPrice: 0
})
},
gotoDetail: function (e) {
console.log(e)
let item = e.currentTarget.dataset.item.product;
util.gotoDetail(item, 1);
},
getList: function () {
commonApi.user_post("cart/get_list", {
// type: '1'
}).then(res => {
this.setData({
list: res.data
})
})
},
minus: function (e) {
let index = e.currentTarget.dataset.index,
list = this.data.list;
let num = list[index].num;
if (num <= 1) return;
num = num - 1;
list[index].num = num;
this.setData({
list: list
})
this.changeNumber(list[index])
this.updatePrice()
},
add: function (e) {
let index = e.currentTarget.dataset.index,
list = this.data.list;
let num = list[index].num + 1;
list[index].num = num;
this.setData({
list: list
})
this.changeNumber(list[index])
this.updatePrice()
},
select: function (e) {
let index = e.currentTarget.dataset.index,
list = this.data.list;
if (list[index].product.flag != 1 || list[index].sku.flag != 'on') {
if (!this.data.manageFlag) {
wx.showToast({
title: '产品已下架',
icon: 'none'
}) })
return; this.setData({
} manageFlag: !this.data.manageFlag,
} allChecked: 0,
list[index].checked = list[index].checked ? false : true; list: list,
this.setData({ allPrice: 0
list: list })
}) },
let flag = true gotoDetail: function (e) {
list.forEach(item => { console.log(e)
if (!item.checked) { let item = e.currentTarget.dataset.item.product;
flag = false util.gotoDetail(item, 1);
return },
} getList: function () {
}); commonApi.user_post("cart/get_list", {
this.setData({ // type: '1'
allChecked:flag }).then(res => {
}) this.setData({
this.updatePrice() list: res.data
}, })
selectAll: function () { })
let list = this.data.list, },
allChecked = this.data.allChecked ? false : true; minus: function (e) {
list.map(item => { let index = e.currentTarget.dataset.index,
if (item.sku.flag == 'on' && item.product.flag == 1) { list = this.data.list;
item.checked = allChecked; let num = list[index].num;
} if (num <= 1) return;
}) num = num - 1;
this.setData({ list[index].num = num;
allChecked: allChecked, this.setData({
list: list list: list
}) })
this.updatePrice() this.changeNumber(list[index])
}, this.updatePrice()
changeNumber(item) { },
commonApi.user_post("cart/update_sku", { add: function (e) {
sku_id: item.sku.id, let index = e.currentTarget.dataset.index,
num: item.num list = this.data.list;
}).then(res => {}) let num = list[index].num + 1;
}, list[index].num = num;
updatePrice: function () { this.setData({
let list = this.data.list, list: list
price = 0; })
list.map(item => { this.changeNumber(list[index])
if (item.checked) { this.updatePrice()
price = price + item.sku.price * item.num; },
} select: function (e) {
}) let index = e.currentTarget.dataset.index,
this.setData({ list = this.data.list;
allPrice: price if (list[index].product.flag != 1 || list[index].sku.flag != 'on') {
}) if (!this.data.manageFlag) {
}, wx.showToast({
order: function () { title: '产品已下架',
app.globalData.couponInfo = null; icon: 'none'
util.pagePoint({ })
event: 'cart_order' return;
}, 1) }
let list = this.data.list,
price = 0,
product = [],
product1 = []
list.map(item => {
if (item.checked) {
// item.product.type="post";
if (item.product.type == 'post') {
product.push({
product: item.product,
sku: item.sku,
productNum: item.num
})
} else {
product1.push(item)
app.globalData.list = product1
}
if (item.product.type.includes('post')) {
this.data.productType = 'post'
}
}
})
if (product.length == 0 && product1.length == 0) {
wx.showToast({
title: '请先选择产品',
icon: 'none'
})
return;
}
if (product.length > 0 && product1.length > 0) {
this.setData({
flag: 'mix',
isCar:'multiple'
})
}
if ( product1.length > 1) {
this.setData({
isCar:'multiple'
})
}else{
this.setData({
isCar:'single'
})
}
console.log(product1);
app.globalData.postProduct = product;
if (app.globalData.list) {
app.globalData.product = app.globalData.list[app.globalData.index]
}
if (this.data.productType == 'post') {
console.log(this.data.flag);
wx.navigateTo({
url: '/pages/order/postOrder/index?from=cart&flag=' + this.data.flag,
})
} else {
wx.navigateTo({
url: '/pages/order/scene/index?isCar=' + this.data.isCar,
})
}
},
touchStart(e) { //移动前点击的位置
console.log(e)
// 在开始触摸时将所有startTouchMove设置为flase,对当前的为true
this.data.list.forEach(cart => {
if (cart.isTouchMove) //当istouchMove为true
cart.isTouchMove = false; //其它的对象都为false
})
this.setData({
startX: e.changedTouches[0].clientX,
startY: e.changedTouches[0].clientY,
list: this.data.list
})
},
touchmove(e) { //移动的位置,用于计算用户滑动的弧度向左还是向右,移动了多少,可以确定删除功能的显示和隐藏
let index = e.currentTarget.dataset.index;
// 获取开始的x,y坐标
let startX = this.data.startX,
startY = this.data.startY;
// 获取移动的x,x坐标
let touchMoveX = e.changedTouches[0].clientX,
touchMoveY = e.changedTouches[0].clientY;
// 调用计算角度的方法,获取角度
var angel = this.angel({
X: startX,
Y: startY
}, {
X: touchMoveX,
Y: touchMoveY
})
// 遍历cartArray
this.data.list.forEach((cart, i) => {
cart.isTouchMove = false;
// 滑动角度大于30,直接return 视为非滑动意思
if (Math.abs(angel) > 30) return;
// 匹配当前所点击的list和滑动的list
if (i == index) {
// 匹配上后判断滑动方向
if (touchMoveX > startX) { //左滑动隐藏删除
cart.isTouchMove = false;
} else {
cart.isTouchMove = true;
} }
} list[index].checked = list[index].checked ? false : true;
}) this.setData({
// 更新数据 list: list
this.setData({ })
list: this.data.list let flag = true
}) list.forEach(item => {
}, if (!item.checked) {
angel(start, end) { //计算滑动的角度 flag = false
// console.log(start,end) return
// 移动坐标减去对应的开始坐标 }
var _X = end.X - start.X, });
_Y = end.Y - start.Y; this.setData({
// 返回角度 Math.atan() 返回数字的正切值 allChecked: flag
return 360 * Math.atan(_Y / _X) / (2 * Math.PI) })
}, this.updatePrice()
del: function (e) { },
let index = e.currentTarget.dataset.index, selectAll: function () {
list = this.data.list; let list = this.data.list,
commonApi.user_post("cart/del_sku", { allChecked = this.data.allChecked ? false : true;
sku_id: list[index].sku_id list.map(item => {
}).then(res => { if (item.sku.flag == 'on' && item.product.flag == 1) {
if (res.code == 1) { item.checked = allChecked;
wx.showToast({ }
title: '删除成功', })
icon: "success" this.setData({
allChecked: allChecked,
list: list
})
this.updatePrice()
},
changeNumber(item) {
commonApi.user_post("cart/update_sku", {
sku_id: item.sku.id,
num: item.num
}).then(res => { })
},
updatePrice: function () {
let list = this.data.list,
price = 0;
list.map(item => {
if (item.checked) {
price = price + item.sku.price * item.num;
}
}) })
list.splice(index, 1);
this.setData({ this.setData({
list: list allPrice: price
}) })
} },
}) order: function () {
}, commonApi.user_post('wx/get_user_keep', {
delM() { jumpurl: '/pages/user/cartlist/list',
let that = this title: '购物车',
let arr = this.data.list type: 'mini'
let suid = [] }).then(res => {
arr.forEach(item => { if (res.data.subscribe == 0) {
if (item.checked) { this.setData({
suid.push(item.sku_id) wxqrcode: res.data.qrcode,
} showQrCode: true
}); })
let skuids = suid.join(',') } else {
wx.showModal({ app.globalData.couponInfo = null;
title: '提示', util.pagePoint({
content: '确定要删除选定的产品?', event: 'cart_order'
success: function (res) { }, 1)
if (res.confirm) { let list = this.data.list,
commonApi.user_post("cart/del_sku", { price = 0,
sku_id:skuids product = [],
}).then(res => { product1 = []
list.map(item => {
if (item.checked) {
// item.product.type="post";
if (item.product.type == 'post') {
product.push({
product: item.product,
sku: item.sku,
productNum: item.num
})
} else {
product1.push(item)
app.globalData.list = product1
}
if (item.product.type.includes('post')) {
this.data.productType = 'post'
}
}
})
if (product.length == 0 && product1.length == 0) {
wx.showToast({
title: '请先选择产品',
icon: 'none'
})
return;
}
if (product.length > 0 && product1.length > 0) {
this.setData({
flag: 'mix',
isCar: 'multiple'
})
}
if (product1.length > 1) {
this.setData({
isCar: 'multiple'
})
} else {
this.setData({
isCar: 'single'
})
}
console.log(product1);
app.globalData.postProduct = product;
if (app.globalData.list) {
app.globalData.product = app.globalData.list[app.globalData.index]
}
if (this.data.productType == 'post') {
console.log(this.data.flag);
wx.navigateTo({
url: '/pages/order/postOrder/index?from=cart&flag=' + this.data.flag,
})
} else {
wx.navigateTo({
url: '/pages/order/scene/index?isCar=' + this.data.isCar,
})
}
}
})
},
touchStart(e) { //移动前点击的位置
console.log(e)
// 在开始触摸时将所有startTouchMove设置为flase,对当前的为true
this.data.list.forEach(cart => {
if (cart.isTouchMove) //当istouchMove为true
cart.isTouchMove = false; //其它的对象都为false
})
this.setData({
startX: e.changedTouches[0].clientX,
startY: e.changedTouches[0].clientY,
list: this.data.list
})
},
touchmove(e) { //移动的位置,用于计算用户滑动的弧度向左还是向右,移动了多少,可以确定删除功能的显示和隐藏
let index = e.currentTarget.dataset.index;
// 获取开始的x,y坐标
let startX = this.data.startX,
startY = this.data.startY;
// 获取移动的x,x坐标
let touchMoveX = e.changedTouches[0].clientX,
touchMoveY = e.changedTouches[0].clientY;
// 调用计算角度的方法,获取角度
var angel = this.angel({
X: startX,
Y: startY
}, {
X: touchMoveX,
Y: touchMoveY
})
// 遍历cartArray
this.data.list.forEach((cart, i) => {
cart.isTouchMove = false;
// 滑动角度大于30,直接return 视为非滑动意思
if (Math.abs(angel) > 30) return;
// 匹配当前所点击的list和滑动的list
if (i == index) {
// 匹配上后判断滑动方向
if (touchMoveX > startX) { //左滑动隐藏删除
cart.isTouchMove = false;
} else {
cart.isTouchMove = true;
}
}
})
// 更新数据
this.setData({
list: this.data.list
})
},
angel(start, end) { //计算滑动的角度
// console.log(start,end)
// 移动坐标减去对应的开始坐标
var _X = end.X - start.X,
_Y = end.Y - start.Y;
// 返回角度 Math.atan() 返回数字的正切值
return 360 * Math.atan(_Y / _X) / (2 * Math.PI)
},
del: function (e) {
let index = e.currentTarget.dataset.index,
list = this.data.list;
commonApi.user_post("cart/del_sku", {
sku_id: list[index].sku_id
}).then(res => {
if (res.code == 1) { if (res.code == 1) {
wx.showToast({ wx.showToast({
title: '删除成功', title: '删除成功',
icon: "success" icon: "success"
}) })
that.getList(); list.splice(index, 1);
this.setData({
list: list
})
} }
}) })
},
} else { delM() {
console.log('取消') let that = this
} let arr = this.data.list
} let suid = []
}) arr.forEach(item => {
}, if (item.checked) {
/** suid.push(item.sku_id)
* 生命周期函数--监听页面初次渲染完成 }
*/ });
onReady: function () { let skuids = suid.join(',')
wx.showModal({
title: '提示',
content: '确定要删除选定的产品?',
success: function (res) {
if (res.confirm) {
commonApi.user_post("cart/del_sku", {
sku_id: skuids
}).then(res => {
if (res.code == 1) {
wx.showToast({
title: '删除成功',
icon: "success"
})
that.getList();
}
})
}, } else {
console.log('取消')
}
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
/** },
* 生命周期函数--监听页面显示
*/
onShow: function () {
util.pagePoint({
event: 'cart_view'
}, 1)
app.globalData.list = null
app.globalData.createDate = null
app.globalData.index = 0
app.globalData.productPrice = 0
app.globalData.ticketPrice = 0
this.data.productType = ''
},
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面显示
*/ */
onHide: function () { onShow: function () {
util.pagePoint({
event: 'cart_view'
}, 1)
app.globalData.list = null
app.globalData.createDate = null
app.globalData.index = 0
app.globalData.productPrice = 0
app.globalData.ticketPrice = 0
this.data.productType = ''
},
}, /**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
/** },
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
}, /**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
/** },
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
}, /**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
/** },
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
} /**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
}
}) })

3
pages/user/cartlist/list.json

@ -1,5 +1,6 @@
{ {
"usingComponents": { "usingComponents": {
"title": "/pages/component/TitleHeader" "title": "/pages/component/TitleHeader",
"code":"../../order/components/wxqrCode/index"
} }
} }

4
pages/user/cartlist/list.wxml

@ -41,4 +41,6 @@
<view class="iconfont{{allChecked?' icon-gou':' icon-quan'}}" bindtap="selectAll"></view> <view class="iconfont{{allChecked?' icon-gou':' icon-quan'}}" bindtap="selectAll"></view>
<text style="color:#666;font-size:26rpx;flex-shrink:0;margin-left:10rpx;flex:1">全选</text> <text style="color:#666;font-size:26rpx;flex-shrink:0;margin-left:10rpx;flex:1">全选</text>
<view class="fixed-btn del-btn" bindtap="delM">删除</view> <view class="fixed-btn del-btn" bindtap="delM">删除</view>
</view> </view>
<code showModel="{{showQrCode}}" qrcode = "{{wxqrcode}}">
</code>
Loading…
Cancel
Save