@ -1,339 +0,0 @@ |
||||
<template> |
||||
<view v-show="!isLoading" class="container" :style="appThemeStyle"> |
||||
<!-- 商品图片轮播 --> |
||||
<SlideImage v-if="!isLoading" :video="goods.video" :videoCover="goods.videoCover" :images="goods.goods_images" /> |
||||
|
||||
<!-- 商品信息 --> |
||||
<view v-if="!isLoading" class="goods-info m-top20"> |
||||
<!-- 价格、销量 --> |
||||
<view class="info-item info-item__top dis-flex flex-x-between flex-y-end"> |
||||
<view class="block-left dis-flex flex-y-center"> |
||||
<!-- 商品售价 --> |
||||
<text class="floor-price__samll">¥</text> |
||||
<text class="floor-price">{{ goods.goods_price_min }}</text> |
||||
<!-- 会员价标签 --> |
||||
<view v-if="goods.is_user_grade" class="user-grade"> |
||||
<text>会员价</text> |
||||
</view> |
||||
<!-- 划线价 --> |
||||
<text v-if="goods.line_price_min > 0" class="original-price">¥{{ goods.line_price_min }}</text> |
||||
</view> |
||||
<view class="block-right dis-flex"> |
||||
<!-- 销量 --> |
||||
<view class="goods-sales"> |
||||
<text>已售{{ goods.goods_sales }}件</text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<!-- 标题、分享 --> |
||||
<view class="info-item info-item__name dis-flex flex-y-center"> |
||||
<view class="goods-name flex-box"> |
||||
<text class="twoline-hide">{{ goods.goods_name }}</text> |
||||
</view> |
||||
<view class="goods-share__line"></view> |
||||
<view class="goods-share"> |
||||
<button class="share-btn dis-flex flex-dir-column" @click="onShowShareSheet()"> |
||||
<text class="share__icon iconfont icon-fenxiang"></text> |
||||
<text class="f-24">分享</text> |
||||
</button> |
||||
</view> |
||||
</view> |
||||
<!-- 商品卖点 --> |
||||
<view v-if="goods.selling_point" class="info-item info-item_selling-point"> |
||||
<text>{{ goods.selling_point }}</text> |
||||
</view> |
||||
</view> |
||||
|
||||
<!-- 选择商品规格 --> |
||||
<view v-if="goods.spec_type == 20" class="goods-choice m-top20 b-f" @click="onShowSkuPopup(1)"> |
||||
<view class="spec-list"> |
||||
<view class="flex-box"> |
||||
<text class="col-8">选择:</text> |
||||
<text class="spec-name" v-for="(item, index) in goods.specList" :key="index">{{ item.spec_name }}</text> |
||||
</view> |
||||
<view class="f-26 col-9 t-r"> |
||||
<text class="iconfont icon-arrow-right"></text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
|
||||
<!-- 商品服务 --> |
||||
<Service v-if="!isLoading" :goods-id="goodsId" /> |
||||
|
||||
<!-- 商品SKU弹窗 --> |
||||
<SkuPopup v-if="!isLoading" v-model="showSkuPopup" :skuMode="skuMode" :goods="goods" @addCart="onAddCart" /> |
||||
|
||||
<!-- 商品评价 --> |
||||
<Comment v-if="!isLoading" :goods-id="goodsId" :limit="2" /> |
||||
|
||||
<!-- 商品描述 --> |
||||
<view v-if="!isLoading" class="goods-content m-top20"> |
||||
<view class="item-title b-f"> |
||||
<text>商品描述</text> |
||||
</view> |
||||
<view v-if="goods.content != ''" class="goods-content__detail b-f"> |
||||
<mp-html :content="goods.content" /> |
||||
</view> |
||||
</view> |
||||
|
||||
<!-- 商品推荐 --> |
||||
<recommended /> |
||||
|
||||
<!-- 底部选项卡 --> |
||||
<view class="footer-fixed"> |
||||
<view class="footer-container"> |
||||
<!-- 导航图标 --> |
||||
<view class="foo-item-fast"> |
||||
<!-- 首页 --> |
||||
<view class="fast-item fast-item--home" @click="onTargetHome"> |
||||
<view class="fast-icon"> |
||||
<text class="iconfont icon-shouye"></text> |
||||
</view> |
||||
<view class="fast-text"> |
||||
<text>首页</text> |
||||
</view> |
||||
</view> |
||||
<!-- 客服 --> |
||||
<customer-btn v-if="isShowCustomerBtn"> |
||||
<view class="fast-item"> |
||||
<view class="fast-icon"> |
||||
<text class="iconfont icon-kefu1"></text> |
||||
</view> |
||||
<view class="fast-text"> |
||||
<text>客服</text> |
||||
</view> |
||||
</view> |
||||
</customer-btn> |
||||
<!-- 购物车 --> |
||||
<view class="fast-item fast-item--cart" @click="onTargetCart"> |
||||
<view v-if="cartTotal > 0" class="fast-badge fast-badge--fixed">{{ cartTotal > 99 ? '99+' : cartTotal }} |
||||
</view> |
||||
<view class="fast-icon"> |
||||
<text class="iconfont icon-gouwuche"></text> |
||||
</view> |
||||
<view class="fast-text"> |
||||
<text>购物车</text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<!-- 操作按钮 --> |
||||
<view class="foo-item-btn"> |
||||
<view class="btn-wrapper"> |
||||
<view v-if="isEnableCart" class="btn-item btn-item-deputy" @click="onShowSkuPopup(2)"> |
||||
<text>加入购物车</text> |
||||
</view> |
||||
<view class="btn-item btn-item-main" @click="onShowSkuPopup(3)"> |
||||
<text>立即购买</text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
|
||||
<!-- 快捷导航 --> |
||||
<!-- <shortcut bottom="120rpx" /> --> |
||||
|
||||
<!-- 分享菜单 --> |
||||
<share-sheet v-model="showShareSheet" :shareTitle="goods.goods_name" :shareImageUrl="goods.goods_image" :posterApiCall="posterApiCall" |
||||
:posterApiParam="{ goodsId }" /> |
||||
|
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import WxofficialMixin from '@/core/mixins/wxofficial' |
||||
import { getSceneData } from '@/core/app' |
||||
import * as GoodsApi from '@/api/goods' |
||||
import * as CartApi from '@/api/cart' |
||||
import SettingModel from '@/common/model/Setting' |
||||
import { GoodsTypeEnum } from '@/common/enum/goods' |
||||
import Recommended from '@/components/recommended' |
||||
import ShareSheet from '@/components/share-sheet' |
||||
import CustomerBtn from '@/components/customer-btn' |
||||
import SlideImage from './components/SlideImage' |
||||
import SkuPopup from './components/SkuPopup' |
||||
import Comment from './components/Comment' |
||||
import Service from './components/Service' |
||||
|
||||
export default { |
||||
components: { |
||||
Recommended, |
||||
ShareSheet, |
||||
CustomerBtn, |
||||
SlideImage, |
||||
SkuPopup, |
||||
Comment, |
||||
Service |
||||
}, |
||||
mixins: [WxofficialMixin], |
||||
data() { |
||||
return { |
||||
// 正在加载 |
||||
isLoading: true, |
||||
// 当前商品ID |
||||
goodsId: null, |
||||
// 商品详情 |
||||
goods: {}, |
||||
// 购物车总数量 |
||||
cartTotal: 0, |
||||
// 显示/隐藏SKU弹窗 |
||||
showSkuPopup: false, |
||||
// 模式 1:都显示 2:只显示购物车 3:只显示立即购买 |
||||
skuMode: 1, |
||||
// 显示/隐藏分享菜单 |
||||
showShareSheet: false, |
||||
// 获取商品海报图api方法 |
||||
posterApiCall: GoodsApi.poster, |
||||
// 是否支持加入购物车 |
||||
isEnableCart: false, |
||||
// 是否显示在线客服按钮 |
||||
isShowCustomerBtn: false, |
||||
} |
||||
}, |
||||
|
||||
/** |
||||
* 生命周期函数--监听页面加载 |
||||
*/ |
||||
async onLoad(options) { |
||||
// 记录query参数 |
||||
this.onRecordQuery(options) |
||||
// 加载页面数据 |
||||
this.onRefreshPage() |
||||
// 是否显示在线客服按钮 |
||||
this.isShowCustomerBtn = await SettingModel.isShowCustomerBtn() |
||||
}, |
||||
|
||||
methods: { |
||||
|
||||
// 记录query参数 |
||||
onRecordQuery(query) { |
||||
const scene = getSceneData(query) |
||||
this.goodsId = query.goodsId ? parseInt(query.goodsId) : parseInt(scene.gid) |
||||
}, |
||||
|
||||
// 刷新页面数据 |
||||
onRefreshPage() { |
||||
const app = this |
||||
app.isLoading = true |
||||
Promise.all([app.getGoodsDetail(), app.getCartTotal()]) |
||||
.then(() => app.setWxofficialShareData()) |
||||
.finally(() => app.isLoading = false) |
||||
}, |
||||
|
||||
// 获取商品信息 |
||||
getGoodsDetail() { |
||||
const app = this |
||||
return new Promise((resolve, reject) => { |
||||
GoodsApi.detail(app.goodsId) |
||||
.then(result => { |
||||
app.goods = result.data.detail |
||||
if (app.goods.goods_type == GoodsTypeEnum.PHYSICAL.value) { |
||||
app.isEnableCart = true |
||||
} |
||||
resolve(result) |
||||
}) |
||||
.catch(reject) |
||||
}) |
||||
}, |
||||
|
||||
// 获取购物车总数量 |
||||
getCartTotal() { |
||||
const app = this |
||||
return new Promise((resolve, reject) => { |
||||
CartApi.total() |
||||
.then(result => { |
||||
app.cartTotal = result.data.cartTotal |
||||
resolve(result) |
||||
}) |
||||
.catch(reject) |
||||
}) |
||||
}, |
||||
|
||||
// 更新购物车数量 |
||||
onAddCart(total) { |
||||
this.cartTotal = total |
||||
}, |
||||
|
||||
/** |
||||
* 显示/隐藏SKU弹窗 |
||||
* @param {skuMode} 模式 1:都显示 2:只显示购物车 3:只显示立即购买 |
||||
*/ |
||||
onShowSkuPopup(skuMode = 1) { |
||||
const app = this |
||||
if (app.isEnableCart) { |
||||
app.skuMode = skuMode |
||||
} else { |
||||
app.skuMode = 3 |
||||
} |
||||
app.showSkuPopup = !app.showSkuPopup |
||||
}, |
||||
|
||||
// 显示隐藏分享菜单 |
||||
onShowShareSheet() { |
||||
this.showShareSheet = !this.showShareSheet |
||||
}, |
||||
|
||||
// 跳转到首页 |
||||
onTargetHome(e) { |
||||
this.$navTo('pages/index/index') |
||||
}, |
||||
|
||||
// 跳转到购物车页 |
||||
onTargetCart() { |
||||
this.$navTo('pages/cart/index') |
||||
}, |
||||
|
||||
// 设置微信公众号链接分享卡片内容 |
||||
setWxofficialShareData() { |
||||
const { goods } = this |
||||
this.updateShareCardData({ |
||||
title: goods.goods_name, |
||||
desc: goods.selling_point, |
||||
imgUrl: goods.goods_image |
||||
}) |
||||
}, |
||||
|
||||
}, |
||||
|
||||
/** |
||||
* 分享当前页面 |
||||
*/ |
||||
onShareAppMessage() { |
||||
const app = this |
||||
// 构建页面参数 |
||||
const params = app.$getShareUrlParams({ |
||||
goodsId: app.goodsId, |
||||
}) |
||||
return { |
||||
title: app.goods.goods_name, |
||||
path: `/pages/goods/detail?${params}` |
||||
} |
||||
}, |
||||
|
||||
/** |
||||
* 分享到朋友圈 |
||||
* 本接口为 Beta 版本,暂只在 Android 平台支持,详见分享到朋友圈 (Beta) |
||||
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html |
||||
*/ |
||||
onShareTimeline() { |
||||
const app = this |
||||
// 构建页面参数 |
||||
const params = app.$getShareUrlParams({ |
||||
goodsId: app.goodsId, |
||||
}) |
||||
return { |
||||
title: app.goods.goods_name, |
||||
path: `/pages/goods/detail?${params}` |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style> |
||||
page { |
||||
background: #fafafa; |
||||
} |
||||
</style> |
||||
<style lang="scss" scoped> |
||||
@import "./detail.scss"; |
||||
</style> |
@ -1,915 +0,0 @@ |
||||
<template> |
||||
<view v-if="!isLoading" class="container" :style="appThemeStyle"> |
||||
|
||||
<view class="header"> |
||||
<!-- 订单状态 --> |
||||
<view class="order-status"> |
||||
<view class="status-icon"> |
||||
<!-- 进行中的订单 --> |
||||
<block v-if="order.order_status == OrderStatusEnum.NORMAL.value"> |
||||
<!-- 待支付 --> |
||||
<block v-if="order.pay_status == PayStatusEnum.PENDING.value"> |
||||
<image class="image" src="/static/order/status/wait_pay.png" mode="aspectFit"></image> |
||||
</block> |
||||
<!-- 待发货 --> |
||||
<block v-else-if="order.delivery_status == DeliveryStatusEnum.NOT_DELIVERED.value"> |
||||
<image class="image" src="/static/order/status/wait_deliver.png" mode="aspectFit"></image> |
||||
</block> |
||||
<!-- 待收货 --> |
||||
<block v-else-if="order.receipt_status == ReceiptStatusEnum.NOT_RECEIVED.value"> |
||||
<image class="image" src="/static/order/status/wait_receipt.png" mode="aspectFit"></image> |
||||
</block> |
||||
</block> |
||||
<!-- 已完成 --> |
||||
<block v-if="order.order_status == OrderStatusEnum.COMPLETED.value"> |
||||
<image class="image" src="/static/order/status/received.png" mode="aspectFit"></image> |
||||
</block> |
||||
<!-- 已取消/待取消 --> |
||||
<block v-if="order.order_status == OrderStatusEnum.CANCELLED.value || order.order_status == OrderStatusEnum.APPLY_CANCEL.value"> |
||||
<image class="image" src="/static/order/status/close.png" mode="aspectFit"></image> |
||||
</block> |
||||
</view> |
||||
<view class="status-text"> |
||||
<text>{{ order.state_text }}</text> |
||||
</view> |
||||
</view> |
||||
<!-- 下一步操作 --> |
||||
<view class="next-action" v-if="order.order_status == OrderStatusEnum.NORMAL.value"> |
||||
<view v-if="order.pay_status == PayStatusEnum.PENDING.value" class="action-btn" @click="onPay(order.order_id)"> |
||||
去支付</view> |
||||
<view |
||||
v-if="order.delivery_status == DeliveryStatusEnum.DELIVERED.value && order.receipt_status == ReceiptStatusEnum.NOT_RECEIVED.value" |
||||
class="action-btn" @click="onReceipt(order.order_id)">确认收货</view> |
||||
</view> |
||||
</view> |
||||
|
||||
<view class="card-area"> |
||||
<!-- 实物订单 --> |
||||
<block v-if="order.order_type == OrderTypeEnum.PHYSICAL.value"> |
||||
<!-- 快递配送:配送地址 --> |
||||
<view v-if="order.delivery_type == DeliveryTypeEnum.EXPRESS.value" class="delivery-address i-card"> |
||||
<view class="link-man"> |
||||
<text class="name">{{ order.address.name }}</text> |
||||
<text class="phone">{{ order.address.phone }}</text> |
||||
</view> |
||||
<view class="address"> |
||||
<text class="region" v-for="(region, idx) in order.address.region" :key="idx">{{ region }}</text> |
||||
<text class="detail">{{ order.address.detail }}</text> |
||||
</view> |
||||
</view> |
||||
|
||||
<!-- 快递配送:门店自提 --> |
||||
<view v-if="order.delivery_type == DeliveryTypeEnum.EXTRACT.value" class="delivery-extract i-card" |
||||
@click="handleTargetExtract(order.extract_shop.shop_id)"> |
||||
<view class="extract-top"> |
||||
<text class="title">自提门店</text> |
||||
<text class="subtitle">您须到该自提点取货</text> |
||||
</view> |
||||
<view class="shop-info"> |
||||
<view class="icon-location"> |
||||
<text class="iconfont icon-dingwei"></text> |
||||
</view> |
||||
<view class="shop-content"> |
||||
<view class="shop-name"> |
||||
<text>{{ order.extract_shop.shop_name }}</text> |
||||
</view> |
||||
<view class="shop-describe"> |
||||
<text class="item-text">{{ order.extract_shop.region.province }}</text> |
||||
<text class="item-text">{{ order.extract_shop.region.city }}</text> |
||||
<text class="item-text">{{ order.extract_shop.region.region }}</text> |
||||
<text class="item-text">{{ order.extract_shop.address }}</text> |
||||
</view> |
||||
</view> |
||||
<view class="icon-arrow"> |
||||
<text class="iconfont icon-arrow-right"></text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</block> |
||||
|
||||
<!-- 物流信息 --> |
||||
<view v-if="order.delivery_type == DeliveryTypeEnum.EXPRESS.value |
||||
&& order.delivery_status == DeliveryStatusEnum.DELIVERED.value |
||||
&& order.delivery |
||||
&& order.delivery.length" class="express i-card" @click="handleTargetExpress()"> |
||||
<view v-if="order.delivery.length > 1" class="main"> |
||||
<view class="info-item"> |
||||
<view class="item-content"> |
||||
<text>订单已拆分多个包裹发货</text> |
||||
</view> |
||||
</view> |
||||
<view class="info-item"> |
||||
<view class="item-content"> |
||||
<text>已发货{{ order.delivery.length }}个包裹</text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<view v-else class="main"> |
||||
<view class="info-item"> |
||||
<view class="item-lable">物流公司</view> |
||||
<view class="item-content"> |
||||
<text |
||||
v-if="order.delivery[0].delivery_method != DeliveryMethodEnum.UNWANTED.value">{{ order.delivery[0].express ? order.delivery[0].express.express_name : '--' }}</text> |
||||
<text v-else>无需物流</text> |
||||
</view> |
||||
</view> |
||||
<view class="info-item"> |
||||
<view class="item-lable">物流单号</view> |
||||
<view class="item-content"> |
||||
<text>{{ order.delivery[0].express_no ? order.delivery[0].express_no : '--' }}</text> |
||||
<view v-if="order.delivery[0].express_no" class="act-copy" @click.stop="handleCopy(order.delivery[0].express_no)"> |
||||
<text>复制</text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<view class="right-arrow"> |
||||
<text class="iconfont icon-arrow-right"></text> |
||||
</view> |
||||
</view> |
||||
|
||||
<!-- 商品列表 --> |
||||
<view class="goods-list i-card"> |
||||
<view class="goods-item" v-for="(goods, idx) in order.goods" :key="idx"> |
||||
<view class="goods-main" @click="handleTargetGoods(goods.goods_id)"> |
||||
<!-- 商品图片 --> |
||||
<view class="goods-image"> |
||||
<image class="image" :src="goods.goods_image" mode="scaleToFill"></image> |
||||
</view> |
||||
<!-- 商品信息 --> |
||||
<view class="goods-content"> |
||||
<view class="goods-title"><text class="twoline-hide">{{ goods.goods_name }}</text></view> |
||||
<view class="goods-props clearfix"> |
||||
<view class="goods-props-item" v-for="(props, idx) in goods.goods_props" :key="idx"> |
||||
<text>{{ props.value.name }}</text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<!-- 交易信息 --> |
||||
<view class="goods-trade"> |
||||
<view class="goods-price"> |
||||
<text class="unit">¥</text> |
||||
<text class="value">{{ goods.is_user_grade ? goods.grade_goods_price : goods.goods_price }}</text> |
||||
</view> |
||||
<view class="goods-num"> |
||||
<text>×{{ goods.total_num }}</text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<!-- 商品售后 --> |
||||
<view class="goods-refund"> |
||||
<text v-if="goods.refund" class="stata-text">已申请售后</text> |
||||
<view v-else-if="order.isAllowRefund" class="action-btn" @click.stop="handleApplyRefund(goods.order_goods_id)">申请售后</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
|
||||
<!-- 订单信息 --> |
||||
<view class="order-info i-card"> |
||||
<view class="info-item"> |
||||
<view class="item-lable">订单编号</view> |
||||
<view class="item-content"> |
||||
<text>{{ order.order_no }}</text> |
||||
<view class="act-copy" @click="handleCopy(order.order_no)"> |
||||
<text>复制</text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<view class="info-item"> |
||||
<view class="item-lable">下单时间</view> |
||||
<view class="item-content"> |
||||
<text>{{ order.create_time }}</text> |
||||
</view> |
||||
</view> |
||||
<view class="info-item"> |
||||
<view class="item-lable">买家留言</view> |
||||
<view class="item-content"> |
||||
<text>{{ order.buyer_remark ? order.buyer_remark : '--' }}</text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
|
||||
<!-- 结算信息 --> |
||||
<view class="trade-info i-card"> |
||||
<view class="info-item"> |
||||
<view class="item-lable">订单金额</view> |
||||
<view class="item-content"> |
||||
<text>¥{{ order.total_price }}</text> |
||||
</view> |
||||
</view> |
||||
<view v-if="order.coupon_money > 0" class="info-item"> |
||||
<view class="item-lable">优惠券抵扣</view> |
||||
<view class="item-content"> |
||||
<text>-¥{{ order.coupon_money }}</text> |
||||
</view> |
||||
</view> |
||||
<view v-if="order.points_money > 0" class="info-item"> |
||||
<view class="item-lable">{{ setting.points_name }}抵扣</view> |
||||
<view class="item-content"> |
||||
<text>-¥{{ order.points_money }}</text> |
||||
</view> |
||||
</view> |
||||
<view class="info-item"> |
||||
<view class="item-lable">运费</view> |
||||
<view class="item-content"> |
||||
<text>+¥{{ order.express_price }}</text> |
||||
</view> |
||||
</view> |
||||
<view v-if="order.update_price.value != '0.00'" class="info-item"> |
||||
<view class="item-lable">后台改价</view> |
||||
<view class="item-content"> |
||||
<text>{{ order.update_price.symbol }}</text> |
||||
<text>¥{{ order.update_price.value }}</text> |
||||
</view> |
||||
</view> |
||||
<view class="divider"></view> |
||||
<view class="trade-total"> |
||||
<text class="lable">实付款</text> |
||||
<view class="goods-price"> |
||||
<text class="unit">¥</text> |
||||
<text class="value">{{ order.pay_price }}</text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
|
||||
<!-- 底部操作按钮 --> |
||||
<view v-if="order.order_status != OrderStatusEnum.CANCELLED.value" class="footer-fixed"> |
||||
<view class="btn-wrapper"> |
||||
<!-- 未支付取消订单 --> |
||||
<block v-if="order.pay_status == PayStatusEnum.PENDING.value"> |
||||
<view class="btn-item" @click="onCancel(order.order_id)">取消</view> |
||||
</block> |
||||
<!-- 已支付进行中的订单 --> |
||||
<block v-if="order.order_status != OrderStatusEnum.APPLY_CANCEL.value"> |
||||
<block v-if="order.pay_status == PayStatusEnum.SUCCESS.value && order.delivery_status == DeliveryStatusEnum.NOT_DELIVERED.value"> |
||||
<view class="btn-item" @click="onCancel(order.order_id)">申请取消</view> |
||||
</block> |
||||
<!-- 订单核销码 --> |
||||
<block v-if="order.pay_status == PayStatusEnum.SUCCESS.value && order.delivery_type == DeliveryTypeEnum.EXTRACT.value |
||||
&& order.delivery_status == DeliveryStatusEnum.NOT_DELIVERED.value"> |
||||
<view class="btn-item active" @click="onExtractQRCode(order.order_id)"> |
||||
<text class="iconfont icon-qr-extract"></text> |
||||
<text class="m-l-10">核销码</text> |
||||
</view> |
||||
</block> |
||||
</block> |
||||
<!-- 已申请取消 --> |
||||
<view v-else class="f-28 col-8">取消申请中</view> |
||||
<!-- 未支付的订单 --> |
||||
<block v-if="order.pay_status == PayStatusEnum.PENDING.value"> |
||||
<view class="btn-item active" @click="onPay(order.order_id)">去支付</view> |
||||
</block> |
||||
<!-- 确认收货 --> |
||||
<block |
||||
v-if="order.delivery_status == DeliveryStatusEnum.DELIVERED.value && order.receipt_status == ReceiptStatusEnum.NOT_RECEIVED.value"> |
||||
<view class="btn-item active" @click="onReceipt(order.order_id)">确认收货</view> |
||||
</block> |
||||
<!-- 订单评价 --> |
||||
<block v-if="order.order_status == OrderStatusEnum.COMPLETED.value && order.is_comment == 0"> |
||||
<view class="btn-item" @click="handleTargetComment(order.order_id)">评价</view> |
||||
</block> |
||||
</view> |
||||
</view> |
||||
|
||||
<!-- 核销二维码弹窗 --> |
||||
<u-popup v-model="showQRCodePopup" mode="center" border-radius="26" :closeable="true"> |
||||
<view class="qrcode-popup"> |
||||
<view class="title">自提核销二维码</view> |
||||
<view class="pop-content"> |
||||
<image v-if="qrcodeImage" class="image" :src="qrcodeImage"></image> |
||||
</view> |
||||
</view> |
||||
</u-popup> |
||||
|
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { |
||||
OrderTypeEnum, |
||||
DeliveryStatusEnum, |
||||
DeliveryTypeEnum, |
||||
OrderStatusEnum, |
||||
PayStatusEnum, |
||||
ReceiptStatusEnum |
||||
} from '@/common/enum/order' |
||||
import { DeliveryMethodEnum } from '@/common/enum/order/delivery' |
||||
import * as OrderApi from '@/api/order' |
||||
|
||||
export default { |
||||
data() { |
||||
return { |
||||
// 枚举类 |
||||
OrderTypeEnum, |
||||
DeliveryStatusEnum, |
||||
DeliveryTypeEnum, |
||||
OrderStatusEnum, |
||||
PayStatusEnum, |
||||
ReceiptStatusEnum, |
||||
DeliveryMethodEnum, |
||||
// 当前订单ID |
||||
orderId: null, |
||||
// 加载中 |
||||
isLoading: true, |
||||
// 当前订单详情 |
||||
order: {}, |
||||
// 当前设置 |
||||
setting: {}, |
||||
// 核销二维码弹窗 |
||||
showQRCodePopup: false, |
||||
// 核销二维码图片url (通过后端获取) |
||||
qrcodeImage: '', |
||||
// 控制onShow事件是否刷新订单信息 |
||||
canReset: false, |
||||
} |
||||
}, |
||||
|
||||
/** |
||||
* 生命周期函数--监听页面加载 |
||||
*/ |
||||
onLoad({ orderId }) { |
||||
// 当前订单ID |
||||
this.orderId = orderId |
||||
// 获取当前订单信息 |
||||
this.getOrderDetail() |
||||
// 注册全局事件订阅: 是否刷新当前订单数据 |
||||
uni.$on('syncRefresh', (val, isCur) => { |
||||
if (!isCur) { |
||||
this.canReset = val |
||||
} |
||||
}) |
||||
}, |
||||
|
||||
/** |
||||
* 生命周期函数--监听页面显示 |
||||
*/ |
||||
onShow() { |
||||
this.canReset && this.getOrderDetail() |
||||
this.canReset = false |
||||
}, |
||||
|
||||
methods: { |
||||
|
||||
// 获取当前订单信息 |
||||
getOrderDetail(canReset = false) { |
||||
const app = this |
||||
app.isLoading = true |
||||
OrderApi.detail(app.orderId) |
||||
.then(result => { |
||||
app.order = result.data.order |
||||
app.setting = result.data.setting |
||||
app.isLoading = false |
||||
}) |
||||
// 相应全局事件订阅: 刷新上级页面数据 |
||||
canReset && uni.$emit('syncRefresh', true, true) |
||||
}, |
||||
|
||||
// 复制指定内容 |
||||
handleCopy(value) { |
||||
const app = this |
||||
uni.setClipboardData({ |
||||
data: value, |
||||
success: () => app.$toast('复制成功'), |
||||
fail: ({ errMsg }) => app.$toast('复制失败 ' + errMsg) |
||||
}) |
||||
}, |
||||
|
||||
// 跳转到门店详情页 |
||||
handleTargetExtract(shopId) { |
||||
this.$navTo('pages/shop/detail', { shopId }) |
||||
}, |
||||
|
||||
// 跳转到物流跟踪页面 |
||||
handleTargetExpress() { |
||||
this.$navTo('pages/order/express/index', { orderId: this.orderId }) |
||||
}, |
||||
|
||||
// 跳转到商品详情页面 |
||||
handleTargetGoods(goodsId) { |
||||
this.$navTo('pages/goods/detail', { goodsId }) |
||||
}, |
||||
|
||||
// 跳转到申请售后页面 |
||||
handleApplyRefund(orderGoodsId) { |
||||
this.$navTo('pages/refund/apply', { orderGoodsId }) |
||||
}, |
||||
|
||||
// 取消订单 |
||||
onCancel(orderId) { |
||||
const app = this |
||||
uni.showModal({ |
||||
title: '友情提示', |
||||
content: '确认要取消该订单吗?', |
||||
success(o) { |
||||
if (o.confirm) { |
||||
OrderApi.cancel(orderId) |
||||
.then(result => { |
||||
// 显示成功信息 |
||||
app.$toast(result.message) |
||||
setTimeout(() => { |
||||
// 刷新当前订单数据 |
||||
app.getOrderDetail(true) |
||||
}, 1500) |
||||
}) |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
// 确认收货 |
||||
onReceipt(orderId) { |
||||
const app = this |
||||
uni.showModal({ |
||||
title: '友情提示', |
||||
content: '确认收到商品了吗?', |
||||
success(o) { |
||||
if (o.confirm) { |
||||
OrderApi.receipt(orderId) |
||||
.then(result => { |
||||
// 显示成功信息 |
||||
app.$success(result.message) |
||||
setTimeout(() => { |
||||
// 刷新当前订单数据 |
||||
app.getOrderDetail(true) |
||||
}, 1500) |
||||
}) |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
// 获取核销二维码 |
||||
onExtractQRCode(orderId) { |
||||
const app = this |
||||
OrderApi.extractQrcode(orderId, { channel: app.platform }) |
||||
.then(result => { |
||||
app.qrcodeImage = result.data.qrcode |
||||
app.showQRCodePopup = true |
||||
}) |
||||
}, |
||||
|
||||
// 点击去支付 |
||||
onPay(orderId) { |
||||
this.$navTo('pages/checkout/cashier/index', { orderId }) |
||||
}, |
||||
|
||||
// 跳转到订单评价页 |
||||
handleTargetComment(orderId) { |
||||
this.$navTo('pages/order/comment/index', { orderId }) |
||||
}, |
||||
|
||||
}, |
||||
|
||||
} |
||||
</script> |
||||
|
||||
<style> |
||||
page { |
||||
background: #f4f4f4; |
||||
} |
||||
</style> |
||||
<style lang="scss" scoped> |
||||
.container { |
||||
// 设置ios刘海屏底部横线安全区域 |
||||
padding-bottom: calc(constant(safe-area-inset-bottom) + 106rpx + 6rpx); |
||||
padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx + 6rpx); |
||||
} |
||||
|
||||
// 页面顶部 |
||||
.header { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
background-color: #e8c269; |
||||
height: 280rpx; |
||||
padding: 56rpx 30rpx 0 30rpx; |
||||
|
||||
.order-status { |
||||
display: flex; |
||||
align-items: center; |
||||
height: 128rpx; |
||||
|
||||
.status-icon { |
||||
width: 128rpx; |
||||
height: 128rpx; |
||||
|
||||
.image { |
||||
display: block; |
||||
width: 100%; |
||||
height: 100%; |
||||
} |
||||
} |
||||
|
||||
.status-text { |
||||
padding-left: 20rpx; |
||||
color: #fff; |
||||
font-size: 38rpx; |
||||
font-weight: bold; |
||||
} |
||||
} |
||||
|
||||
.next-action { |
||||
display: flex; |
||||
align-items: center; |
||||
height: 128rpx; |
||||
|
||||
.action-btn { |
||||
min-width: 152rpx; |
||||
height: 56rpx; |
||||
padding: 0 30rpx; |
||||
background-color: #fff; |
||||
border-radius: 28rpx; |
||||
border-color: rgb(102, 102, 102); |
||||
cursor: pointer; |
||||
user-select: none; |
||||
color: #c7a157; |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// 卡片区域 |
||||
.card-area { |
||||
margin-top: -50rpx; |
||||
} |
||||
|
||||
// 通栏卡片 |
||||
.i-card { |
||||
background: #fff; |
||||
padding: 24rpx 24rpx; |
||||
width: 94%; |
||||
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05); |
||||
margin: 0 auto 20rpx auto; |
||||
border-radius: 20rpx; |
||||
} |
||||
|
||||
// 自提门店 |
||||
.delivery-extract { |
||||
|
||||
.extract-top { |
||||
margin-bottom: 20rpx; |
||||
|
||||
.title { |
||||
font-size: 28rpx; |
||||
margin-right: 30rpx; |
||||
} |
||||
|
||||
.subtitle { |
||||
font-size: 24rpx; |
||||
color: #888; |
||||
} |
||||
} |
||||
|
||||
.shop-info { |
||||
display: flex; |
||||
align-items: center; |
||||
} |
||||
|
||||
.icon-location { |
||||
font-size: 34rpx; |
||||
} |
||||
|
||||
.shop-content { |
||||
flex: 1; |
||||
margin-left: 26rpx; |
||||
font-size: 24rpx; |
||||
|
||||
.shop-name { |
||||
font-size: 28rpx; |
||||
margin-bottom: 8rpx; |
||||
} |
||||
|
||||
.shop-describe { |
||||
color: #777; |
||||
|
||||
.item-text { |
||||
margin-right: 8rpx; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
// 收货地址 |
||||
.delivery-address { |
||||
|
||||
.link-man { |
||||
line-height: 46rpx; |
||||
color: #333; |
||||
|
||||
.name { |
||||
margin-right: 10rpx; |
||||
} |
||||
} |
||||
|
||||
.address { |
||||
margin-top: 12rpx; |
||||
color: #999; |
||||
font-size: 24rpx; |
||||
|
||||
.detail { |
||||
margin-left: 6rpx; |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
// 物流公司 |
||||
.express { |
||||
display: flex; |
||||
align-items: center; |
||||
|
||||
.main { |
||||
flex: 1; |
||||
} |
||||
|
||||
.info-item { |
||||
display: flex; |
||||
margin-bottom: 20rpx; |
||||
|
||||
&:last-child { |
||||
margin-bottom: 0; |
||||
} |
||||
|
||||
.item-lable { |
||||
display: flex; |
||||
align-items: center; |
||||
font-size: 24rpx; |
||||
color: #999; |
||||
margin-right: 30rpx; |
||||
} |
||||
|
||||
.item-content { |
||||
flex: 1; |
||||
display: flex; |
||||
align-items: center; |
||||
font-size: 26rpx; |
||||
color: #333; |
||||
|
||||
.act-copy { |
||||
margin-left: 20rpx; |
||||
padding: 2rpx 20rpx; |
||||
font-size: 22rpx; |
||||
color: #666; |
||||
border: 1rpx solid #c1c1c1; |
||||
border-radius: 16rpx; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// 右侧箭头 |
||||
.right-arrow { |
||||
margin-left: 16rpx; |
||||
font-size: 26rpx; |
||||
} |
||||
|
||||
} |
||||
|
||||
// 商品列表 |
||||
.goods-list { |
||||
|
||||
// 商品项 |
||||
.goods-item { |
||||
margin-bottom: 40rpx; |
||||
|
||||
&:last-child { |
||||
margin-bottom: 0; |
||||
} |
||||
|
||||
// 商品信息 |
||||
.goods-main { |
||||
display: flex; |
||||
} |
||||
|
||||
// 商品图片 |
||||
.goods-image { |
||||
width: 180rpx; |
||||
height: 180rpx; |
||||
|
||||
.image { |
||||
display: block; |
||||
width: 100%; |
||||
height: 100%; |
||||
border-radius: 8rpx; |
||||
} |
||||
} |
||||
|
||||
// 商品内容 |
||||
.goods-content { |
||||
flex: 1; |
||||
padding-left: 16rpx; |
||||
padding-top: 16rpx; |
||||
|
||||
.goods-title { |
||||
font-size: 26rpx; |
||||
max-height: 76rpx; |
||||
} |
||||
|
||||
.goods-props { |
||||
margin-top: 14rpx; |
||||
color: #ababab; |
||||
font-size: 24rpx; |
||||
overflow: hidden; |
||||
|
||||
.goods-props-item { |
||||
padding: 4rpx 16rpx; |
||||
border-radius: 12rpx; |
||||
background-color: #fcfcfc; |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
// 交易信息 |
||||
.goods-trade { |
||||
padding-top: 16rpx; |
||||
width: 150rpx; |
||||
text-align: right; |
||||
color: $uni-text-color-grey; |
||||
font-size: 26rpx; |
||||
|
||||
.goods-price { |
||||
vertical-align: bottom; |
||||
margin-bottom: 16rpx; |
||||
|
||||
.unit { |
||||
margin-right: -2rpx; |
||||
font-size: 24rpx; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// 商品售后 |
||||
.goods-refund { |
||||
display: flex; |
||||
justify-content: flex-end; |
||||
|
||||
.stata-text { |
||||
font-size: 24rpx; |
||||
color: #999; |
||||
} |
||||
|
||||
.action-btn { |
||||
border-radius: 28rpx; |
||||
padding: 8rpx 26rpx; |
||||
font-size: 24rpx; |
||||
color: #383838; |
||||
border: 1rpx solid #a8a8a8; |
||||
} |
||||
|
||||
} |
||||
|
||||
} |
||||
|
||||
} |
||||
|
||||
// 订单信息 |
||||
.order-info { |
||||
|
||||
.info-item { |
||||
display: flex; |
||||
margin-bottom: 24rpx; |
||||
|
||||
&:last-child { |
||||
margin-bottom: 0; |
||||
} |
||||
|
||||
.item-lable { |
||||
display: flex; |
||||
align-items: center; |
||||
font-size: 24rpx; |
||||
color: #999; |
||||
margin-right: 30rpx; |
||||
} |
||||
|
||||
.item-content { |
||||
flex: 1; |
||||
display: flex; |
||||
align-items: center; |
||||
font-size: 26rpx; |
||||
color: #333; |
||||
|
||||
.act-copy { |
||||
margin-left: 20rpx; |
||||
padding: 2rpx 20rpx; |
||||
font-size: 22rpx; |
||||
color: #666; |
||||
border: 1rpx solid #c1c1c1; |
||||
border-radius: 16rpx; |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
// 交易信息 |
||||
.trade-info { |
||||
|
||||
.info-item { |
||||
display: flex; |
||||
margin-bottom: 24rpx; |
||||
|
||||
.item-lable { |
||||
font-size: 24rpx; |
||||
color: #999; |
||||
margin-right: 24rpx; |
||||
} |
||||
|
||||
.item-content { |
||||
flex: 1; |
||||
font-size: 26rpx; |
||||
color: #333; |
||||
text-align: right; |
||||
} |
||||
} |
||||
|
||||
.divider { |
||||
height: 1rpx; |
||||
background: #f1f1f1; |
||||
margin-bottom: 24rpx; |
||||
} |
||||
|
||||
.trade-total { |
||||
display: flex; |
||||
justify-content: flex-end; |
||||
|
||||
.goods-price { |
||||
margin-left: 12rpx; |
||||
vertical-align: bottom; |
||||
color: $main-bg; |
||||
|
||||
.unit { |
||||
margin-right: -2rpx; |
||||
font-size: 24rpx; |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
// 底部操作栏 |
||||
.footer-fixed { |
||||
position: fixed; |
||||
bottom: var(--window-bottom); |
||||
left: 0; |
||||
right: 0; |
||||
z-index: 11; |
||||
box-shadow: 0 -4rpx 40rpx 0 rgba(151, 151, 151, 0.24); |
||||
background: #fff; |
||||
|
||||
// 设置ios刘海屏底部横线安全区域 |
||||
padding-bottom: constant(safe-area-inset-bottom); |
||||
padding-bottom: env(safe-area-inset-bottom); |
||||
|
||||
.btn-wrapper { |
||||
height: 106rpx; |
||||
display: flex; |
||||
align-items: center; |
||||
justify-content: flex-end; |
||||
padding: 0 30rpx; |
||||
} |
||||
|
||||
.btn-item { |
||||
min-width: 180rpx; |
||||
border-radius: 30rpx; |
||||
padding: 12rpx 26rpx; |
||||
font-size: 28rpx; |
||||
color: #383838; |
||||
text-align: center; |
||||
border: 1rpx solid #a8a8a8; |
||||
margin-left: 24rpx; |
||||
|
||||
&.active { |
||||
border: none; |
||||
background: linear-gradient(to right, $main-bg, $main-bg2); |
||||
color: $main-text; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// 弹出层 - 核销二维码 |
||||
.qrcode-popup { |
||||
padding: 36rpx 30rpx; |
||||
|
||||
.title { |
||||
font-size: 30rpx; |
||||
margin-bottom: 26rpx; |
||||
font-weight: bold; |
||||
text-align: center; |
||||
} |
||||
|
||||
.pop-content { |
||||
min-height: 260rpx; |
||||
padding: 0 10rpx; |
||||
|
||||
.image { |
||||
display: block; |
||||
width: 510rpx; |
||||
height: 510rpx; |
||||
} |
||||
|
||||
} |
||||
} |
||||
</style> |
@ -1,523 +0,0 @@ |
||||
<template> |
||||
<view class="container" :style="appThemeStyle"> |
||||
<mescroll-body ref="mescrollRef" :sticky="true" @init="mescrollInit" :down="{ native: true }" @down="downCallback" :up="upOption" |
||||
@up="upCallback"> |
||||
<!-- tab栏 --> |
||||
<u-tabs :list="tabs" :is-scroll="false" :current="curTab" :active-color="appTheme.mainBg" :duration="0.2" @change="onChangeTab" /> |
||||
<!-- 订单列表 --> |
||||
<view class="order-list"> |
||||
<view class="order-item" v-for="(item, index) in list.data" :key="index"> |
||||
<view class="item-top"> |
||||
<view class="item-top-left"> |
||||
<text class="order-time">{{ item.create_time }}</text> |
||||
</view> |
||||
<view class="item-top-right"> |
||||
<text class="state-text" :style="{{(item.pay_status == PayStatusEnum.PENDING.value?'color:#05C669':'color:#FF2F2F')}}">{{ item.state_text }}</text> |
||||
</view> |
||||
</view> |
||||
<!-- 商品列表 --> |
||||
<view class="goods-list" @click="handleTargetDetail(item.order_id)"> |
||||
<view class="goods-item" v-for="(goods, idx) in item.goods" :key="idx"> |
||||
<!-- 商品图片 --> |
||||
<view class="goods-image"> |
||||
<image class="image" :src="goods.goods_image" mode="scaleToFill"></image> |
||||
</view> |
||||
<!-- 商品信息 --> |
||||
<view class="goods-content"> |
||||
<view class="goods-title"><text class="twoline-hide">{{ goods.goods_name }}</text></view> |
||||
<view class="goods-props clearfix"> |
||||
<view class="goods-props-item" v-for="(props, idx) in goods.goods_props" :key="idx"> |
||||
<text>{{ props.value.name }}</text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<!-- 交易信息 --> |
||||
<view class="goods-trade"> |
||||
<view class="goods-price"> |
||||
<text class="unit">¥</text> |
||||
<text class="value">{{ goods.is_user_grade ? goods.grade_goods_price : goods.goods_price }}</text> |
||||
</view> |
||||
<view class="goods-num"> |
||||
<text>×{{ goods.total_num }}</text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<!-- 订单合计 --> |
||||
<view class="order-total"> |
||||
<text>共{{ item.total_num }}件商品,总金额</text> |
||||
<text class="unit">¥</text> |
||||
<text class="money">{{ item.pay_price }}</text> |
||||
</view> |
||||
<!-- 订单操作 --> |
||||
<view v-if="item.order_status != OrderStatusEnum.CANCELLED.value" class="order-handle"> |
||||
<view class="btn-group clearfix"> |
||||
<!-- 未支付取消订单 --> |
||||
<block v-if="item.pay_status == PayStatusEnum.PENDING.value"> |
||||
<view class="btn-item" @click="onCancel(item.order_id)">取消</view> |
||||
</block> |
||||
<!-- 已支付进行中的订单 --> |
||||
<block v-if="item.order_status != OrderStatusEnum.APPLY_CANCEL.value"> |
||||
<block v-if="item.pay_status == PayStatusEnum.SUCCESS.value && item.delivery_status == DeliveryStatusEnum.NOT_DELIVERED.value"> |
||||
<view class="btn-item" @click="onCancel(item.order_id)">申请取消</view> |
||||
</block> |
||||
<!-- 订单核销码 --> |
||||
<block v-if="item.pay_status == PayStatusEnum.SUCCESS.value && item.delivery_type == DeliveryTypeEnum.EXTRACT.value |
||||
&& item.delivery_status == DeliveryStatusEnum.NOT_DELIVERED.value"> |
||||
<view class="btn-item active" @click="onExtractQRCode(item.order_id)"> |
||||
<text class="iconfont icon-qr-extract"></text> |
||||
<text class="m-l-10">核销码</text> |
||||
</view> |
||||
</block> |
||||
</block> |
||||
<!-- 已申请取消 --> |
||||
<view v-else class="f-28 col-8">取消申请中</view> |
||||
<!-- 未支付的订单 --> |
||||
<block v-if="item.pay_status == PayStatusEnum.PENDING.value"> |
||||
<view class="btn-item active" @click="onPay(item.order_id)">去支付</view> |
||||
</block> |
||||
<!-- 确认收货 --> |
||||
<block v-if="item.delivery_status == DeliveryStatusEnum.DELIVERED.value && item.receipt_status == ReceiptStatusEnum.NOT_RECEIVED.value"> |
||||
<view class="btn-item active" @click="onReceipt(item.order_id)">确认收货</view> |
||||
</block> |
||||
<!-- 订单评价 --> |
||||
<block v-if="item.order_status == OrderStatusEnum.COMPLETED.value && item.is_comment == 0"> |
||||
<view class="btn-item" @click="handleTargetComment(item.order_id)">评价</view> |
||||
</block> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</mescroll-body> |
||||
<!-- 核销二维码弹窗 --> |
||||
<u-popup v-model="showQRCodePopup" mode="center" border-radius="26" :closeable="true"> |
||||
<view class="qrcode-popup"> |
||||
<view class="title">自提核销二维码</view> |
||||
<view class="pop-content"> |
||||
<image v-if="qrcodeImage" class="image" :src="qrcodeImage"></image> |
||||
</view> |
||||
</view> |
||||
</u-popup> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { |
||||
DeliveryStatusEnum, |
||||
DeliveryTypeEnum, |
||||
OrderStatusEnum, |
||||
PayStatusEnum, |
||||
ReceiptStatusEnum |
||||
} from '@/common/enum/order' |
||||
import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins' |
||||
import { getEmptyPaginateObj, getMoreListData } from '@/core/app' |
||||
import * as OrderApi from '@/api/order' |
||||
|
||||
// 每页记录数量 |
||||
const pageSize = 15 |
||||
|
||||
// tab栏数据 |
||||
const tabs = [{ |
||||
name: `全部`, |
||||
value: 'all' |
||||
}, { |
||||
name: `待支付`, |
||||
value: 'payment' |
||||
}, { |
||||
name: `待发货`, |
||||
value: 'delivery' |
||||
}, { |
||||
name: `待收货`, |
||||
value: 'received' |
||||
}, { |
||||
name: `待评价`, |
||||
value: 'comment' |
||||
}] |
||||
|
||||
export default { |
||||
mixins: [MescrollMixin], |
||||
data() { |
||||
return { |
||||
// 枚举类 |
||||
DeliveryStatusEnum, |
||||
DeliveryTypeEnum, |
||||
OrderStatusEnum, |
||||
PayStatusEnum, |
||||
ReceiptStatusEnum, |
||||
|
||||
// 当前页面参数 |
||||
options: { dataType: 'all' }, |
||||
// tab栏数据 |
||||
tabs, |
||||
// 当前标签索引 |
||||
curTab: 0, |
||||
// 订单列表数据 |
||||
list: getEmptyPaginateObj(), |
||||
|
||||
// 上拉加载配置 |
||||
upOption: { |
||||
// 首次自动执行 |
||||
auto: true, |
||||
// 每页数据的数量; 默认10 |
||||
page: { size: pageSize }, |
||||
// 数量要大于4条才显示无更多数据 |
||||
noMoreSize: 4, |
||||
// 空布局 |
||||
empty: { |
||||
tip: '亲,暂无订单记录' |
||||
} |
||||
}, |
||||
// 控制onShow事件是否刷新订单列表 |
||||
canReset: false, |
||||
// 核销二维码弹窗 |
||||
showQRCodePopup: false, |
||||
// 核销二维码图片url (通过后端获取) |
||||
qrcodeImage: '', |
||||
} |
||||
}, |
||||
|
||||
/** |
||||
* 生命周期函数--监听页面加载 |
||||
*/ |
||||
onLoad(options) { |
||||
// 初始化当前选中的标签 |
||||
this.initCurTab(options) |
||||
// 注册全局事件订阅: 是否刷新订单列表 |
||||
uni.$on('syncRefresh', canReset => { |
||||
this.canReset = canReset |
||||
}) |
||||
}, |
||||
|
||||
/** |
||||
* 生命周期函数--监听页面显示 |
||||
*/ |
||||
onShow() { |
||||
this.canReset && this.onRefreshList() |
||||
this.canReset = false |
||||
}, |
||||
|
||||
/** |
||||
* 生命周期函数--监听页面的卸载 |
||||
*/ |
||||
onUnload() { |
||||
// 卸载全局事件订阅 |
||||
uni.$off('syncRefresh') |
||||
}, |
||||
|
||||
methods: { |
||||
|
||||
// 初始化当前选中的标签 |
||||
initCurTab(options) { |
||||
const app = this |
||||
if (options.dataType) { |
||||
const index = app.tabs.findIndex(item => item.value == options.dataType) |
||||
app.curTab = index > -1 ? index : 0 |
||||
} |
||||
}, |
||||
|
||||
/** |
||||
* 上拉加载的回调 (页面初始化时也会执行一次) |
||||
* 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 |
||||
* @param {Object} page |
||||
*/ |
||||
upCallback(page) { |
||||
const app = this |
||||
// 设置列表数据 |
||||
app.getOrderList(page.num) |
||||
.then(list => { |
||||
const curPageLen = list.data.length |
||||
const totalSize = list.data.total |
||||
app.mescroll.endBySize(curPageLen, totalSize) |
||||
}) |
||||
.catch(() => app.mescroll.endErr()) |
||||
}, |
||||
|
||||
// 获取订单列表 |
||||
getOrderList(pageNo = 1) { |
||||
const app = this |
||||
return new Promise((resolve, reject) => { |
||||
OrderApi.list({ dataType: app.getTabValue(), page: pageNo }, { load: false }) |
||||
.then(result => { |
||||
// 合并新数据 |
||||
const newList = app.initList(result.data.list) |
||||
app.list.data = getMoreListData(newList, app.list, pageNo) |
||||
resolve(newList) |
||||
}) |
||||
}) |
||||
}, |
||||
|
||||
// 初始化订单列表数据 |
||||
initList(newList) { |
||||
newList.data.forEach(item => { |
||||
item.total_num = 0 |
||||
item.goods.forEach(goods => { |
||||
item.total_num += goods.total_num |
||||
}) |
||||
}) |
||||
return newList |
||||
}, |
||||
|
||||
// 获取当前标签项的值 |
||||
getTabValue() { |
||||
return this.tabs[this.curTab].value |
||||
}, |
||||
|
||||
// 切换标签项 |
||||
onChangeTab(index) { |
||||
const app = this |
||||
// 设置当前选中的标签 |
||||
app.curTab = index |
||||
// 刷新订单列表 |
||||
app.onRefreshList() |
||||
}, |
||||
|
||||
// 刷新订单列表 |
||||
onRefreshList() { |
||||
this.list = getEmptyPaginateObj() |
||||
setTimeout(() => { |
||||
this.mescroll.resetUpScroll() |
||||
}, 120) |
||||
}, |
||||
|
||||
// 取消订单 |
||||
onCancel(orderId) { |
||||
const app = this |
||||
uni.showModal({ |
||||
title: '友情提示', |
||||
content: '确认要取消该订单吗?', |
||||
success(o) { |
||||
if (o.confirm) { |
||||
OrderApi.cancel(orderId) |
||||
.then(result => { |
||||
// 显示成功信息 |
||||
app.$toast(result.message) |
||||
// 刷新订单列表 |
||||
app.onRefreshList() |
||||
}) |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
// 确认收货 |
||||
onReceipt(orderId) { |
||||
const app = this |
||||
uni.showModal({ |
||||
title: '友情提示', |
||||
content: '确认收到商品了吗?', |
||||
success(o) { |
||||
if (o.confirm) { |
||||
OrderApi.receipt(orderId) |
||||
.then(result => { |
||||
// 显示成功信息 |
||||
app.$success(result.message) |
||||
// 刷新订单列表 |
||||
app.onRefreshList() |
||||
}) |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
// 获取核销二维码 |
||||
onExtractQRCode(orderId) { |
||||
const app = this |
||||
OrderApi.extractQrcode(orderId, { channel: app.platform }) |
||||
.then(result => { |
||||
app.qrcodeImage = result.data.qrcode |
||||
app.showQRCodePopup = true |
||||
}) |
||||
}, |
||||
|
||||
// 点击去支付 |
||||
onPay(orderId) { |
||||
this.$navTo('pages/checkout/cashier/index', { orderId }) |
||||
}, |
||||
|
||||
// 跳转到订单详情页 |
||||
handleTargetDetail(orderId) { |
||||
this.$navTo('pages/order/detail', { orderId }) |
||||
}, |
||||
|
||||
// 跳转到订单评价页 |
||||
handleTargetComment(orderId) { |
||||
this.$navTo('pages/order/comment/index', { orderId }) |
||||
} |
||||
|
||||
}, |
||||
|
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
// 项目内容 |
||||
.order-item { |
||||
margin: 20rpx auto 20rpx auto; |
||||
padding: 30rpx 30rpx; |
||||
width: 94%; |
||||
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05); |
||||
border-radius: 16rpx; |
||||
background: #fff; |
||||
} |
||||
|
||||
// 项目顶部 |
||||
.item-top { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
font-size: 26rpx; |
||||
margin-bottom: 40rpx; |
||||
|
||||
.order-time { |
||||
color: #777; |
||||
} |
||||
|
||||
.state-text { |
||||
color: $main-bg; |
||||
} |
||||
} |
||||
|
||||
// 商品列表 |
||||
.goods-list { |
||||
|
||||
// 商品项 |
||||
.goods-item { |
||||
display: flex; |
||||
margin-bottom: 40rpx; |
||||
|
||||
// 商品图片 |
||||
.goods-image { |
||||
width: 180rpx; |
||||
height: 180rpx; |
||||
|
||||
.image { |
||||
display: block; |
||||
width: 100%; |
||||
height: 100%; |
||||
border-radius: 8rpx; |
||||
} |
||||
} |
||||
|
||||
// 商品内容 |
||||
.goods-content { |
||||
flex: 1; |
||||
padding-left: 16rpx; |
||||
padding-top: 16rpx; |
||||
|
||||
.goods-title { |
||||
font-size: 26rpx; |
||||
max-height: 76rpx; |
||||
} |
||||
|
||||
.goods-props { |
||||
margin-top: 14rpx; |
||||
height: 40rpx; |
||||
color: #ababab; |
||||
font-size: 24rpx; |
||||
overflow: hidden; |
||||
|
||||
.goods-props-item { |
||||
display: inline-block; |
||||
margin-right: 14rpx; |
||||
padding: 4rpx 16rpx; |
||||
border-radius: 12rpx; |
||||
background-color: #F5F5F5; |
||||
width: auto; |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
// 交易信息 |
||||
.goods-trade { |
||||
padding-top: 16rpx; |
||||
width: 150rpx; |
||||
text-align: right; |
||||
color: $uni-text-color-grey; |
||||
font-size: 26rpx; |
||||
|
||||
.goods-price { |
||||
vertical-align: bottom; |
||||
margin-bottom: 16rpx; |
||||
|
||||
.unit { |
||||
margin-right: -2rpx; |
||||
font-size: 24rpx; |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
} |
||||
|
||||
// 订单合计 |
||||
.order-total { |
||||
font-size: 26rpx; |
||||
vertical-align: bottom; |
||||
text-align: right; |
||||
height: 40rpx; |
||||
margin-bottom: 30rpx; |
||||
|
||||
.unit { |
||||
margin-left: 8rpx; |
||||
margin-right: -2rpx; |
||||
font-size: 26rpx; |
||||
} |
||||
|
||||
.money { |
||||
font-size: 28rpx; |
||||
} |
||||
} |
||||
|
||||
// 订单操作 |
||||
.order-handle { |
||||
.btn-group { |
||||
|
||||
.btn-item { |
||||
border-radius: 10rpx; |
||||
padding: 8rpx 20rpx; |
||||
margin-left: 15rpx; |
||||
font-size: 26rpx; |
||||
float: right; |
||||
color: #383838; |
||||
border: 1rpx solid #a8a8a8; |
||||
|
||||
&:last-child { |
||||
margin-left: 0; |
||||
} |
||||
|
||||
&.active { |
||||
color: $main-bg; |
||||
border: 1rpx solid $main-bg; |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
} |
||||
|
||||
// 弹出层 - 核销二维码 |
||||
.qrcode-popup { |
||||
padding: 36rpx 30rpx; |
||||
|
||||
.title { |
||||
font-size: 30rpx; |
||||
margin-bottom: 26rpx; |
||||
font-weight: bold; |
||||
text-align: center; |
||||
} |
||||
|
||||
.pop-content { |
||||
min-height: 260rpx; |
||||
padding: 0 10rpx; |
||||
|
||||
.image { |
||||
display: block; |
||||
width: 510rpx; |
||||
height: 510rpx; |
||||
} |
||||
|
||||
} |
||||
} |
||||
</style> |
Before Width: | Height: | Size: 960 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 958 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.8 KiB |