This commit is contained in:
魏啾
2024-05-27 14:26:14 +08:00
43 changed files with 1087 additions and 239 deletions

View File

@@ -16,6 +16,7 @@ export default {
accountPay(data) { accountPay(data) {
return uni.api.get("/pay/accountPay", data); return uni.api.get("/pay/accountPay", data);
}, },
// 下单 // 下单
creatGroupOrder(data) { creatGroupOrder(data) {
return uni.api.post("/groupOrderInfo/creatGroupOrder", data); return uni.api.post("/groupOrderInfo/creatGroupOrder", data);
@@ -71,6 +72,10 @@ export default {
shopUserInfo(data) { shopUserInfo(data) {
return uni.api.get("/user/shopUserInfo", data); return uni.api.get("/user/shopUserInfo", data);
}, },
// 优惠券数量
userCoupon(data) {
return uni.api.get("/user/userCoupon", data);
},
// 优惠加倍 // 优惠加倍
yhqDouble(data) { //查询订单支付状态 yhqDouble(data) { //查询订单支付状态
return uni.api.post("/order/yhqDouble", data); return uni.api.post("/order/yhqDouble", data);
@@ -138,7 +143,7 @@ export default {
return uni.api.get("/distirict/comShopList", data); return uni.api.get("/distirict/comShopList", data);
}, },
loginOut(data) { //退出登录 loginOut(data) { //退出登录
return uni.api.post("/loginOut", data); return uni.api.post("/login/loginOut", data);
}, },
productqueryShopIdByTableCode(data) { //通过桌码获取shopId productqueryShopIdByTableCode(data) { //通过桌码获取shopId
return uni.api.get("/product/queryShopIdByTableCode", data); return uni.api.get("/product/queryShopIdByTableCode", data);

192
components/payPassword.vue Normal file
View File

@@ -0,0 +1,192 @@
<template>
<view class="page">
<view>
<view class="pay-title">
<text>请输入6位支付密码</text>
</view>
<view class="pay-password" @click="onPayUp">
<view class="list">
<text v-show="passwordArr.length >= 1"></text>
</view>
<view class="list">
<text v-show="passwordArr.length >= 2"></text>
</view>
<view class="list">
<text v-show="passwordArr.length >= 3"></text>
</view>
<view class="list">
<text v-show="passwordArr.length >= 4"></text>
</view>
<view class="list">
<text v-show="passwordArr.length >= 5"></text>
</view>
<view class="list">
<text v-show="passwordArr.length >= 6"></text>
</view>
</view>
<view class="hint" @click="gopaypassword">
<text>忘记支付密码</text>
</view>
</view>
<!-- ref:唯一ref passwrdType密码样式pay keyInfo密码输入返回事件 -->
<cc-defineKeyboard ref="CodeKeyboard" passwrdType="pay" @KeyInfo="KeyInfo"></cc-defineKeyboard>
</view>
</template>
<script>
export default {
components: {
},
data() {
return {
// AffirmStatus: 1,
passwordArr: [],
oldPasswordArr: [],
newPasswordArr: [],
afPasswordArr: [],
};
},
onLoad() {
},
methods: {
// 忘记支付密码
gopaypassword() {
uni.pro.navigateTo('/pages/user/repairpassword', {
// shopId_id: uni.cache.get('shopUser')
})
},
/**
* 唤起键盘
*/
onPayUp() {
this.$refs.CodeKeyboard.show();
},
/**
* 支付键盘回调
* @param {Object} val
*/
KeyInfo(val) {
if (val.index >= 6) {
return;
}
// 判断是否输入的是删除键
if (val.keyCode === 8) {
// 删除最后一位
this.passwordArr.splice(val.index + 1, 1)
}
// 判断是否输入的是.
else if (val.keyCode == 190) {
// 输入.无效
} else {
this.passwordArr.push(val.key);
}
// uni.showModal({
// title: '温馨提示',
// content: '输入密码是 = ' + JSON.stringify(this.passwordArr)
// })
// 判断是否等于6
if (this.passwordArr.length === 6) {
// this.AffirmStatus = this.AffirmStatus + 1;
let str = ''
this.passwordArr.forEach(res => {
str += res
})
this.$emit('accountPayevent', str)
this.passwordArr = [];
}
// 判断到哪一步了
// if (this.AffirmStatus === 1) {
// this.oldPasswordArr = this.passwordArr;
// } else if (this.AffirmStatus === 2) {
// this.newPasswordArr = this.passwordArr;
// } else if (this.AffirmStatus === 3) {
// this.afPasswordArr = this.passwordArr;
// } else if (this.AffirmStatus === 4) {
// console.log(this.oldPasswordArr.join(''));
// console.log(this.newPasswordArr.join(''));
// console.log(this.afPasswordArr.join(''));
// uni.showToast({
// title: '修改成功',
// icon: 'none'
// })
// setTimeout(() => {
// uni.navigateBack();
// }, 2000)
// }
this.$forceUpdate();
}
}
}
</script>
<style scoped lang="scss">
$base: #555; // 基础颜色
.page {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: #FFFFFF;
}
.pay-title {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 200rpx;
text {
font-size: 28rpx;
color: #555555;
}
}
.pay-password {
display: flex;
align-items: center;
width: 90%;
height: 80rpx;
margin: 20rpx auto;
border: 2rpx solid $base;
.list {
display: flex;
align-items: center;
justify-content: center;
width: 16.666%;
height: 100%;
border-right: 2rpx solid #EEEEEE;
text {
font-size: 32rpx;
}
}
.list:nth-child(6) {
border-right: none;
}
}
.hint {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100rpx;
text {
font-size: 28rpx;
color: $base;
}
}
</style>

View File

@@ -3,10 +3,10 @@ const debug = process.env.NODE_ENV == 'development' ? true : false;
const proxyApi = "/api" const proxyApi = "/api"
// #endif // #endif
// #ifdef MP-WEIXIN || APP // #ifdef MP-WEIXIN || APP
// const proxyApi = 'http://192.168.2.133:9889/cashierService' // 王伟 // const proxyApi = 'http://192.168.2.96:9889/cashierService' // 王伟
// const proxyApi = 'http://192.168.2.74:9888/cashierService' // 帆哥 // const proxyApi = 'http://192.168.2.74:9888/cashierService' // 帆哥
const proxyApi = 'https://wxcashiertest.sxczgkj.cn/cashierService' // 测试
// const proxyApiwws = 'ws://192.168.2.74:9888/cashierService' // 测试 // const proxyApiwws = 'ws://192.168.2.74:9888/cashierService' // 测试
const proxyApi = 'https://wxcashiertest.sxczgkj.cn/cashierService' // 测试
const proxyApiwws = 'wss://wxcashiertest.sxczgkj.cn/cashierService' // 测试 const proxyApiwws = 'wss://wxcashiertest.sxczgkj.cn/cashierService' // 测试
// #endif // #endif
@@ -19,6 +19,7 @@ const baseUrlwws = 'ws://cashier.sxczgkj.cn/cashierService'
// const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.cn/cashierService'// 线上 // const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.cn/cashierService'// 线上
// const baseUrlwws = debug ? proxyApiwws : 'wss://cashier.sxczgkj.cn/cashierService' // 线上 // const baseUrlwws = debug ? proxyApiwws : 'wss://cashier.sxczgkj.cn/cashierService' // 线上
const baseUrl = 'https://wxcashiertest.sxczgkj.cn/cashierService'// 测试 const baseUrl = 'https://wxcashiertest.sxczgkj.cn/cashierService'// 测试
// const baseUrl = 'http://192.168.2.96:9889/cashierService'
const baseUrlwws ='wss://wxcashiertest.sxczgkj.cn/cashierService' // 测试 const baseUrlwws ='wss://wxcashiertest.sxczgkj.cn/cashierService' // 测试
// #endif // #endif

View File

@@ -127,6 +127,7 @@ async function request(options) {
} }
}) })
} }
return res
} }
} else { } else {
uni.hideLoading() uni.hideLoading()

View File

@@ -1,111 +1,111 @@
{ {
"name": "cashier_weapp", "name" : "cashier_weapp",
"appid": "__UNI__8092421", "appid" : "__UNI__8092421",
"description": "", "description" : "",
"versionName": "1.0.0", "versionName" : "1.0.0",
"versionCode": "100", "versionCode" : "100",
"transformPx": false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus": { "app-plus" : {
"usingComponents": true, "usingComponents" : true,
"nvueStyleCompiler": "uni-app", "nvueStyleCompiler" : "uni-app",
"compilerVersion": 3, "compilerVersion" : 3,
"splashscreen": { "splashscreen" : {
"alwaysShowBeforeRender": true, "alwaysShowBeforeRender" : true,
"waiting": true, "waiting" : true,
"autoclose": true, "autoclose" : true,
"delay": 0 "delay" : 0
}, },
/* */ /* */
"modules": { "modules" : {
"Barcode": {} "Barcode" : {}
}, },
/* */ /* */
"distribute": { "distribute" : {
/* android */ /* android */
"android": { "android" : {
"permissions": [ "permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>", "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>", "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>", "<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>", "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>", "<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
] ]
}, },
/* ios */ /* ios */
"ios": { "ios" : {
"dSYMs": false "dSYMs" : false
}, },
/* SDK */ /* SDK */
"sdkConfigs": { "sdkConfigs" : {
"ad": {} "ad" : {}
} }
} }
}, },
/* */ /* */
"quickapp": {}, "quickapp" : {},
/* */ /* */
"mp-weixin": { "mp-weixin" : {
"appid": "wxd88fffa983758a30", "appid" : "wxd88fffa983758a30",
"setting": { "setting" : {
"urlCheck": false, "urlCheck" : false,
"minified": true, "minified" : true,
"es6": true, "es6" : true,
"postcss": true "postcss" : true
}, },
"usingComponents": true, "usingComponents" : true,
"libVersion": "latest", "libVersion" : "latest",
"permission": { "permission" : {
"scope.userLocation": { "scope.userLocation" : {
"desc": "你的位置信息将用于小程序位置接口的效果展示" "desc" : "你的位置信息将用于小程序位置接口的效果展示"
} }
}, },
"requiredPrivateInfos": ["getLocation", "onLocationChange", "chooseLocation", "chooseAddress"] "requiredPrivateInfos" : [ "getLocation", "onLocationChange", "chooseLocation", "chooseAddress" ]
}, },
"h5": { "h5" : {
"devServer": { "devServer" : {
"https": false, "https" : false,
"disableHostCheck": false, "disableHostCheck" : false,
"proxy": { "proxy" : {
"/api": { "/api" : {
"target": "https://wxcashiertest.sxczgkj.cn/cashierService", "target" : "https://wxcashiertest.sxczgkj.cn/cashierService",
// "target" : "https://ky.sxczgkj.cn", // "target" : "https://ky.sxczgkj.cn",
"ws": false, "ws" : false,
"changeOrigin": true, //是否跨域 "changeOrigin" : true, //是否跨域
"secure": false, // 设置支持https协议的代理 "secure" : false, // 设置支持https协议的代理
"pathRewrite": { "pathRewrite" : {
"^/api": "" //需要rewrite重写的, "^/api" : "" //需要rewrite重写的,
} }
} }
} }
}, },
"template": "template.h5.html", "template" : "template.h5.html",
"router": { "router" : {
"mode": "history", "mode" : "history",
"base": "/h5/" "base" : "/h5/"
} }
}, },
"mp-alipay": { "mp-alipay" : {
"usingComponents": true "usingComponents" : true
}, },
"mp-baidu": { "mp-baidu" : {
"usingComponents": true "usingComponents" : true
}, },
"mp-toutiao": { "mp-toutiao" : {
"usingComponents": true "usingComponents" : true
}, },
"uniStatistics": { "uniStatistics" : {
"enable": false "enable" : false
}, },
"vueVersion": "2" "vueVersion" : "2"
} }

