123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- <template>
- <view>
- <view class="top">
- <image class="left-icon" :src="icon" mode="scaleToFill"></image>
- <text class="tit">100元话费,限时{{price}}元</text>
- </view>
- <view class="user-data">
- <van-cell-group>
- <van-field :value="tmallNo" @change='tmallNo_fieldChange' type="text" required clearable label="天猫订单号"
- icon="question-o" placeholder="请输入天猫订单号" @click-icon="onClickIcon('买了山泉心品才有的单号')" />
- <van-field :value="rechargePhoneNo" @change='rechargePhoneNo_fieldChange' type="number" label="手机号码"
- placeholder="请输入手机号码" required />
- </van-cell-group>
- </view>
- <view class="commodity-selection">
- <text class="top-tit">充值运营商类型</text>
- <view class="selection-box">
- <view class="commodity" :class="{selected:current==index}" @click="current=index"
- v-for="(item,index) in goodsInfoList" :key='index'>
- <text>{{item}}</text>
- <m-icon v-if="current==index" class="xuanzhong-icon" type="xuanzhong" color="#47CB79"></m-icon>
- </view>
- </view>
- </view>
- <view class="prompt">
- <text class="top-tit">购买须知</text>
- <view class="dex-box">
- <text v-for="(item,index) in remark" :key='index'>{{index+1}}、{{item}}</text>
- </view>
- </view>
- <view class="buy-btn-box"></view>
- <view class="buy-btn" @click="buy">
- 立即充值
- </view>
- </view>
- </template>
- <script>
- export default {
- data: () => ({
- current: 0,
- goodsInfoList: ['移动', '联通', '电信'],
- remark: ['请注意,买了就不给退钱'],
- tmallNo: null,
- rechargePhoneNo: null,
- icon: 'https://t1-1305573081.cos.ap-shanghai.myqcloud.com/wxapp/static/imgs/%E5%A4%A9%E7%8C%AB%E6%B4%BB%E5%8A%A8%E8%AF%9D%E8%B4%B9.png',
- price: null
- }),
- async mounted() {
- let {
- data
- } = await this.$api.phoneBill.getPriceKeyword()
- this.price = data
- },
- methods: {
- async buy() {
- this.$utils.wxUtils.subscribeToNews().then(async res => {
- let orderRes = await this.$api.phoneBill.prepareOrder({
- tmallNo: this.tmallNo,
- rechargePhoneNo: this.rechargePhoneNo,
- operators: this.current + 1,
- goodsPictureUrl: this.icon,
- })
- let payRes = await wx.requestPayment(orderRes.data)
- if (payRes.errMsg == 'requestPayment:ok') {
- this.$utils.goPage(
- `/pages/phoneBill/orderdes?outTradeNo=${orderRes.data.outTradeNo}`,
- 'reLaunch')
- }
- })
- },
- tmallNo_fieldChange(e) {
- this.tmallNo = e.detail
- },
- rechargePhoneNo_fieldChange(e) {
- this.rechargePhoneNo = e.detail
- },
- onClickIcon(msg) {
- wx.showToast({
- title: msg,
- icon: 'none'
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .top {
- margin-top: 20rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- background-color: #FFFFFF;
- padding: 23rpx;
- .left-icon {
- width: 87rpx;
- height: 79rpx;
- margin-right: 22rpx;
- }
- .tit {
- white-space: nowrap;
- font-size: 30rpx;
- font-weight: 400;
- color: #0F0404;
- }
- }
- .user-data {
- background-color: #FFFFFF;
- display: flex;
- flex-direction: column;
- }
- .commodity-selection {
- margin-top: 20rpx;
- background-color: #FFFFFF;
- display: flex;
- flex-direction: column;
- .top-tit {
- font-size: 26rpx;
- font-weight: 400;
- color: #666666;
- line-height: 39rpx;
- border-bottom: 1rpx solid #e8e8e8;
- padding: 28rpx;
- }
- .selection-box {
- margin-top: 30rpx;
- display: flex;
- flex-wrap: wrap;
- justify-content: flex-start;
- padding-left: 15rpx;
- .selected {
- border: 1rpx solid #ECBF7A !important;
- background-color: #FDF3D7;
- }
- .commodity {
- margin-bottom: 15rpx;
- margin-right: 15rpx;
- width: 230rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- border: 1rpx solid #E8E8E8;
- box-sizing: border-box;
- padding: 30rpx 20rpx;
- border-radius: 6rpx;
- position: relative;
- .xuanzhong-icon {
- position: absolute;
- right: 0;
- bottom: 0;
- }
- text {
- &:nth-child(1) {
- color: #999999;
- font-size: 26rpx;
- }
- &:nth-child(2) {
- color: #999999;
- font-size: 26rpx;
- }
- &:nth-child(3) {
- color: #E31818;
- font-size: 40rpx;
- }
- &:nth-child(4) {
- color: #999999;
- font-size: 26rpx;
- text-decoration: line-through;
- }
- }
- }
- }
- }
- .prompt {
- margin-top: 20rpx;
- background-color: #FFFFFF;
- display: flex;
- flex-direction: column;
- .top-tit {
- font-size: 26rpx;
- font-weight: 400;
- color: #666666;
- line-height: 39rpx;
- border-bottom: 1rpx solid #e8e8e8;
- padding: 28rpx;
- }
- .dex-box {
- padding: 28rpx;
- display: flex;
- flex-direction: column;
- font-size: 26rpx;
- font-weight: 400;
- color: #666666;
- line-height: 39rpx;
- }
- }
- .buy-btn-box {
- margin-top: 30rpx;
- width: 600rpx;
- height: 80rpx;
- opacity: 0;
- }
- .buy-btn {
- position: fixed;
- bottom: 30rpx;
- left: 50%;
- transform: translateX(-50%);
- width: 600rpx;
- height: 80rpx;
- background: linear-gradient(90deg, #E31818, #ED3E24, #ED4F24);
- border-radius: 40rpx;
- font-size: 30rpx;
- font-weight: 400;
- color: #FFFFFF;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- </style>
|