Commit 23ebe04a by 前端

Merge branch 'develop' into 'master'

Develop

See merge request !19
2 parents 9adea726 053518b5
...@@ -260,7 +260,7 @@ App({ ...@@ -260,7 +260,7 @@ App({
* 登录成功回调 * 登录成功回调
*/ */
loginSuccessCallback: function (userInfo) { loginSuccessCallback: function (userInfo) {
console.log(userInfo) // console.log(userInfo)
this.globalData.userInfo = userInfo this.globalData.userInfo = userInfo
this.globalData.accountId = userInfo.accountId this.globalData.accountId = userInfo.accountId
// this.getCustomerMessageNew(userInfo.accountId) // this.getCustomerMessageNew(userInfo.accountId)
......
{ {
"pages": [ "pages": ["pages/tab/index/index", "pages/tab/personal/personal", "pages/auth/userInfo/userInfo", "pages/auth/phone/phone", "pages/route/to", "pages/webpage/webpage", "pages/upgrade/upgrade", "pages/auth/login/login", "pages/auth/index/index", "pages/tab/logout/logout"],
"pages/tab/index/index", "requiredPrivateInfos": ["getLocation", "chooseAddress", "chooseLocation"],
"pages/tab/personal/personal",
"pages/auth/userInfo/userInfo",
"pages/auth/phone/phone",
"pages/route/to",
"pages/webpage/webpage",
"pages/upgrade/upgrade",
"pages/auth/login/login",
"pages/auth/index/index",
"pages/tab/logout/logout"
],
"requiredPrivateInfos": [
"getLocation",
"chooseAddress",
"chooseLocation"
],
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff", "navigationBarBackgroundColor": "#fff",
...@@ -154,32 +139,24 @@ ...@@ -154,32 +139,24 @@
{ {
"name": "payment", "name": "payment",
"root": "packagesPayment", "root": "packagesPayment",
"pages": [ "pages": ["pages/payment/index", "pages/QRPayment/QRPayment", "pages/userCollaboration/userCollaboration", "pages/warrantyCard/warrantyCard"]
"pages/payment/index",
"pages/QRPayment/QRPayment",
"pages/userCollaboration/userCollaboration",
"pages/warrantyCard/warrantyCard"
]
} }
], ],
"preloadRule": { "preloadRule": {
"pages/tab/index/index": { "pages/tab/index/index": {
"network": "all", "network": "all",
"packages": [ "packages": ["homeindex"]
"homeindex"
]
}, },
"pages/tab/personal/personal": { "pages/tab/personal/personal": {
"network": "all", "network": "all",
"packages": [ "packages": ["personal"]
"personal"
]
}, },
"packagePersonal/pages/smartplus/smartplus": { "packagePersonal/pages/smartplus/smartplus": {
"network": "all", "network": "all",
"packages": [ "packages": ["smartplus"]
"smartplus"
]
} }
},
"resolveAlias": {
"~/*": "/*"
} }
} }
/**
* 用来配置小程序项目的变量
* 统一管理
*/
/**
* 环境指定
* 0本地
* 1开发
* 2测试
* 3生产环境
*/
let index = 1
const accountInfo = wx.getAccountInfoSync()
const systemInfo = wx.getSystemInfoSync()
const envName = accountInfo.miniProgram.envVersion
//手动控制体验版环境的请求 true就依据下面index false就默认为2
const manual = false
const release = false
// 判断小程序环境
// develop:开发版 trial:体验版 release:正式版
if (systemInfo.platform != 'devtools') {
switch (envName) {
case 'develop':
break
case 'trial':
index = manual ? index : 2
break
case 'release':
index = release ? index : 3
break
default:
index = 3
break
}
}
export const env = envName
export const envIndex = index
const createOrderPosterImgUrl = {
develop: `http://192.168.1.178:9528/dj-scrm-wx-work-main-zhangls/#/orderDetailPoster?`,
trial: `http://frontend.test.glsx.com.cn/dj-car-boutique-work-wechat/#/orderDetailPoster?`,
release: `https://dj.glsx.com.cn/dj-car-boutique-work-wechat/#/orderDetailPoster?`
}
const target = ['ip', 'develop', 'trial', 'release', 'preRelease']
// 订单详情地址
export const orderPosterImgUrl = createOrderPosterImgUrl[target[envIndex]]
// 配置预发布的小程序aapId
// export const preReleaseAppId = 'wx24ebae5768e74138'
// 小程序id
// export const appId = 'wx570d9331f9ace0bd'
// sentry Dsn 地址
// export const dsnUrl = 'https://ddaadc52bf8d4ecc92eca632683d456a@sentry.glsx.com.cn/23'
// 图片基地址
// export const ImgUrl = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat'
// packageCrowdfunding/components/createImage/index.js
import Draw from '~/utils/Draw'
import { IMG_URL } from '~/utils/constantData'
Component({
externalClasses: ['custom-class', 'class'],
/**
* 组件的属性列表
*/
properties: {
mode: {
type: String,
value: 'widthFix'
},
orderInfo: {
type: Object,
value: {},
observer: function (n) {
if (n) {
const fn = wx.getFileSystemManager()
fn.readdir({
dirPath: wx.env.USER_DATA_PATH,
success({ files }) {
files.length &&
files.map(e => {
fn.unlink({
filePath: `${wx.env.USER_DATA_PATH}/${e}`
})
})
}
})
let _this = this
_this.drawOrderImg()
}
}
}
},
/**
* 组件的初始数据
*/
data: {
ctx: '',
imagePath: ''
},
/**
* 组件的方法列表
*/
methods: {
// 画图
async drawOrderImg(callBack) {
let _this = this
let { plateNo, payPrice, userName, goodsName, orderNumber, orderStatus, goodsNumber, createdDate, vehicleBrandName, vehicleShapeName, formContentFirst, vehicleSeriesName, formDescribeFirst, formContentSecond, formDescribeSecond, vehicleSubBrandName, phone } = this.data.orderInfo
let valueX = 95,
labelX = 17,
fontSize = 14,
valueEndX = 320 - fontSize / 2,
textBaseline = 'top',
canvasWidth = 337,
canvasHeight = 561,
carText = '',
labelList = ['客户姓名:'],
spacing = 0,
textYList = [],
labelEndX = 80,
lineNum = 2,
lineHeight = 24,
valueList = [userName]
const draw = new Draw(
{
width: canvasWidth,
height: canvasHeight
},
_this
)
if (phone) {
labelList.push('手机号:')
valueList.push(phone)
}
if (plateNo) {
labelList.push('车牌号:')
valueList.push(plateNo)
}
if (vehicleBrandName) {
carText = `${vehicleBrandName || ''} ${vehicleSubBrandName || ''} ${vehicleSeriesName || ''} ${vehicleShapeName || ''}`
labelList.push('车型:')
valueList.push(carText)
}
console.log(new Date(createdDate).format('yyyy年M月d日 hh:mm:ss'))
labelList = [...labelList, '商品名称:', '支付时间:']
// valueList = [...valueList, `${goodsName}${goodsNumber > 1 ? `*${goodsNumber}` : ''}` , new Date(createdDate).format('yyyy年M月d日 hh:mm:ss')]
valueList = [...valueList, goodsName, new Date(createdDate).format('yyyy年M月d日 hh:mm:ss')]
if (orderStatus != 10 && orderNumber) {
labelList.push('订单号:')
valueList.push(orderNumber)
}
if (formContentFirst) {
labelList.push(formDescribeFirst)
valueList.push(formContentFirst)
}
if (formContentSecond) {
labelList.push(formDescribeSecond)
valueList.push(formContentSecond)
}
labelList.push('支付定金')
valueList.push(`${payPrice}元`)
labelList.map((e, index) => {
if (e == '商品名称:' && draw.getTextWidth(carText, fontSize) > valueEndX - valueX) spacing = lineHeight
if ((e == formDescribeSecond && draw.getTextWidth(formContentFirst, fontSize) > valueEndX - valueX) || (e === formDescribeSecond && draw.getTextWidth(formDescribeFirst, fontSize) > labelEndX - labelX)) spacing = lineHeight * 2
if (index == labelList.length - 1) textYList.push(493)
else textYList.push(index * 32 + 109 + spacing)
})
const imgName = {
8: '-2',
10: '-3'
}[orderStatus]
let textList = []
;(labelList || []).map((e, index) => {
let y = textYList[index] + fontSize / 2
let label = {
text: e,
x: labelX,
y,
color: '#999',
fontSize,
textBaseline
}
let value = {
text: valueList[index],
x: valueX,
y,
color: '#282829',
fontSize,
textBaseline,
width: valueEndX
}
if (e === '商品名称:') {
value.color = '#FC5B32'
value.lineNum = 3
}
if ((formDescribeFirst && e === formDescribeFirst) || (formDescribeSecond && e === formDescribeSecond) || e === '品牌车型:') {
value.lineNum = lineNum
value.lineHeight = lineHeight
if ((formDescribeFirst && e === formDescribeFirst) || (formDescribeSecond && e === formDescribeSecond)) {
label.lineNum = lineNum
label.lineHeight = lineHeight
label.width = labelEndX
label.lastFont = ':'
}
}
if (e === '支付定金') {
label.color = '#282829'
value.color = orderStatus == 8 ? '#3162E6' : '#F13C3D'
value.fontWeight = '600'
value.fontSize = 18
value.y = textYList[index] + 5
}
if (orderStatus == 10) {
textList.push({
text: '订单号',
x: labelX - 1,
y: 24,
color: '#282829',
fontSize,
textBaseline,
lineNum: 3
})
textList.push({
text: orderNumber || '',
x: labelX - 1,
y: 54,
color: '#282829',
fontSize,
textBaseline,
lineNum: 3
})
}
textList.push(label)
textList.push(value)
})
let res = await draw.begin({
imageList: [
{
url: `${IMG_URL}crowdfunding/order-bg${imgName || ''}.png`,
x: 0,
y: 0,
width: canvasWidth,
height: canvasHeight
}
],
textList: textList,
lineList: [
{
startX: labelX,
startY: 478,
endX: 320,
endY: 478,
width: 0.1,
color: '#F1F1F1'
}
]
})
this.setData({
imagePath: res.path
})
console.log(res.path)
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* packageCrowdfunding/components/createImage/index.wxss */
\ No newline at end of file \ No newline at end of file
<!--packageCrowdfunding/components/createImage/index.wxml-->
<image src="{{imagePath}}" class="custom-class" mode="{{mode}}" show-menu-by-longpress />
\ No newline at end of file \ No newline at end of file
/** // /**
* // *
0本地 // 0本地
1开发 // 1开发
2测试 // 2测试
3生产环境 // 3生产环境
*/ // */
const accountInfo = wx.getAccountInfoSync() // const accountInfo = wx.getAccountInfoSync()
const systemInfo = wx.getSystemInfoSync() // const systemInfo = wx.getSystemInfoSync()
// console.log(systemInfo); // // console.log(systemInfo);
// console.log(accountInfo.miniProgram.envVersion) // // console.log(accountInfo.miniProgram.envVersion)
//手动控制体验版环境的请求 true就依据下面index false就默认为2 // //手动控制体验版环境的请求 true就依据下面index false就默认为2
const manual = false // const manual = false
const release = false // const release = false
let index = 3 // let index = 3
// 判断小程序环境 // // 判断小程序环境
// develop:开发版(正常开发工具,测试时) // // develop:开发版(正常开发工具,测试时)
// trial:体验版 // // trial:体验版
// release:正式版 // // release:正式版
// console.log( systemInfo.platform); // // console.log( systemInfo.platform);
// console.log(accountInfo.miniProgram.envVersion); // // console.log(accountInfo.miniProgram.envVersion);
if (systemInfo.platform != 'devtools') { // if (systemInfo.platform != 'devtools') {
switch (accountInfo.miniProgram.envVersion) { // switch (accountInfo.miniProgram.envVersion) {
case 'develop': // case 'develop':
// this.globalData.url = 'http://192.168.0.252:3000/api'; // // // this.globalData.url = 'http://192.168.0.252:3000/api'; //
break // break
case 'trial': // case 'trial':
index = manual ? index : 2 // index = manual ? index : 2
break // break
case 'release': // case 'release':
index = release? index : 3 // index = release? index : 3
break // break
default: // default:
index = 3 // index = 3
break // break
} // }
} // }
import { envIndex } from '~/config'
let index = envIndex
// console.log(index); // console.log(index);
const secretKey_items = { const secretKey_items = {
...@@ -60,7 +62,7 @@ const secretKey_items = { ...@@ -60,7 +62,7 @@ const secretKey_items = {
} }
const domain_items = { const domain_items = {
// ip: 'http://192.168.2.59:8292', // ip: 'http://192.168.2.59:8292',
ip:'http://192.168.1.129:8392', ip: 'http://192.168.1.129:8392',
// ip: 'http://192.168.2.3:8292', // ip: 'http://192.168.2.3:8292',
dev: 'https://dj.dev.glsx.com.cn', dev: 'https://dj.dev.glsx.com.cn',
uat: 'https://dj.test.glsx.com.cn', uat: 'https://dj.test.glsx.com.cn',
......
...@@ -28,6 +28,7 @@ const sign = (params, secret, noSignAttr = []) => { ...@@ -28,6 +28,7 @@ const sign = (params, secret, noSignAttr = []) => {
} }
realObj[key] = obj realObj[key] = obj
} }
// console.log(noSignAttr,'noSignAttr');
keys.forEach(e => { keys.forEach(e => {
!noSignAttr.includes(e) && str.push(e + realObj[e]) !noSignAttr.includes(e) && str.push(e + realObj[e])
}) })
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
import api from '../../restapi' import api from '../../restapi'
const util = require('../../../utils/util.js') const util = require('../../../utils/util.js')
const app = getApp() const app = getApp()
import { orderPosterImgUrl } from '~/config'
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
...@@ -26,6 +27,7 @@ Page({ ...@@ -26,6 +27,7 @@ Page({
{ name: 'tradeNo', label: '流水号', info: '' }, { name: 'tradeNo', label: '流水号', info: '' },
{ name: 'payTime', label: '支付时间', info: '' } { name: 'payTime', label: '支付时间', info: '' }
], ],
posterUrl: '',
openId: 'oQ6Sh5cGirPd55Oc1J1oJSRpboFM', openId: 'oQ6Sh5cGirPd55Oc1J1oJSRpboFM',
// openId: '', // openId: '',
outTradeNo: '', outTradeNo: '',
...@@ -42,7 +44,8 @@ Page({ ...@@ -42,7 +44,8 @@ Page({
onLoad: function (options) { onLoad: function (options) {
// console.log('app', app.globalData.login()) // console.log('app', app.globalData.login())
// console.log(aa) // console.log(aa)
// 开发用
// this.getOrderScreenShot()
this.gteOpenId() this.gteOpenId()
wx.hideHomeButton({ wx.hideHomeButton({
success: function () { success: function () {
...@@ -317,7 +320,7 @@ Page({ ...@@ -317,7 +320,7 @@ Page({
}) })
_this.setData({ _this.setData({
unpaid: false, unpaid: false,
dataTime: new Date().format('yyyy/MM/dd hh:mm') dataTime: new Date().format('yyyy年MM月dd hh:mm:ss')
// showOrderInfo: data ? true : false, // showOrderInfo: data ? true : false,
// orderInfoList // orderInfoList
}) })
...@@ -335,31 +338,39 @@ Page({ ...@@ -335,31 +338,39 @@ Page({
}, },
// 支付成功获取订单回调信息 // 支付成功获取订单回调信息
successInfo() { // successInfo() {
let { outTradeNo, orderInfoList, showOrderInfo } = this.data // let { outTradeNo, orderInfoList, showOrderInfo } = this.data
api.queryPayOrderStatus( // api.queryPayOrderStatus(
{ outTradeNo }, // { outTradeNo },
res => { // res => {
util.hideLoading() // util.hideLoading()
console.log(res) // console.log(res)
let { data, returnCode } = res // let { data, returnCode } = res
if (returnCode == 0) { // if (returnCode == 0) {
data && // this.setData({
orderInfoList.forEach(element => { // orderCode: data.orderCode
element['info'] = data[element['name']] // })
}) // this.getOrderScreenShot()
// }
// },
// rej => {
// console.log(rej)
// util.hideLoading()
// }
// )
// },
getOrderScreenShot() {
let { merchantName, dataTime, outTradeNo } = this.data
let params = JSON.stringify({ merchantName, formatAccountDate: dataTime, selectPayType: 1, outTradeNo, payMoney })
api
.orderScreenShot({ url: orderPosterImgUrl + 'orderInfo=' + params })
.then(result => {
// this.poster = res.data
console.log(result, 'poster')
this.setData({ this.setData({
unpaid: false, posterUrl: result.data
showOrderInfo: data ? true : false,
orderInfoList
}) })
} })
// let { returnCode, data } = res .catch(err => {})
},
rej => {
console.log(rej)
util.hideLoading()
}
)
} }
}) })
...@@ -73,7 +73,10 @@ ...@@ -73,7 +73,10 @@
<view wx:if="{{!unpaid}}"> <view wx:if="{{!unpaid}}">
<!-- <view>支付成功</view> --> <!-- <view>支付成功</view> -->
<view class="success-Container"> <view class="success-Container">
<view class="amountOfMoney">¥ {{payMoney}}</view> <view class="poster">
<image class="posetrimg" mode="widthFix" src="{{posterUrl}}" />
</view>
<!-- <view class="amountOfMoney">¥ {{payMoney}}</view>
<view class="success-tips"> <view class="success-tips">
<image class="successIcon" src="../../../images/successIcon.png" /> <image class="successIcon" src="../../../images/successIcon.png" />
支付成功 支付成功
...@@ -94,7 +97,7 @@ ...@@ -94,7 +97,7 @@
<view class="orderInfo"> <view class="orderInfo">
<view class="label">支付时间</view> <view class="label">支付时间</view>
<view class="info">{{dataTime}}</view> <view class="info">{{dataTime}}</view>
</view> </view> -->
<!-- <block wx:for="{{orderInfoList}}" wx:for-item="item" wx:key="index"> <!-- <block wx:for="{{orderInfoList}}" wx:for-item="item" wx:key="index">
<view class="orderInfo" wx:if="{{item.info}}"> <view class="orderInfo" wx:if="{{item.info}}">
<view class="label">{{item.label}}</view> <view class="label">{{item.label}}</view>
......
...@@ -233,7 +233,7 @@ ...@@ -233,7 +233,7 @@
} }
.success-Container { .success-Container {
padding: 100rpx 76rpx 0; padding: 10rpx 0 0;
text-align: center; text-align: center;
background-color: #fff; background-color: #fff;
height: 100vh; height: 100vh;
...@@ -325,3 +325,18 @@ ...@@ -325,3 +325,18 @@
width: 200rpx; width: 200rpx;
height: 50rpx; height: 50rpx;
} }
.poster {
box-sizing: border-box;
margin: 20rpx auto;
width: 710rpx;
/* height: 964rpx; */
background: #FFFFFF;
box-shadow: 0 4rpx 20rpx 0 #0000001a;
border-radius: 16rpx;
}
.posetrimg {
width: 100%;
/* height: 100%; */
}
\ No newline at end of file \ No newline at end of file
...@@ -3,6 +3,7 @@ const filter = require('../../../utils/filter.js') ...@@ -3,6 +3,7 @@ const filter = require('../../../utils/filter.js')
var app = getApp() var app = getApp()
import api from '../../restapi' import api from '../../restapi'
import util from '../../../utils/util.js' import util from '../../../utils/util.js'
import { orderPosterImgUrl } from '~/config'
Page( Page(
// { // {
filter.identityFilter({ filter.identityFilter({
...@@ -14,14 +15,14 @@ Page( ...@@ -14,14 +15,14 @@ Page(
authType: true, // 授权类型(true:授权用户信息;false:授权手机号) authType: true, // 授权类型(true:授权用户信息;false:授权手机号)
sceneId: '', sceneId: '',
ajaxing: false, ajaxing: false,
paySuccess: false paySuccess: false,
// paySuccess: true posterUrl: 'https://wx.glsx.com.cn/upload/biz/646958380279271424.png'
}, },
onLogin() { onLogin() {
util.showLoading('加载中...') // util.showLoading('加载中...')
this.getScenInfo() this.data.sceneId && this.getScenInfo()
console.log(app.globalData) // console.log(app.globalData)
// if (app.globalData.userInfo || app.globalData.userInfo.phone) { // if (app.globalData.userInfo || app.globalData.userInfo.phone) {
// } // }
}, },
...@@ -30,6 +31,9 @@ Page( ...@@ -30,6 +31,9 @@ Page(
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
// 开发用
// this.getOrderDetail()
// this.getOrderScreenShot()
// options.scene = 'sceneId=10689' // options.scene = 'sceneId=10689'
// let options = { // let options = {
...@@ -38,17 +42,17 @@ Page( ...@@ -38,17 +42,17 @@ Page(
// console.log(options, 'options') // console.log(options, 'options')
wx.hideHomeButton({ wx.hideHomeButton({
success: function () { success: function () {
console.log('隐藏成功!') // console.log('隐藏成功!')
} }
}) })
console.log(options) // console.log(options)
let id = decodeURIComponent(options.scene).split('=')[1] let id = decodeURIComponent(options.scene).split('=')[1]
console.log(id, 'id') // console.log(id, 'id')
this.setData({ this.setData({
sceneId: id sceneId: id
}) })
util.showLoading('加载中...')
this.getScenInfo() id && this.getScenInfo()
}, },
/** /**
...@@ -66,7 +70,19 @@ Page( ...@@ -66,7 +70,19 @@ Page(
ajaxing: false ajaxing: false
}) })
}, },
getOrderScreenShot() {
const { orderCode } = this.data
api
.orderScreenShot({ url: orderPosterImgUrl + 'orderCode='(orderCode || '230407155523620') })
.then(result => {
// this.poster = res.data
console.log(result, 'poster')
this.setData({
posterUrl: result.data
})
})
.catch(err => {})
},
// 获取订单信息 // 获取订单信息
getInfo: function (row) { getInfo: function (row) {
let _this = this let _this = this
...@@ -102,12 +118,14 @@ Page( ...@@ -102,12 +118,14 @@ Page(
success: function (res) { success: function (res) {
console.log(res) console.log(res)
_this.setData({ _this.setData({
paySuccess: true, paySuccess: true
dataTime: new Date().format('yyyy/MM/dd hh:mm') // dataTime: new Date().format('yyyy/MM/dd hh:mm')
}) })
wx.setNavigationBarTitle({ wx.setNavigationBarTitle({
title: '支付成功' title: '支付成功'
}) })
// 获取订单截图
_this.getOrderScreenShot()
// wx.redirectTo({ // wx.redirectTo({
// url: '/packagePersonal/pages/boutiqueList/boutiqueList' // url: '/packagePersonal/pages/boutiqueList/boutiqueList'
// }) // })
...@@ -130,6 +148,7 @@ Page( ...@@ -130,6 +148,7 @@ Page(
// 获取订单信息 // 获取订单信息
getScenInfo() { getScenInfo() {
util.showLoading('加载中...')
let id = this.data.sceneId let id = this.data.sceneId
console.log(this.data) console.log(this.data)
// console.log(); // console.log();
...@@ -164,6 +183,6 @@ Page( ...@@ -164,6 +183,6 @@ Page(
) )
} }
} }
}) })
// } // }
) )
{ {
"usingComponents": {}, "usingComponents": {
},
"navigationBarTitleText": "支付" "navigationBarTitleText": "支付"
} }
\ No newline at end of file \ No newline at end of file
<!--支付--> <!-- 支付 -->
<view class="page"> <!-- wx:if="{{orderInfo}}" -->
<view class="success-Container" wx:if="{{paySuccess}}"> <block wx:if="{{paySuccess}}">
<!-- <view class="amountOfMoney">¥ {{payMoney}}</view> --> <view class="poster">
<view class="success-tips"> <image class="posetrimg" mode="widthFix" src="{{posterUrl}}" />
<image class="successIcon" src="../../../images/successIcon.png" /> </view>
支付成功 <view class="footerCon">
</view> <view class="wxTips">长按识别扫码领取质保卡</view>
<view class="line" /> <image bindlongpress="navWarrantyCard" class="wxqrCon" src="https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/minizhibaoka.png" />
<view class="orderInfo"> <image class="logoIcon" src="../../../images/djLogin.png" />
<view class="label">收款主体</view> </view>
<view class="info">深圳市嘀加智慧云服务有限公司</view> </block>
</view> <auth-setting auth='{{authToast}}' type='{{authType}}' />
<!-- <view class="orderInfo">
<view class="label">商户名称</view>
<view class="info">{{merchantName || shopMerchantName}}</view>
</view> -->
<view class="orderInfo">
<view class="label">支付订单号</view>
<view class="info">{{orderCode}}</view>
</view>
<view class="orderInfo">
<view class="label">支付时间</view>
<view class="info">{{dataTime}}</view>
</view>
</view>
</view>
<auth-setting auth='{{authToast}}' type='{{authType}}' index />
\ No newline at end of file \ No newline at end of file
/* packagesPayment/pages/payment/index.wxss */ /* packagesPayment/pages/payment/index.wxss */
.success-Container { /* page {
padding: 100rpx 76rpx 0; padding: 20rpx;
text-align: center; } */
background-color: #fff;
height: 100vh;
}
.amountOfMoney {
font-size: 80rpx;
font-weight: 600;
}
.success-tips {
display: flex;
align-items: center;
justify-content: center;
font-size: 48rpx;
margin-bottom: 30rpx;
}
.successIcon {
width: 64rpx;
height: 64rpx;
margin-right: 30rpx;
}
.orderInfo {
display: flex;
justify-content: space-between;
}
.success-Container { .poster {
box-sizing: border-box; box-sizing: border-box;
display: flex; margin: 20rpx auto;
flex-direction: column; width: 710rpx;
/* justify-content: center; */ /* height: 964rpx; */
align-items: center; background: #FFFFFF;
} box-shadow: 0 4rpx 20rpx 0 #0000001a;
border-radius: 16rpx;
.success-Container .line {
height: 1px;
width: 100%;
margin: 28rpx 0;
background: #E5E5E5;
} }
.success-Container .orderInfo { .posetrimg {
width: 100%; width: 100%;
margin-bottom: 28rpx; /* height: 100%; */
}
.success-Container .label {
font-size: 30rpx;
color: #999;
}
.success-Container .info {
font-size: 30rpx;
color: #333;
flex: 1;
text-align: right;
max-width: 80%;
overflow: hidden;
text-overflow: ellipsis;
/* display: -webkit-box; */
white-space: nowrap;
} }
.footerCon { .footerCon {
margin-top: auto; box-sizing: border-box;
margin-bottom: 200rpx; width: 710rpx;
height: 558rpx;
background: #FFFFFF;
box-shadow: 0 4rpx 20rpx 0 #0000001a;
border-radius: 16rpx;
/* margin-top: auto; */
margin: auto auto 0rpx;
/* margin-bottom: 200rpx; */
padding: 44rpx 0 58rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
...@@ -84,7 +43,7 @@ ...@@ -84,7 +43,7 @@
.wxqrCon { .wxqrCon {
width: 306rpx; width: 306rpx;
height: 305rpx; height: 305rpx;
margin: 12rpx 0 84rpx; margin: 16rpx 0 50rpx;
Object-fit: contain; Object-fit: contain;
} }
......
...@@ -5,7 +5,33 @@ module.exports = { ...@@ -5,7 +5,33 @@ module.exports = {
GETORDERINFO: function (oParams, success, fail) { GETORDERINFO: function (oParams, success, fail) {
restapi.req('/web-dj-weapp/smartcarlife/goodsOrder/createWxPayOrder', oParams, {}, 'GET', 'json', 'text', success, fail) restapi.req('/web-dj-weapp/smartcarlife/goodsOrder/createWxPayOrder', oParams, {}, 'GET', 'json', 'text', success, fail)
}, },
/** 精品交付单订单详情列表 */
// getBoutiqueOrderDetail(data, success, fail) {
// api.get('boutiquedelivery/order/getDetail', data, success, fail)
// },
// req(`/web-dj-weapp/${link}`, data, header, method, 'json', 'text',
/** 精品交付单订单详情列表 */
// getBoutiqueOrderDetail: function (params, success, fail) {
// restapi.req(
// '/web-dj-weapp/boutiquedelivery/order/getDetail',
// // JSON.stringify(code),
// params, {},'GET', 'json', 'text', success,fail
// )
// },
getDetailByOrderCode(params, success, fail) {
// api.get('smartcarlife/goodsOrder/getDetailByOrderCode', data, success)
restapi.req(
'/web-dj-weapp/smartcarlife/goodsOrder/getDetailByOrderCode',
// JSON.stringify(code),
params,
{},
'GET',
'json',
'text',
success,
fail
)
},
/** /**
* 根据场景id获取场景值 * 根据场景id获取场景值
*/ */
...@@ -88,5 +114,9 @@ module.exports = { ...@@ -88,5 +114,9 @@ module.exports = {
/** 获取用户协议配置 */ /** 获取用户协议配置 */
getTitleByModule(data) { getTitleByModule(data) {
return api.post('dj.api.smartcarlife.privacyAgreement.getTitleByModule', data) return api.post('dj.api.smartcarlife.privacyAgreement.getTitleByModule', data)
},
/** 订单截图 */
orderScreenShot(data) {
return api.post('dj.api.smartcarlife.common.screenShot', data)
} }
} }
...@@ -116,9 +116,6 @@ module.exports = { ...@@ -116,9 +116,6 @@ module.exports = {
restapi.req( restapi.req(
'/web-dj-weapp/smartcarlife/goodsOrder/queryPayOrderStatus', '/web-dj-weapp/smartcarlife/goodsOrder/queryPayOrderStatus',
params, params,
// {
// 'content-type': 'application/x-www-form-urlencoded'
// },
{ {
'content-type': 'application/json' 'content-type': 'application/json'
}, },
......
...@@ -243,7 +243,7 @@ ...@@ -243,7 +243,7 @@
{ {
"name": "支付", "name": "支付",
"pathName": "packagesPayment/pages/payment/index", "pathName": "packagesPayment/pages/payment/index",
"query": "sceneId='sceneId=10683'", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
}, },
...@@ -280,5 +280,5 @@ ...@@ -280,5 +280,5 @@
}, },
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "dj-car-weapp-smartshop", "projectname": "dj-car-weapp-smartshop",
"libVersion": "2.10.4" "libVersion": "2.24.4"
} }
\ No newline at end of file \ No newline at end of file
// export const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/store-assistant/'
import getAppId from '~/utils/utils_wx'
import util from '~/utils/util'
export const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/'
// 缓存get方法为空的默认指定值
export const DEFAULT_GET_STORAGEKEY = ['sessionId', 'merchantId', 'userInfo']
export const appId = getAppId.getAppId()
// 缓存get方法key的对应才映射值
export const STORAGE_OBJECTkEY = {
DEFAULT_GET_STORAGEKEY,
sessionId: 'sessionId',
userInfo: 'userInfo',
system_info: 'system_info',
app_title: 'appTitle',
auto_login_object: 'auto_login_object',
address_info: 'address_info',
wx_user_info: 'wx_user_info',
isVIP: 'isVIP',
edjurl: 'edjurl',
isNeedShowModal: 'isNeedShowModal',
bindInfo: 'bindInfo',
isShowPreModal: 'isShowPreModal',
unauthorized: 'unauthorized',
activityId: 'activityId',
shareStaff: 'shareStaff',
miaoshatrack: 'miaoshatrack',
lastCouponIds: 'lastCouponIds',
merchant_info: 'merchant_info',
refresh_oil_oage: 'refresh_oil_oage',
shareStaffTracker: 'shareStaffTracker',
srcm_shopmall_merchant_id: 'srcm_shopmall_merchant_id',
srcm_shopmall_city_list: 'srcm_shopmall_city_list',
srcm_shopmall_brand_list: 'srcm_shopmall_brand_list',
newCarBrandList: 'newCarBrandList',
scrm_shopmall_car_brand_list: 'scrm_shopmall_car_brand_list',
srcm_shopmall_user_info: 'srcm_shopmall_user_info',
scrm_shopmall_sessionId: 'scrm_shopmall_sessionId',
closeMask: 'closeMask',
activity_options: 'activity_options',
closePYQTip: 'closePYQTip',
user_profile: 'user_profile',
srcm_shopmall_customer_id: 'srcm_shopmall_customer_id',
mock_data: 'mock_data'
}
export const IMG_VERSION = async () => {
const accountInfo = await util.getMockData()
return accountInfo?.version || Date.now()
}
\ No newline at end of file \ No newline at end of file
const restapi = require('restapi.js') const restapi = require('restapi.js')
const app = getApp(); const app = getApp()
const whitePage = ['pages/tab/index/index']; const whitePage = ['pages/tab/index/index']
/** /**
* 身份验证过滤器 * 身份验证过滤器
* @param pageObj 页面对象 * @param pageObj 页面对象
*/ */
function identityFilter(pageObj) { function identityFilter(pageObj) {
var enterTime = new Date(); var enterTime = new Date()
if(pageObj.onLoad){ if (pageObj.onLoad) {
let _onLoad = pageObj.onLoad; let _onLoad = pageObj.onLoad
pageObj.onLoad = function(op){ pageObj.onLoad = function (op) {
console.log(op); // console.log(op)
let currentInstance = getPageInstance(); let currentInstance = getPageInstance()
if(op.scene){ if (op.scene) {
var scene = decodeURIComponent(op.scene); var scene = decodeURIComponent(op.scene)
var qrCodeScene = { var qrCodeScene = {
id: scene.split('=')[1] id: scene.split('=')[1]
} }
console.log(qrCodeScene); console.log(qrCodeScene)
restapi.qrCodeScene(qrCodeScene, function(res){ restapi.qrCodeScene(qrCodeScene, function (res) {
if(res.returnCode =='0'){ if (res.returnCode == '0') {
var scenestr = res.data; var scenestr = res.data
if (scenestr){ if (scenestr) {
scenestr.split('&').forEach((item) => { scenestr.split('&').forEach(item => {
const key = item.split("=")[0] const key = item.split('=')[0]
const val = item.split("=")[1]; const val = item.split('=')[1]
op[key] = val; op[key] = val
}) })
console.log(op); console.log(op)
console.log('filter op', op); console.log('filter op', op)
} }
} }
_onLoad.call(currentInstance, op); _onLoad.call(currentInstance, op)
}) })
}else{ } else {
_onLoad.call(currentInstance, op); _onLoad.call(currentInstance, op)
} }
} }
} }
if (pageObj.onShow) { if (pageObj.onShow) {
let _onShow = pageObj.onShow; let _onShow = pageObj.onShow
pageObj.onShow = function () { pageObj.onShow = function () {
let currentInstance = getPageInstance(); let currentInstance = getPageInstance()
var flag = true; var flag = true
for (var i in whitePage){ for (var i in whitePage) {
if (currentInstance.route == whitePage[i]){ if (currentInstance.route == whitePage[i]) {
flag = false; flag = false
break; break
} }
} }
if (!flag){ if (!flag) {
_onShow.call(currentInstance); _onShow.call(currentInstance)
} }
identityCheck(() => { identityCheck(
() => {
// 关闭授权窗 // 关闭授权窗
currentInstance.setData({ currentInstance.setData({
authToast: false authToast: false
}); })
currentInstance.onLogin(); currentInstance.onLogin()
if(flag){ if (flag) {
_onShow.call(currentInstance); _onShow.call(currentInstance)
} }
}, authType => { },
authType => {
// 弹出授权窗口 // 弹出授权窗口
if(!(app.globalData.authUserInfo && app.globalData.authPhone)) { if (!(app.globalData.authUserInfo && app.globalData.authPhone)) {
currentInstance.setData({ currentInstance.setData({
authToast: true, authToast: true,
authType: authType authType: authType
}); })
} }
// 完成授权后回调 // 完成授权后回调
app.userInfoReadyCallback = userInfo => { app.userInfoReadyCallback = userInfo => {
currentInstance.onLogin(); currentInstance.onLogin()
if(flag){ if (flag) {
_onShow.call(currentInstance); _onShow.call(currentInstance)
}
} }
} }
}); )
} }
} }
if (pageObj.onHide) { if (pageObj.onHide) {
let _onHide = pageObj.onHide; let _onHide = pageObj.onHide
pageObj.onHide = function () { pageObj.onHide = function () {
let currentInstance = getPageInstance(); let currentInstance = getPageInstance()
pageVisitCollect(currentInstance.route, enterTime); pageVisitCollect(currentInstance.route, enterTime)
_onHide.call(currentInstance); _onHide.call(currentInstance)
} }
} }
if (pageObj.onUnload) { if (pageObj.onUnload) {
let _onUnload = pageObj.onUnload; let _onUnload = pageObj.onUnload
pageObj.onUnload = function () { pageObj.onUnload = function () {
let currentInstance = getPageInstance(); let currentInstance = getPageInstance()
pageVisitCollect(currentInstance.route, enterTime); pageVisitCollect(currentInstance.route, enterTime)
_onUnload.call(currentInstance); _onUnload.call(currentInstance)
} }
} }
return pageObj; return pageObj
} }
/** /**
* 身份验证 * 身份验证
*/ */
function identityCheck(success, fail){ function identityCheck(success, fail) {
// 获取用户信息 // 获取用户信息
wx.login({ wx.login({
success: response => { success: response => {
app.globalData.code = response.code; app.globalData.code = response.code
userAuth(success, fail); userAuth(success, fail)
} }
}) })
} }
...@@ -118,75 +119,76 @@ function identityCheck(success, fail){ ...@@ -118,75 +119,76 @@ function identityCheck(success, fail){
/** /**
* 用户授权 * 用户授权
*/ */
function userAuth(success, fail){ function userAuth(success, fail) {
let currentInstance = getPageInstance()
let currentInstance = getPageInstance(); // console.log(app.globalData)
console.log(app.globalData)
// 已授权微信用户信息 // 已授权微信用户信息
if (app.globalData.authUserInfo) { if (app.globalData.authUserInfo) {
// 已授权手机号 // 已授权手机号
if (app.globalData.authPhone) { if (app.globalData.authPhone) {
// 停掉检测任务 // 停掉检测任务
clearInterval(currentInstance.data.authInterval); clearInterval(currentInstance.data.authInterval)
// 授权成功 // 授权成功
success(); success()
} else { } else {
// 开启授权检测任务 // 开启授权检测任务
checkAuthInterval(); checkAuthInterval()
// 未授权手机号 // 未授权手机号
fail(false); fail(false)
} }
return; return
} else { } else {
fail(true); fail(true)
} }
// 开启新的授权检测任务 // 开启新的授权检测任务
checkAuthInterval(); checkAuthInterval()
restapi.jscodeLogin(app.globalData.code, app.globalData.appId, function (response) { restapi.jscodeLogin(app.globalData.code, app.globalData.appId, function (response) {
console.log(response); // console.log(response)
switch (response.returnCode) { switch (response.returnCode) {
case '0': // 获取微信用户信息成功 case '0': // 获取微信用户信息成功
app.globalData.userInfo = response.data; app.globalData.userInfo = response.data
if(app.globalData.userInfo.isLogin == 'Y'){ if (app.globalData.userInfo.isLogin == 'Y') {
// 退出登录,重新授权用户信息(单独授权手机号,由于code失效导致解密异常,后期处理) // 退出登录,重新授权用户信息(单独授权手机号,由于code失效导致解密异常,后期处理)
app.globalData.authUserInfo = true; app.globalData.authUserInfo = true
if (response.data.accountId) { // 已获取手机号 if (response.data.accountId) {
app.globalData.authPhone = true; // 已获取手机号
app.globalData.authPhone = true
// 登录成功回调 // 登录成功回调
app.globalData.loginSuccessCallback(response.data); app.globalData.loginSuccessCallback(response.data)
success(); success()
} else { // 未获取手机号,授权获取 } else {
fail(false); // 未获取手机号,授权获取
fail(false)
} }
}else{ } else {
// 已退出登录,授权获取用户信息 // 已退出登录,授权获取用户信息
fail(true); fail(true)
} }
break; break
case '-1': case '-1':
// 获取微信用户信息为空,授权获取 // 获取微信用户信息为空,授权获取
if (response.errId == '200205') { if (response.errId == '200205') {
fail(true); fail(true)
} }
break; break
default: default:
wx.showToast({ wx.showToast({
title: response.message title: response.message
}) })
} }
}); })
} }
/** /**
* 轮询检测授权 * 轮询检测授权
*/ */
function checkAuthInterval(){ function checkAuthInterval() {
let currentInstance = getPageInstance(); let currentInstance = getPageInstance()
// 停掉原有检测任务 // 停掉原有检测任务
clearInterval(currentInstance.data.authInterval); clearInterval(currentInstance.data.authInterval)
var authInterval = setInterval(function(){ var authInterval = setInterval(function () {
// 已授权微信用户信息 // 已授权微信用户信息
if (app.globalData.authUserInfo) { if (app.globalData.authUserInfo) {
// 已授权手机号 // 已授权手机号
...@@ -194,28 +196,28 @@ function checkAuthInterval(){ ...@@ -194,28 +196,28 @@ function checkAuthInterval(){
// 关闭授权窗口 // 关闭授权窗口
currentInstance.setData({ currentInstance.setData({
authToast: false authToast: false
}); })
console.log("clear interval:" + currentInstance.data.authInterval); console.log('clear interval:' + currentInstance.data.authInterval)
clearInterval(currentInstance.data.authInterval); clearInterval(currentInstance.data.authInterval)
// 登录成功回调 // 登录成功回调
app.globalData.loginSuccessCallback(app.globalData.userInfo); app.globalData.loginSuccessCallback(app.globalData.userInfo)
} else { } else {
// 切换到手机号授权窗口 // 切换到手机号授权窗口
currentInstance.setData({ currentInstance.setData({
authType: false authType: false
}); })
} }
} }
}, 1000); }, 1000)
// 保存任务ID // 保存任务ID
currentInstance.setData({ currentInstance.setData({
authInterval: authInterval authInterval: authInterval
}); })
} }
function getPageInstance() { function getPageInstance() {
var pages = getCurrentPages(); var pages = getCurrentPages()
return pages[pages.length - 1]; return pages[pages.length - 1]
} }
/** /**
...@@ -223,15 +225,15 @@ function getPageInstance() { ...@@ -223,15 +225,15 @@ function getPageInstance() {
* @param {页面路径} page * @param {页面路径} page
* @param {进入时间} enterTime * @param {进入时间} enterTime
*/ */
function pageVisitCollect(page, enterTime){ function pageVisitCollect(page, enterTime) {
var data = { var data = {
path: page, path: page,
enterTime: enterTime, enterTime: enterTime,
leaveTime: new Date, leaveTime: new Date(),
merchantId: app.globalData.extConfig.merchantId, merchantId: app.globalData.extConfig.merchantId,
appId: app.globalData.appId appId: app.globalData.appId
} }
restapi.pageVisitCollect(JSON.stringify(data), function(res){}); restapi.pageVisitCollect(JSON.stringify(data), function (res) {})
} }
exports.identityFilter = identityFilter;
\ No newline at end of file \ No newline at end of file
exports.identityFilter = identityFilter
...@@ -14,7 +14,7 @@ const systemInfo = wx.getSystemInfoSync() ...@@ -14,7 +14,7 @@ const systemInfo = wx.getSystemInfoSync()
const manual = false const manual = false
const release = false const release = false
let index =3 let index =1
// 判断小程序环境 // 判断小程序环境
// develop:开发版(正常开发工具,测试时) // develop:开发版(正常开发工具,测试时)
......
import $router from '../router/index'
/**
* 微信校验通知类工具封装
*/
const tipsObj = {
phone: {
icon: 'error',
title: '请输入手机号'
},
username: {
icon: 'error',
title: '请输入用户名'
},
password: {
icon: 'error',
title: '请输入密码'
}
}
/**
* 禁止滑动
*/
const noScroll = () => {}
/**设置粘贴板内容 */
const setCopyData = (data, callBack) => {
wx.setClipboardData({
data: data,
success(res) {
if (callBack && typeof callBack === 'function') callBack(res)
}
})
}
/** 获取小程序 appId */
const getAppId = () => {
return wx.getAccountInfoSync().miniProgram.appId
}
/**
* 防止重复点击
*/
const showLoading = (title = '') => {
if (wx.showLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
wx.showLoading({
title,
mask: true
})
} else {
// 低版本采用Toast兼容处理并将时间设为20秒以免自动消失
wx.showToast({
title,
icon: 'loading',
mask: true,
duration: 20000
})
}
}
const hideLoading = () => {
if (wx.hideLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
wx.hideLoading()
} else {
wx.hideToast()
}
}
const showToast = val => {
let obj = {}
if (val && typeof val === 'object') {
obj = val
} else {
obj.title = String(val)
obj.icon = 'none'
}
return wx.showToast(obj)
}
/**
*
* @param {* string | object} name 信息名称
* @param {* object | null} [params] 信息名称参数
*/
const wxShowToast = (name, params) => {
if (arguments.length == 2) {
wx.showToast({
title: tipsObj[name]['title'],
icon: tipsObj[name]['icon'],
...params
})
} else {
wx.showToast({
...params
})
}
}
/**获取设备信息 */
const getSystemInfo = callBack => {
wx.getSystemInfo({
success(res) {
callBack(res)
},
fail(err) {
callBack(err)
}
})
}
/**拨打电话 */
const phoneCall = phoneNumber => {
wx.makePhoneCall({
phoneNumber: `${phoneNumber}`
})
}
/**查看大图 */
const previewImage = params => {
wx.previewImage(params)
}
/**是否全面屏 */
const isFullSucreen = isComponents => {
const thisPage = $router.getPageInstance()
const routerList = $router.getRouterList()
const router = routerList.find(item => item.url === `/${thisPage.route}`)
let key = `${router.url.replace('/', '')}.html`
let val = false
if (__wxConfig && __wxConfig.page && __wxConfig.page[key]) {
let {
navigationStyle
} = __wxConfig.page[key].window
wx.getSystemInfo({
success(res) {
if (res.platform != 'android') {
let {
statusBarHeight,
screenHeight,
windowHeight
} = res
if (navigationStyle && navigationStyle == 'custom') {
windowHeight = windowHeight - thisPage.data.navHeight || 0
}
//兼容自定义标题
val = router.isTab ? screenHeight - windowHeight - statusBarHeight - 32 > 72 : screenHeight - windowHeight > 72
if (isComponents) val = screenHeight - windowHeight > 72
}
},
fail(err) {
return false
}
})
}
return val
}
/**获取节点信息
* name(id获取class)
* callBack 回调函数
* isComponents是否在组件
*/
const getViewInfo = (name, callBack, isComponents) => {
const query = !isComponents ? wx.createSelectorQuery() : wx.createSelectorQuery().in(isComponents)
query
.select(name)
.boundingClientRect(res => {
callBack(res)
})
.exec()
}
/**触底加载 */
const onReachBottom = (obj, callBack) => {
let _this = $router.getPageInstance()
let {
pageNum,
total,
pageSize,
nothing
} = obj
if (!total && !pageNum) {
console.error('total&&pageNum为必传')
return
}
if (!pageSize) pageSize = 10
if (!nothing) nothing = 'nothing'
if (Math.ceil(total / pageSize) > pageNum) {
_this.setData({
pageNum: pageNum + 1
})
callBack()
} else {
_this.setData({
[nothing]: true
})
}
}
const wxApi = {
previewImage,
getSystemInfo,
showLoading,
hideLoading,
setCopyData,
showToast,
phoneCall,
noScroll,
wxShowToast,
getAppId,
isFullSucreen,
getViewInfo,
onReachBottom
}
export default wxApi
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!