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,
retailId: "",
shareImg: null,
showShareFlag: false
showShareFlag: false,
showQrCode: false,
wxqrcode: null
},
/**
@ -127,44 +129,72 @@ Page({
})
},
order: function (e) {
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',
console.log(this.data.sceneInfo);
commonApi.user_post('wx/get_user_keep', {
jumpurl: '/pages/info/hotelProductInfo/index?id=' + this.data.id,
title: this.data.sceneInfo.title,
type: 'mini'
}).then(res => {
if (res.data.subscribe == 0) {
this.setData({
wxqrcode: res.data.qrcode,
showQrCode: true
})
} 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) {
let item = e.currentTarget.dataset.item, product = e.currentTarget.dataset.product;
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;
item.id = item.sku_id;
// item.product_id = product.real_room_id;
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',
})
commonApi.user_post('wx/get_user_keep', {
jumpurl: '/pages/info/hotelProductInfo/index?id=' + this.data.id,
title: this.data.sceneInfo.title,
type: 'mini'
}).then(res => {
if (res.data.subscribe == 0) {
this.setData({
wxqrcode: res.data.qrcode,
showQrCode: true
})
} else {
let item = e.currentTarget.dataset.item, product = e.currentTarget.dataset.product;
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;
item.id = item.sku_id;
// item.product_id = product.real_room_id;
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) {
let d = new Date(date.replace(/-/g, '/')).getDay();

4
pages/info/hotelProductInfo/index.json

@ -1,6 +1,8 @@
{
"usingComponents": {
"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>
<view class="product-info textOver">
<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="mt-price">{{item.low_price>0?item.low_price/100:'0'}}</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²'):''}} {{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 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>
@ -216,4 +217,6 @@
</view>
<view class="save-btn" bindtap="save">保存到相册</view>
</view>
</view>
</view>
<code showModel="{{showQrCode}}" qrcode = "{{wxqrcode}}">
</code>

57
pages/info/museumInfo/index.js

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

4
pages/info/museumInfo/index.json

@ -1,6 +1,8 @@
{
"usingComponents": {
"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 class="save-btn" bindtap="save">保存到相册</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": {
"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>
<rich-text nodes="{{allowance_data.content}}"></rich-text>
</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()
Page({
/**
* 页面的初始数据
*/
data: {
fixed: false,
type: 1,
top: 0,
info: null,
comment: [],
commentTotal: 0,
retailId: "",
retailSkuId: "",
shareImg: null,
showShareFlag: false
},
/**
* 页面的初始数据
*/
data: {
fixed: false,
type: 1,
top: 0,
info: null,
comment: [],
commentTotal: 0,
retailId: "",
retailSkuId: "",
shareImg: null,
showShareFlag: false,
showQrCode: false,
wxqrcode: null
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let rect = wx.getMenuButtonBoundingClientRect();
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];
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let rect = wx.getMenuButtonBoundingClientRect();
let height = (rect.top - device.statusBarHeight) * 2 + rect.height + device.statusBarHeight;
this.setData({
retailSkuId: options.skuid
})
}
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 => {
top: height,
id: options.id
})
}
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({
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
})
if (options.retailId) {
this.setData({
retailId: options.retailId
})
}
else {
that.setData({
type: 1
})
let api = commonApi._post;
if (wx.getStorageSync("jstrip_token")) {
api = commonApi.user_post;
}
})
}).exec()
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);
},
order: function () {
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({
event:'product_share_login',
param:{
id:that.data.info.id,
type:that.data.info.type
}
},1)
commonApi.user_post("user/getMyInfo", {}).then(res => {
if (options.skuid) {
let sku = res.data.sku.find(item => item.id == options.skuid);
res.data.sku = [sku];
this.setData({
retailSkuId: options.skuid
})
}
res.data.flag = res.data.sku.find(item => item.flag == 'on') ? res.data.flag : 0
})
return;
}
if (!this.data.shareImg) {
wx.showToast({
title: '图片生成中,稍后再试',
icon: 'none'
})
return;
}
this.setData({
showShareFlag: !this.data.showShareFlag
})
},
// 保存
save() {
let url = this.data.shareImg, that = this;
wx.authorize({
/* 这个就是保存相册的 */
scope: 'scope.writePhotosAlbum',
success() {
wx.saveImageToPhotosAlbum({
filePath: url,
success(res) {
wx.showToast({
title: '保存成功',
icon: "success"
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 => {})
} 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({
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({
event:'product_share_save',
param:{
id:that.data.info.id,
type:that.data.info.type
}
},1)
},
fail(res) {
event: 'product_share_login',
param: {
id: that.data.info.id,
type: that.data.info.type
}
}, 1)
commonApi.user_post("user/getMyInfo", {}).then(res => {
})
return;
}
if (!this.data.shareImg) {
wx.showToast({
title: '保存失败',
icon: 'none'
title: '图片生成中,稍后再试',
icon: 'none'
})
}
return;
}
this.setData({
showShareFlag: !this.data.showShareFlag
})
},
complete(res) {
console.log(res);
/* 这里判断一下如果没有授权重新打开设置选项 */
wx.getSetting({
success(res) {
if (!res.authSetting['scope.writePhotosAlbum']) {
/* 打开设置的方法 */
// opensit();
wx.showToast({
title: '请打开权限后再试',
icon: 'none'
})
},
// 保存
save() {
let url = this.data.shareImg,
that = this;
wx.authorize({
/* 这个就是保存相册的 */
scope: 'scope.writePhotosAlbum',
success() {
wx.saveImageToPhotosAlbum({
filePath: url,
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 () {
var that = this, userinfo = wx.getStorageSync('jstrip_userInfo');
if (!userinfo) {
// 去登录
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);
},
// 绘制海报
drawImg: function () {
var that = this,
userinfo = wx.getStorageSync('jstrip_userInfo');
if (!userinfo) {
// 去登录
return false;
}
})
})
//成功得到图片信息后,开始绘图
Promise.all([promise2, promise3]).then(imgs => {
ctx.save();
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);
ctx.restore();
ctx.save();
that.handleBorderRect2(ctx, 0, 407 * ratio, 551 * ratio, 236 * ratio, 25 * ratio, '#fff')
ctx.restore();
// 绘制二维码
ctx.drawImage(imgs[1].path, 373 * ratio, 495 * ratio, 137 * ratio, 137 * ratio);
// 开始文字绘制
ctx.setFillStyle("#000");
ctx.setFontSize(30 * ratio); //字大小
ctx.setTextAlign('left'); //是否居中显示,参考点画布中线
that.drawText(ctx, that.data.info.title, 25 * ratio, 450 * ratio, 480 * ratio, ratio);
// 售价
ctx.setFillStyle("#D62828");
ctx.setFontSize(40 * ratio); //字大小
ctx.setTextAlign('left'); //是否居中显示,参考点画布中线
let price = that.data.info.price ? ("¥" + (that.data.info.price / 100)) : '免费';
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
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);
}
})
},
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-- 是为了防止字符丢失,效果图中有对比
//成功得到图片信息后,开始绘图
Promise.all([promise2, promise3]).then(imgs => {
ctx.save();
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);
ctx.restore();
ctx.save();
that.handleBorderRect2(ctx, 0, 407 * ratio, 551 * ratio, 236 * ratio, 25 * ratio, '#fff')
ctx.restore();
// 绘制二维码
ctx.drawImage(imgs[1].path, 373 * ratio, 495 * ratio, 137 * ratio, 137 * ratio);
// 开始文字绘制
ctx.setFillStyle("#000");
ctx.setFontSize(30 * ratio); //字大小
ctx.setTextAlign('left'); //是否居中显示,参考点画布中线
that.drawText(ctx, that.data.info.title, 25 * ratio, 450 * ratio, 480 * ratio, ratio);
// 售价
ctx.setFillStyle("#D62828");
ctx.setFontSize(40 * ratio); //字大小
ctx.setTextAlign('left'); //是否居中显示,参考点画布中线
let price = that.data.info.price ? ("¥" + (that.data.info.price / 100)) : '免费';
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;
}).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);
temp = "";
}
}
row.push(temp);
//如果数组长度大于2 则截取前两个
if (row.length > 2) {
var rowCut = row.slice(0, 2);
var rowPart = rowCut[1];
var test = "";
var empty = [];
for (var a = 0; a < rowPart.length; a++) {
if (ctx.measureText(test).width < canvasWidth - 30 * ratio) {
test += rowPart[a];
//如果数组长度大于2 则截取前两个
if (row.length > 2) {
var rowCut = row.slice(0, 2);
var rowPart = rowCut[1];
var test = "";
var empty = [];
for (var a = 0; a < rowPart.length; a++) {
if (ctx.measureText(test).width < canvasWidth - 30 * ratio) {
test += rowPart[a];
} else {
break;
}
}
empty.push(test);
var group = empty[0] + "..." //这里只显示两行,超出的用...表示
rowCut.splice(1, 1, group);
row = rowCut;
}
else {
break;
for (var b = 0; b < row.length; b++) {
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 () {
if (!wx.getStorageSync('jstrip_token')) {
return;
}
if (this.data.info && this.data.info.id) {
this.drawImg()
}
else {
setTimeout(() => {
this.onShow()
}, 200)
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
if (!wx.getStorageSync('jstrip_token')) {
return;
}
if (this.data.info && this.data.info.id) {
this.drawImg()
} else {
setTimeout(() => {
this.onShow()
}, 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": {
"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 class="save-btn" bindtap="save">保存到相册</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": {
"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>
<rich-text nodes="{{info.allowance.content}}"></rich-text>
</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"
Page({
/**
* 页面的初始数据
*/
data: {
id:null,
dates:[],
days:['周日','周一','周二','周三','周四','周五','周六'],
dateIndex:0,
areas:[],
areaIndex:0,
lat:"",
lon:"",
sort:'distance',
list:[],
title:"",
page:1,
isMore:true
},
/**
* 页面的初始数据
*/
data: {
id: null,
dates: [],
days: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
dateIndex: 0,
areas: [],
areaIndex: 0,
lat: "",
lon: "",
sort: 'distance',
list: [],
title: "",
page: 1,
isMore: true,
showQrCode: false,
wxqrcode: null
},
/**
* 生命周期函数--监听页面加载
*/
pagePoint(e) {
util.pagePoint(e)
},
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)=>{
/**
* 生命周期函数--监听页面加载
*/
pagePoint(e) {
util.pagePoint(e)
},
onLoad: function (options) {
this.setData({
lat:res.latitude,
lon:res.longitude
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({
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()
},
fail:()=>{
},
changeArea: function (e) {
this.setData({
areaIndex: e.detail.value,
list: [],
page: 1,
isMore: true
})
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()
},
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
})
}
})
}
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({
isMore:false
dates: dates
})
}
console.log(res)
})
},
selectMovieSeat(e){
let info = e.currentTarget.dataset.info
let index = e.currentTarget.dataset.index
console.log(index);
console.log(info.schedules);
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 () {
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({
isMore: false
})
}
console.log(res)
})
},
selectMovieSeat(e) {
commonApi.user_post('wx/get_user_keep', {
jumpurl: '/pages/list/movieticket/list/ticket/index?id=' + this.data.id,
title: this.data.title,
type: 'mini'
}).then(res => {
if (res.data.subscribe == 0) {
this.setData({
wxqrcode: res.data.qrcode,
showQrCode: true
})
} else {
let info = e.currentTarget.dataset.info
let index = e.currentTarget.dataset.index
console.log(index);
console.log(info.schedules);
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 () {
this.getList()
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.getList()
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
}
})

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

@ -1,5 +1,6 @@
{
"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>
<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>
</view>
<view class="tel-box">
<text>手机号码:</text>
<input value="{{tel}}" type="number" bindinput="changeTel" placeholder="输入您的手机号"></input>
</view>
</view>
<view class="tips">
@ -32,6 +27,10 @@
</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>

8
pages/order/movie/index.wxss

@ -14,7 +14,7 @@ page {
display: flex;
padding-top: 30rpx;
padding-bottom: 41rpx;
border-bottom: 1rpx solid #ccc;
/* border-bottom: 1rpx solid #ccc; */
font-size: 27rpx;
color: #999;
justify-content: space-between;
@ -42,7 +42,11 @@ page {
align-items: center;
height: 126rpx;
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 {
color: #000;

688
pages/user/cartlist/list.js

@ -1,6 +1,6 @@
// pages/user/cartlist/list.js
const device = wx.getSystemInfoSync(),
rect = wx.getMenuButtonBoundingClientRect(); // 获取设备信息
rect = wx.getMenuButtonBoundingClientRect(); // 获取设备信息
const ratio = 750 / device.windowWidth;
console.log(rect)
const width = device.windowWidth // 示例为一个与屏幕等宽的正方形裁剪框
@ -10,357 +10,373 @@ import util from '../../../utils/util'
let app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
menuWidth: width - rect.right + rect.width + 6,
list: [],
allChecked: false,
allPrice: 0,
productType: '',
manageFlag: false,
flag: false, //判断订单是否同时有商品和票
isCar:'single',//判断是否购物车
},
/**
* 页面的初始数据
*/
data: {
menuWidth: width - rect.right + rect.width + 6,
list: [],
allChecked: false,
allPrice: 0,
productType: '',
manageFlag: false,
flag: false, //判断订单是否同时有商品和票
isCar: 'single', //判断是否购物车
showQrCode: false,
wxqrcode: null
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.removeStorageSync('linkMan')
this.getList();
},
manage: function () {
let list = this.data.list;
list.map(item => {
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'
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.removeStorageSync('linkMan')
this.getList();
},
manage: function () {
let list = this.data.list;
list.map(item => {
item.checked = 0;
})
return;
}
}
list[index].checked = list[index].checked ? false : true;
this.setData({
list: list
})
let flag = true
list.forEach(item => {
if (!item.checked) {
flag = false
return
}
});
this.setData({
allChecked:flag
})
this.updatePrice()
},
selectAll: function () {
let list = this.data.list,
allChecked = this.data.allChecked ? false : true;
list.map(item => {
if (item.sku.flag == 'on' && item.product.flag == 1) {
item.checked = allChecked;
}
})
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;
}
})
this.setData({
allPrice: price
})
},
order: function () {
app.globalData.couponInfo = null;
util.pagePoint({
event: 'cart_order'
}, 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;
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({
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) {
wx.showToast({
title: '删除成功',
icon: "success"
list[index].checked = list[index].checked ? false : true;
this.setData({
list: list
})
let flag = true
list.forEach(item => {
if (!item.checked) {
flag = false
return
}
});
this.setData({
allChecked: flag
})
this.updatePrice()
},
selectAll: function () {
let list = this.data.list,
allChecked = this.data.allChecked ? false : true;
list.map(item => {
if (item.sku.flag == 'on' && item.product.flag == 1) {
item.checked = allChecked;
}
})
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({
list: list
allPrice: price
})
}
})
},
delM() {
let that = this
let arr = this.data.list
let suid = []
arr.forEach(item => {
if (item.checked) {
suid.push(item.sku_id)
}
});
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 => {
},
order: function () {
commonApi.user_post('wx/get_user_keep', {
jumpurl: '/pages/user/cartlist/list',
title: '购物车',
type: 'mini'
}).then(res => {
if (res.data.subscribe == 0) {
this.setData({
wxqrcode: res.data.qrcode,
showQrCode: true
})
} else {
app.globalData.couponInfo = null;
util.pagePoint({
event: 'cart_order'
}, 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;
}
}
})
// 更新数据
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) {
wx.showToast({
title: '删除成功',
icon: "success"
})
that.getList();
wx.showToast({
title: '删除成功',
icon: "success"
})
list.splice(index, 1);
this.setData({
list: list
})
}
})
} else {
console.log('取消')
}
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
})
},
delM() {
let that = this
let arr = this.data.list
let suid = []
arr.forEach(item => {
if (item.checked) {
suid.push(item.sku_id)
}
});
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": {
"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>
<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>
</view>
<code showModel="{{showQrCode}}" qrcode = "{{wxqrcode}}">
</code>
Loading…
Cancel
Save