Commit f8a5a642 by 张立顺

feat 功能开发

1 parent b2749eb1
......@@ -2,9 +2,9 @@
Component({
properties: {
position: {
type: String,
value: 'center',
position: {
type: String,
value: 'center',
observer: function (newVal, oldVal) { }
},
title: {
......@@ -18,11 +18,12 @@ Component({
value: 'alert',
observer: function (newVal, oldVal) { }
},
closeApp:Boolean
closeApp: Boolean
},
data: {},
methods: {
confirm: function (e) {
console.log(111);
this.setData({
hidden: true
});
......
......@@ -11,10 +11,10 @@
<view class="modal-footer {{type === 'custom' ? 'hidden' : ''}}">
<view hover-class hidden="{{type === 'alert' }}" bindtap='confirm' class='btn btn-cancel'>取消</view>
<block wx:if='{{closeApp}}'>
<navigator class='btn btn-ok' target="miniProgram" open-type="exit">确定</navigator >
<navigator class='btn btn-ok' target="miniProgram" open-type="exit">确定</navigator>
</block>
<block wx:else>
<view hover-class data-is-confirm="true" bindtap='confirm' class='btn btn-ok'>确认</view>
<view hover-class data-is-confirm="true" bindtap='confirm' class='btn btn-ok'>知道了</view>
</block>
</view>
</view>
......
......@@ -9,6 +9,7 @@
height: 100%;
background: rgba(0, 0, 0, 0.4);
}
.hidden {
display: none !important;
}
......@@ -23,6 +24,7 @@
content: '';
background: rgba(0, 0, 0, 0.4);
}
.modal-wrapper .modal {
position: fixed;
top: 50%;
......@@ -34,6 +36,7 @@
transform: translate3d(0, -50%, 0);
overflow: hidden;
}
.modal-wrapper .modal-bottom {
top: auto;
bottom: 0;
......@@ -42,6 +45,7 @@
border-radius: 0;
transform: translate3d(0, 0, 0);
}
.modal-wrapper .modal-top {
top: 0;
bottom: auto;
......@@ -50,14 +54,17 @@
border-radius: 0;
transform: translate3d(0, 0, 0);
}
.modal-wrapper .modal-sm {
left: 12%;
right: 12%;
}
.modal-wrapper .modal-block {
left: 0;
right: 0;
}
.modal-wrapper .modal.transparent-dark {
background-color: rgba(0, 0, 0, 0.7);
color: #FFF;
......@@ -65,26 +72,32 @@
max-width: 300rpx;
margin: 0 auto;
}
.modal-wrapper .modal-header {
padding: 68rpx 30rpx 0;
text-align: center;
}
.modal-wrapper .modal-header .title {
font-weight: normal;
color: #333;
}
.modal-wrapper .modal-header.no-borders {
padding: 15rpx;
}
.modal-wrapper .modal-header.no-borders + .modal-body {
.modal-wrapper .modal-header.no-borders+.modal-body {
padding: 0 30rpx 22rpx;
}
.modal-wrapper .modal-body {
overflow-y: auto;
max-height: 660rpx;
padding: 100rpx 15rpx;
padding: 30rpx 15rpx 60rpx;
text-align: center;
}
.modal-wrapper .modal-footer {
display: flex;
border-top: 1rpx solid #D8D8D8;
......@@ -92,6 +105,7 @@
justify-content: space-around;
text-align: center;
}
.modal-wrapper .modal-footer .btn {
padding: 24rpx;
border: none;
......@@ -99,14 +113,17 @@
border-radius: 0;
flex: 1;
font-size: 28rpx;
color: #007AFF;
color: #347BFF;
}
.modal-wrapper .modal-footer .btn + .btn {
.modal-wrapper .modal-footer .btn+.btn {
border-left: 1rpx solid #D8D8D8;
}
.modal-wrapper .modal-footer .btn-ok {
color: #007AFF;
}
.mask_relative {
position: absolute;
top: 0;
......
......@@ -11,7 +11,7 @@
* 3生产环境
* 4预发布
*/
let index = 1
let index = 2
const accountInfo = wx.getAccountInfoSync()
const systemInfo = wx.getSystemInfoSync()
......
......@@ -10,6 +10,8 @@ Page({
* 页面的初始数据
*/
data: {
tips: '222',
showModal: true,
KeyboardKeys: [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, '.'],
merchantId: '',
merchantName: '',
......@@ -38,7 +40,6 @@ Page({
userCollaborationCheck: false,
isYqType: true
},
/**
* 生命周期函数--监听页面加载
*/
......@@ -53,30 +54,28 @@ Page({
console.log('隐藏成功!')
}
})
// options = {
// sceneId%3D4
// scene: 'sceneId%3D4'
// }
// console.log(decodeURIComponent(options.scene))
// let id = decodeURIComponent(options.scene).split('=')[1]
// if (!id) {
// throw new Error('id缺失')
// }
// // console.log(id)
// //获取门店信息
// this.getMerthcantInfo(id)
// // 获取用户隐私协议配置
// this.getTitleByModule()
console.log(decodeURIComponent(options.scene))
let id = decodeURIComponent(options.scene).split('=')[1]
if (!id) {
throw new Error('id缺失')
}
// console.log(id)
//获取门店信息
this.getMerthcantInfo(id)
// 获取用户隐私协议配置
this.getTitleByModule()
// this.navToUserCollaboration()
// this.setData({
// merchantId: id
// })
this.wxPayment()
},
close() {
console.log('close');
wx.exitMiniProgram()
},
navToUserCollaboration() {
wx.$router.go('userCollaboration')
......@@ -85,6 +84,7 @@ Page({
getMiniAppConfig(id) {
console.log(id, 'id');
let that = this
let { isYqType } = this.data
const target = ['develop', 'develop', 'test', 'production', 'beta']
wx.request({
// url: `${domain}${path}?method=${method}`,
......@@ -96,13 +96,25 @@ Page({
responseType: 'text',
success(response) {
// app.globalData.configInfo = response.data
let { statusCode, data: { disabledList } } = response
let { statusCode, data: { disabledList, prohibitedList } } = response
console.log(statusCode, 'statusCode');
if (statusCode == 200) {
let merchantDisabled = disabledList.some(item => item.merchantId == id)
that.setData({
merchantDisabled
})
if (isYqType) {
let disabledPay = !prohibitedList.some(item => item.merchantId == id)
// console.log(this.disabledPay, prohibitedList)
if (disabledPay) {
that.setData({
disabledPay,
showModal: false
})
// this.show = true
}
}
// isYqType && this.setDisabledList(op?.merchantId)
}
// console.log(data.disabledList, 'response');
// resolve(response.data)
......@@ -175,8 +187,8 @@ Page({
...op,
isYqType
})
// 获取质保卡配置
isYqType && this.getwxQrcode()
this.getMiniAppConfig(op.merchantId || op.shopMerchantId)
//util.showLoading('加载中...')
......@@ -264,10 +276,8 @@ Page({
} else {
money = payMoney + key
}
// console.log(/^(\d+\.?\d{0,2})$/.test(money), money, 'money')
// console.log(/^(\d{0,7}\.?\d{0,2})$/.test(money), money, 'money')
if (/^(\d{0,6}\.?\d{0,2})$/.test(money)) {
// 此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
if (money.indexOf('.') < 0 && money != '') {
......@@ -285,17 +295,23 @@ Page({
// 支付
handlePay() {
let _this = this
const { payMoney, merchantId, isYqType, shopMerchantId, openId, unPayMoneyList, userCollaborationName, userCollaborationCheck, merchantDisabled } = this.data
const { disabledPay, payMoney, merchantId, isYqType, shopMerchantId, openId, unPayMoneyList, userCollaborationName, userCollaborationCheck, merchantDisabled, paymentChannelId } = this.data
if (isYqType && disabledPay) {
return this.setData({
showModal: false
})
}
if (userCollaborationName && !userCollaborationCheck && !merchantDisabled) {
return util.showToast(`请先阅读并勾选《${userCollaborationName}》`)
}
if (payMoney === '' || unPayMoneyList.includes(payMoney)) return
// this.wxPayment(payMoney)
// console.log(Number(payMoney), '付款')
let params = {
openId,
receivedMoney: payMoney * 100
receivedMoney: payMoney * 100,
paymentChannelId,
appId: app.globalData.appId
}
if (isYqType) {
params.merchantId = merchantId
......@@ -316,9 +332,11 @@ Page({
util.hideLoading()
// console.log(res)
let { returnCode, data, message } = res
if (returnCode == 0) {
let jsapiPayInfo = data.jsapiPayInfo ? JSON.parse(data.jsapiPayInfo) : {}
if (jsapiPayInfo?.chnlPayInfo) {
jsapiPayInfo = JSON.parse(jsapiPayInfo.chnlPayInfo)
}
// 保存参考交易号在支付成功时调用
this.setData({
outTradeNo: data.outTradeNo
......@@ -349,7 +367,6 @@ Page({
// _this.wxPayment(jsapiPayInfo)
// })
},
// 调用微信支付
wxPayment(row) {
let _this = this
......@@ -359,16 +376,13 @@ Page({
// _this.setData({
// ajaxing: true
// })
console.log(row, 'row');
wx.requestPayment({
// nonceStr: row.nonceStr,
// package: row.package,
// paySign: row.paySign,
nonceStr: '82bbe0aa7f4c41eabd10a3b21172efc6',
package: 'prepay_id=wx3116401807672131003ecc94470aa00001',
paySign: 'wCKGkB7Dbuz2YyJTiQC8kiO9Y6gfgwCRincAVkXntYHEOE3Fd9hQkioaeYJpC9uCPQoH0+EC54geeqwuOeUPmHsjsuXMP0v6Su8tVwQLaUYqkF+Fpgk8wpl4eNQMvzAgAgkAqJlTSlhdBQ6r+ZgQpVdBbVMnAXdAgifTOCs7R4FdBfXWZIFVU9+qNFVLaSWBsoZ5iK7Ft5YO/FGZSAmEsQVmmrYSB7xbQSCRKsM00IIeApWOtkYw0AO2NKa+Nx3ee44qV9siSGbCDZmIfYImP8bUQ0XJiT9orslvtdT+KUx1M/zF9HBKor8KexwE/xdVMgdvFb7rSe0e7uYUzEGXmg==',
timeStamp: '1753951218',
signType: 'RSA',
// signType: 'MD5',
nonceStr: row.nonceStr,
package: row.package,
paySign: row.paySign,
timeStamp: row.timeStamp,
signType: 'MD5',
success: function (res) {
console.log(res)
// 查询订单信息
......@@ -387,6 +401,7 @@ Page({
// _this.successInfo()
},
fail: function (error) {
console.log(error, 'error');
wx.showToast({
title: '支付失败',
icon: 'fail',
......@@ -395,7 +410,6 @@ Page({
}
})
},
// 支付成功获取订单回调信息
// successInfo() {
// let { outTradeNo, orderInfoList, showOrderInfo } = this.data
......@@ -432,4 +446,4 @@ Page({
})
.catch(err => { })
}
})
})
\ No newline at end of file
......@@ -104,4 +104,9 @@
<image class="logoIcon" src="../../../images/djLogin.png" />
</view>
</view>
</view>
\ No newline at end of file
</view>
<modal hidden='{{showModal}}' class="modal" bindclose="close">
<image class="errorIcon" src="https://img02.glsx.com.cn/weapp/resource/saas/h5/image/error.png" />
<view class="text ">当前收款码已停用,请联系销售人员</view>
<view class="text text_bottom">重新提供新的收款码,谢谢~</view>
</modal>
\ No newline at end of file
......@@ -72,12 +72,12 @@ Page({
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
onReady: function () { },
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {},
onShow: function () { },
onUnload: function () {
this.setData({
......@@ -116,8 +116,8 @@ Page({
})
otherOrderCode
? that.getOrderDetail({
orderCode: otherOrderCode
})
orderCode: otherOrderCode
})
: that.getScenInfo()
}
}
......@@ -138,16 +138,20 @@ Page({
posterUrl: result.data
})
})
.catch(err => {})
.catch(err => { })
},
// 获取订单信息
getInfo: function (row) {
getInfo: function (row, data) {
console.log(row, data, 'row');
console.log(data.paymentChannel.paymentChannelId, 'data.paymentChannel.paymentChannelId');
let { openId } = this.data
let _this = this
let oParams = {}
oParams.orderCode = row.orderCode
oParams.workWxSessionId = row.workWxSessionId
oParams.openId = openId
oParams.appId = app.globalData.appId
oParams.paymentChannelId = data.paymentChannel.paymentChannelId
if (!((row.zyVoucherStatus ?? '') === '')) {
oParams.zyVoucherStatus = row.zyVoucherStatus
}
......@@ -159,6 +163,9 @@ Page({
if (returnCode == 0) {
let o = data ? JSON.parse(data) : {}
if (o?.chnlPayInfo) {
o = JSON.parse(o.chnlPayInfo)
}
this.setData({
o
})
......@@ -204,7 +211,7 @@ Page({
params = ''
for (const key in miniProgramParams) {
params += `${key}=${miniProgramParams[key]}&`
params += `${key}=${miniProgramParams[key]}&`
}
return wx.navigateToMiniProgram({
......@@ -277,15 +284,15 @@ Page({
)
}
},
setPayFail (){
setPayFail() {
this.setData({
payFail:true
payFail: true
})
} ,
},
getOrderDetail(item) {
console.log(item, 'item')
let { orderCode } = item
let { orderCode, } = item
api.getOrderDetail({ orderCode }).then(res => {
console.log(res, 'res')
let { code, data, errId } = res
......@@ -298,9 +305,9 @@ Page({
})
// 必须要订单 为待支付才能发起支付
if (data?.payOrder == null || data.payOrder.payStatus == 1) {
this.getInfo(item)
this.getInfo(item, data)
} else {
this.setPayFail()
this.setPayFail()
wx.showToast({
title: message || '订单已失效',
icon: 'error'
......@@ -312,7 +319,7 @@ Page({
title: '订单已失效',
icon: 'error'
})
} else {
wx.showToast({
title: '请求失败',
......
......@@ -299,5 +299,5 @@
},
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "dj-car-weapp-smartshop",
"libVersion": "3.8.11"
"libVersion": "3.0.2"
}
\ 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!