123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365 |
- <template>
- <view class="container">
- <view class="list">
- <view class="card" style="height: 120rpx; align-items: center" @click="toAddress" v-if="!addressId">
- <view class="row">
- <view class="left">
- <image
- class="icon"
- :src="'https://file.rongcyl.cn/festatic/bkm/imgv2/orderConfirm/icon1.png'"
- mode="widthFix"
- ></image>
- <span class="text1" style="margin-left: 10rpx">添加地址</span>
- </view>
- <view class="">
- <image
- class="icon"
- :src="'https://file.rongcyl.cn/festatic/bkm/imgv2/orderConfirm/icon2.png'"
- mode="widthFix"
- ></image>
- </view>
- </view>
- </view>
- <view class="card" style="height: 120rpx; align-items: center" v-else @click="toAddress">
- <view class="row">
- <view>
- {{ address.name }}
- </view>
- <view>
- {{ address.tel }}
- </view>
- </view>
- <view class="row" style="margin-top: 10rpx">
- <view style="font-size: 24rpx">
- {{ address.province }}{{ address.city }}{{ address.county }}{{ address.addressDetail }}
- </view>
- </view>
- </view>
- </view>
- <view class="list">
- <view class="card" v-for="(item, index) in list">
- <view class="row" style="margin-top: 20rpx">
- <view class="left">
- <image class="img" :src="'https://file.rongcyl.cn/festatic/bkm/imgv2/ka.jpeg'" mode="aspectFill"></image>
- </view>
- <view class="right" style="font-size: 28rpx">
- <view class="row title">
- {{ item.prizeName }}
- </view>
- <view class="row text">获得时间:{{ item.creatTime }}</view>
- <!-- <view class="row" style="color: #FF2C43;">
- 回收积分:{{ item.integral }}
- <span class="status">{{ item.prizeStatus }}</span>
- </view> -->
- <!-- <view class="row button">
- <span></span>
- <span>
- <image style="width: 88rpx;" :src="'https://file.rongcyl.cn/festatic/bkm/imgv2' + /knapsack/button5.png" mode="widthFix"></image>
- </span>
- </view> -->
- </view>
- </view>
- </view>
- </view>
- <view class="bottom">
- <view class="left">
- <view class="text">
- 共计:
- <span style="color: #000">{{ list.length }}</span>
- </view>
- </view>
- <view class="right">
- <image
- class="button"
- @click="clickSubmit"
- :src="'https://file.rongcyl.cn/festatic/bkm/imgv2/orderConfirm/button.png'"
- mode="heightFix"
- ></image>
- </view>
- </view>
- <uni-popup ref="popup" type="bottom" background-color="#fff" safe-area>
- <view class="popupContent">
- <view class="title">发货须知</view>
- <view class="text">
- 1.平台默认使用圆通物流,满5件国内包邮新疆、内蒙、港澳台除外),小于5件需支付15元邮费。申请发货后7-10个工作日发出
- </view>
- <view class="text">2.需要发其他快递请联系客服,高价卡建议联系客服进行顺丰保价。</view>
- <view class="text2">
- 运费:
- <view class="price" v-if="this.list.length >= 5">¥0</view>
- <view class="price" v-else>¥15</view>
- </view>
- <image
- class="button"
- @click="payment"
- :src="'https://file.rongcyl.cn/festatic/bkm/imgv2/orderConfirm/button2.png'"
- mode="heightFix"
- ></image>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- import { packagePrizeIdsListApi, prizeOrderApi } from '@/api/knapsack.js'
- import { addressDetailApi, addressDefaultDetailApi } from '@/api/address.js'
- export default {
- data() {
- return {
- ids: [],
- list: [],
- address: {},
- addressId: '',
- }
- },
- onLoad(query) {
- this.getDefaultAddress()
- let orderConfirmIds = getApp().globalData.orderConfirmIds
- if (orderConfirmIds.length > 0) {
- this.ids = orderConfirmIds
- this.getList()
- }
- if (query.addressId) {
- this.addressId = query.addressId
- this.geAddress()
- }
- // this.$refs.popup.open('bottom')
- },
- methods: {
- getList() {
- packagePrizeIdsListApi(this.ids).then(res => {
- console.log(res, '商品')
- this.list = res.data
- })
- },
- // 获取默认地址
- getDefaultAddress() {
- addressDefaultDetailApi().then(res => {
- console.log(res, '默认地址')
- if (res.data) {
- this.address = res.data
- this.addressId = res.data.id
- }
- })
- },
- // 获取地址
- geAddress() {
- let params = {
- id: this.addressId,
- }
- addressDetailApi(params).then(res => {
- console.log(res, '选中的地址')
- if (res.data) {
- this.address = res.data
- }
- })
- },
- // 去选择地址
- toAddress() {
- getApp().globalData.selectAddrss = true
- this.$navigateTo('/pages/addressManage/addressManage')
- },
- clickSubmit() {
- if (!this.addressId) {
- wx.showToast({
- title: '请选则收货地址。',
- icon: 'none',
- })
- return
- }
- this.$refs.popup.open('bottom')
- },
- payment() {
- let param = {
- addressId: this.addressId,
- prizeIdList: this.ids,
- }
- let _this = this
- prizeOrderApi(param).then(res => {
- console.log(res, 'res')
- if (res.data.orderStatus == 201) {
- wx.showToast({
- title: '下单成功。',
- icon: 'success',
- })
- wx.switchTab({
- url: '/pages/knapsack/knapsack',
- })
- return
- }
- _this.wxPayment(res.data)
- })
- },
- close() {
- this.$refs.popup.close()
- },
- wxPayment(data) {
- let _this = this
- wx.requestPayment({
- timeStamp: data.timeStamp,
- nonceStr: data.nonceStr,
- package: data.packageValue,
- signType: data.signType,
- paySign: data.paySign,
- success: function (res) {
- console.log(res, '支付过程成功')
- wx.showToast({
- title: '支付成功。',
- icon: 'success',
- })
- _this.close()
- wx.navigateBack({
- delta: 1,
- })
- },
- fail: function (res) {
- console.log('支付过程失败')
- // util.showErrorToast('支付失败');
- },
- complete: function (res) {
- console.log('支付过程结束')
- },
- })
- },
- },
- }
- </script>
- <style scoped lang="scss">
- .list {
- padding: 20rpx;
- .swipeLeft {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 80rpx;
- .radio {
- transform: scale(0.8);
- }
- }
- .card {
- margin-bottom: 20rpx;
- border-radius: 16rpx;
- background: #fff;
- padding: 20rpx;
- display: flex;
- flex-wrap: wrap;
- .row {
- display: flex;
- justify-content: space-between;
- width: 100%;
- .left {
- display: flex;
- align-items: center;
- .photo {
- margin-right: 10rpx;
- width: 60rpx;
- height: 60rpx;
- border-radius: 50%;
- }
- .name {
- font-size: 28rpx;
- font-weight: 600;
- }
- .img {
- width: 200rpx;
- height: 200rpx;
- border-radius: 4rpx;
- margin-right: 20rpx;
- }
- }
- .right {
- flex: 1;
- .row {
- margin-bottom: 10rpx;
- }
- .title {
- font-size: 32rpx;
- font-weight: 600;
- }
- }
- .icon {
- width: 32rpx;
- }
- .text1 {
- color: #666666;
- font-size: 24rpx;
- }
- }
- }
- }
- .bottom {
- background: #fff;
- position: fixed;
- bottom: 0;
- display: flex;
- justify-content: space-between;
- width: calc(100% - 40rpx);
- padding: 20rpx 20rpx 60rpx 20rpx;
- .left {
- display: flex;
- justify-content: center;
- align-items: center;
- .text {
- color: #999;
- font-size: 28rpx;
- margin-left: 20rpx;
- }
- .radio1 {
- width: 40rpx;
- height: 40rpx;
- }
- .radio2 {
- width: 36rpx;
- height: 36rpx;
- }
- }
- .right {
- display: flex;
- .button {
- height: 60rpx;
- }
- }
- }
- .popupContent {
- .title {
- text-align: center;
- padding: 30rpx;
- font-weight: 600;
- }
- .text {
- padding: 20rpx 60rpx;
- font-size: 28rpx;
- }
- .text2 {
- padding: 20rpx;
- display: flex;
- justify-content: flex-end;
- .price {
- font-size: 28rpx;
- font-weight: 600;
- color: #ff2c43;
- }
- }
- .button {
- margin: 40rpx auto;
- height: 80rpx;
- }
- }
- </style>
|