View File

@@ -10,7 +10,7 @@
</view> </view>
<view class="addreeStyle"> <view class="addreeStyle">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/dingwei.png" <image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/dingwei.png"
style="width: 17.9rpx;height: 22rpx;margin-right: 6rpx;" mode=""></image>{{info.distances}}km | style="width: 17.9rpx;height: 22rpx;margin-right: 6rpx;" mode=""></image>{{info.distances}} |
{{info.address}} {{info.address}}
</view> </view>
<view class="rightStyle"> <view class="rightStyle">

View File

@@ -193,7 +193,8 @@
userId: uni.cache.get('userInfo').id, userId: uni.cache.get('userInfo').id,
status: 0, status: 0,
page: this.form.page, page: this.form.page,
size: this.form.size size: this.form.size,
orderId:''
}) })
try { try {
this.totalnumber = res.data.total this.totalnumber = res.data.total

View File

@@ -35,7 +35,7 @@
{{item.shopName}} {{item.shopName}}
</view> </view>
<view> <view>
龙首.{{item.distances}}km {{item.distances}}
</view> </view>
</view> </view>
<view class="fivecontent_item_nav_lefttopstart flex-start"> <view class="fivecontent_item_nav_lefttopstart flex-start">

View File

@@ -47,7 +47,7 @@
</image> </image>
<view> {{item.productName}}</view> <view> {{item.productName}}</view>
</view> </view>
<text class="fivecontent_item_boxitemlefttow_t">{{item.distances}}km</text> <text class="fivecontent_item_boxitemlefttow_t">{{item.distances}}</text>
</view> </view>
<view class="fivecontent_item_boxitemlefthere flex-start"> <view class="fivecontent_item_boxitemlefthere flex-start">
<view class="fivecontent_item_boxitemlefthere_one flex-start"> <view class="fivecontent_item_boxitemlefthere_one flex-start">

View File

@@ -27,7 +27,7 @@
{{item.address.length>7?item.address.substring(0,7)+'...':item.address}} {{item.address.length>7?item.address.substring(0,7)+'...':item.address}}
</view> </view>
<view class="fivecontent_itemoneboxtow_t"> <view class="fivecontent_itemoneboxtow_t">
{{item.distances}}km {{item.distances}}
</view> </view>
</view> </view>
</view> </view>

View File

@@ -49,7 +49,7 @@
} }
}, },
onLoad(e) { onLoad(e) {
console.log(e) console.log(e,'调试')
if (e.type == 'list') {//从列表进来的 if (e.type == 'list') {//从列表进来的
this.paygetShopByMember(e.shopId_id) this.paygetShopByMember(e.shopId_id)
}else{ }else{

View File

@@ -11,9 +11,10 @@
<view class="towcontentitemone flex-start"> <view class="towcontentitemone flex-start">
<image class="towcontentitemoneimage" :src="item.logo" mode="aspectFill"></image> <image class="towcontentitemoneimage" :src="item.logo" mode="aspectFill"></image>
<text class="towcontentitemonetext" style="color: #333333;">{{item.chainName}}</text> <text class="towcontentitemonetext" style="color: #333333;">{{item.chainName}}</text>
<!-- 余额<text class="towcontentitemtheretext">{{userInfo.amount || '0.00'}}</text> -->
</view> </view>
<view class="towcontentitemtow flex-between"> <view class="towcontentitemtow flex-between">
<text class="towcontentitemtowetext" style="color:#333333;">{{item.is_vip}}</text> <text class="towcontentitemtowetext" style="color:#333333;">余额:{{item.amount}}</text>
<text>{{item.shopName}}</text> <text>{{item.shopName}}</text>
</view> </view>
</view> </view>

View File

@@ -148,9 +148,6 @@
}, 1000) }, 1000)
this.getinfo(e.orderId) this.getinfo(e.orderId)
this.orderInfo = JSON.parse(e.orderInfo) this.orderInfo = JSON.parse(e.orderInfo)
console.log('调试1', e)
console.log('调试2', JSON.parse(e.orderInfo))
console.log('调试3', this.orderInfo)
}, },
computed: { computed: {
HeighT() { //手机类型的尺寸 HeighT() { //手机类型的尺寸

View File

@@ -82,10 +82,10 @@
<view> <view>
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/hongbao.png" <image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/hongbao.png"
style="width: 30rpx;height: 30.24rpx;;" mode=""></image> style="width: 30rpx;height: 30.24rpx;;" mode=""></image>
红包/低佣 红包/抵用
</view> </view>
<view @click="orderfoodindex"> <view @click="orderfoodindex">
<!-- {{info.couponDetail.name}} --> 可用优惠券{{couponAmount}}
</view> </view>
</view> </view>
<!-- 支付方式 --> <!-- 支付方式 -->
@@ -118,7 +118,8 @@
</u-radio> </u-radio>
</u-radio-group> </u-radio-group>
<view style="font-weight: 400;font-size: 24rpx;color: #333333;margin-left: 60rpx;"> <view style="font-weight: 400;font-size: 24rpx;color: #333333;margin-left: 60rpx;">
会员卡余额{{ amountVIP.amount}} <text style="font-weight: 500;font-size: 28rpx;margin-left: 16rpx;color: #FF4C11;" 会员卡余额{{ amountVIP.amount}} <text
style="font-weight: 500;font-size: 28rpx;margin-left: 16rpx;color: #FF4C11;"
@click="goRecharge">去充值</text> @click="goRecharge">去充值</text>
</view> </view>
</view> </view>
@@ -170,17 +171,23 @@
以优惠¥{{emitorderfoodform.couponsPrice}} 以优惠¥{{emitorderfoodform.couponsPrice}}
</view> </view>
</view> </view>
<view class="fixedview_tow" @click="showpopupclick"> <view class="fixedview_tow" @click="shopEvent">
立即付款 立即付款
</view> </view>
</view> </view>
</view> </view>
<!-- 支付密码 -->
<payPassword ref="payPwd" @accountPayevent="accountPayevent" v-show="ispws"></payPassword>
</view> </view>
</template> </template>
<script> <script>
import webSocketUtils from '@/common/js/websocket.js' import webSocketUtils from '@/common/js/websocket.js'
import payPassword from '@/components/payPassword.vue'
export default { export default {
components: {
payPassword
},
data() { data() {
return { return {
height: '', height: '',
@@ -197,14 +204,25 @@
amountVIP: null, amountVIP: null,
radiovalue1: '1', radiovalue1: '1',
vipId: null, vipId: null,
orderInfo: '' orderInfo: '',
// 可用优惠券数据
couponAmount: 0,
// 输入支付密码 123
passwordArr: [],
ispws: false,
numValue: 0
}; };
}, },
onUnload() { onUnload() {
uni.$off('getMessage') uni.$off('getMessage')
// uni.showToast({
// title: this.radiovalue1 + '-110',
// duration:5000
// })
}, },
onLoad(e) { onLoad(e) {
// console.log(e, 140) // console.log(e, 140)
let res = JSON.parse(e.tableId) let res = JSON.parse(e.tableId)
this.listinfo.detailList = res this.listinfo.detailList = res
@@ -213,42 +231,53 @@
this.handlemessage() this.handlemessage()
uni.$on('message', this.getMessage) uni.$on('message', this.getMessage)
// 获取余额 // 获取余额
this.getAount() this.getAount()
// 获取可用优惠券数量
this.getcoupon()
this.vipId = uni.cache.get('userInfo').id this.vipId = uni.cache.get('userInfo').id
}, },
onShow() { onShow() {
}, },
created() { created() {
uni.$on('emitclickorderfood', (num) => { uni.$on('emitclickorderfood', (num) => {
console.log(num) // 总金额 couponsAmount 优惠卷购买金额 couponsPrice优惠金额 等于1是团购/不等于1
// 总金额 couponsAmount 优惠卷购买金额 couponsPrice优惠金额
if (num.clickiconone == 1) { if (num.clickiconone == 1) {
this.listinfo.amount = (Number(this.listinfo.amounts) - Number(num.couponsPrice)).toFixed(2) this.listinfo.amount = (Number(this.listinfo.amounts) + Number(num.couponsPrice) - Number(num
.couponsAmount)).toFixed(2)
} else { } else {
this.listinfo.amount = (Number(this.listinfo.amounts) + Number(num.couponsAmount) - Number(num this.listinfo.amount = (Number(this.listinfo.amounts) - Number(num.couponsAmount)).toFixed(2)
.couponsPrice)).toFixed(2)
} }
this.emitorderfoodform = num this.emitorderfoodform = num
// this.num += num // this.num += num
}) })
}, },
methods: { methods: {
async getAount(){
async getcoupon() {
let res = await this.api.userCoupon({
"orderNum": this.listinfo.amount,
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.couponAmount = res.data
}
},
async getAount() {
let res = await this.api.shopUserInfo({ let res = await this.api.shopUserInfo({
// shopId:店铺ID // shopId:店铺ID
"shopId": uni.cache.get('shopUser'), "shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id, "userId": uni.cache.get('userInfo').id,
}) })
if(res.code==0){ if (res.code == 0) {
this.amountVIP = res.data this.amountVIP = res.data
} }
}, },
getMessage(msg) { getMessage(msg) {
console.log('tiaoshi1', msg)
if (msg.status != 'success') { if (msg.status != 'success') {
uni.showToast({ uni.showToast({
title: msg.msg, title: msg.msg,
@@ -260,7 +289,6 @@ this.getAount()
} else { } else {
switch (msg.type) { switch (msg.type) {
case 'createOrder': //去结算 case 'createOrder': //去结算
console.log('tiaoshi2', msg)
this.listinfoid = msg.data.id //下单需要的id this.listinfoid = msg.data.id //下单需要的id
this.orderInfo = msg.data this.orderInfo = msg.data
this.showpopupclickdd() this.showpopupclickdd()
@@ -288,8 +316,8 @@ this.getAount()
orderfoodindex() { orderfoodindex() {
uni.pro.navigateTo('index/coupons/index', { uni.pro.navigateTo('index/coupons/index', {
orderfood: 0, orderfood: 0,
orderId :this.listinfoid,
amount: this.listinfo.amounts amount: this.listinfo.amounts
}) })
}, },
copyHandle(e) { copyHandle(e) {
@@ -308,56 +336,51 @@ this.getAount()
orderId: this.listinfoid orderId: this.listinfoid
}) })
}, },
// 防抖去结算
shopEvent(){
uni.$u.throttle(this.showpopupclick, 500)
},
// 去结算 // 去结算
showpopupclick() { showpopupclick() {
if (this.numValue == 0) {
let data = { //定义socket数据传参 let data = { //定义socket数据传参
"skuId": '', "skuId": '',
"num": '', //数量 "num": '', //数量
"type": "createOrder", //“addcart:添加购物车create0rder:生成订单clearCart:庆康购物车”, "type": "createOrder", //“addcart:添加购物车create0rder:生成订单clearCart:庆康购物车”,
"couponsId": this.emitorderfoodform.id ? this.emitorderfoodform.id : '', //优惠券ID, "couponsId": this.emitorderfoodform.id ? this.emitorderfoodform.id : '', //优惠券ID,
"isYhq": this.emitorderfoodform.id ? 1 : 0, // 是否使用优惠券( 1 使用, 0 不使用), "isYhq": this.emitorderfoodform.id ? 1 : 0, // 是否使用优惠券( 1 使用, 0 不使用),
"isBuyYhq": this.emitorderfoodform.clickiconone == 1 ? 1 : 0, // 是否购买优惠券( 1 购买, 0 不够买) "isBuyYhq": this.emitorderfoodform.clickiconone == 1 ? 1 : 0, // 是否购买优惠券( 1 购买, 0 不够买)
"productId": '', //商品id "productId": '', //商品id
"shopId": uni.cache.get('shopUser'), "shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id, "userId": uni.cache.get('userInfo').id,
// tableId:uni.cache.get('tableCode') // tableId:uni.cache.get('tableCode')
}
this.numValue = 1
uni.$u.debounce(this.socketSendMsg(data), 500)
} else {
this.showpopupclickdd()
} }
console.log(data)
uni.$u.debounce(this.socketSendMsg(data), 500)
}, },
// 去充值 // 去充值
goRecharge() { goRecharge() {
uni.pro.navigateTo('/pages/member/index') uni.pro.navigateTo('/pages/member/index', {
}, shopId_id: uni.cache.get('shopUser')
// 余额支付
async accountPayevent(id) {
let res = await this.api.accountPay({
orderId: id,
memberId: this.vipId
}) })
console.log(res, '调试12')
if (res) {
} else {
setTimeout(() => {
this.goRecharge()
}, 1000)
}
}, },
async showpopupclickdd(i) { async showpopupclickdd(i) {
let res = await this.api.payorderPay({
orderId: this.listinfoid if (this.radiovalue1 == 1) {
}) //判断是否支付成功 let res = await this.api.payorderPay({
if (res.code == 0) { orderId: this.listinfoid
uni.showLoading({ }) //判断是否支付成功
title: '加载中', if (res.code == 0) {
mask: true // uni.showLoading({
}) // title: '加载中',
// #ifdef MP-WEIXIN // mask: true
if (this.radiovalue1 == 1) { // })
// #ifdef MP-WEIXIN
// 微信支付还是余额支付
uni.requestPayment({ uni.requestPayment({
provider: 'wxpay', //支付类型-固定值 provider: 'wxpay', //支付类型-固定值
partnerid: res.data.appId, // 微信支付商户号 partnerid: res.data.appId, // 微信支付商户号
@@ -370,7 +393,7 @@ this.getAount()
uni.showToast({ uni.showToast({
title: "支付成功" title: "支付成功"
}) })
uni.cache.set('shopUser','')//删除shopUser uni.cache.set('shopUser', '') //删除shopUser
this.paymodfiyOrderInfo() this.paymodfiyOrderInfo()
setTimeout(res => { setTimeout(res => {
uni.redirectTo({ uni.redirectTo({
@@ -385,31 +408,75 @@ this.getAount()
// }); // });
}, },
fail: (err) => { fail: (err) => {
setTimeout(() => {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '支付失败' title: '支付失败'
}) })
uni.hideLoading() uni.hideLoading()
}, 2000) // uni.redirectTo({
uni.redirectTo({ // url: '/pages/order/order_detail?orderId=' + this.listinfoid
url: '/pages/order/order_detail?orderId=' + this.listinfoid // });
});
}, },
complete: (data) => { complete: (data) => {
console.log(data, '成功与否') console.log(data, '成功与否')
} }
}); });
} else { // #endif
this.accountPayevent(this.listinfoid) }
} else {
// 判断是否有绑定支付密码
// 先判断是否设置支付密码。0是没设置。没设置的情况下跳转到设置页面。有的话输入支付密码
let isVip = uni.cache.get('userInfo').isPwd
if (isVip == 0) {
uni.pro.navigateTo('/pages/user/repairpassword', {
shopId_id: uni.cache.get('shopUser')
})
} else {
this.ispws = true
this.$nextTick(() => {
this.$refs.payPwd.onPayUp();
})
} }
// #endif
} }
}, },
// 余额支付
async accountPayevent(pwd) {
this.ispws = false
let res = await this.api.accountPay({
orderId: this.listinfoid,
memberId: this.amountVIP.id,
pwd: pwd
})
if (res.code == 0) {
uni.showToast({
icon: 'none',
title: '支付成功',
success: () => {
setTimeout(res => {
uni.redirectTo({
url: '/pages/order/successful?orderId=' + this
.listinfoid + '&orderInfo=' + JSON.stringify(
this.orderInfo)
});
}, 1000)
}
})
} else if (res.data == 1) {
setTimeout(() => {
// 去充值
this.goRecharge()
}, 2000)
}
},
clickselect(b) { clickselect(b) {
this.pay_type = b this.pay_type = b
}, },
}, },
mounted() { mounted() {
//#ifdef MP-WEIXIN || H5 //#ifdef MP-WEIXIN || H5

View File

@@ -17,7 +17,7 @@
<image class="contentitemthere_image" <image class="contentitemthere_image"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/product/d.png" mode="aspectFill"></image> src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/product/d.png" mode="aspectFill"></image>
<view class="contentitemthere_t"> <view class="contentitemthere_t">
距您{{item.distances}}km<text v-if="item.address">,{{item.address}}</text> 距您{{item.distances}}<text v-if="item.address">,{{item.address}}</text>
</view> </view>
<u-icon name="arrow-right" color="#999999" size="28"></u-icon> <u-icon name="arrow-right" color="#999999" size="28"></u-icon>
</view> </view>

View File

@@ -467,6 +467,7 @@
bottom: 0; bottom: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 180rpx;
padding: 24rpx 28rpx; padding: 24rpx 28rpx;
background: #FFFFFF; background: #FFFFFF;
z-index: 999; z-index: 999;

View File

@@ -31,7 +31,7 @@
<view> <view>
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/hongbao.png" <image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/hongbao.png"
style="width: 30rpx;height: 30.24rpx;;" mode=""></image> style="width: 30rpx;height: 30.24rpx;;" mode=""></image>
红包/低佣 红包/抵用
</view> </view>
<view> <view>
{{info.couponDetail.name}} {{info.couponDetail.name}}
@@ -40,16 +40,16 @@
<view style="background-color: #F6F6F6;height: 2rpx;width: 100%;margin: 16rpx 0;"></view> <view style="background-color: #F6F6F6;height: 2rpx;width: 100%;margin: 16rpx 0;"></view>
<view class="jiesuanmoney"> <view class="jiesuanmoney">
<text> <text>
优惠<text style="color: #FF4C11;font-weight: 500;">{{info.save * Quantity}}</text> 优惠<text style="color: #FF4C11;font-weight: 500;">{{calculateEvent(info.save)}}</text>
</text> </text>
<text> <text>
小计<text style="color: #FF4C11;font-weight: 500;">{{info.salePrice * Quantity}}</text> 小计<text style="color: #FF4C11;font-weight: 500;">{{calculateEvent(info.salePrice) }}</text>
</text> </text>
</view> </view>
</view> </view>
<!-- 支付方式 --> <!-- 支付方式 -->
<view class="payType" v-if="false"> <view class="payType" >
<view class=""> <view class="">
支付方式 支付方式
</view> </view>
@@ -65,9 +65,8 @@
</text> </text>
</view> </view>
</u-radio> </u-radio>
<view style="margin: 22rpx 0;width: 100%;height: 2rpx;background-color: #E5E5E5;"> <view style="margin: 22rpx 0;width: 100%;height: 2rpx;background-color: #E5E5E5;" v-if="info.isUseVip==1"> </view>
</view> <u-radio activeColor="#ffd158" name="2" v-if="info.isUseVip==1">
<u-radio activeColor="#ffd158" name="2">
<view class="dfs"> <view class="dfs">
<image style="width:44rpx;height:44rpx" <image style="width:44rpx;height:44rpx"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png" mode=""> src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png" mode="">
@@ -77,31 +76,41 @@
</view> </view>
</u-radio> </u-radio>
</u-radio-group> </u-radio-group>
<view style="font-weight: 400;font-size: 24rpx;color: #333333;"> <view style="font-weight: 400;font-size: 24rpx;color: #333333;margin-left: 60rpx;" v-if="info.isUseVip==1">
会员卡余额${{ amount}} <text style="font-weight: 500;font-size: 28rpx;color: #FF4C11;" 会员卡余额{{ amountVIP.amount}} <text
style="font-weight: 500;font-size: 28rpx;margin-left: 16rpx;color: #FF4C11;"
@click="goRecharge">去充值</text> @click="goRecharge">去充值</text>
</view> </view>
</view> </view>
</view> </view>
<view class="placeBottom"> <view class="placeBottom">
<view class=""> <view class="">
<text style="font-size: 24rpx;font-weight: bold;"> 合计 </text><text <text style="font-size: 24rpx;font-weight: bold;"> 合计 </text><text
style="font-size: 32rpx;font-weight: bold;color:#FF4C11"> {{info.salePrice * Quantity}} </text> style="font-size: 32rpx;font-weight: bold;color:#FF4C11"> {{calculateEvent(info.salePrice)}}
</text>
<text style="font-size: 24rpx;font-weight: 400;color: # 999;">含优惠卷包0</text> <text style="font-size: 24rpx;font-weight: 400;color: # 999;">含优惠卷包0</text>
</view> </view>
<view class=""> <view class="">
{{Quantity}} 已优惠{{info.save * Quantity}} {{Quantity}} 已优惠{{calculateEvent(info.save) }}
</view> </view>
<button class="btnStyle" @click="sumbitFrom">提交订单</button> <button class="btnStyle" @click="sumbitFroms">提交订单</button>
</view> </view>
<payPassword ref="payPwd" @accountPayevent="accountPayevent" v-show="ispws"></payPassword>
</view> </view>
</template> </template>
<script> <script>
import payPassword from '@/components/payPassword.vue'
export default { export default {
components: {
payPassword
},
onLoad(e) { onLoad(e) {
this.getInfo(e.id) this.getInfo(e.id)
this.orderIds= e.id
this.orderIds = e.id
this.amount = uni.cache.get('userInfo').amount this.amount = uni.cache.get('userInfo').amount
this.vipId = uni.cache.get('userInfo').id this.vipId = uni.cache.get('userInfo').id
}, },
@@ -111,37 +120,101 @@
Quantity: 1, Quantity: 1,
radiovalue1: '1', radiovalue1: '1',
amount: 0, amount: 0,
orderIds:null, orderIds: null,
vipId:null vipId: null,
ispws: false,
amountVIP: null,
listinfoid: null
} }
}, },
methods: { methods: {
async getAount() {
let res = await this.api.shopUserInfo({
// shopId:店铺ID
"shopId": this.info.shopId,
"userId": uni.cache.get('userInfo').id
})
if (res.code == 0) {
this.amountVIP = res.data
}
},
// 余额支付
async accountPayevent(pwd) {
this.ispws = false
let res = await this.api.payOrderPay({
orderId: this.listinfoid.id,
payType: "deposit",
pwd
})
if (res.code == 0) {
let orderInfo = {
createdAt:this.listinfoid.createTime,
orderNo:this.listinfoid.orderNo,
orderAmount:this.calculateEvent(this.info.salePrice)
}
uni.showToast({
icon: 'none',
title: '支付成功',
success: () => {
setTimeout(res => {
uni.redirectTo({
url: '/pages/order/successful?orderId=' + this
.listinfoid.id + '&orderInfo=' + JSON.stringify(orderInfo)
});
}, 1000)
}
})
} else if (res.data == 1) {
setTimeout(() => {
// 去充值
this.goRecharge()
}, 2000)
}
},
calculateEvent(d) {
return (d * 1000 * this.Quantity)/1000
},
goRecharge() { goRecharge() {
// uni.pro.to uni.pro.navigateTo('/pages/member/index', {
shopId_id: this.info.shopId
})
},
// 防抖
sumbitFroms(){
uni.$u.throttle(this.sumbitFrom, 500)
}, },
async sumbitFrom() { async sumbitFrom() {
// radiovalue1:为1的时候微信支付,为2是会员卡,需要输入支付密码 let payMoney = this.info.salePrice * this.Quantity
if (this.radiovalue1 == 1) { let res = await this.api.creatGroupOrder({
let payMoney = this.info.salePrice * this.Quantity num: this.Quantity,
let res = await this.api.creatGroupOrder({ proId: this.info.proId,
num: this.Quantity, shopId: this.info.shopId,
proId: this.info.proId, payAmount: payMoney,
shopId: this.info.shopId, orderAmount: payMoney
payAmount: payMoney, })
orderAmount: payMoney if (res.code == 0) {
}) this.listinfoid = res.data
if (res.code == 0) { // radiovalue1:为1的时候微信支付,为2是会员卡,需要输入支付密码
if (this.radiovalue1 == 1) {
// 调用支付接口 // 调用支付接口
this.payEvent(res.data.id) this.payEvent(res.data.id)
} } else {
}else{ // 先判断是否设置支付密码。0是没设置。没设置的情况下跳转到设置页面。有的话输入支付密码
let res = await this.api.accountPay({ let isVip = uni.cache.get('userInfo').isPwd
orderId: this.orderIds, if (isVip == 0) {
memberId:this.vipId uni.pro.navigateTo('/pages/user/repairpassword', {
}) shopId_id: uni.cache.get('shopUser')
if (res.code == 0) { })
} else {
this.ispws = true
this.$nextTick(() => {
this.$refs.payPwd.onPayUp();
})
}
} }
} }
}, },
async payEvent(id) { async payEvent(id) {
let res = await this.api.payOrderPay({ let res = await this.api.payOrderPay({
@@ -150,7 +223,6 @@
orderType: 'group' orderType: 'group'
}) })
if (res) { if (res) {
console.log(res, '调试1')
uni.requestPayment({ uni.requestPayment({
provider: 'wxpay', //支付类型-固定值 provider: 'wxpay', //支付类型-固定值
partnerid: res.data.appId, // 微信支付商户号 partnerid: res.data.appId, // 微信支付商户号
@@ -184,6 +256,9 @@
}) })
if (res.code == 0) { if (res.code == 0) {
this.info = res.data this.info = res.data
uni.cache.set('shopUser', res.data.shopId);
// 获取余额
this.getAount()
} }
} }
} }
@@ -296,6 +371,12 @@
>view:last-child { >view:last-child {
margin-top: 32rpx; margin-top: 32rpx;
} }
.dfs {
display: flex;
align-items: center;
}
} }
.placeBottom { .placeBottom {

View File

@@ -109,7 +109,8 @@
userId: uni.cache.get('userInfo').id, userId: uni.cache.get('userInfo').id,
status: this.form.statuses, status: this.form.statuses,
page: this.form.page, page: this.form.page,
size: this.form.size size: this.form.size,
orderId:""
}) })
if (res.data.pages < this.form.page) { if (res.data.pages < this.form.page) {
this.form.status = 'nomore' this.form.status = 'nomore'

View File

@@ -10,7 +10,7 @@
</button> --> </button> -->
<!-- <image class="onecontentboximage" :src="userHeadImg" mode="" @click="uploadImg"></image> --> <!-- <image class="onecontentboximage" :src="userHeadImg" mode="" @click="uploadImg"></image> -->
<button type="default" class="btn" open-type="chooseAvatar" @chooseavatar="uploadImg"> <button type="default" class="btn" open-type="chooseAvatar" @chooseavatar="uploadImg">
<view class="" :style="'background-image:url('+userHeadImg+');'" style="width: 200rxp;height: 200rpx;"></view> <view class="" :style="'background-image:url('+userHeadImg+');'" style="width: 180rxp;height: 180rpx; background-position: center;"></view>
</button> </button>
@@ -218,13 +218,11 @@
} }
} }
.btn{ .btn{
width: 200rpx; width: 180rpx;
height: 200rpx; height: 180rpx;
border-radius: 100%; border-radius: 100%;
padding: 0; padding: 0;
>view{ >view{
width: 200rpx;
height: 200rpx;
border-radius: 100%; border-radius: 100%;
} }
} }

View File

@@ -52,6 +52,7 @@
}; };
}, },
onLoad() { onLoad() {
if (uni.cache.get('userInfo').isPwd != 0) { if (uni.cache.get('userInfo').isPwd != 0) {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: '忘记支付密码', // 标题文本,必须是字符串 title: '忘记支付密码', // 标题文本,必须是字符串
@@ -84,6 +85,14 @@
}, 60000); }, 60000);
} }
}, },
async loginwxuserInfo() {
let res = await this.api.loginwxuserInfo({
userId: uni.cache.get('userInfo').id
})
if (res.code == 0) {
uni.cache.set('userInfo', res.data);
}
},
async userInfosavePayPassword() { async userInfosavePayPassword() {
if (this.form.mobile.length != 11 && this.isPwd == 0) { if (this.form.mobile.length != 11 && this.isPwd == 0) {
@@ -145,6 +154,8 @@
icon: 'none' icon: 'none'
}); });
} }
// 获取用户信息
this.loginwxuserInfo()
setTimeout(() => { setTimeout(() => {
uni.navigateBack(); uni.navigateBack();
}, 1000); }, 1000);

