123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443 |
- <template>
- <view class="order-detail">
- <topNavBar title="订单详情" />
- <view class="order-state padding-sm dflex-b w-full">
- <view class="state-left">
- <view class="state-info">待支付 </view>
- <view class="order-code">剩余 09:59 逾期未支付将自动取消</view>
- </view>
- <!-- <uni-icons type="right" size="24" color="#FFF"></uni-icons> -->
- </view>
- <view class="gap"></view>
- <view class="padding-sm dflex-b bg-main" @click="show = true">
- <view class="dflex">
- <view class="w-full dflex-wrap-w send-label">
- 取餐时间
- </view>
- </view>
- <u-icon slot="icon" size="20" name="arrow-right" label="15:00" labelPos="left"></u-icon>
- <!-- <u-icon slot="icon" size="20" name="arrow-right" :label="goods.orderPickup.writeOffTime" labelPos="left"></u-icon> -->
- </view>
- <view class="gap"></view>
- <view class="padding-sm dflex-b bg-main">
- <view class="dflex">
- <view class="w-full dflex-wrap-w send-label">
- 取餐方式
- </view>
- </view>
- <view>
- <!-- 字段返回数据有问题 -->
- <radio style="transform: scale(0.85)" value="r1" :checked="true" color="#ff0000" class="radio">
- {{goods.pickupType.pickupType == '0' ? '打包带走' : '店内用餐'}}
- </radio>
- </view>
- </view>
- <view class="gap"></view>
- <view class="goods-order-list padding-lr-sm">
- <view class="shop dflex-b ">
- <view class="shop-check">
- <text class="send-label">{{goods.storeName}}</text>
- </view>
- <view class="total-goods">共计{{lists}}件商品</view>
- </view>
- <view class="goods-cart w-full">
- <view class="goods-cont padding-tb" v-for="(item, index) in goods.orderItemVoList" :key="index">
- <my-goods :item="item">
- <view class="good-num">×{{item.quantity}}</view>
- </my-goods>
- </view>
- </view>
- <!-- <view class="goods-cart" v-for="(item, index) in goods.itemList" :key="index">
- <view class="goods-cont dflex-b padding-tb-16">
- <view class="goods-cart-info dflex-b">
- <view class="pic"></view>
- <my-goods :item="item">
- <view class="good-num">×{{item.quantity}}</view>
- </my-goods>
- <view class="goods-cart-right">
- <view class="cart-title">{{item.skuName}}</view>
- <view class="order-spec">
- <text>500g</text>
- </view>
- <view class="cart-row-info dflex-s">
- <view class="cart-price">
- ¥<text>{{item.price}}</text>
- </view>
- <view class="goods-num">×{{item.quantity}}</view>
- </view>
- </view>
- </view>
- </view>
- <view class="goods-cont dflex-b padding-tb-16">
- <view class="goods-cart-info dflex-b">
- <view class="pic"></view>
- <view class="goods-cart-right">
- <view class="cart-title">商品名称商品名称</view>
- <view class="order-spec">
- <text>500g</text>
- </view>
- <view class="cart-row-info dflex-s">
- <view class="cart-price">
- ¥<text>12.30</text>
- </view>
- <view class="goods-num">×1</view>
- </view>
- </view>
- </view>
- </view>
- </view> -->
- </view>
- <view class="gap"></view>
- <!-- 金额明细 -->
- <view class="bg-main">
- <view class="dflex-b padding-lr padding-tb-sm">
- <view class="flex1 send-label">总金额</view>
- <view class="price">{{goods.totalAmount}}</view>
- </view>
- </view>
- <view class="gap"></view>
- <view class="bar-space"></view>
- <view class="cart-bottom padding-sm dflex-b">
- <view class="go-cart dflex-c" @click="toDelete()">取消订单</view>
- <view class="go-buy dflex-c background-gradient" @click="toPay()">去支付</view>
- </view>
- <u-toast ref="uToast"></u-toast>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- goods: {},
- lists: 0
- }
- },
- onLoad(e) {
- var dataString = decodeURIComponent(e.data)
- var data = JSON.parse(dataString);
- console.log('data', data)
- this.goods = data
- this.lists = this.goods.orderItemVoList.length
- this.goods.orderItemVoList.forEach(item => {
- item.imgUrl = item.picUrl
- })
- console.log('this.lists', this.lists)
- // this.fatchDate(e)
- },
- methods: {
- async fatchDate(e) {
- console.log('e', e)
- const result = await this.$request('get', `/order/tradeOrder/queryTradeOrder/${e.id}`,
- true)
- if (result) {
- console.log('result', result.data)
- this.goods = result.data
- this.lists = this.goods.itemList.length
- this.goods.itemList.forEach(item => {
- item.imgUrl = item.picUrl
- })
- console.log('this.goods', this.goods)
- console.log('this.goods.itemList', this.goods.itemList)
- }
- },
- uuid() {
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
- var r = Math.random() * 16 | 0,
- v = c == 'x' ? r : (r & 0x3 | 0x8);
- return v.toString(16);
- });
- },
- toDelete() {
- this.$refs.uToast.show({
- type: 'default',
- title: '默认主题',
- message: "演示阶段暂时不能取消",
- position: 'center'
- })
- },
- toPay() {
- // 显示提示
- this.$refs.uToast.show({
- type: 'default',
- title: '默认主题',
- message: "演示阶段暂时不能支付",
- position: 'center'
- })
- // uni.showToast({
- // title: '演示阶段暂时不能支付',
- // icon: 'error',
- // duration: 1000
- // });
- // const params = {
- // orderId: this.goods.orderId,
- // amount: this.goods.payment,
- // }
- // this.$request('post', `/order/orderPay/addOrderPay`, params, true).then(res => {
- // this._toPay()
- // })
- },
- async _toPay() {
- console.log('this.uuid()', this.uuid())
- const openId = uni.getStorageSync('openId');
- const token = uni.getStorageSync('token');
- if (!token) {
- await this.autoLogin()
- }
- const that = this;
- uni.request({
- url: 'http://36.137.224.81:8030/weChatPay/payment/miniPay',
- header: {
- // "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8", //
- "Content-Type": "application/json;charset=UTF-8", //
- 'Authorization': 'Bearer ' + token,
- },
- method: 'post',
- data: {
- tenantId: '000000',
- outTradeNo: this.uuid(),
- openId: openId,
- total: Math.round(this.goods.payment * 10), //以分为单位
- profitSharing: false // 是否分销
- },
- success: res => {
- console.log('预支付成功')
- that.data = res.data;
- wx.requestPayment({
- "timeStamp": res.data.timeStamp,
- "nonceStr": res.data.nonceStr,
- "package": res.data.packageValue,
- "signType": "RSA",
- "paySign": res.data.paySign,
- "success": function(res) {
- console.log('调用支付接口成功', res)
- },
- "fail": function(res) {
- console.log('调用支付接口fail', res)
- },
- "complete": function(res) {
- console.log('调用支付接口完成', res)
- }
- })
- },
- fail: err => {
- uni.hideLoading()
- }
- })
- // const params = {
- // tenantId: '000000',
- // outTradeNo: this.uuid(),
- // openId: openId,
- // total: Math.round(this.goods.payment * 10), //以分为单位
- // profitSharing: false // 是否分销
- // }
- // console.log('params', params)
- // this.$request('post', `/weChatPay/payment/miniPay`, params, true).then(res => {
- // // 请求成功
- // console.log('response', res)
- // console.log('预支付成功')
- // that.data = res.data;
- // wx.requestPayment({
- // "timeStamp": res.data.timeStamp,
- // "nonceStr": res.data.nonceStr,
- // "package": res.data.packageValue,
- // "signType": "RSA",
- // "paySign": res.data.paySign,
- // "success": function(res) {
- // console.log('调用支付接口成功', res)
- // },
- // "fail": function(res) {
- // console.log('调用支付接口fail', res)
- // },
- // "complete": function(res) {
- // console.log('调用支付接口完成', res)
- // }
- // })
- // }).catch(error => {
- // // 请求失败
- // uni.hideLoading()
- // console.error('请求失败:', error);
- // })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .order-state {
- background-color: #F96C22;
- box-sizing: border-box;
- color: #FFF;
- .state-info {
- font-size: 18px;
- padding-bottom: 4px;
- }
- .order-code {
- font-size: 12px;
- }
- }
- .addr-label {
- padding: 6upx 0;
- border-radius: 3px;
- background-color: #F6390D;
- color: #fff;
- width: 120upx;
- text-align: center;
- flex-shrink: 0;
- margin-right: 14upx;
- }
- .order-spec {
- padding-bottom: 10upx;
- }
- .shop {
- padding-top: 20upx;
- }
- .goods-num {
- font-size: 16px;
- padding-left: 20upx;
- }
- .sub-coupon {
- padding-top: 20upx;
- padding-bottom: 0;
- color: #000;
- .coupon-name {
- font-weight: normal;
- }
- .mj-tag {
- background-color: #F6390D;
- >text {
- color: #FFF;
- }
- }
- }
- .total-goods {
- font-size: 12px;
- color: #999;
- }
- .submit-bar {
- height: 100upx;
- width: 100%;
- background-color: #FFF;
- position: fixed;
- left: 0;
- bottom: 0;
- .submit-total {
- font-size: 16px;
- font-weight: 700;
- color: #F6390D;
- }
- .submit-btn {
- background-image: $base-bg-gradient-color;
- height: 70upx;
- width: 200upx;
- color: #FFF;
- font-size: 14px;
- font-weight: 700;
- border-radius: 35upx;
- }
- }
- .order-btn {
- height: 76upx;
- border-radius: 38px;
- background-image: $base-bg-gradient-color;
- text-align: center;
- line-height: 76upx;
- color: #FFF;
- font-size: 14px;
- width: 90%;
- position: fixed;
- left: 5%;
- bottom: 30upx;
- z-index: 99;
- }
- .order-info {
- background-color: #FFF;
- box-sizing: border-box;
- }
- .row-cell {
- padding-bottom: 20upx;
- .cell-right {
- font-size: 12px;
- color: #999;
- }
- }
- .row-cell:last-child {
- padding-bottom: 0;
- }
- .pic {
- margin-right: 20upx;
- height: 160rpx;
- width: 160rpx;
- background-color: #EEE;
- }
- .send-label {
- font-size: 14px;
- font-weight: 700;
- }
- .cart-bottom {
- width: 100%;
- position: fixed;
- left: 0;
- bottom: 0;
- height: 130rpx;
- box-sizing: border-box;
- background-color: #FFF;
- z-index: 10;
- box-shadow: 0px -4px 16px 0px rgba(0, 0, 0, 0.15);
- .go-cart {
- height: 80%;
- box-sizing: border-box;
- border: solid 1px #FF0000;
- font-size: 14px;
- color: #FF0000;
- border-radius: 50upx;
- margin: 0 10px;
- width: 45%;
- }
- .go-buy {
- height: 80%;
- width: 45%;
- background-color: #FF0000;
- color: #FFF;
- border-radius: 50upx;
- font-size: 14px;
- }
- }
- .good-num {
- font-size: 12px;
- padding-top: 65rpx;
- }
- .goods-cont {
- width: 100%;
- box-sizing: border-box;
- }
- </style>
|