|
@@ -0,0 +1,381 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div class="app-content pay-wrap">
|
|
|
|
|
+ <div class="delivery-wrap">
|
|
|
|
|
+ <div class="shop-logo-wrap">
|
|
|
|
|
+ <div class="logo-img">
|
|
|
|
|
+ <image class="logo" :src="`${constant.imgUrl}/logo4.png`" alt mode="widthFix" ></image>
|
|
|
|
|
+ <div class="title">{{ ghsInfo.name?ghsInfo.name:'' }}</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div style="padding:10upx 0 25upx 10upx;font-size:30upx;">
|
|
|
|
|
+ {{ customInfo.name?customInfo.name:'' }},
|
|
|
|
|
+ <text>您的待结款这里直接付款销账</text>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="module-com pay-input-wrap">
|
|
|
|
|
+ <pay-input-module :focus="inpFocus" :num="amount" @focusFn="focusFn" @blurFn="blurFn" @clickKey="clickKeyFn" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="btn-wrap">
|
|
|
|
|
+ <!-- #ifdef MP-WEIXIN -->
|
|
|
|
|
+ <button class="button-com green" @click="wexinPayFn">微信支付</button>
|
|
|
|
|
+ <!-- #endif -->
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+<script>
|
|
|
|
|
+ import { mapGetters } from 'vuex'
|
|
|
|
|
+ import PayInputModule from './components/pay-input'
|
|
|
|
|
+ import wexinPay from '@/utils/pay/wxPay'
|
|
|
|
|
+ import ModalModule from '@/components/plugin/modal'
|
|
|
|
|
+ import AppCouponSel from '@/components/app-coupon-sel'
|
|
|
|
|
+ import { share } from '@/mixins'
|
|
|
|
|
+ import { rechargeBalance } from '@/api/recharge'
|
|
|
|
|
+ import { postWxCode } from '@/api/mini'
|
|
|
|
|
+ export default {
|
|
|
|
|
+ name: 'pay',
|
|
|
|
|
+ components: {
|
|
|
|
|
+ PayInputModule,
|
|
|
|
|
+ ModalModule,
|
|
|
|
|
+ AppCouponSel
|
|
|
|
|
+ },
|
|
|
|
|
+ mixins: [share],
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ constant: this.$constant,
|
|
|
|
|
+ inpFocus: false,
|
|
|
|
|
+ amount: '',
|
|
|
|
|
+ payWay: 0,
|
|
|
|
|
+ payCallData: null,
|
|
|
|
|
+ id:0,
|
|
|
|
|
+ salt:'',
|
|
|
|
|
+ ghsInfo:[],
|
|
|
|
|
+ customInfo:[],
|
|
|
|
|
+ imgUrl:''
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ computed: {},
|
|
|
|
|
+ onLoad(option) {
|
|
|
|
|
+ // #ifdef H5
|
|
|
|
|
+ this.specialInit()
|
|
|
|
|
+ // #endif
|
|
|
|
|
+ },
|
|
|
|
|
+ onShow(){
|
|
|
|
|
+ this.specialInit()
|
|
|
|
|
+ },
|
|
|
|
|
+ mounted(){
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ teachPayFn() {
|
|
|
|
|
+ this.pageTo({ url: "/admin/ghs/teachPay"})
|
|
|
|
|
+ },
|
|
|
|
|
+ downloadImg(){
|
|
|
|
|
+ let that = this
|
|
|
|
|
+ uni.downloadFile({
|
|
|
|
|
+ url:that.imgUrl,
|
|
|
|
|
+ success: (res) => {
|
|
|
|
|
+ if (res.statusCode === 200) {
|
|
|
|
|
+ uni.saveImageToPhotosAlbum({
|
|
|
|
|
+ filePath: res.tempFilePath,
|
|
|
|
|
+ success: function (data) {
|
|
|
|
|
+ uni.showToast({title:'下载成功'})
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ init(){
|
|
|
|
|
+ this.specialInit();
|
|
|
|
|
+ },
|
|
|
|
|
+ specialInit() {
|
|
|
|
|
+ let that = this
|
|
|
|
|
+ let id = 0
|
|
|
|
|
+ let salt = ''
|
|
|
|
|
+ if(this.option.id && this.option.salt){
|
|
|
|
|
+ id = this.option.id?this.option.id:0
|
|
|
|
|
+ salt = this.option.salt?this.option.salt:''
|
|
|
|
|
+ }else{
|
|
|
|
|
+ if(this.option.q){
|
|
|
|
|
+ let currentUrl = decodeURIComponent(this.option.q)
|
|
|
|
|
+ let str = currentUrl.substring(currentUrl.lastIndexOf("?") + 1)
|
|
|
|
|
+ var sceneItem = str.split("&");
|
|
|
|
|
+ var arr, name, value;
|
|
|
|
|
+ var sceneArray = new Array();
|
|
|
|
|
+ for (var i = 0, l = sceneItem.length; i < l; i++) {
|
|
|
|
|
+ arr = sceneItem[i].split("=");
|
|
|
|
|
+ name = arr[0];
|
|
|
|
|
+ value = arr[1];
|
|
|
|
|
+ sceneArray[name] = value;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(sceneArray.id){
|
|
|
|
|
+ id =sceneArray.id
|
|
|
|
|
+ }
|
|
|
|
|
+ if(sceneArray.salt){
|
|
|
|
|
+ salt = sceneArray.salt
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ this.id = id
|
|
|
|
|
+ this.salt = salt
|
|
|
|
|
+
|
|
|
|
|
+ this.inpFocus = true
|
|
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
|
|
+ // 设置分享
|
|
|
|
|
+ let shareParams = {
|
|
|
|
|
+ title: `点击结账付款`,
|
|
|
|
|
+ desc: '',
|
|
|
|
|
+ imgUrl: '',
|
|
|
|
|
+ pagePath: `/admin/ghs/pay?id=${this.id}&salt=${this.salt}`
|
|
|
|
|
+ }
|
|
|
|
|
+ this.jweixinFn(shareParams)
|
|
|
|
|
+ console.log(`/admin/ghs/pay?id=${this.id}&salt=${this.salt}`)
|
|
|
|
|
+ // #endif
|
|
|
|
|
+ },
|
|
|
|
|
+ toPay() {
|
|
|
|
|
+ if (!this.amount) {
|
|
|
|
|
+ this.$msg('请先输入金额!')
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ let params = {}
|
|
|
|
|
+ params = {
|
|
|
|
|
+ actPrice: this.amount,
|
|
|
|
|
+ payWay: this.payWay,
|
|
|
|
|
+ }
|
|
|
|
|
+ let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
|
|
|
|
|
+ params.currentMiniOpenId = currentMiniOpenId
|
|
|
|
|
+ params.ghsId = this.id
|
|
|
|
|
+ params.salt = this.salt
|
|
|
|
|
+ rechargeBalance(params).then(res => {
|
|
|
|
|
+ this.payCallData = res.data
|
|
|
|
|
+ //错误返回判断
|
|
|
|
|
+ if(res.code == 0){
|
|
|
|
|
+ this.$msg(res.msg)
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.payWay == 0) {
|
|
|
|
|
+ wexinPay(res.data, this.paySuccess, this.payFail)
|
|
|
|
|
+ } else if (this.payWay == 1) {
|
|
|
|
|
+ window.location.href = res.data.url;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.paySuccess()
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ focusFn() {
|
|
|
|
|
+ this.inpFocus = true
|
|
|
|
|
+ },
|
|
|
|
|
+ // 失焦
|
|
|
|
|
+ blurFn() {
|
|
|
|
|
+ this.inpFocus = false
|
|
|
|
|
+ },
|
|
|
|
|
+ // 点击键盘
|
|
|
|
|
+ clickKeyFn(val) {
|
|
|
|
|
+ this.amount = val
|
|
|
|
|
+ },
|
|
|
|
|
+ // 支付宝支付
|
|
|
|
|
+ aliPayFn() {
|
|
|
|
|
+ this.payWay = 1
|
|
|
|
|
+ this.toPay()
|
|
|
|
|
+ },
|
|
|
|
|
+ // 微信支付
|
|
|
|
|
+ wexinPayFn() {
|
|
|
|
|
+
|
|
|
|
|
+ let platformType = uni.getSystemInfoSync().platform
|
|
|
|
|
+ if(platformType == 'windows'){
|
|
|
|
|
+ this.$msg('请使用手机小程序付款')
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.payWay = 0
|
|
|
|
|
+ let that = this
|
|
|
|
|
+ let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
|
|
|
|
|
+ if (this.$util.isEmpty(currentMiniOpenId)){
|
|
|
|
|
+ uni.showLoading({mask:true})
|
|
|
|
|
+ uni.login({
|
|
|
|
|
+ provider: 'weixin',
|
|
|
|
|
+ success: res => {
|
|
|
|
|
+ postWxCode({ code: res.code }).then(subRes => {
|
|
|
|
|
+ uni.hideLoading()
|
|
|
|
|
+ if(subRes.data.currentMiniOpenId){
|
|
|
|
|
+ let thisMiniOpenId = subRes.data.currentMiniOpenId
|
|
|
|
|
+ uni.setStorageSync('currentMiniOpenId',thisMiniOpenId)
|
|
|
|
|
+ that.toPay()
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }else{
|
|
|
|
|
+ that.toPay()
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ paySuccess() {
|
|
|
|
|
+ this.$util.pageTo({url: '/admin/ghs/result?id='+this.id+'&salt='+this.salt,type: 2})
|
|
|
|
|
+ },
|
|
|
|
|
+ payFail() {
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style lang="scss">
|
|
|
|
|
+ .app-content {
|
|
|
|
|
+ min-height: calc(100vh - 20upx);
|
|
|
|
|
+ padding-top: 20upx;
|
|
|
|
|
+ }
|
|
|
|
|
+ .tabs-wrap {
|
|
|
|
|
+ position: fixed;
|
|
|
|
|
+ top: 0;
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 80upx;
|
|
|
|
|
+ line-height: 80upx;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ background-color: #fff;
|
|
|
|
|
+ font-size: 30upx;
|
|
|
|
|
+ box-shadow: 4upx 4upx 10upx #eee;
|
|
|
|
|
+ }
|
|
|
|
|
+ .pay-wrap {
|
|
|
|
|
+ .pay-input-wrap {
|
|
|
|
|
+ background-color: #fff;
|
|
|
|
|
+ border-top-left-radius: 20upx;
|
|
|
|
|
+ border-top-right-radius: 20upx;
|
|
|
|
|
+ padding: 50upx 80upx 28upx;
|
|
|
|
|
+ margin-bottom: 0 !important;
|
|
|
|
|
+ .balance {
|
|
|
|
|
+ margin-top: 30upx;
|
|
|
|
|
+ color: $fontColor2;
|
|
|
|
|
+ }
|
|
|
|
|
+ .btn-wrap {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ margin-top: 64upx;
|
|
|
|
|
+ .button-com {
|
|
|
|
|
+ display: block;
|
|
|
|
|
+ margin-bottom: 20upx;
|
|
|
|
|
+ padding-top: 30upx;
|
|
|
|
|
+ padding-bottom: 30upx;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 我要配送
|
|
|
|
|
+ .delivery-wrap {
|
|
|
|
|
+ .module-com {
|
|
|
|
|
+ margin-bottom: 20upx;
|
|
|
|
|
+ background-color: #fff;
|
|
|
|
|
+ .module-tit {
|
|
|
|
|
+ padding: 20upx 18upx;
|
|
|
|
|
+ font-size: 28upx;
|
|
|
|
|
+ font-weight: 600;
|
|
|
|
|
+ border-bottom: 1upx solid $borderColor;
|
|
|
|
|
+ }
|
|
|
|
|
+ .module-det {
|
|
|
|
|
+ padding: 0 30upx;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 金额
|
|
|
|
|
+ .pay-input-wrap {
|
|
|
|
|
+ padding: 50upx 36upx 38upx;
|
|
|
|
|
+ .balance {
|
|
|
|
|
+ margin-top: 30upx;
|
|
|
|
|
+ color: $fontColor2;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .shop-logo-wrap {
|
|
|
|
|
+ padding-bottom: 20upx;
|
|
|
|
|
+ @include disFlex(center, center);
|
|
|
|
|
+ .logo-img {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ margin: 10upx auto;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ .logo {
|
|
|
|
|
+ width: 100upx;
|
|
|
|
|
+ height:100upx;
|
|
|
|
|
+ border-radius: 10upx;
|
|
|
|
|
+ margin-left:10upx;
|
|
|
|
|
+ float: left;
|
|
|
|
|
+ }
|
|
|
|
|
+ .title{
|
|
|
|
|
+ margin-left:20upx;
|
|
|
|
|
+ float:left;
|
|
|
|
|
+ width:600upx;
|
|
|
|
|
+ height:100upx;
|
|
|
|
|
+ line-height:100upx;
|
|
|
|
|
+ font-size:38upx;
|
|
|
|
|
+ font-weight: bold;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 可选优惠
|
|
|
|
|
+ .discount-wrap {
|
|
|
|
|
+ .module-det {
|
|
|
|
|
+ padding-top: 20upx;
|
|
|
|
|
+ padding-bottom: 20upx;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 匿名派送
|
|
|
|
|
+ .none-name-delivery {
|
|
|
|
|
+ // padding-left: 30upx;
|
|
|
|
|
+ padding: 26upx 30upx;
|
|
|
|
|
+ // margin-top: 40upx;
|
|
|
|
|
+ margin-bottom: 20upx;
|
|
|
|
|
+ background-color: #fff;
|
|
|
|
|
+ .none-name-text {
|
|
|
|
|
+ margin-left: 14upx;
|
|
|
|
|
+ color: $fontColor2;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 按钮
|
|
|
|
|
+ .btn-wrap {
|
|
|
|
|
+ width: calc(100% - 60upx);
|
|
|
|
|
+ margin: 64upx auto 0;
|
|
|
|
|
+ padding-bottom: 20upx;
|
|
|
|
|
+ .button-com {
|
|
|
|
|
+ display: block;
|
|
|
|
|
+ margin-bottom: 20upx;
|
|
|
|
|
+ padding-top: 30upx;
|
|
|
|
|
+ padding-bottom: 30upx;
|
|
|
|
|
+ &:last-child {
|
|
|
|
|
+ margin-bottom: 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 查看更多
|
|
|
|
|
+ .view-more {
|
|
|
|
|
+ width: auto;
|
|
|
|
|
+ padding-bottom: 20upx;
|
|
|
|
|
+ margin-bottom: 20upx;
|
|
|
|
|
+ font-size: 28upx;
|
|
|
|
|
+ @include disFlex(center, center);
|
|
|
|
|
+ background-color: #fff;
|
|
|
|
|
+ color: #666565;
|
|
|
|
|
+ justify-content: flex-start;
|
|
|
|
|
+ z-index:9999999;
|
|
|
|
|
+ .view-more-text {
|
|
|
|
|
+ margin-right: 14upx;
|
|
|
|
|
+ }
|
|
|
|
|
+ padding-left:40upx;
|
|
|
|
|
+ i {
|
|
|
|
|
+ font-size: 30upx;
|
|
|
|
|
+ font-weight: 600;
|
|
|
|
|
+ }
|
|
|
|
|
+ .fill-get-man{
|
|
|
|
|
+ color:red;
|
|
|
|
|
+ margin-left:10upx;
|
|
|
|
|
+ font-weight:600;
|
|
|
|
|
+ text-decoration:underline;
|
|
|
|
|
+ }
|
|
|
|
|
+ .pack-up{
|
|
|
|
|
+ margin-left:20upx;
|
|
|
|
|
+ font-weight:600;
|
|
|
|
|
+ color:red;
|
|
|
|
|
+ text-decoration:underline;
|
|
|
|
|
+ }
|
|
|
|
|
+ &.open {
|
|
|
|
|
+ i {
|
|
|
|
|
+ transform: rotate(180deg);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+</style>
|