View File

@@ -23,7 +23,7 @@
<!-- #endif --> <!-- #endif -->
<view class="boxtop_top flex-between"> <view class="boxtop_top flex-between">
<view class="boxtop_topleft"> <view class="boxtop_topleft">
<view class="flex-start" v-if="userInfo.nickName"> <view class="flex-start" v-if="userInfo.nickName" @click="clickinformation">
<image style="width: 108rpx; height: 108rpx; border-radius: 50%;" v-if="userInfo.headImg" <image style="width: 108rpx; height: 108rpx; border-radius: 50%;" v-if="userInfo.headImg"
:src="userInfo.headImg" mode="aspectFill"> :src="userInfo.headImg" mode="aspectFill">
</image> </image>
@@ -33,7 +33,7 @@
<text>去登录</text> <text>去登录</text>
</view> </view>
</view> </view>
<image style="width: 44rpx; height: 42.26rpx;" <image style="width: 44rpx; height: 42.26rpx;" @click="clickphone()"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/user/kf.png" mode="aspectFill"> src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/user/kf.png" mode="aspectFill">
</view> </view>
@@ -99,6 +99,11 @@
} }
}, },
methods: { methods: {
clickphone() {
uni.makePhoneCall({
phoneNumber: uni.cache.get('userInfo').custPhone
});
},
clickinformation() { clickinformation() {
uni.pro.navigateTo('user/information') uni.pro.navigateTo('user/information')
}, },

View File

@@ -0,0 +1,8 @@
## 2.02023-08-03
修复小程序bug
## 1.0.22023-06-21
组件优化 增加键盘高度
## 1.0.12023-06-21
组件优化
## 1.0.02023-06-21
组件初始化

View File

@@ -0,0 +1,43 @@
.page-total{
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: #f6f6f6;
}
.key-list{
display: flex;
flex-wrap: wrap;
align-items: center;
padding: 1% 3%;
height: 90%;
margin-top: 20rpx;
.list{
display: flex;
align-items: center;
justify-content: center;
width: 32%;
height: 92rpx;
background-color: #FFFFFF;
border-radius: 10rpx;
box-shadow: 0 0 10rpx rgba(0,0,0,0.1);
margin-right: 1.7%;
margin-bottom: 16rpx;
text{
font-size: 38rpx;
font-weight: bold;
color: #222222;
}
}
.list:nth-child(3n){
margin-right: 0;
}
.special{
background-color: #f6f6f6;
box-shadow: none;
text{
color: #959595;
}
}
}

View File

@@ -0,0 +1,116 @@
<template>
<view class="page-total" v-show="isShow">
<view class="key-list">
<view class="list" v-for="(item,index) in keyList" :class="{'special':item.keyCode==190||item.keyCode==8}"
@click="onKeyList(item,index)" :key="item.keyCode">
<block v-if="item.keyCode!=8">
<text>{{item.key}}</text>
</block>
<block v-else>
<image style="width: 80rpx;height: 80rpx;" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/tuige.png" mode=""></image>
</block>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
isShow: false,
keyList: [{
key: 1,
en: '',
keyCode: 49,
}, {
key: 2,
en: 'ABC',
keyCode: 50,
}, {
key: 3,
en: 'ABC',
keyCode: 51,
}, {
key: 4,
en: 'ABC',
keyCode: 52,
}, {
key: 5,
en: 'ABC',
keyCode: 53,
}, {
key: 6,
en: 'ABC',
keyCode: 54,
}, {
key: 7,
en: 'ABC',
keyCode: 55,
}, {
key: 8,
en: 'ABC',
keyCode: 56,
}, {
key: 9,
en: 'ABC',
keyCode: 57,
}, {
key: '.',
en: 'ABC',
keyCode: 190,
}, {
key: 0,
en: 'ABC',
keyCode: 48,
}, {
key: 'del',
en: 'DEL',
keyCode: 8,
}, ],
keyIndex: -1,
};
},
props: {
passwrdType: {
type: String,
default: 'pay'
}
},
methods: {
show() {
this.isShow = true;
},
hide() {
this.isShow = false;
},
/**
* 密码键盘按下
* @param {Object} item
* @param {Number} index
*/
onKeyList(item, index) {
let KeyInfo = item;
// 删除键
if (KeyInfo.keyCode === 8 && this.keyIndex > -1) {
this.keyIndex--;
}
this.$emit('KeyInfo', KeyInfo);
// 不是删除键
if (KeyInfo.keyCode != 8) {
console.log(this.keyIndex, '支付键盘');
if (this.keyIndex = 4) {
this.keyIndex = -1;
return;
}
this.keyIndex++;
}
KeyInfo.index = this.keyIndex;
}
}
}
</script>
<style scoped lang="scss">
@import 'cc-defineKeyboard.scss';
</style>

