Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
7
7-Eleven
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
高淑倩
7-Eleven
Commits
55cbde3c
Commit
55cbde3c
authored
Aug 27, 2019
by
高淑倩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify: 分享
parent
adb321e8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
45 deletions
+46
-45
sharePoster.js
src/component/sharePoster/sharePoster.js
+43
-42
sharePoster.wxss
src/component/sharePoster/sharePoster.wxss
+1
-1
confirmOrder.js
src/pages/confirmOrder/confirmOrder.js
+2
-2
No files found.
src/component/sharePoster/sharePoster.js
View file @
55cbde3c
...
@@ -20,7 +20,6 @@ Component({
...
@@ -20,7 +20,6 @@ Component({
value
:
''
value
:
''
}
}
},
},
/**
/**
* 组件的初始数据
* 组件的初始数据
*/
*/
...
@@ -32,15 +31,14 @@ Component({
...
@@ -32,15 +31,14 @@ Component({
},
},
attached
()
{
attached
()
{
// 获取小程序二维码 url
this
.
getMiniCode
()
this
.
getMiniCode
()
},
},
/**
/**
* 组件的方法列表
* 组件的方法列表
*/
*/
methods
:
{
methods
:
{
//下载产品图片
//下载产品图片
getAvaterInfo
:
function
()
{
getAvaterInfo
:
function
()
{
wx
.
showLoading
({
wx
.
showLoading
({
...
@@ -96,37 +94,42 @@ Component({
...
@@ -96,37 +94,42 @@ Component({
wxService
.
post
(
`/merchant/contentMobileTerminal/getAppletQrCode`
,
data
).
then
(
res
=>
{
wxService
.
post
(
`/merchant/contentMobileTerminal/getAppletQrCode`
,
data
).
then
(
res
=>
{
const
{
result
,
data
}
=
res
.
data
const
{
result
,
data
}
=
res
.
data
if
(
result
==
0
){
this
.
setData
({
// codeImg: data.codeUrl
codeImg
:
"https://hwimagecdn.ihotwind.cn/usr/201908/miniQrCode-f00c5051fef7479395efb193431762c4.jpg"
})
}
// if (result == 0) {
// const fsm = wx.getFileSystemManager();
// const FILE_BASE_NAME = 'tmp_base64src';
if
(
result
==
0
)
{
// const base64src = function (data) {
const
fsm
=
wx
.
getFileSystemManager
();
// return new Promise((resolve, reject) => {
const
FILE_BASE_NAME
=
'tmp_base64src'
;
const
base64src
=
function
(
data
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
filePath
=
`
${
wx
.
env
.
USER_DATA_PATH
}
/
${
FILE_BASE_NAME
}
.png`
;
//
const filePath = `${wx.env.USER_DATA_PATH}/${FILE_BASE_NAME}.png`;
const
buffer
=
wx
.
base64ToArrayBuffer
(
data
);
//
const buffer = wx.base64ToArrayBuffer(data);
fsm
.
writeFile
({
//
fsm.writeFile({
filePath
,
//
filePath,
data
:
buffer
,
//
data: buffer,
encoding
:
'binary'
,
//
encoding: 'binary',
success
()
{
//
success() {
resolve
(
filePath
);
//
resolve(filePath);
},
//
},
fail
()
{
//
fail() {
reject
(
new
Error
(
'ERROR_BASE64SRC_WRITE'
));
//
reject(new Error('ERROR_BASE64SRC_WRITE'));
},
//
},
});
//
});
});
//
});
};
//
};
base64src
(
data
).
then
(
res
=>
{
//
base64src(data).then(res => {
console
.
log
(
res
)
//
console.log(res)
this
.
setData
({
//
this.setData({
codeImg
:
res
//
codeImg: res
})
//
})
})
//
})
}
//
}
})
})
},
},
...
@@ -185,7 +188,7 @@ Component({
...
@@ -185,7 +188,7 @@ Component({
ctx
.
setFillStyle
(
'#fff'
);
ctx
.
setFillStyle
(
'#fff'
);
ctx
.
fillRect
(
0
,
0
,
rect
.
width
,
height
);
ctx
.
fillRect
(
0
,
0
,
rect
.
width
,
height
);
//
头像
//
图片
if
(
avaterSrc
)
{
if
(
avaterSrc
)
{
if
(
imgInfo
)
{
if
(
imgInfo
)
{
var
imgheght
=
parseFloat
(
imgInfo
);
var
imgheght
=
parseFloat
(
imgInfo
);
...
@@ -196,21 +199,22 @@ Component({
...
@@ -196,21 +199,22 @@ Component({
ctx
.
setTextAlign
(
'left'
);
ctx
.
setTextAlign
(
'left'
);
}
}
//
产品名称
//
品牌头像
if
(
that
.
data
.
userAvatar
)
{
if
(
that
.
data
.
userAvatar
)
{
console
.
log
(
imgheght
)
console
.
log
(
imgheght
)
ctx
.
drawImage
(
that
.
data
.
userAvatar
,
12
,
306
,
25
,
25
);
// ctx.drawImage(that.data.userAvatar, 12, 306, 25, 25);
ctx
.
drawImage
(
that
.
data
.
userAvatar
,
12
,
290
,
40
,
40
);
ctx
.
setFontSize
(
14
);
ctx
.
setFontSize
(
14
);
ctx
.
setFillStyle
(
'#d8d8d8'
);
ctx
.
setFillStyle
(
'#d8d8d8'
);
ctx
.
setTextAlign
(
'left'
);
ctx
.
setTextAlign
(
'left'
);
// ctx.fillText(that.data.userAvatar, left - 15, imgheght + 110); //电话
// ctx.fillText(that.data.userAvatar, left - 15, imgheght + 110); //电话
}
}
// title
if
(
that
.
data
.
productDesc
){
if
(
that
.
data
.
productDesc
){
ctx
.
setFontSize
(
9
);
ctx
.
setFontSize
(
12
);
ctx
.
setFillStyle
(
'#333333'
);
ctx
.
setFillStyle
(
'#333333'
);
ctx
.
setTextAlign
(
'left'
);
ctx
.
setTextAlign
(
'left'
);
ctx
.
fillText
(
that
.
data
.
productDesc
,
41
,
312
);
//电话
ctx
.
fillText
(
that
.
data
.
productDesc
,
61
,
300
);
}
}
...
@@ -229,7 +233,7 @@ Component({
...
@@ -229,7 +233,7 @@ Component({
// 绘制二维码
// 绘制二维码
if
(
codeSrc
)
{
if
(
codeSrc
)
{
ctx
.
drawImage
(
codeSrc
,
1
70
,
281
,
50
,
50
)
ctx
.
drawImage
(
codeSrc
,
1
90
,
281
,
61.5
,
61.5
)
ctx
.
setFontSize
(
10
);
ctx
.
setFontSize
(
10
);
ctx
.
setFillStyle
(
'#000'
);
ctx
.
setFillStyle
(
'#000'
);
// ctx.fillText("微信扫码或长按保存图片", left + 165, imgheght + 110);
// ctx.fillText("微信扫码或长按保存图片", left + 165, imgheght + 110);
...
@@ -239,9 +243,6 @@ Component({
...
@@ -239,9 +243,6 @@ Component({
ctx
.
draw
();
ctx
.
draw
();
wx
.
hideLoading
();
wx
.
hideLoading
();
},
1000
)
},
1000
)
},
},
textByteLength
(
text
,
num
)
{
// text为传入的文本 num为单行显示的字节长度
textByteLength
(
text
,
num
)
{
// text为传入的文本 num为单行显示的字节长度
...
...
src/component/sharePoster/sharePoster.wxss
View file @
55cbde3c
...
@@ -147,7 +147,7 @@
...
@@ -147,7 +147,7 @@
overflow: hidden;
overflow: hidden;
}
}
.poste_content{
.poste_content{
width:
410
rpx;
width:
524
rpx;
margin: auto;
margin: auto;
overflow: hidden;
overflow: hidden;
margin-top: 153rpx;
margin-top: 153rpx;
...
...
src/pages/confirmOrder/confirmOrder.js
View file @
55cbde3c
...
@@ -25,8 +25,8 @@ wxService.page({
...
@@ -25,8 +25,8 @@ wxService.page({
console
.
log
(
'thtrolleySku2Bu'
,
JSON
.
parse
(
trolleySku2Buy
))
console
.
log
(
'thtrolleySku2Bu'
,
JSON
.
parse
(
trolleySku2Buy
))
// 下单 && 计算优惠价
// 下单 && 计算优惠价
if
(
trolleySku2Buy
.
length
){
if
(
trolleySku2Buy
.
length
){
this
.
getBill
(
trolleySku2Buy
)
// 下单
//
this.getBill(trolleySku2Buy) // 下单
//
this.calPreferentialPrice(trolleySku2Buy) // 计算优惠价
this
.
calPreferentialPrice
(
trolleySku2Buy
)
// 计算优惠价
}
}
},
},
// 下单
// 下单
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment