|
|
@@ -0,0 +1,332 @@
|
|
|
+<template>
|
|
|
+ <div class="app-content pay-wrap">
|
|
|
+ <div class="delivery-wrap">
|
|
|
+ <div class="shop-logo-wrap">
|
|
|
+ <div class="logo-img">
|
|
|
+ <img :src="`${constant.imgUrl}/logo4.png`" alt mode="widthFix" />
|
|
|
+ </div>
|
|
|
+ </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 -->
|
|
|
+ <!-- #ifdef H5 -->
|
|
|
+ <button class="button-com red" @click="aliPayFn">支付宝支付</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 { fastPay } from '@/api/pay'
|
|
|
+ import { recharge } from '@/api/member'
|
|
|
+ import { getOrderShop } from '@/utils/config'
|
|
|
+ export default {
|
|
|
+ name: 'pay',
|
|
|
+ components: {
|
|
|
+ PayInputModule,
|
|
|
+ ModalModule,
|
|
|
+ AppCouponSel
|
|
|
+ },
|
|
|
+ mixins: [share],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ constant: this.$constant,
|
|
|
+ inpFocus: false,
|
|
|
+ amount: '',
|
|
|
+ form: { payWay: 0 },
|
|
|
+ aliPayHtml: '',
|
|
|
+ passwordModal: false,
|
|
|
+ payCallData: null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters({ orderShop: 'getOrderShop' }),
|
|
|
+ ...mapGetters({ shopUser: 'getShopUser' })
|
|
|
+ },
|
|
|
+ onLoad(option) {
|
|
|
+ // #ifdef H5
|
|
|
+ this.specialInit()
|
|
|
+ // #endif
|
|
|
+ },
|
|
|
+ mounted() {},
|
|
|
+ methods: {
|
|
|
+ init(){
|
|
|
+ this.specialInit();
|
|
|
+ },
|
|
|
+ specialInit() {
|
|
|
+ getOrderShop(true).then(res => {
|
|
|
+ this.inpFocus = true
|
|
|
+ // 设置分享
|
|
|
+ let shareParams = {
|
|
|
+ title: `点我付款`, // 分享标题
|
|
|
+ desc: '享随机优惠,最高20元', // 分享内容
|
|
|
+ imgUrl: '',
|
|
|
+ pagePath: `/pages/pay/index?account=${res.shop.id}&store=0&fromType=3`
|
|
|
+ }
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
+ this.jweixinFn(shareParams)
|
|
|
+ // #endif
|
|
|
+ console.log(`/pages/pay/index?account=${res.shop.id}&store=0&fromType=3`)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ toPay() {
|
|
|
+ if (!this.amount) {
|
|
|
+ this.$msg('请先输入金额!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ let params = {}
|
|
|
+ params = {
|
|
|
+ prePrice: this.amount,
|
|
|
+ payWay: this.form.payWay,
|
|
|
+ }
|
|
|
+ if (this.option.store) {
|
|
|
+ params.store = this.option.store
|
|
|
+ }
|
|
|
+ params.fromType = this.option.fromType || 1
|
|
|
+ let miniOpenId = uni.getStorageSync('miniOpenId')
|
|
|
+ params.miniOpenId = miniOpenId
|
|
|
+ fastPay(params).then(res => {
|
|
|
+ this.payCallData = res.data
|
|
|
+ //错误返回判断
|
|
|
+ if(res.code == 0){
|
|
|
+ this.$msg(res.msg)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (this.form.payWay == 0) {
|
|
|
+ wexinPay(res.data, this.paySuccess, this.payFail)
|
|
|
+ } else if (this.form.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.form.payWay = 1
|
|
|
+ this.toPay()
|
|
|
+ },
|
|
|
+ // 微信支付
|
|
|
+ wexinPayFn() {
|
|
|
+ this.form.payWay = 0
|
|
|
+ this.toPay()
|
|
|
+ },
|
|
|
+ // 暂未设置密码
|
|
|
+ hideAlert() {
|
|
|
+ this.$util.pageTo('/pages/user/password')
|
|
|
+ },
|
|
|
+ passwordModalClick(e) {
|
|
|
+ if (e.index === 0) {
|
|
|
+ this.modalCancel()
|
|
|
+ } else {
|
|
|
+ this.toPay()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ modalCancel() {
|
|
|
+ this.passwordModal = false
|
|
|
+ },
|
|
|
+ // 支付成功
|
|
|
+ paySuccess() {
|
|
|
+ this.$util.pageTo({
|
|
|
+ url: '/pages/callback/index',
|
|
|
+ type: 2,
|
|
|
+ query: {
|
|
|
+ pageStatus: 3,
|
|
|
+ orderSn:this.payCallData.orderSn,
|
|
|
+ totalPrice:this.payCallData.totalPrice,
|
|
|
+ id: this.payCallData.orderId,
|
|
|
+ ...this.params
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ 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 {
|
|
|
+ .logo-wrap {
|
|
|
+ padding-top: 70upx;
|
|
|
+ padding-bottom: 60upx;
|
|
|
+ text-align: center;
|
|
|
+ .logo-img {
|
|
|
+ width: 120upx;
|
|
|
+ margin: 0 auto 20upx;
|
|
|
+ border-radius:10upx;
|
|
|
+ img {
|
|
|
+ border-radius: 50%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .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: 120upx;
|
|
|
+ border-radius: 10upx;
|
|
|
+ margin: 10upx auto;
|
|
|
+ img {
|
|
|
+ border-radius: 50%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 可选优惠
|
|
|
+ .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>
|