View File

@@ -0,0 +1,87 @@
{
"id": "cc-defineKeyboard",
"displayName": "自定义支付密码输入键盘Keyboard和支付设置输入框Input",
"version": "2.0",
"description": "自定义支付密码输入键盘Keyboard和支付设置输入框Input",
"keywords": [
"支付密码",
"键盘",
"",
"支付密码输入键盘",
"Keyboard",
"",
"自定义键盘"
],
"repository": "",
"engines": {
"HBuilderX": "^3.7.0"
},
"dcloudext": {
"type": "component-vue",
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"Vue": {
"vue2": "y",
"vue3": "y"
},
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y",
"钉钉": "y",
"快手": "y",
"飞书": "y",
"京东": "y"
},
"快应用": {
"华为": "y",
"联盟": "y"
}
}
}
}
}

View File

@@ -0,0 +1,232 @@
# cc-defineKeyboard
#### 使用方法
```使用方法
<!-- ref:唯一ref passwrdType密码样式pay keyInfo密码输入监测事件 -->
<cc-defineKeyboard ref="CodeKeyboard" passwrdType="pay" @KeyInfo="KeyInfo"></cc-defineKeyboard>
/** * 唤起键盘 */
onPayUp() {
this.$refs.CodeKeyboard.show();
},
/*** 支付键盘回调* @param {Object} val */
KeyInfo(val) {
if (val.index >= 6) {
return;
}
// 判断是否输入的是删除键
if (val.keyCode === 8) {
// 删除最后一位
this.passwordArr.splice(val.index + 1, 1)
}
// 判断是否输入的是.
else if (val.keyCode == 190) {
// 输入.无效
} else {
this.passwordArr.push(val.key);
}
uni.showModal({
title: '温馨提示',
content: '输入密码是 = ' + JSON.stringify(this.passwordArr)
})
}
```
#### HTML代码实现部分
```html
<template>
<view class="page">
<view>
<view class="pay-title">
<text v-show="AffirmStatus === 1">请输入6位支付密码</text>
<text v-show="AffirmStatus === 2">请设置6位支付密码</text>
<text v-show="AffirmStatus === 3">请确认6位支付密码</text>
</view>
<view class="pay-password" @click="onPayUp">
<view class="list">
<text v-show="passwordArr.length >= 1">●</text>
</view>
<view class="list">
<text v-show="passwordArr.length >= 2">●</text>
</view>
<view class="list">
<text v-show="passwordArr.length >= 3">●</text>
</view>
<view class="list">
<text v-show="passwordArr.length >= 4">●</text>
</view>
<view class="list">
<text v-show="passwordArr.length >= 5">●</text>
</view>
<view class="list">
<text v-show="passwordArr.length >= 6">●</text>
</view>
</view>
<view class="hint">
<text>忘记支付密码?</text>
</view>
</view>
<!-- ref:唯一ref passwrdType密码样式pay keyInfo密码输入返回事件 -->
<cc-defineKeyboard ref="CodeKeyboard" passwrdType="pay" @KeyInfo="KeyInfo"></cc-defineKeyboard>
</view>
</template>
<script>
export default {
components: {
},
data() {
return {
AffirmStatus: 1,
passwordArr: [],
oldPasswordArr: [],
newPasswordArr: [],
afPasswordArr: [],
};
},
onLoad() {
},
methods: {
/**
* 唤起键盘
*/
onPayUp() {
this.$refs.CodeKeyboard.show();
},
/**
* 支付键盘回调
* @param {Object} val
*/
KeyInfo(val) {
if (val.index >= 6) {
return;
}
// 判断是否输入的是删除键
if (val.keyCode === 8) {
// 删除最后一位
this.passwordArr.splice(val.index + 1, 1)
}
// 判断是否输入的是.
else if (val.keyCode == 190) {
// 输入.无效
} else {
this.passwordArr.push(val.key);
}
uni.showModal({
title: '温馨提示',
content: '输入密码是 = ' + JSON.stringify(this.passwordArr)
})
// 判断是否等于6
if (this.passwordArr.length === 6) {
this.passwordArr = [];
this.AffirmStatus = this.AffirmStatus + 1;
}
// 判断到哪一步了
if (this.AffirmStatus === 1) {
this.oldPasswordArr = this.passwordArr;
} else if (this.AffirmStatus === 2) {
this.newPasswordArr = this.passwordArr;
} else if (this.AffirmStatus === 3) {
this.afPasswordArr = this.passwordArr;
} else if (this.AffirmStatus === 4) {
console.log(this.oldPasswordArr.join(''));
console.log(this.newPasswordArr.join(''));
console.log(this.afPasswordArr.join(''));
uni.showToast({
title: '修改成功',
icon: 'none'
})
setTimeout(() => {
uni.navigateBack();
}, 2000)
}
this.$forceUpdate();
}
}
}
</script>
<style scoped lang="scss">
$base: orangered; // 基础颜色
.page {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: #FFFFFF;
}
.pay-title {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 200rpx;
text {
font-size: 28rpx;
color: #555555;
}
}
.pay-password {
display: flex;
align-items: center;
width: 90%;
height: 80rpx;
margin: 20rpx auto;
border: 2rpx solid $base;
.list {
display: flex;
align-items: center;
justify-content: center;
width: 16.666%;
height: 100%;
border-right: 2rpx solid #EEEEEE;
text {
font-size: 32rpx;
}
}
.list:nth-child(6) {
border-right: none;
}
}
.hint {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100rpx;
text {
font-size: 28rpx;
color: $base;
}
}
</style>
```