Commit 488af917bea0bcace6b17265f232c5497bc53527

Authored by vking
2 parents 5aa39cef 7446f086

Merge remote-tracking branch 'remotes/origin/seller-share-img'

[submodule "components/painter"]
path = components/painter
url = https://github.com/Kujiale-Mobile/PainterCore.git
... ...
... ... @@ -27,7 +27,8 @@
"pages/manager-invitation/setting/history",
"pages/reserve/activity",
"pages/reserve/discount",
"pages/reserve/indexList"
"pages/reserve/indexList",
"pages/reserve/share"
],
"subpackages": [
{
... ...
Subproject commit ef9e437398fb26868088b85a71dfc3076605cfd4
... ...
// components/reserve/share/share.js
import util from '../../../utils/util';
Component({
/**
* 组件的属性列表
*/
properties: {
seller_id:String,
hasSellerShare:{
type:Boolean,
value:false,
}
},
/**
* 组件的初始数据
*/
data: {
hasShow:false,
},
/**
* 组件的方法列表
*/
methods: {
show(){
this.setData({
hasShow:true,
})
},
hide(){
this.setData({
hasShow:false,
})
},
shareDo(e){
this.hide()
let act=util.attr(e,'act');
if(!act) return;
console.log('shareDo.'+act,e);
wx.navigateTo({
url:util.http_build_query({
id:this.data.seller_id,
act:act,
hasSellerShare:this.data.hasSellerShare
},'/pages/reserve/share')
})
},
}
})
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--components/reserve/share/share.wxml-->
<view class="share mask" catchtap="hide" wx:if="{{hasShow}}">
<view class="share-view flex-lr">
<button class="button-none share-item flex-vc" open-type="share" catchtap="shareDo">
<image class="share-img wechat"></image>
<view class="share-name">微信</view>
</button>
<view class="share-item flex-vc" catchtap="shareDo" data-act="quanzi">
<image class="share-img quanzi"></image>
<view class="share-name">朋友圈</view>
</view>
<view class="share-item flex-vc" catchtap="shareDo" data-act="qrcode">
<image class="share-img qrcode"></image>
<view class="share-name">二维码</view>
</view>
</view>
</view>
... ...
/* components/reserve/share/share.wxss */
@import "../../../app.wxss";
.share-view{
height: 316rpx;
background: #fefefe;
width: calc(100% - 40rpx);
padding: 0 20rpx;
position: fixed;
bottom: 0;
}
.share-img{
width: 140rpx;
height: 140rpx;
background-size: 100% 100%;
}
.share-img.wechat{
background-image: url("http://qn.colorcun.com/reserve/share/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201906251004331.png");
}
.share-img.quanzi{
background-image: url("http://qn.colorcun.com/reserve/share/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20190625100433.png");
}
.share-img.qrcode{
background-image: url("http://qn.colorcun.com/reserve/share/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201906251004332.png");
}
.share-name{
margin-top: 20rpx;
font-size: 30rpx;
height: 42rpx;
line-height: 42rpx;
color: #353535;
}
.share-item{
min-width: 33%;
width: 33%;
}
\ No newline at end of file
... ...
// component/menu/addDelete.js
import util from '../../utils/util';
import App from '../../utils/api';
Component({
/**
* 组件的属性列表
*/
properties: {
filePath:String,
},
/**
* 组件的初始数据
*/
data: {
},
attached(){
},
ready () {
},
detached(){
},
/**
* 组件的方法列表
*/
methods: {
saveFile(){
let filePath=this.data.filePath
console.log('saveFile.filePath',filePath)
wx.saveImageToPhotosAlbum({
filePath:filePath,
complete:res=>{
console.log(res,filePath)
},
success:res=>{
util.toast('已保存到相册')
},
fail:(efail)=>{
console.log('saveImageToPhotosAlbum.fail',efail)
wx.showModal({
title: '授权提示',
content: '您拒绝了保存文件,请点击确定打开授权',
confirmColor: '#199095',
cancelColor: '#999',
success: function (res) {
if (res.confirm) {
util.setting();
}
}
})
},
})
},
}
})
... ...
{
"component": true,
"usingComponents": {
"formids": "/components/formids/formids"
}
}
\ No newline at end of file
... ...
<formids bindclick="saveFile" style="width: 100%;">
<slot></slot>
</formids>
\ No newline at end of file
... ...
@import "../../app.wxss";
\ No newline at end of file
... ...
... ... @@ -4,7 +4,7 @@
</button>
</block>
<block wx:else="">
<formids bindclick="setUserInfoSuccess" catchtap="catchtap">
<formids bindclick="setUserInfoSuccess" catchtap="catchtap" style="width: 100%;">
<slot></slot>
</formids>
</block>
\ No newline at end of file
... ...
... ... @@ -67,9 +67,30 @@ Page({
onHide: function () {
},
onShareAppMessage: function () {
let path=util.http_build_query(
{
id:this.data.seller.id,
fromid:getApp().openid,
hasSellerShare:true,
},'/pages/reserve/detail')
return {
title:'请客订包间,就上一键订',
imageUrl:'https://xt04.colorcun.com/sellerShare/Share_'+this.data.seller.id+'.png?'+Math.random(),
path: path,
}
},
NewCustomer(e){
this.setData({
NewCustomerTotal:e.detail.total
})
}
},
shareDisplay(){
this.selectComponent('#share').show()
},
gotoSellerShop(){
wx.navigateTo({
url:util.http_build_query({id:this.data.seller.id},'/pages/reserve/detail')
})
},
})
\ No newline at end of file
... ...
... ... @@ -5,6 +5,7 @@
"usingComponents": {
"nav":"/components/nav/nav",
"tabBar":"../../../components/book/tabBar/tabBar",
"formids":"/components/formids/formids"
"formids":"/components/formids/formids",
"share":"/components/reserve/share/share"
}
}
\ No newline at end of file
... ...
<!--pages/book/setting/index.wxml-->
<nav id="nav" backgroundColor="#199095" color="#fefefe">订座</nav>
<view class="header">
<view class="header flex-lr">
<view class="info">
<view class="nick">{{user.nick_name || user.nickname}}</view>
<view class="seller Medium">{{seller.sellername}} | {{user.role_name||''}}</view>
<view class="nick flex-lr">
<view bindtap="gotoSellerShop">{{seller.sellername}}</view>
<view class="share-but" bindtap="shareDisplay"></view>
</view>
<view class="seller Medium">{{user.nick_name || user.nickname}} | {{user.role_name||''}}</view>
</view>
</view>
<view class="page">
... ... @@ -59,3 +62,4 @@
</formids>
</view>
<tabBar bindNewCustomer="NewCustomer" id="tabBar"></tabBar>
<share id="share" seller_id="{{seller.id}}" hasSellerShare="{{true}}"></share>
... ...
... ... @@ -4,15 +4,15 @@ http://qn.colorcun.com/custom/lite-yd/image/icon-zk.png
http://qn.colorcun.com/custom/lite-yd/image/icon-cz.png
*/
.header{
height: 302rpx;
background-color: #199095;
margin-top: -2rpx;
}
.header .info{
color:#FEFEFE;
width: 90%;
padding-top: 86rpx;
padding-top: 66rpx;
margin: 0 auto;
padding-bottom: 80rpx;
}
.header .info .nick{
font-size: 44rpx;
... ... @@ -43,4 +43,11 @@ http://qn.colorcun.com/custom/lite-yd/image/icon-cz.png
}
.row .more{
margin-left: 20rpx;
}
.share-but{
background-image: url("http://qn.colorcun.com/reserve/share/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20190625162307.png");
width: 52rpx;
height: 52rpx;
background-size: 100% 100%;
min-width: 52rpx;
}
\ No newline at end of file
... ...
... ... @@ -30,6 +30,7 @@ Page({
IsCollectionSeller:res.data,
})
})
this.SetRelaOpenid();
},
GetSellerDetail(){
let options=this.options
... ... @@ -110,9 +111,11 @@ Page({
* 用户点击右上角分享
*/
onShareAppMessage: function () {
let path=util.http_build_query({id:this.data.seller.id,fromid:getApp().openid},'/pages/reserve/detail')
return {
title:'请客订包间,就上一键订',
imageUrl:'https://xt04.colorcun.com/sellerShare/Share_'+this.options.id+'.png?'+Math.random(),
path:path,
}
},
reserve(){
... ... @@ -212,11 +215,22 @@ Page({
})
},
shareUserinfo(){
util.toast('授权成功,请继续分享','none');
//util.toast('授权成功,请继续分享','none');
this.selectComponent('#share').show()
},
bindtransition(e){
this.setData({
currentView:e.detail.current+1
})
},
async SetRelaOpenid(){
if(!this.options.fromid) return;
let openid=await getApp().getOpenid()
App.Reserve.SetRelaOpenid({
openid:openid,
fromid:this.options.fromid,
sid:this.options.id,
sub:this.options.hasSellerShare?2:3,//关系类型:1/2/3 邀请关系/商户端分享关系/C端分享关系
})
},
})
\ No newline at end of file
... ...
... ... @@ -10,6 +10,7 @@
"as":"/components/actionSheet/index",
"nav":"/components/nav/nav",
"getpos":"/components/userinfo/getpos",
"discount":"/components/reserve/discount"
"discount":"/components/reserve/discount",
"share":"/components/reserve/share/share"
}
}
\ No newline at end of file
... ...
... ... @@ -148,16 +148,18 @@
</userinfo>
</view>
<view class="reserve share flex-vc">
<userinfo-share class="flex-vc" style="width: 100%" binduserinfo="shareUserinfo">
<userinfo class="flex-vc" style="width: 100%" binduserinfo="shareUserinfo">
<view class="text">分享</view>
</userinfo-share>
</userinfo>
</view>
<view class="reserve">
<formids class="flex-vc" bindclick="reserve" id="reserve-button">
<view class="text">电话预订</view>
</formids>
</view>
</view>
<as id="as" items="{{seller.seller_tel}}" bindclick="reservePhone">拨打电话预订</as>
<getpos bindpos="onpos" id="getpos"></getpos>
<discount id="discount" seller="{{seller}}" bindhide="discountHide" bindshow="discountShow"></discount>
\ No newline at end of file
<discount id="discount" seller="{{seller}}" bindhide="discountHide" bindshow="discountShow"></discount>
<share id="share" seller_id="{{seller.id}}"></share>
\ No newline at end of file
... ...
// pages/reserve/share.js
import util from '../../utils/util';
import App from '../../utils/api';
const {regeneratorRuntime} = global
Page({
/**
* 页面的初始数据
*/
data: {
seller:{},
paletteImageSrc:'',
palette:null,
hasLoadData:false,
act:'',
hasActName:'',
hasSellerShare:false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.options=options;
this.setData({
actType:options.act,
hasSellerShare:options.hasSellerShare||false,
})
this.GetSellerDetail();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
GetSellerDetail(){
let options=this.options
App.Customer.GetSellerDetail({
sid:options.id,
}).then(async res=>{
if(res.ret==200){
let seller=res.data
console.log('App',App)
let openid=await getApp().getOpenid()
let qrcode=await App.Other.generate_qrcode({
tpl_id: 25415,
code_type: 'wxcode',
'param_value[0]':options.id,
'param_value[1]':openid,
'param_value[2]':this.options.hasSellerShare
});
this.setData({
seller:seller,
qrcode:qrcode.data.replace('http://','https://'),
hasLoadData:true,
})
setTimeout(()=>{
this.initImage()
},0);
}
})
},
initImage(){
let palette={}
if(this.options.act=='quanzi'){
let seller=this.data.seller
let pw=getApp().system.windowWidth-20;
let ph=pw/355*558;
let tagsHeight=60//rpx
if(seller.activity.length==0){
ph=pw/355*500;
}
let cai_jiu_bao=[]//菜酒包
if(seller.cate.length>0){
cai_jiu_bao.push(seller.cate[0])
}
cai_jiu_bao.push(seller.is_belt_wine==1?'不可带酒水':'可自带酒水');
if(seller.room_num>0){
cai_jiu_bao.push(seller.room_num+'个包间')
}
cai_jiu_bao=cai_jiu_bao.join(' | ')
let tags=[];
tags=tags.join(' | ')
if(!tags){
ph=ph-tagsHeight/2
tagsHeight=0
}
let share_image=seller.share_image
.replace('http://','https://')
+'?imageView2/1/w/750/h/500/q/100'
console.log('share_image:',share_image)
palette={
background: '#fff',
width: pw+'px',
height: ph+'px',
views: [
{
type:'image',
url:share_image,
css:{
width:pw+'px',
height:470+'rpx',
mode:'aspectFill'
}
},
{
type:'text',
text: seller.sellername,
id:'seller-name',
css:{
fontSize:'36rpx',
color:'#353535',
top:520+'rpx',
left:'30rpx',
fontWeight:'bold',
}
},
{
type:'text',
text: seller.rank,
css:{
fontSize:'20rpx',
color:'#ffffff',
top:531+'rpx',
left:['60rpx', 'seller-name', 1] ,
background:'#F57E32',
padding:'2rpx 8rpx',
lineHeight:'28rpx'
}
},
{
type:'text',
text: cai_jiu_bao,
css:{
fontSize:'26rpx',
color:'#999999',
top: '578rpx',
left: '30rpx',
}
},
{
type:'text',
text: tags,
css:{
fontSize:'22rpx',
color:'#C0A369',
top: '638rpx',
left: '42rpx',
background:'#FFEFDF',
lineHeight:'28rpx',
padding:'10rpx 12rpx',
}
},
{
type:'rect',
css:{
color:'#F5F5F5',
top:(634+tagsHeight)+'rpx',
left:'30rpx',
width:(pw-30)+'px',
height:'1px'
}
},
/*
{
type:'text',
text: "陕西风味面馆",
css:{
fontSize:'14px',
color:'#f00',
background:'#ff0',
padding:'8px 20px',
top:(480*(getApp().system.windowWidth/600)+20)+'px',
left:'16px',
lineHeight:'18px'
}
},
{
type:'rect',
css:{
color:'rgba(0,0,0,0.5)',
top:(480*(getApp().system.windowWidth/600)+12)+'px',
left:'0px',
width:'320px',
height:'34px'
}
},
*/
{
type: 'image',
url: this.data.qrcode,
css: {
bottom: '112rpx',
left: (pw / 2) + 'px',
width: '140rpx',
height: '140rpx',
align: 'center',
},
},
{
type:'text',
text: '长按或扫描二维码,预订、导航',
css:{
fontSize:'22rpx',
color:'#999999',
bottom: '50rpx',
left: (pw / 2) + 'px',
align: 'center',
}
},
],
}
if(seller.activity.length>0){
//活动
let activity=[];
seller.activity.forEach(act=>{
activity.push(act.title)
})
activity='活动: '+activity.join(' | ')
palette.views.push({
type:'text',
text: activity,
css:{
fontSize:'30rpx',
color:'#353535',
top: (676+tagsHeight)+'rpx',
left: '30rpx',
lineHeight:'38rpx',
maxLines:1,
width:(pw-30)+'px',
}
});
palette.views.push({
type:'rect',
css:{
color:'#F5F5F5',
top:(754+tagsHeight)+'rpx',
left:'30rpx',
width:(pw-30)+'px',
height:'1px'
}
});
}
}else{
palette={
background: '#fff',
width: '400rpx',
height: '400rpx',
views: [
{
type: 'image',
url: this.data.qrcode,
css: {
mode:'scaleToFill',
width: '400rpx',
height: '400rpx',
},
}
],
}
}
this.setData({
palette:palette
})
},
onImgOK(e){
console.log('onImgOK',e.detail.path)
wx.getImageInfo({
src:e.detail.path,
success:res=>{
let w=getApp().system.windowWidth-24
console.log('getImageInfo',res)
this.setData({
paletteImageWidth:w,
paletteImageHeight:w/res.width*res.height,
paletteImageSrc:e.detail.path,
})
}
})
},
reviewImage(){
wx.previewImage({
urls:[this.data.paletteImageSrc],
})
}
})
\ No newline at end of file
... ...
{
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black",
"navigationBarTitleText":"一键订",
"usingComponents": {
"nav":"/components/nav/nav",
"painter":"/components/painter/painter",
"savefile":"/components/userinfo/savefile"
}
}
... ...
<!--pages/reserve/share.wxml-->
<nav>{{actType=='quanzi'?'分享图':'二维码下载'}}</nav>
<loading wx:if="{{!hasLoadData || !paletteImageSrc}}">图片生成中</loading>
<view wx:if="{{hasLoadData}}" style="position: fixed;top:-9999rpx;">
<painter palette="{{palette}}" bind:imgOK="onImgOK" bind:imgErr="onImgOK"/>
</view>
<view wx:if="{{paletteImageSrc}}" class="pages">
<view class="pages-view" wx:if="{{actType=='quanzi'}}">
<image src="{{paletteImageSrc}}"
bindtap="reviewImage"
style="width:{{paletteImageWidth}}px;height:{{paletteImageHeight}}px;"></image>
</view>
<view class="pages-view flex-vc" wx:else="">
<image src="{{paletteImageSrc}}"
bindtap="reviewImage"
style="width:400rpx;height:400rpx; margin-top: 90rpx;"></image>
<view class="qrcode-text">{{seller.sellername}}</view>
</view>
<view class="save">
<savefile filePath="{{paletteImageSrc}}">
<view class="save-but {{hasSellerShare?'sellerShare':''}} flex-cc">
<view class="save-but-icon"></view>
<view class="save-but-text">保存到相册</view>
</view>
</savefile>
</view>
</view>
... ...
/* pages/reserve/share.wxss */
page{
background-color: #EEF2F2;
}
.pages{
padding-bottom: 160rpx;
width: 100%;
padding-top: 20rpx;
}
.pages-view{
width: calc(100% - 24px);
margin: 0 auto;
background-color: #fefefe;
}
.save{
position: fixed;
bottom: 0;
width: 100%;
}
.save-but{
width: calc(100% - 24px);
height: 100rpx;
margin: 0 auto 30rpx;
background-color: #C0A369;
font-size: 32rpx;
color: #fefefe;
border-radius: 10rpx;
}
.save-but.sellerShare{
background-color: #199095;
}
.save-but-icon{
width: 40rpx;
height: 40rpx;
background-size: 100% 100%;
background-image: url("http://qn.colorcun.com/reserve/share/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201906251004333.png");
}
.save-but-text{
height:40rpx;
line-height: 40rpx;
margin-left: 20rpx;
}
.qrcode-text{
font-size: 34rpx;
margin-top: 40rpx;
margin-bottom: 90rpx;
}
\ No newline at end of file
... ...
... ... @@ -45,7 +45,7 @@
"list": []
},
"miniprogram": {
"current": 25,
"current": 39,
"list": [
{
"id": 0,
... ... @@ -221,7 +221,7 @@
},
{
"id": -1,
"name": "预订本-设置",
"name": "pack-book/pages/book/setting/index 预订本-设置",
"pathName": "pack-book/pages/book/setting/index",
"query": "",
"scene": "1001"
... ... @@ -348,7 +348,7 @@
"id": 39,
"name": "pages/reserve/detail 在线订座 ",
"pathName": "pages/reserve/detail",
"query": "id=1",
"query": "id=999&fromid=22222",
"scene": null
},
{
... ... @@ -448,6 +448,13 @@
"pathName": "pack-book/pages/book/b_desk",
"query": "rdate=1559617200-1559631600&tid=0&pnum=6&checked_tids=760,761&rid=",
"scene": null
},
{
"id": 54,
"name": "pages/reserve/share 在线订座 ",
"pathName": "pages/reserve/share",
"query": "id=1&act=quanzi",
"scene": null
}
]
}
... ...
... ... @@ -4,7 +4,7 @@ export default {
silence: true, //静默,不带loading; 默认 true 不带loading
cachetime: 0, //缓存 0无,-1永久,86400秒; 默认 0 不缓存
timeout: 2000, //接口超时时间,默认2s
host: '', //默认空使用04服务器,测试填写 'https://xt05.colorcun.com/?s='
host: '', //默认空使用04服务器,测试填写 'https://xt05.colorcun.com:10006/?s='
alias: 'App.TestManagement.TestReal', //真实接口名称,默认为空
},
... ... @@ -249,4 +249,10 @@ export default {
openid:'openid',
cachetime: 60,
},
//获得小程序码
'App.Other.generate_qrcode':{
host: 'https://cli.im/mina/',
alias:'generate_qrcode'
}
}
\ No newline at end of file
... ...
... ... @@ -768,7 +768,7 @@ module.exports = {
http_build_query(obj,url=''){
let ps=[]
for(let i in obj){
if(typeof obj[i]=='undefined' || obj[i]==null) continue;
if(typeof obj[i]=='undefined' || obj[i]==null || obj[i]===false) continue;
ps.push(i+'='+obj[i].toString())
}
ps=ps.join('&');
... ...