123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- <template>
- <view class="page-content">
- <view class="content">
- <u-field
- class="field-item"
- :value="store.name"
- disabled
- input-align="right"
- label="收取门店"
- >
- </u-field>
- <u-field
- v-model="remarks"
- label="备注"
- input-align="right"
- auto-height
- :maxlength="10"
- placeholder="请填写备注(最多10个字符)"
- >
- </u-field>
- <view class="num-cont">
- <text class="u-required">支付数量</text>
- <view class="num-input">
- <u-input v-model="number" input-align="right" type="number" placeholder="请输入数量" />
- <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
- </view>
- </view>
- </view>
- <view class="pay-btn">
- <view class="total">
- <text>{{number||0}}</text>
- <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
- </view>
- <u-button @click="handlePay" type="success" >确认支付</u-button>
- </view>
- <!-- 确认支付弹窗 -->
- <u-popup mode="center" closeable @close="closeModal" negative-top="150" v-model="showPayModal" width="600rpx" >
- <view class="slot-content">
- <view class="slot-title">请输入支付密码</view>
- <view class="text-cont">
- <view>
- <text>收取门店:</text>
- <text>{{store.name||'--'}}</text>
- </view>
- <view class="num-text">
- <text>支付数量:</text>
- <view>
- <text class="num-big">{{number}}</text>
- <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
- </view>
- </view>
- <view>
- <text>备 注:</text>
- <text>{{remarks||'无'}}</text>
- </view>
- </view>
- <view class="footer">
- <input v-model="password"
- type="password"
- :focus="focus"
- placeholder="请输入支付密码"
- :maxlength="30"
- @confirm="confirm"
- />
- </view>
- <view class="fot-btn">
- <u-button @click="confirm" type="success" >确认支付</u-button>
- </view>
- </view>
- </u-popup>
-
- <!-- 提示用户设置支付密码 -->
- <u-modal v-model="showSetPswModal"
- content="请先设置支付密码,才能使用乐豆"
- show-cancel-button
- confirm-text="去设置"
- cancel-text="暂时放弃"
- @confirm="toSetPwd"
- @cancel="showSetPswModal=false"
- ></u-modal>
- </view>
- </template>
- <script>
- import { sellerReceive } from '@/api/user.js'
- import { existPayPwd } from '@/api/order.js'
- export default{
- data() {
- return {
- showSetPswModal: false,
- store: null, // 门店信息
- remarks: '', // 备注
- number: '', // 支付数量
- showPayModal: false, // 支付弹窗
- password: '', // 支付密码
- partnerNo: '', // 销售商编号
- currentGold: 0, //用户当前拥有乐豆数
- focus: false
- }
- },
- onLoad(opts) {
- this.currentGold = this.$store.state.vuex_userData.currentGold
- console.log(this.currentGold,'currentGold')
- this.store = JSON.parse(decodeURIComponent(opts.store))
- this.partnerNo = this.store.officialPartnerNo
- // console.log(this.store,'22222')
- },
- methods: {
- // 跳转到设置支付密码页
- toSetPwd () {
- uni.navigateTo({
- url:"/pages/userCenter/userInfo/smsVerification"
- })
- },
- // 确认支付
- handlePay() {
- if (!this.number) {
- uni.showToast({
- title: '请输入支付数量',
- icon: 'none'
- })
- } else {
- if (this.number>this.currentGold) {
- uni.showToast({
- title: '您当前余额不足!',
- icon: 'none'
- })
- return false
- }
- existPayPwd().then(res => {
- console.log(res,'rrrrrr')
- if(res.status == 200) {
- // 设置过支付密码,输入密码
- if(res.data) {
- this.showPayModal = true
- setTimeout(()=>{
- this.focus = true
- },300)
- } else {
- // 没设置过支付密码,提示设置密码
- this.showSetPswModal = true
- }
- }
- })
- }
- },
- // 关闭弹窗
- closeModal() {
- this.showPayModal = false
- this.password = ''
- },
- // 输入密码完成 支付
- confirm(e) {
- if(this.password == ''){
- uni.showToast({
- title: '请输入支付密码',
- icon: 'none'
- })
- return
- }
- let data = {
- "payPassword": this.password,
- "changeNum": this.number,
- "remarks": this.remarks,
- "officialPartnerNo": this.partnerNo
- }
- sellerReceive(data).then(res => {
- console.log(res)
- if(res.status == 200){
- uni.redirectTo({
- url: '/pages/checkOut/checkFinish?num='+this.number
- })
- }
- })
- }
- },
- }
- </script>
- <style lang="less">
- page{
- height: 100%;
- }
- .page-content{
- width: 100%;
- height: 100%;
- padding: 20upx;
- background-color: #f8f8f8;
- .content{
- background-color: #fff;
- }
- .num-cont{
- width: 100%;
- padding: 16upx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .num-input{
- display: flex;
- align-items: center;
- justify-content: center;
- >u-input {
- width: 300upx;
- }
- }
- }
- .pay-btn{
- padding: 0 30upx;
- .total {
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 48upx;
- font-weight: 600;
- color: red;
- padding: 60upx 0;
- }
- }
- }
- .slot-content{
- padding: 30upx 0;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: space-between;
- .slot-title{
- font-size: 36rpx;
- }
- .text-cont{
- width: 100%;
- margin-top: 20upx;
- // font-size: 20rpx;
- >view {
- padding: 10upx 80upx;
- display: flex;
- >text{
- &:last-child {
- flex: 1;
- padding-left: 30upx;
- }
- }
- .num-big{
- font-size: 36upx;
- color: red;
- padding-left: 30upx;
- font-weight: 600;
- }
- }
- .num-text{
- align-items: center;
- >view {
- display: flex;
- align-items: center;
- }
- }
-
- }
- .footer{
- width: 80%;
- border-bottom: 1px solid #b1b1b1;
- >input {
- text-align: center;
- padding: 10upx 0;
- }
- }
- .fot-btn{
- margin-top: 30upx;
- }
- }
- </style>
|