| | |
| | | <!-- 扫码支付 --> |
| | | <template> |
| | | <view class="page"> |
| | | <u-alert type="warning" closable description="安全提醒:请谨慎核对商家、订单信息,保护自己资金安全!"></u-alert> |
| | | <view class="pay-box"> |
| | | <view class="u-font-26 color-666">应付金额</view> |
| | | <view class="u-m-t-14"> |
| | |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- <view v-if="discountInfo.shopDiscount!=1&&money*(1-discountInfo.shopDiscount)>=0.01" |
| | | class="bg-fff u-m-h-32 u-m-t-20 u-p-h-32 u-br-10"> |
| | | <view v-if="discountInfo.shopDiscount!=1&&money*(1-discountInfo.shopDiscount)>=0.01" class="bg-fff u-m-h-32 u-m-t-20 u-p-h-32 u-br-10"> |
| | | <view class="u-p-v-32 u-flex u-row-between u-border-bottom u-font-30 color-333"> |
| | | <view>{{discountInfo.memberGradeName}}专属折扣</view> |
| | | <view>-{{ money*(1-discountInfo.shopDiscount).toFixed(2) }}</view> |
| | | </view> |
| | | </view>--> |
| | | </view> |
| | | <view v-if="canUseIntegral||canUseCoupon" class="u-p-h-32 bg-fff u-m-h-32 u-br-10"> |
| | | <!-- <view class="u-font-28 u-m-t-32">选择优惠方式</view> |
| | | <view class="u-font-28 u-m-t-32">选择优惠方式</view> |
| | | <view v-if="canUseIntegral" class="u-p-v-24 u-border-bottom u-flex u-m-t-10"> |
| | | <image class="item-icon" style="align-self: flex-start;position: relative;top: -3rpx;" |
| | | src="/static/integral.png" mode=""></image> |
| | | <image class="item-icon" style="align-self: flex-start;position: relative;top: -3rpx;" src="/static/integral.png" mode=""></image> |
| | | <view class="u-flex-1 u-m-h-16"> |
| | | <view class="u-font-30">积分抵扣</view> |
| | | <view class="u-font-24 color-999 u-m-t-20">可用<text style="color: #D31F28;">{{integral}}</text>积分 |
| | |
| | | </view> |
| | | <input-number @handleCount="changeInt" :value="canUseInt" :min="0" :max="maxIntegral"> |
| | | </input-number> |
| | | </view>--> |
| | | </view> |
| | | <view v-if="canUseCoupon" class="u-flex u-p-v-32"> |
| | | <image class="item-icon" src="/static/coupon-icon.png" mode=""></image> |
| | | <view class="u-font-30 u-flex-1 u-m-h-16">优惠券</view> |
| | |
| | | 已选择优惠券1张,共抵扣¥{{parseFloat((checkCoupon.discount/100).toFixed(2))}}</view> |
| | | <!-- <view class="choose-coupon">选择优惠券</view> --> |
| | | <scroll-view scroll-y class="u-p-30 coupon-list"> |
| | | <view @click="clickCoupon(item)" class="u-m-b-24 u-flex coupon" v-for="(item, index) in couponList" |
| | | :key="index"> |
| | | <view @click="clickCoupon(item)" class="u-m-b-24 u-flex coupon" v-for="(item, index) in couponList" :key="index"> |
| | | <view style="color: #D31F28;" class="u-p-h-28"> |
| | | <view class="font-bold"> |
| | | <text class="u-font-36">¥</text> |
| | |
| | | <key-bord @changeMoney="changeMoney" :num.sync="money" @close="bordShow = false" @pay="pay"></key-bord> |
| | | </u-popup> |
| | | <!-- 支付验证码 --> |
| | | <!-- <u-popup :show="codeShow" closeable mode="center" @close="codeShow = false"> |
| | | <u-popup :show="codeShow" closeable mode="center" @close="codeShow = false"> |
| | | <view class="u-p-h-40 u-p-b-40"> |
| | | <view class="u-text-center u-p-t-20 u-m-b-30 u-font-34">请输入手机验证码</view> |
| | | <view class="u-text-center u-m-b-20 color-666">{{ shopInfo.shop_name }}</view> |
| | | <view class="u-flex u-row-center font-bold u-m-b-40"><text class="u-font-42">¥</text><text |
| | | class="u-font-money">{{ price }}</text> |
| | | <view class="u-flex u-row-center font-bold u-m-b-40"><text class="u-font-42">¥</text><text class="u-font-money">{{ price }}</text> |
| | | </view> |
| | | <u-code-input @finish="bankPay" v-model="smscode" mode="box" :focus="true"></u-code-input> |
| | | </view> |
| | | |
| | | </u-popup>--> |
| | | </u-popup> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | config, |
| | | ACCESSTOKEN |
| | | } from '@/common/config.js'; |
| | | import { |
| | | queryMyUseSweepPayMaxCoupon, |
| | | getScoreWorth, |
| | | queryScore, |
| | | queryUseSweepPayCoupon, |
| | | getWechatConfigInfo, |
| | | saveWxOrder, |
| | | tlPay |
| | | } from '@/common/api/index' |
| | | import wx from 'weixin-js-sdk'; // 使用js-sdk |
| | | import { |
| | | nextTick |
| | | } from "vue"; |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | onLoad(opt) { |
| | | this.isNew = uni.getStorageSync('IS_NEW') |
| | | this.cid = uni.getStorageSync('CID') |
| | | this.discountInfo = uni.getStorageSync('DISCOUNT_INFO') |
| | | const token = uni.getStorageSync(ACCESSTOKEN) || null |
| | | if (opt.shopInfo) { |
| | | this.shopInfo = JSON.parse(decodeURIComponent(opt.shopInfo)) |
| | | this.discountInfo = uni.getStorageSync('DISCOUNT_INFO') || { |
| | | shopDiscount: 1 |
| | | } |
| | | const token = uni.getStorageSync(ACCESSTOKEN) || null |
| | | this.shopInfo = uni.getStorageSync('SHOP_INFO') |
| | | if (opt.scoreWorth) { |
| | | this.scoreWorth = Number(opt.scoreWorth) |
| | | } |
| | |
| | | } |
| | | if (opt.money) { |
| | | this.money = parseFloat(opt.money).toFixed(2) |
| | | let dis = this.money * 100 * (1 - this.discountInfo.shopDiscount) |
| | | let money = parseInt((this.money * 100 * this.discountInfo.shopDiscount)) |
| | | let ds = parseFloat(this.discountInfo.shopDiscount) |
| | | let dis = this.money * 100 * (1 - ds) |
| | | let money = parseInt((this.money * 100 * ds)) |
| | | if (dis < 1) { |
| | | money = parseInt((this.money * 100)) |
| | | } |
| | |
| | | money: money < 1 ? 1 : money |
| | | } |
| | | }).then(res => { |
| | | if (res&&this.canUseCoupon) { |
| | | this.couponInfo = res |
| | | this.checkCoupon = res |
| | | if (res && this.canUseCoupon) { |
| | | this.couponInfo = res |
| | | this.checkCoupon = res |
| | | } |
| | | |
| | | }) |
| | |
| | | this.aliPay(res.paymentData) |
| | | } |
| | | } else if (res.toPayMethod == 3) { |
| | | // window.location.href = res.paymentUrl |
| | | this.smscode = '' |
| | | this.codeShow = true |
| | | window.location.href = res.paymentUrl |
| | | } |
| | | } |
| | | } catch (e) { |
| | |
| | | }) |
| | | }, |
| | | // 微信支付 |
| | | wxPay(res) { |
| | | setTimeout(() => { |
| | | WeixinJSBridge.invoke( |
| | | 'getBrandWCPayRequest', { |
| | | "appId": res.appId, //公众号ID,由商户传入 |
| | | "timeStamp": res.timeStamp, //时间戳,自1970年以来的秒数 |
| | | "nonceStr": res.nonceStr, //随机串 |
| | | "package": res.package, |
| | | "signType": res.signType, //微信签名方式: |
| | | "paySign": res.paySign //微信签名 |
| | | }, |
| | | (res) => { |
| | | if (res.err_msg == "get_brand_wcpay_request:ok") { |
| | | // 使用以上方式判断前端返回,微信团队郑重提示: |
| | | //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 |
| | | uni.navigateTo({ |
| | | url: `/pages/pay/paySuccess?orderId=${this.orderId}&youHuiInfo=${JSON |
| | | wxPay(res) { |
| | | /*setTimeout(() => { |
| | | wx.chooseWXPay({ |
| | | timestamp: res.timeStamp, // 支付签名时间戳 |
| | | nonceStr: res.nonceStr, // 支付签名随机串,不长于 32 位 |
| | | package: res.package, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*) |
| | | signType: res.signType, // 微信支付V3的传入 RSA ,微信支付V2的传入格式与V2统一下单的签名格式保持一致 |
| | | paySign: res.paySign, // 支付签名 |
| | | success: function(res) { |
| | | // 支付成功后的回调函数 |
| | | uni.navigateTo({ |
| | | url: `/pages/pay/paySuccess?orderId=${this.orderId}&youHuiInfo=${JSON |
| | | .stringify(this.youHuiInfo)}` |
| | | }) |
| | | } |
| | | }); |
| | | }, 200)*/ |
| | | setTimeout(() => { |
| | | WeixinJSBridge.invoke( |
| | | 'getBrandWCPayRequest', { |
| | | "appId": res.appId, //公众号ID,由商户传入 |
| | | "timeStamp": res.timeStamp, //时间戳,自1970年以来的秒数 |
| | | "nonceStr": res.nonceStr, //随机串 |
| | | "package": res.package, |
| | | "signType": res.signType, //微信签名方式: |
| | | "paySign": res.paySign //微信签名 |
| | | }, |
| | | (res) => { |
| | | if (res.err_msg == "get_brand_wcpay_request:ok") { |
| | | // 使用以上方式判断前端返回,微信团队郑重提示: |
| | | //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 |
| | | /*uni.navigateTo({ |
| | | url: `/pages/pay/paySuccess?orderId=${this.orderId}&youHuiInfo=${JSON |
| | | .stringify(this.youHuiInfo)}` |
| | | }) |
| | | } |
| | | }); |
| | | }, 200) |
| | | }, |
| | | })*/ |
| | | } |
| | | }); |
| | | }, 200) |
| | | }, |
| | | //支付宝支付 |
| | | aliPay(res) { |
| | | ap.tradePay({ |
| | | tradeNO: res.tradeNO |
| | | }, (res) => { |
| | | if (res.resultCode == 9000) { |
| | | uni.navigateTo({ |
| | | /*uni.navigateTo({ |
| | | url: `/pages/pay/paySuccess?orderId=${this.orderId}&youHuiInfo=${JSON |
| | | .stringify(this.youHuiInfo)}` |
| | | }) |
| | | })*/ |
| | | // 支付成功 |
| | | } else if (res.resultCode == 8000 || res.resultCode == 6001) { |
| | | // 正在处理中 || 取消 |