This commit is contained in:
HongRun Liu
2026-05-26 15:52:30 +08:00
commit b0744c8ab6
849 changed files with 130587 additions and 0 deletions
+302
View File
@@ -0,0 +1,302 @@
<!-- 下单界面,收货地址 or 自提门店的选择组件 -->
<template>
<view class="allAddress theme-ai" :style="state.isPickUp ? '' : 'padding-top:10rpx;'">
<view class="nav flex flex-wrap" :class="{ nav1: props.theme == '2' }">
<view
class="item font-color"
:class="[state.deliveryType === 1 ? 'on' : 'on2', props.theme == '2' ? 'c0' : '']"
@tap="switchDeliveryType(1)"
v-if="state.isPickUp"
/>
<view
class="item font-color"
:class="[state.deliveryType === '2' ? 'on' : 'on2', props.theme == '2' ? 'c0' : '']"
@tap="switchDeliveryType(2)"
v-if="state.isPickUp"
/>
</view>
<!-- 情况一:收货地址的选择 -->
<view
class="address flex flex-wrap flex-center ss-row-between"
@tap="onSelectAddress"
v-if="state.deliveryType === 1"
:class="{ 'bg24 c0': props.theme == '2', radius20: !state.isPickUp }"
>
<view class="addressCon" v-if="state.addressInfo.name">
<view class="name" :class="{ c0: props.theme == '2' }"
>{{ state.addressInfo.name }}
<text class="phone" :class="{ c0: props.theme == '2' }">{{
state.addressInfo.mobile
}}</text>
</view>
<view class="flex flex-wrap">
<text
class="default font-color"
:class="{ c0: props.theme == '2' }"
v-if="state.addressInfo.defaultStatus"
>[默认]</text
>
<text class="line2" :class="{ c0: props.theme == '2' }">
{{ state.addressInfo.areaName }} {{ state.addressInfo.detailAddress }}
</text>
</view>
</view>
<view class="addressCon" v-else>
<view class="setaddress" :class="{ c0: props.theme == '2' }">设置收货地址</view>
</view>
<view class="iconfont">
<view class="ss-rest-button">
<text class="_icon-forward" />
</view>
</view>
</view>
<!-- 情况二:门店的选择 -->
<view
class="address flex flex-wrap flex-center ss-row-between"
v-if="state.deliveryType === '2'"
@tap="onSelectAddress"
:class="{ 'bg24 c0': props.theme == '2' }"
>
<view class="addressCon" v-if="state.pickUpInfo.name">
<view class="name"
>{{ state.pickUpInfo.name }}
<text class="phone">{{ state.pickUpInfo.phone }}</text>
</view>
<view class="line1">
{{ state.pickUpInfo.areaName }}{{ ', ' + state.pickUpInfo.detailAddress }}
</view>
</view>
<view class="addressCon" v-else>
<view class="setaddress">选择自提门店</view>
</view>
<view class="iconfont">
<view class="ss-rest-button">
<text class="_icon-forward" />
</view>
</view>
</view>
<view class="line">
<image :src="sheep.$url.static('/static/img/shop/line.png')" />
</view>
</view>
</template>
<script setup>
import { computed, getCurrentInstance } from 'vue';
import sheep from '@/sheep';
import { isEmpty } from 'lodash-es';
let { proxy } = getCurrentInstance();
const props = defineProps({
modelValue: {
type: Object,
default() {},
},
theme: {
type: String,
default: '2', //1浅色 2深色
},
});
console.log(props.modelValue);
const emits = defineEmits(['update:modelValue']);
// computed 解决父子组件双向数据同步
const state = computed({
get() {
return new Proxy(props.modelValue, {
set(obj, name, val) {
emits('update:modelValue', {
...obj,
[name]: val,
});
return true;
},
});
},
set(val) {
emits('update:modelValue', val);
},
});
// 选择地址
function onSelectAddress() {
let emitName = 'SELECT_ADDRESS';
let addressPage = '/pages/user/address/list?type=select&theme=' + props.theme;
if (state.value.deliveryType === 2) {
emitName = 'SELECT_PICK_UP_INFO';
addressPage = '/pages/user/goods_details_store/index';
}
uni.$once(emitName, (e) => {
changeConsignee(e.addressInfo);
});
sheep.$router.go(addressPage);
}
// 更改收货人地址&计算订单信息
async function changeConsignee(addressInfo = {}) {
console.log(addressInfo);
proxy.$emit('getSettlementInfo', addressInfo.id);
if (!isEmpty(addressInfo)) {
if (state.value.deliveryType === 1) {
state.value.addressInfo = addressInfo;
}
if (state.value.deliveryType === 2) {
state.value.pickUpInfo = addressInfo;
}
}
}
// 收货方式切换
const switchDeliveryType = (type) => {
state.value.deliveryType = type;
};
</script>
<style scoped lang="scss">
.font-color {
color: #e93323;
}
.line2 {
width: 504rpx;
}
.textR {
text-align: right;
}
.line {
width: 100%;
height: 3rpx;
}
.line image {
width: 100%;
height: 100%;
display: block;
}
.address {
padding: 28rpx;
background-color: #fff;
box-sizing: border-box;
}
.address .addressCon {
width: 596rpx;
font-size: 26rpx;
color: #666;
}
.address .addressCon .name {
font-size: 30rpx;
color: #282828;
font-weight: bold;
margin-bottom: 10rpx;
}
.address .addressCon .name .phone {
margin-left: 50rpx;
}
.address .addressCon .default {
margin-right: 12rpx;
}
.address .addressCon .setaddress {
color: #333;
font-size: 28rpx;
}
.address .iconfont {
font-size: 35rpx;
color: #707070;
}
.allAddress {
width: 100%;
// background: linear-gradient(to bottom, #e93323 0%, #f5f5f5 100%);
// background-image: linear-gradient(to bottom, #e93323 0%, #f5f5f5 100%);
// background-image: -webkit-linear-gradient(to bottom, #e93323 0%, #f5f5f5 100%);
// background-image: -moz-linear-gradient(to bottom, #e93323 0%, #f5f5f5 100%);
//padding: 100rpx 30rpx 0 30rpx;
padding-top: 100rpx;
padding-bottom: 10rpx;
}
.allAddress .nav {
width: 690rpx;
margin: 0 auto;
}
.allAddress .nav .item {
width: 334rpx;
}
.allAddress .nav .item.on {
position: relative;
width: 230rpx;
}
.allAddress .nav .item.on::before {
position: absolute;
bottom: 0;
content: '快递配送';
font-size: 28rpx;
display: block;
height: 0;
width: 336rpx;
border-width: 0 20rpx 80rpx 0;
border-style: none solid solid;
border-color: transparent transparent #fff;
z-index: 2;
border-radius: 14rpx 36rpx 0 0;
text-align: center;
line-height: 80rpx;
}
.allAddress .nav .item:nth-of-type(2).on::before {
content: '到店自提';
border-width: 0 0 80rpx 20rpx;
border-radius: 36rpx 14rpx 0 0;
}
.allAddress .nav .item.on2 {
position: relative;
}
.allAddress .nav .item.on2::before {
position: absolute;
bottom: 0;
content: '到店自提';
font-size: 28rpx;
display: block;
height: 0;
width: 401rpx;
border-width: 0 0 60rpx 60rpx;
border-style: none solid solid;
border-color: transparent transparent #f7c1bd;
border-radius: 36rpx 14rpx 0 0;
text-align: center;
line-height: 60rpx;
}
.allAddress .nav .item:nth-of-type(1).on2::before {
content: '快递配送';
border-width: 0 60rpx 60rpx 0;
border-radius: 14rpx 36rpx 0 0;
}
.allAddress .nav1 .item.on::before {
border-color: transparent transparent rgb(145, 168, 243) !important;
}
.allAddress .nav1 .item.on2::before {
border-color: transparent transparent var(--color24);
}
.allAddress .address {
width: 690rpx;
max-height: 180rpx;
margin: 0 auto;
}
.allAddress .line {
width: 100%;
margin: 0 auto;
}
</style>
+379
View File
@@ -0,0 +1,379 @@
<!-- 售后申请 -->
<template>
<s-pages title="申请售后">
<!-- 售后商品 -->
<view class="goods-box">
<s-goods-item
:img="state.item.picUrl"
:title="state.item.spuName"
:skuText="state.item.properties?.map((property) => property.valueName).join(' ')"
:price="state.item.price"
:num="state.item.count"
/>
</view>
<uni-forms ref="form" v-model="formData" :rules="rules" label-position="top">
<!-- 售后类型 -->
<view class="card">
<view class="refund-item m-b-32">
<view class="item-title ss-m-b-20">售后类型</view>
<view class="ss-flex-col">
<radio-group @change="onRefundChange">
<label
class="ss-flex ss-col-center ss-p-y-10"
v-for="(item, index) in state.wayList"
:key="index"
>
<radio
:checked="formData.type === item.value"
color="var(--color32)"
style="transform: scale(0.8)"
:value="item.value"
/>
<view class="item-value ss-m-l-8">{{ item.text }}</view>
</label>
</radio-group>
</view>
</view>
</view>
<!-- 退款金额 -->
<view class="card">
<view
class="refund-item ss-flex ss-col-center ss-row-between"
@tap="state.showModal = true"
>
<text class="item-title">退款金额</text>
<view class="ss-flex refund-cause ss-col-center">
<text class="ss-m-r-20">¥{{ fen2yuan(state.item.payPrice) }}</text>
</view>
</view>
<!-- 申请原因 -->
<view class="refund-item ss-flex ss-col-center ss-row-between" @tap="toReason()">
<text class="item-title">申请原因</text>
<view class="ss-flex refund-cause ss-col-center" style="color: #999">
<text class="ss-m-r-20" v-if="formData.applyReason">{{ formData.applyReason }}</text>
<text class="ss-m-r-20" v-else>请选择申请原因~</text>
<text class="cicon-forward" style="height: 28rpx"></text>
</view>
</view>
<!-- 留言 -->
<view class="refund-item">
<view class="item-title ss-m-b-20">相关描述</view>
<view class="describe-box">
<uni-easyinput
:inputBorder="false"
class="describe-content p-x-26 p-y-26 m-b-32"
type="textarea"
maxlength="120"
autoHeight
v-model="formData.applyDescription"
placeholder="客官~请描述您遇到的问题,建议上传照片"
/>
<view class="upload-img">
<s-uploader
v-model:url="formData.applyPicUrls"
fileMediatype="image"
limit="9"
mode="grid"
:imageStyles="{ width: '168rpx', height: '168rpx' }"
/>
</view>
</view>
</view>
</view>
</uni-forms>
<!-- 底部按钮 -->
<su-fixed bottom placeholder>
<view class="foot-wrap bg24">
<view class="ai-button" @tap="submit">提交</view>
</view>
</su-fixed>
<!-- 申请原因弹窗 -->
<su-popup :show="state.showModal" round="10" :showClose="true" @close="state.showModal = false">
<view class="modal-box page_box bg24">
<view class="modal-head item-title head_box ss-flex ss-row-center ss-col-center">
申请原因
</view>
<view class="modal-content content_box">
<radio-group @change="onChange">
<label class="radio ss-flex ss-col-center" v-for="item in state.reasonList" :key="item">
<view class="ss-flex-1 ss-p-20">{{ item }}</view>
<radio :value="item" color="var(--color32)" :checked="item === state.currentValue" />
</label>
</radio-group>
</view>
<view class="modal-foot foot_box ss-flex ss-row-center ss-col-center p-x-24 p-y-20">
<view class="ai-button" @tap="onReason">确认</view>
</view>
</view>
</su-popup>
</s-pages>
</template>
<script setup>
import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app';
import { reactive, ref } from 'vue';
import OrderApi from '@/sheep/api/trade/order';
import TradeConfigApi from '@/sheep/api/trade/config';
import { fen2yuan } from '@/sheep/hooks/useGoods';
import AfterSaleApi from '@/sheep/api/trade/afterSale';
const form = ref(null);
const state = reactive({
orderId: 0, // 订单编号
itemId: 0, // 订单项编号
order: {}, // 订单
item: {}, // 订单项
config: {}, // 交易配置
// 售后类型
wayList: [
{
text: '仅退款',
value: '10',
},
{
text: '退款退货',
value: '20',
},
],
reasonList: [], // 可选的申请原因数组
showModal: false, // 是否显示申请原因弹窗
currentValue: '', // 当前选择的售后原因
});
let formData = reactive({
way: '',
applyReason: '',
applyDescription: '',
applyPicUrls: [],
});
const rules = reactive({});
// 提交表单
async function submit() {
let data = {
orderItemId: state.itemId,
refundPrice: state.item.payPrice,
...formData,
};
const { code } = await AfterSaleApi.createAfterSale(data);
if (code === 0) {
uni.showToast({
title: '申请成功',
});
uni.navigateBack({
delta: 1,
});
} else {
uni.navigateBack({
delta: 1,
});
}
}
//申请原因
function toReason() {
if (!formData.way) {
uni.showToast({
title: '请选择售后类型',
icon: 'none',
});
} else {
state.showModal = true;
}
}
// 选择售后类型
function onRefundChange(e) {
formData.way = e.detail.value;
// 清理理由
state.reasonList =
formData.way === '10'
? state.config.afterSaleRefundReasons || []
: state.config.afterSaleReturnReasons || [];
formData.applyReason = '';
state.currentValue = '';
}
// 选择申请原因
function onChange(e) {
state.currentValue = e.detail.value;
}
// 确定
function onReason() {
formData.applyReason = state.currentValue;
state.showModal = false;
}
onLoad(async (options) => {
// 解析参数
if (!options.orderId || !options.itemId) {
sheep.$helper.toast(`缺少订单信息,请检查`);
return;
}
state.orderId = options.orderId;
state.itemId = parseInt(options.itemId);
// 读取订单信息
const { code, data } = await OrderApi.getOrderDetail(state.orderId);
if (code !== 0) {
return;
}
state.order = data;
state.item = data.items.find((item) => item.id === state.itemId) || {};
// 设置选项
if (state.order.status === 10) {
state.wayList.splice(1, 1);
}
// 读取配置
state.config = (await TradeConfigApi.getTradeConfig()).data;
});
</script>
<style lang="scss" scoped>
.card {
background: #fff;
}
.item-title {
font-size: 30rpx;
font-weight: bold;
// color: #ffffff;
// margin-bottom: 20rpx;
}
// 售后项目
.refund-item {
background: #fff;
border-bottom: 2rpx solid #f1f1f1; //var(--color24)
padding: 30rpx;
margin: 0 22rpx;
&:last-child {
border: none;
}
// 留言
.describe-box {
// width: 690rpx;
//background: var(--color24);
// padding: 30rpx;
box-sizing: border-box;
border-radius: 20rpx;
.describe-content {
min-height: 200rpx;
font-size: 24rpx;
font-weight: 400;
color: #333;
background: #f9fafc;
border-radius: 24rpx;
// padding: 26rpx;
}
}
// 联系方式
.input-box {
height: 84rpx;
background: rgba(249, 250, 251, 1);
border-radius: 20rpx;
}
}
.goods-box {
padding: 20rpx;
margin: 32rpx 0;
background: #fff;
}
.ai-button {
border-radius: 12rpx;
color: #fff;
}
.foot-wrap {
height: 120rpx;
width: 100%;
padding: 10rpx 40rpx;
box-sizing: border-box;
.submit-btn {
height: 100%;
}
}
.foot_box {
height: 100rpx;
.sub-btn {
width: 336rpx;
line-height: 74rpx;
border-radius: 38rpx;
color: rgba(#fff, 0.9);
font-size: 28rpx;
}
.contcat-btn {
width: 336rpx;
line-height: 74rpx;
background: rgba(238, 238, 238, 1);
border-radius: 38rpx;
font-size: 28rpx;
font-weight: 400;
color: rgba(51, 51, 51, 1);
}
}
.modal-box {
width: 750rpx;
// height: 680rpx;
border-radius: 30rpx 30rpx 0 0;
.modal-head {
height: 100rpx;
font-size: 30rpx;
}
.modal-content {
font-size: 28rpx;
}
.modal-foot {
.close-btn {
width: 710rpx;
line-height: 80rpx;
border-radius: 40rpx;
color: rgba(#fff, 0.9);
}
}
}
.success-box {
width: 600rpx;
padding: 90rpx 0 64rpx 0;
.cicon-check-round {
font-size: 96rpx;
color: #04b750;
}
.success-title {
font-weight: 500;
color: #333333;
font-size: 32rpx;
}
.success-btn {
width: 492rpx;
height: 70rpx;
background: linear-gradient(90deg, var(--ui-BG-Main-gradient), var(--ui-BG-Main));
border-radius: 35rpx;
}
}
</style>
+380
View File
@@ -0,0 +1,380 @@
<!-- 售后详情 -->
<template>
<s-layout title="售后详情" :navbar="!isEmpty(state.info) && state.loading ? 'inner' : 'normal'">
<view class="content_box" v-if="!isEmpty(state.info) && state.loading">
<!-- 步骤条 -->
<view
class="steps-box ss-flex"
:style="[
{
marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
paddingTop: Number(statusBarHeight + 88) + 'rpx',
},
]"
>
<view class="ss-flex">
<view class="steps-item" v-for="(item, index) in state.list" :key="index">
<view class="ss-flex">
<text
class="sicon-circleclose"
v-if="state.list.length - 1 === index && [61, 62, 63].includes(state.info.status)"
/>
<text
class="sicon-circlecheck"
v-else
:class="state.active >= index ? 'activity-color' : 'info-color'"
/>
<view
v-if="state.list.length - 1 !== index"
class="line"
:class="state.active >= index ? 'activity-bg' : 'info-bg'"
/>
</view>
<view
class="steps-item-title"
:class="state.active >= index ? 'activity-color' : 'info-color'"
>
{{ item.title }}
</view>
</view>
</view>
</view>
<!-- 服务状态 -->
<view
class="status-box ss-flex ss-col-center ss-row-between ss-m-x-20"
@tap="sheep.$router.go('/pages/order/aftersale/log', { id: state.id })"
>
<view class="">
<view class="status-text">
{{ formatAfterSaleStatusDescription(state.info) }}
</view>
<view class="status-time">
{{ sheep.$helper.timeFormat(state.info.updateTime, 'yyyy-mm-dd hh:MM:ss') }}
</view>
</view>
<text class="ss-iconfont _icon-forward" style="color: #666" />
</view>
<!-- 退款金额 -->
<view class="aftersale-money ss-flex ss-col-center ss-row-between">
<view class="aftersale-money--title">退款总额</view>
<view class="aftersale-money--num">¥{{ fen2yuan(state.info.refundPrice) }}</view>
</view>
<!-- 服务商品 -->
<view class="order-shop">
<s-goods-item
:img="state.info.picUrl"
:title="state.info.spuName"
:titleWidth="480"
:skuText="state.info.properties.map((property) => property.valueName).join(' ')"
:num="state.info.count"
/>
</view>
<!-- 服务内容 -->
<view class="aftersale-content">
<view class="aftersale-item ss-flex ss-col-center">
<view class="item-title">服务单号:</view>
<view class="item-content ss-m-r-16">{{ state.info.no }}</view>
<button class="ss-reset-button copy-btn" @tap="onCopy">复制</button>
</view>
<view class="aftersale-item ss-flex ss-col-center">
<view class="item-title">申请时间:</view>
<view class="item-content">
{{ sheep.$helper.timeFormat(state.info.createTime, 'yyyy-mm-dd hh:MM:ss') }}
</view>
</view>
<view class="aftersale-item ss-flex ss-col-center">
<view class="item-title">售后类型:</view>
<view class="item-content">{{ state.info.way === 10 ? '仅退款' : '退款退货' }}</view>
</view>
<view class="aftersale-item ss-flex ss-col-center">
<view class="item-title">申请原因:</view>
<view class="item-content">{{ state.info.applyReason }}</view>
</view>
<view class="aftersale-item ss-flex ss-col-center">
<view class="item-title">相关描述:</view>
<view class="item-content">{{ state.info.applyDescription }}</view>
</view>
</view>
</view>
<!-- 操作区 -->
<s-empty
v-if="isEmpty(state.info) && state.loading"
icon="/static/order-empty.png"
text="暂无该订单售后详情"
/>
<su-fixed bottom placeholder bg="bg-white" v-if="!isEmpty(state.info)">
<view class="foot_box">
<button
class="ss-reset-button btn"
v-if="state.info.buttons?.includes('cancel')"
@tap="onApply(state.info.id)"
>
取消申请
</button>
<button
class="ss-reset-button btn"
v-if="state.info.buttons?.includes('delivery')"
@tap="sheep.$router.go('/pages/order/aftersale/return-delivery', { id: state.info.id })"
>
填写退货
</button>
<button
class="ss-reset-button contcat-btn btn"
@tap="sheep.$router.go('/pages/chat/index')"
>
联系客服
</button>
</view>
</su-fixed>
</s-layout>
</template>
<script setup>
import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app';
import { reactive } from 'vue';
import { isEmpty } from 'lodash-es';
import {
fen2yuan,
formatAfterSaleStatusDescription,
handleAfterSaleButtons,
} from '@/sheep/hooks/useGoods';
import AfterSaleApi from '@/sheep/api/trade/afterSale';
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
const state = reactive({
id: 0, // 售后编号
info: {}, // 收货信息
loading: false,
active: 0, // 在 list 的激活位置
list: [
{
title: '提交申请',
},
{
title: '处理中',
},
{
title: '完成',
},
], // 时间轴
});
function onApply(id) {
uni.showModal({
title: '提示',
content: '确定要取消此申请吗?',
confirmColor: '#FA7E31',
success: async function (res) {
if (!res.confirm) {
return;
}
const { code } = await AfterSaleApi.cancelAfterSale(id);
if (code === 0) {
await getDetail(id);
}
},
});
}
// 复制
const onCopy = () => {
sheep.$helper.copyText(state.info.no);
};
async function getDetail(id) {
state.loading = true;
const { code, data } = await AfterSaleApi.getAfterSale(id);
if (code !== 0) {
state.info = null;
return;
}
state.info = data;
handleAfterSaleButtons(state.info);
// 处理时间轴
if ([10].includes(state.info.status)) {
state.active = 0;
} else if ([20, 30].includes(state.info.status)) {
state.active = 1;
} else if ([40, 50].includes(state.info.status)) {
state.active = 2;
} else if ([61, 62, 63].includes(state.info.status)) {
state.active = 2;
}
}
onLoad((options) => {
if (!options.id) {
sheep.$helper.toast(`缺少订单信息,请检查`);
return;
}
state.id = options.id;
getDetail(options.id);
});
</script>
<style lang="scss" scoped>
// 步骤条
.steps-box {
width: 100%;
height: 190rpx;
background: v-bind(headerBg) no-repeat,
linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
background-size: 750rpx 100%;
padding-left: 72rpx;
.steps-item {
.sicon-circleclose {
font-size: 24rpx;
color: #fff;
}
.sicon-circlecheck {
font-size: 24rpx;
}
.steps-item-title {
font-size: 24rpx;
font-weight: 400;
margin-top: 16rpx;
margin-left: -36rpx;
width: 100rpx;
text-align: center;
}
}
}
.activity-color {
color: #fff;
}
.info-color {
color: rgba(#fff, 0.4);
}
.activity-bg {
background: #fff;
}
.info-bg {
background: rgba(#fff, 0.4);
}
.line {
width: 270rpx;
height: 4rpx;
}
// 服务状态
.status-box {
position: relative;
z-index: 3;
background-color: #fff;
border-radius: 20rpx 20rpx 0px 0px;
padding: 20rpx;
margin-top: -20rpx;
.status-text {
font-size: 28rpx;
font-weight: 500;
color: rgba(51, 51, 51, 1);
margin-bottom: 20rpx;
}
.status-time {
font-size: 24rpx;
font-weight: 400;
color: rgba(153, 153, 153, 1);
}
}
// 退款金额
.aftersale-money {
background-color: #fff;
height: 98rpx;
padding: 0 20rpx;
margin: 20rpx;
.aftersale-money--title {
font-size: 28rpx;
font-weight: 500;
color: rgba(51, 51, 51, 1);
}
.aftersale-money--num {
font-size: 28rpx;
font-family: OPPOSANS;
font-weight: 500;
color: #ff3000;
}
}
// order-shop
.order-shop {
padding: 20rpx;
background-color: #fff;
margin: 0 20rpx 20rpx 20rpx;
}
// 服务内容
.aftersale-content {
background-color: #fff;
padding: 20rpx;
margin: 0 20rpx;
.aftersale-item {
height: 60rpx;
.copy-btn {
background: #eeeeee;
color: #333;
border-radius: 20rpx;
width: 75rpx;
height: 40rpx;
font-size: 22rpx;
}
.item-title {
color: #999;
font-size: 28rpx;
}
.item-content {
color: #333;
font-size: 28rpx;
}
}
}
// 底部功能
.foot_box {
height: 100rpx;
background-color: #fff;
display: flex;
align-items: center;
justify-content: flex-end;
.btn {
width: 160rpx;
line-height: 60rpx;
background: rgba(238, 238, 238, 1);
border-radius: 30rpx;
padding: 0;
margin-right: 20rpx;
font-size: 26rpx;
font-weight: 400;
color: rgba(51, 51, 51, 1);
}
}
</style>
+218
View File
@@ -0,0 +1,218 @@
<template>
<s-layout title="退货物流">
<view>
<form @submit="subRefund" report-submit="true">
<view class="apply-return">
<view class="list borRadius14">
<view
class="item acea-row row-between-wrapper"
style="display: flex; align-items: center"
>
<view>物流公司</view>
<view v-if="state.expresses.length" style="flex: 1">
<picker
mode="selector"
class="num"
@change="bindPickerChange"
:value="state.expressIndex"
:range="state.expresses"
range-key="name"
>
<view
class="picker acea-row row-between-wrapper"
style="display: flex; justify-content: space-between"
>
<view class="reason">{{ state.expresses[state.expressIndex].name }}</view>
<text class="iconfont _icon-forward" />
</view>
</picker>
</view>
</view>
<view
class="item textarea acea-row row-between"
style="display: flex; align-items: center"
>
<view>物流单号</view>
<input
placeholder="请填写物流单号"
class="num"
name="logisticsNo"
placeholder-style="color: #bbb;"
/>
</view>
<button
class="returnBnt bg-color ss-reset-button ui-BG-Main-Gradient sub-btn"
form-type="submit"
style="background: linear-gradient(90deg,var(--ui-BG-Main),var(--ui-BG-Main-gradient)) !important;">提交</button
>
</view>
</view>
</form>
</view>
</s-layout>
</template>
<script setup>
import { onLoad } from '@dcloudio/uni-app';
import { reactive } from 'vue';
import sheep from '@/sheep';
import AfterSaleApi from '@/sheep/api/trade/afterSale';
import DeliveryApi from '@/sheep/api/trade/delivery';
const state = reactive({
id: 0, // 售后编号
expressIndex: 0, // 选中的 expresses 下标
expresses: [], // 可选的快递列表
});
function bindPickerChange(e) {
state.expressIndex = e.detail.value;
}
async function subRefund(e) {
let data = {
id: state.id,
logisticsId: state.expresses[state.expressIndex].id,
logisticsNo: e.detail.value.logisticsNo,
};
const { code } = await AfterSaleApi.deliveryAfterSale(data);
if (code !== 0) {
return;
}
uni.showToast({
title: '填写退货成功',
});
uni.navigateBack({
delta: 1,
});
}
// 获得快递物流列表
async function getExpressList() {
const { code, data } = await DeliveryApi.getDeliveryExpressList();
if (code !== 0) {
return;
}
state.expresses = data;
}
onLoad((options) => {
if (!options.id) {
sheep.$helper.toast(`缺少订单信息,请检查`);
return;
}
state.id = options.id;
// 获得快递物流列表
getExpressList();
});
</script>
<style lang="scss" scoped>
.apply-return {
padding: 20rpx 30rpx 70rpx 30rpx;
}
.apply-return .list {
background-color: #fff;
margin-top: 18rpx;
padding: 0 24rpx 70rpx 24rpx;
}
.apply-return .list .item {
min-height: 90rpx;
border-bottom: 1rpx solid #eee;
font-size: 30rpx;
color: #333;
}
.apply-return .list .item .num {
color: #282828;
margin-left: 27rpx;
// width: 227rpx;
// text-align: right;
}
.apply-return .list .item .num .picker .reason {
width: 385rpx;
}
.apply-return .list .item .num .picker .iconfont {
color: #666;
font-size: 30rpx;
margin-top: 2rpx;
}
.apply-return .list .item.textarea {
padding: 24rpx 0;
}
.apply-return .list .item textarea {
height: 100rpx;
font-size: 30rpx;
}
.apply-return .list .item .placeholder {
color: #bbb;
}
.apply-return .list .item .title {
height: 95rpx;
width: 100%;
}
.apply-return .list .item .title .tip {
font-size: 30rpx;
color: #bbb;
}
.apply-return .list .item .upload {
padding-bottom: 36rpx;
}
.apply-return .list .item .upload .pictrue {
border-radius: 14rpx;
margin: 22rpx 23rpx 0 0;
width: 156rpx;
height: 156rpx;
position: relative;
font-size: 24rpx;
color: #bbb;
}
.apply-return .list .item .upload .pictrue:nth-of-type(4n) {
margin-right: 0;
}
.apply-return .list .item .upload .pictrue image {
width: 100%;
height: 100%;
border-radius: 14rpx;
}
.apply-return .list .item .upload .pictrue .icon-guanbi1 {
position: absolute;
font-size: 45rpx;
top: -10rpx;
right: -10rpx;
}
.apply-return .list .item .upload .pictrue .icon-icon25201 {
color: #bfbfbf;
font-size: 50rpx;
}
.apply-return .list .item .upload .pictrue:nth-last-child(1) {
border: 1rpx solid #ddd;
box-sizing: border-box;
}
.apply-return .returnBnt {
font-size: 32rpx;
color: #fff;
width: 100%;
height: 86rpx;
border-radius: 50rpx;
text-align: center;
line-height: 86rpx;
margin: 43rpx auto;
}
</style>
+456
View File
@@ -0,0 +1,456 @@
<template>
<s-pages title="确认订单">
<!-- 头部地址选择【配送地址】【自提地址】 -->
<AddressSelection v-model="addressState" />
<view class="m-x-32 bg24 p-x-20 p-y-20 radius16">
<!-- 商品信息 -->
<view class="order-card-box ss-m-b-14">
<s-goods-item
v-for="item in state.orderInfo.items"
:key="item.skuId"
:img="item.picUrl"
:title="item.spuName"
:skuText="item.properties.map((property) => property.valueName).join(' ')"
:price="item.price"
:num="item.count"
marginBottom="10"
/>
</view>
<!-- 价格信息 -->
<view class="total-card-box ss-p-20 ss-m-b-14 ss-r-10">
<view class="total-box-content border-bottom">
<view class="order-item ss-flex ss-col-center ss-row-between">
<view class="item-title">商品金额</view>
<view class="ss-flex ss-col-center">
<text class="item-value ss-m-r-24">
¥{{ fen2yuan(state.orderInfo.price.totalPrice) }}
</text>
</view>
</view>
<view
v-if="state.orderPayload.pointActivityId"
class="order-item ss-flex ss-col-center ss-row-between"
>
<view class="item-title">兑换积分</view>
<view class="ss-flex ss-col-center">
<image
:src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
class="score-img"
/>
<text class="item-value ss-m-r-24">
{{ state.orderInfo.usePoint }}
</text>
</view>
</view>
<view
class="order-item ss-flex ss-col-center ss-row-between"
v-if="state.orderInfo.useConsumption"
>
<view class="item-title">消费金抵扣</view>
<view class="ss-flex ss-col-center">
{{ '消费金可抵扣' }}
<image
:src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
class="score-img"
/>
<text class="item-value ss-m-r-24">
<!-- consumptionPrice -->
{{ $fen2yuan(state.orderInfo.useConsumption) }}
</text>
<!-- <checkbox-group @change="changeIntegral" v-if="!state.orderPayload.pointActivityId">
<checkbox
:checked="state.pointStatus"
:disabled="!state.orderInfo.totalPoint || state.orderInfo.totalPoint <= 0"
/>
</checkbox-group> -->
</view>
</view>
<!-- 快递配置时,信息的展示 -->
<view
class="order-item ss-flex ss-col-center ss-row-between"
v-if="addressState.deliveryType === 1"
>
<view class="item-title">运费</view>
<view class="ss-flex ss-col-center">
<text class="item-value ss-m-r-24" v-if="state.orderInfo.price.deliveryPrice > 0">
+¥{{ fen2yuan(state.orderInfo.price.deliveryPrice) }}
</text>
<view class="item-value ss-m-r-24" v-else>免运费</view>
</view>
</view>
<!-- 门店自提时,需要填写姓名和手机号 -->
<view
class="order-item ss-flex ss-col-center ss-row-between"
v-if="addressState.deliveryType === 2"
>
<view class="item-title">联系人</view>
<view class="ss-flex ss-col-center">
<uni-easyinput
maxlength="20"
placeholder="请填写您的联系姓名"
v-model="addressState.receiverName"
:inputBorder="false"
:clearable="false"
/>
</view>
</view>
<view
class="order-item ss-flex ss-col-center ss-row-between"
v-if="addressState.deliveryType === 2"
>
<view class="item-title">联系电话</view>
<view class="ss-flex ss-col-center">
<uni-easyinput
maxlength="20"
placeholder="请填写您的联系电话"
v-model="addressState.receiverMobile"
:inputBorder="false"
:clearable="false"
/>
</view>
</view>
</view>
<view class="total-box-footer ss-font-28 ss-flex ss-row-right ss-col-center ss-m-r-28">
<view class="total-num ss-m-r-20 c0">
共{{ state.orderInfo.items.reduce((acc, item) => acc + item.count, 0) }}件
</view>
<view>合计:</view>
<view class="total-num text-red"> ¥{{ fen2yuan(state.orderInfo.price.payPrice) }}</view>
</view>
</view>
</view>
<!-- 底部 -->
<su-fixed bottom :opacity="false" bg="bg24" placeholder :noFixed="false" :index="200">
<view class="footer-box border-top ss-flex ss-row-between ss-p-x-20 ss-col-center">
<view class="total-box-footer ss-flex ss-col-center">
<view class="total-num ss-font-30 text-red">
¥{{ fen2yuan(state.orderInfo.price.payPrice) }}
</view>
</view>
<view>
<button class="submit-btn" @tap="$debounce(onConfirm, 1000)"> 提交订单 </button>
</view>
</view>
</su-fixed>
</s-pages>
</template>
<script setup>
import { reactive, ref, watch } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import AddressSelection from '@/pages/order/addressSelection.vue';
import sheep from '@/sheep';
import OrderApi from '@/sheep/api/trade/order';
import TradeConfigApi from '@/sheep/api/trade/config';
import { fen2yuan } from '@/sheep/hooks/useGoods';
import { DeliveryTypeEnum } from '@/sheep/helper/const';
const state = reactive({
orderPayload: {},
orderInfo: {
items: [], // 商品项列表
price: {}, // 价格信息
},
showCoupon: false, // 是否展示优惠劵
couponInfo: [], // 优惠劵列表
showDiscount: false, // 是否展示营销活动
// ========== 积分 ==========
pointStatus: false, //是否使用积分
});
const addressState = ref({
addressInfo: {}, // 选择的收货地址
deliveryType: undefined, // 收货方式:1-快递配送,2-门店自提
isPickUp: true, // 门店自提是否开启
pickUpInfo: {}, // 选择的自提门店信息
receiverName: '', // 收件人名称
receiverMobile: '', // 收件人手机
});
// ========== 积分 ==========
/**
* 使用积分抵扣
*/
const changeIntegral = async () => {
state.pointStatus = !state.pointStatus;
await getOrderInfo();
};
// 选择优惠券
async function onSelectCoupon(couponId) {
state.orderPayload.couponId = couponId;
await getOrderInfo();
state.showCoupon = false;
}
// 提交订单
function onConfirm() {
if (fen2yuan(state.orderInfo.price.payPrice) >= 5000) {
sheep.$helper.toast('订单金额不能超过5000元, 请重新选择商品');
return;
}
if (addressState.value.deliveryType === 1 && !addressState.value.addressInfo.id) {
sheep.$helper.toast('请选择收货地址');
return;
}
if (addressState.value.deliveryType === 2) {
if (!addressState.value.pickUpInfo.id) {
sheep.$helper.toast('请选择自提门店地址');
return;
}
if (addressState.value.receiverName === '' || addressState.value.receiverMobile === '') {
sheep.$helper.toast('请填写联系人或联系人电话');
return;
}
if (!/^[\u4e00-\u9fa5\w]{2,16}$/.test(addressState.value.receiverName)) {
sheep.$helper.toast('请填写您的真实姓名');
return;
}
if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(addressState.value.receiverMobile)) {
sheep.$helper.toast('请填写正确的手机号');
return;
}
}
submitOrder();
}
// 创建订单&跳转
async function submitOrder() {
const { code, data } = await OrderApi.createOrder({
items: state.orderPayload.items,
couponId: state.orderPayload.couponId,
remark: state.orderPayload.remark,
deliveryType: addressState.value.deliveryType,
addressId: addressState.value.addressInfo.id, // 收件地址编号
pickUpStoreId: addressState.value.pickUpInfo.id, //自提门店编号
receiverName: addressState.value.receiverName, // 选择门店自提时,该字段为联系人名
receiverMobile: addressState.value.receiverMobile, // 选择门店自提时,该字段为联系人手机
pointStatus: state.pointStatus,
combinationActivityId: state.orderPayload.combinationActivityId,
combinationHeadId: state.orderPayload.combinationHeadId,
seckillActivityId: state.orderPayload.seckillActivityId,
pointActivityId: state.orderPayload.pointActivityId,
});
if (code !== 0) {
return;
}
// 更新购物车列表,如果来自购物车
if (state.orderPayload.items[0].cartId > 0) {
sheep.$store('cart').getList();
}
// 跳转到支付页面
if (data.payOrderId && data.payOrderId > 0) {
sheep.$router.redirect('/pages/pay/index', {
id: data.payOrderId,
});
// 支付
} else {
sheep.$router.redirect('/pages/order/detail', {
id: data.id,
});
}
}
// 检查库存 & 计算订单价格
async function getOrderInfo() {
// 计算价格
const { data, code } = await OrderApi.settlementOrder({
items: state.orderPayload.items,
couponId: state.orderPayload.couponId,
deliveryType: addressState.value.deliveryType,
addressId: addressState.value.addressInfo.id, // 收件地址编号
pickUpStoreId: addressState.value.pickUpInfo.id, //自提门店编号
receiverName: addressState.value.receiverName, // 选择门店自提时,该字段为联系人名
receiverMobile: addressState.value.receiverMobile, // 选择门店自提时,该字段为联系人手机
pointStatus: state.pointStatus,
combinationActivityId: state.orderPayload.combinationActivityId,
combinationHeadId: state.orderPayload.combinationHeadId,
seckillActivityId: state.orderPayload.seckillActivityId,
pointActivityId: state.orderPayload.pointActivityId,
});
if (code !== 0) {
return code;
}
state.orderInfo = data;
console.log(state.orderInfo);
state.couponInfo = data.coupons || [];
// 设置收货地址
if (state.orderInfo.address) {
addressState.value.addressInfo = state.orderInfo.address;
}
if (fen2yuan(state.orderInfo.price.payPrice) >= 5000) {
sheep.$helper.toast('订单金额不能超过5000元');
}
return code;
}
onLoad(async (options) => {
// 解析参数
if (!options.data) {
sheep.$helper.toast('参数不正确,请检查!');
return;
}
state.orderPayload = JSON.parse(options.data);
// 获取交易配置
const { data, code } = await TradeConfigApi.getTradeConfig();
if (code === 0) {
addressState.value.isPickUp = data.deliveryPickUpEnabled;
}
// 价格计算
// 情况一:先自动选择“快递物流”
addressState.value.deliveryType = DeliveryTypeEnum.EXPRESS.type;
let orderCode = await getOrderInfo();
if (orderCode === 0) {
return;
}
// 情况二:失败,再自动选择“门店自提”
if (addressState.value.isPickUp) {
addressState.value.deliveryType = DeliveryTypeEnum.PICK_UP.type;
let orderCode = await getOrderInfo();
if (orderCode === 0) {
return;
}
}
// 情况三:都失败,则不选择
addressState.value.deliveryType = undefined;
await getOrderInfo();
});
// 使用 watch 监听地址和配送方式的变化
watch(addressState, async (newAddress, oldAddress) => {
// 如果收货地址或配送方式有变化,则重新计算价格
if (
newAddress.addressInfo.id !== oldAddress.addressInfo.id ||
newAddress.deliveryType !== oldAddress.deliveryType
) {
await getOrderInfo();
}
});
</script>
<style lang="scss" scoped>
:deep() {
.uni-input-wrapper {
width: 320rpx;
}
.uni-easyinput__content-input {
font-size: 28rpx;
height: 72rpx;
text-align: right !important;
padding-right: 0 !important;
.uni-input-input {
font-weight: 500;
color: #333333;
font-size: 26rpx;
height: 32rpx;
margin-top: 4rpx;
}
}
.uni-easyinput__content {
display: flex !important;
align-items: center !important;
justify-content: right !important;
}
}
.score-img {
width: 36rpx;
height: 36rpx;
margin: 0 4rpx;
}
.order-item {
height: 80rpx;
.item-title {
font-size: 28rpx;
font-weight: 400;
}
.item-value {
font-size: 28rpx;
font-weight: 500;
font-family: OPPOSANS;
}
.text-disabled {
color: #bbbbbb;
}
.item-icon {
color: $dark-9;
}
.remark-input {
text-align: right;
}
.item-placeholder {
color: $dark-9;
font-size: 26rpx;
text-align: right;
}
}
.total-box-footer {
height: 90rpx;
.total-num {
color: #333333;
font-family: OPPOSANS;
}
}
.footer-box {
height: 100rpx;
.submit-btn {
width: 240rpx;
height: 70rpx;
font-size: 28rpx;
font-weight: 500;
.goto-pay-text {
line-height: 28rpx;
}
}
.cancel-btn {
width: 240rpx;
height: 80rpx;
font-size: 26rpx;
background-color: #e5e5e5;
color: $dark-9;
}
}
.title {
font-size: 36rpx;
font-weight: bold;
color: #333333;
}
.subtitle {
font-size: 28rpx;
color: #999999;
}
.cicon-checkbox {
font-size: 36rpx;
color: var(--ui-BG-Main);
}
.cicon-box {
font-size: 36rpx;
color: #999999;
}
</style>
+459
View File
@@ -0,0 +1,459 @@
<!-- 订单详情 -->
<template>
<s-pages title="订单详情">
<!-- 收货地址 -->
<view class="order-address-box flex-row bg24" v-if="state.orderInfo.receiverAreaId > 0">
<view class="cityImg">
<image :src="`${$url}goods/city.png`" mode="scaleToFill" />
</view>
<view class="size32 c0">
<view class="ss-flex ss-col-center">
<text class="address-username">
{{ state.orderInfo.receiverName }}
</text>
<text class="address-phone">{{ state.orderInfo.receiverMobile }}</text>
</view>
<view class="address-detail size32">
{{ state.orderInfo.receiverAreaName }} {{ state.orderInfo.receiverDetailAddress }}
</view>
</view>
</view>
<view
class="detail-goods"
:style="[{ marginTop: state.orderInfo.receiverAreaId > 0 ? '0' : '-40rpx' }]"
>
<card_order
class="order-goods"
v-if="state?.orderInfo?.items?.length > 0"
:data="state.orderInfo"
type="2"
theme="2"
@getOrderDetail="getOrderDetail"
></card_order>
<!-- 价格信息 -->
<view class="order-price-box bg24">
<view class="notice-item ss-flex ss-row-between" v-for="(v, i) in priceArr" :key="i">
<text class="title c0">{{ v.title }}</text>
<view class="ss-flex">
<text class="detail c0" :class="{ 'all-price': v.value == 'payPrice' }"
><span>{{ v.type == 2 ? '-' : '' }}</span
>¥{{ fen2yuan(state.orderInfo[v.value]) }}</text
>
</view>
</view>
<view
class="notice-item all-rpice-item ss-flex ss-m-t-20"
v-if="state.orderInfo.refundPrice > 0"
>
<text class="title">已退款</text>
<text class="detail all-price">¥{{ fen2yuan(state.orderInfo.refundPrice) }}</text>
</view>
</view>
<!-- 订单信息 -->
<view class="notice-box bg24">
<view class="notice-box__content">
<view class="notice-item--center">
<view class="ss-flex ss-flex-1 flex-row ju-between">
<text class="title c0">订单编号</text>
<text class="detail right c0">{{ state.orderInfo.no }}</text>
</view>
<!-- <button class="ss-reset-button copy-btn" @tap="onCopy">复制</button> -->
<view class="copy" @click.stop="onCopy">
<image :src="`${$url}goods/copy2.svg`" mode="scaleToFill" />
</view>
<truckLine :data="state.orderInfo" :code="1" v-if="state.orderInfo.deliveryTime"></truckLine>
</view>
<view class="notice-item flex-row ju-between">
<text class="title c0">下单时间</text>
<text class="detail right c0">
{{ sheep.$helper.timeFormat(state.orderInfo.createTime, 'yyyy-mm-dd hh:MM:ss') }}
</text>
</view>
<view class="notice-item flex-row ju-between" v-if="state.orderInfo.payTime">
<text class="title c0">支付时间:</text>
<text class="detail right c0">
{{ sheep.$helper.timeFormat(state.orderInfo.payTime, 'yyyy-mm-dd hh:MM:ss') }}
</text>
</view>
<view class="notice-item flex-row ju-between">
<text class="title c0">支付方式</text>
<text class="detail right c0">{{ state.orderInfo.payChannelName || '-' }}</text>
</view>
</view>
</view>
</view>
<su-fixed bottom placeholder bg="bg24" v-if="state.orderInfo.status != 30">
<view class="orderBan flex-column ju-center">
<card_orderBan :data="state.orderInfo" @downData="getOrderDetail" type="2"></card_orderBan>
</view>
</su-fixed>
</s-pages>
</template>
<script setup>
import sheep from '@/sheep';
import { onLoad, onShow } from '@dcloudio/uni-app';
import { reactive, ref } from 'vue';
import { isEmpty } from 'lodash-es';
import {
fen2yuan,
formatOrderStatus,
formatOrderStatusDescription,
handleOrderButtons,
} from '@/sheep/hooks/useGoods';
import OrderApi from '@/sheep/api/trade/order';
import DeliveryApi from '@/sheep/api/trade/delivery';
import PickUpVerify from '@/pages/order/pickUpVerify.vue';
import card_order from '@/components/orderItem/card_order.vue';
import truckLine from '@/components/truckLine/truckLine.vue'
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
const state = reactive({
orderInfo: {},
merchantTradeNo: '', // 商户订单号
comeinType: '', // 进入订单详情的来源类型
});
// ========== 门店自提(核销) ==========
const systemStore = ref({}); // 门店信息
// 复制
const onCopy = () => {
sheep.$helper.copyText(state.orderInfo.no);
};
const pickUpVerifyRef = ref();
async function getOrderDetail() {
let id = state.orderInfo.id;
// 对详情数据进行适配
let res;
if (state.comeinType === 'wechat') {
// TODO 芋艿:【微信物流】微信场景下
res = await OrderApi.getOrderDetail(id, {
merchant_trade_no: state.merchantTradeNo,
});
} else {
res = await OrderApi.getOrderDetail(id);
}
if (res.code === 0) {
state.orderInfo = res.data;
handleOrderButtons(state.orderInfo);
// 配送方式:门店自提
if (res.data.pickUpStoreId) {
const { data } = await DeliveryApi.getDeliveryPickUpStore(res.data.pickUpStoreId);
systemStore.value = data || {};
}
if (state.orderInfo.deliveryType === 2 && state.orderInfo.payStatus) {
pickUpVerifyRef.value && pickUpVerifyRef.value.markCode(res.data.pickUpVerifyCode);
}
} else {
sheep.$router.back();
}
}
onShow(async () => {
//onShow中获取订单列表,保证跳转后页面为最新状态
await getOrderDetail();
});
onLoad(async (options) => {
let id = 0;
if (options.id) {
id = options.id;
}
// TODO 芋艿:【微信物流】下面两个变量,后续接入
state.comeinType = options.comein_type;
if (state.comeinType === 'wechat') {
state.merchantTradeNo = options.merchant_trade_no;
}
state.orderInfo.id = id;
});
const priceArr = ref([
{
title: '商品金额',
value: 'totalPrice',
type: 1,
},
{
title: '消费金抵扣',
value: 'consumptionPrice',
type: 2,
},
{
title: '运费',
value: 'deliveryPrice',
type: 1,
},
{
title: '实付金额',
value: 'payPrice',
type: 1,
},
]);
</script>
<style lang="scss" scoped>
.score-img {
width: 36rpx;
height: 36rpx;
margin: 0 4rpx;
}
.apply-btn {
width: 140rpx;
height: 50rpx;
border-radius: 25rpx;
font-size: 24rpx;
border: 2rpx solid #dcdcdc;
line-height: normal;
margin-left: 16rpx;
}
.state-box {
color: rgba(#fff, 0.9);
width: 100%;
background: v-bind(headerBg) no-repeat,
linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
background-size: 750rpx 100%;
box-sizing: border-box;
.state-img {
width: 60rpx;
height: 60rpx;
margin-right: 20rpx;
}
}
.order-address-box {
background-color: #fff;
border-radius: 12rpx;
margin: 20rpx 32rpx 24rpx 32rpx;
padding: 24rpx 30rpx 24rpx 20rpx;
font-size: 32rpx;
box-sizing: border-box;
color: #1b1b21;
.address-username {
margin-right: 20rpx;
}
.address-detail {
margin-top: 20rpx;
}
}
.detail-goods {
border-radius: 10rpx;
padding: 0 32rpx;
.order-list {
margin-bottom: 20rpx;
background-color: #fff;
.order-card {
padding: 20rpx 0;
.order-sku {
font-size: 24rpx;
font-weight: 400;
color: rgba(153, 153, 153, 1);
width: 450rpx;
margin-bottom: 20rpx;
.order-num {
margin-right: 10rpx;
}
}
.tag-btn {
margin-left: 16rpx;
font-size: 24rpx;
height: 36rpx;
color: var(--ui-BG-Main);
border: 2rpx solid var(--ui-BG-Main);
border-radius: 14rpx;
padding: 0 4rpx;
}
}
}
}
// 订单信息。
.notice-box {
background: #fff;
border-radius: 12rpx;
margin-bottom: 24rpx;
.notice-box__head {
font-size: 30rpx;
font-weight: 500;
color: rgba(51, 51, 51, 1);
line-height: 80rpx;
border-bottom: 1rpx solid #dfdfdf;
padding: 0 25rpx;
}
.notice-box__content {
padding: 20rpx;
.self-pickup-box {
width: 100%;
.self-pickup--img {
width: 200rpx;
height: 200rpx;
margin: 40rpx 0;
}
}
}
.notice-item,
.notice-item--center {
display: flex;
align-items: center;
line-height: normal;
margin-bottom: 36rpx;
.title {
font-size: 28rpx;
color: #3b3b3b;
}
.detail {
font-size: 28rpx;
color: #323232;
flex: 1;
}
}
}
.copy-btn {
width: 100rpx;
line-height: 50rpx;
border-radius: 25rpx;
padding: 0;
background: rgba(238, 238, 238, 1);
font-size: 22rpx;
font-weight: 400;
color: rgba(51, 51, 51, 1);
}
// 订单价格信息
.order-price-box {
background-color: #fff;
border-radius: 12rpx;
padding: 20rpx;
margin-bottom: 24rpx;
.notice-item {
line-height: 70rpx;
.title {
font-size: 28rpx;
color: #3b3b3b;
}
.detail {
font-size: 28rpx;
color: #323232;
font-family: OPPOSANS;
}
}
.all-rpice-item {
justify-content: flex-end;
align-items: center;
.title {
font-size: 26rpx;
font-weight: 500;
color: #3b3b3b;
line-height: normal;
}
}
}
.all-price {
color: #ee0a24 !important;
}
// 底部
.footer-box {
height: 170rpx;
width: 100%;
box-sizing: border-box;
border-radius: 10rpx;
padding-right: 20rpx;
.cancel-btn {
width: 160rpx;
height: 60rpx;
background: #eeeeee;
border-radius: 30rpx;
margin-right: 20rpx;
font-size: 26rpx;
font-weight: 400;
color: #333333;
}
.pay-btn {
width: 160rpx;
height: 60rpx;
font-size: 26rpx;
border-radius: 30rpx;
font-weight: 500;
color: #fff;
}
}
.cityImg {
width: 48rpx;
min-width: 48rpx;
height: 48rpx;
margin-top: 16rpx;
margin-right: 16rpx;
image {
width: 100%;
height: 100%;
}
}
.order-goods {
padding: 24rpx 20rpx;
box-sizing: border-box;
background-color: #fff;
margin-bottom: 24rpx;
border-radius: 12rpx;
}
.right {
text-align: right;
}
.copy {
width: 32rpx;
height: 32rpx;
margin-left: 14rpx;
image {
width: 100%;
height: 100%;
}
}
.orderBan {
height: 140rpx;
width: 100%;
padding: 0 24rpx;
box-sizing: border-box;
box-shadow: 0px -4px 30px 0px rgba(0, 0, 0, 0.1);
}
</style>
+233
View File
@@ -0,0 +1,233 @@
<!-- 物流追踪 -->
<template>
<s-layout title="物流追踪">
<view class="log-wrap">
<!-- 商品信息 -->
<view class="log-card ss-flex ss-m-20 ss-r-10" v-if="goodsImages.length > 0">
<uni-swiper-dot :info="goodsImages" :current="state.current" mode="round">
<swiper class="swiper-box">
<swiper-item v-for="(item, index) in goodsImages" :key="index">
<image class="log-card-img" :src="sheep.$url.static(item.image)" />
</swiper-item>
</swiper>
</uni-swiper-dot>
<view class="log-card-msg">
<!-- TODO 芋艿:【物流】优化点:展示状态 -->
<!-- <view class="ss-flex ss-m-b-8">-->
<!-- <view>物流状态:</view>-->
<!-- <view class="warning-color">{{ state.info.status_text }}</view>-->
<!-- </view>-->
<view class="ss-m-b-8">快递单号:{{ state.info.logisticsNo }}</view>
<view>快递公司:{{ state.info.logisticsName }}</view>
</view>
</view>
<!-- 物流轨迹 -->
<view class="log-content ss-m-20 ss-r-10">
<view
class="log-content-box ss-flex"
v-for="(item, index) in state.tracks"
:key="item.title"
>
<view class="log-icon ss-flex-col ss-col-center ss-m-r-20">
<text class="cicon-title" />
<view v-if="state.tracks.length - 1 !== index" class="line" />
</view>
<view class="log-content-msg">
<!-- TODO 芋艿:【物流】优化点:展示状态 -->
<!-- <view class="log-msg-title ss-m-b-20">-->
<!-- {{ item.status_text }}-->
<!-- </view>-->
<!-- <view class="log-msg-desc ss-m-b-16">{{ item.content }}</view>-->
<view class="log-msg-desc ss-m-b-16">
<highlight-number :content="item.content" @phone-click="handlePhoneClick" />
<!-- <rich-text :nodes="item.content"></rich-text>-->
</view>
<view class="log-msg-date ss-m-b-40">
{{ sheep.$helper.timeFormat(item.time, 'yyyy-mm-dd hh:MM:ss') }}
</view>
</view>
</view>
</view>
</view>
</s-layout>
</template>
<script setup>
import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app';
import { computed, reactive } from 'vue';
import OrderApi from '@/sheep/api/trade/order';
import HighlightNumber from '@/pages/components/HighlightNumberText.vue';
const state = reactive({
info: [],
tracks: [],
});
const goodsImages = computed(() => {
let array = [];
if (state.info.items) {
state.info.items.forEach((item) => {
array.push({
image: item.picUrl,
});
});
}
return array;
});
async function getExpressDetail(id) {
const { data } = await OrderApi.getOrderExpressTrackList(id);
state.tracks = data;
}
async function getOrderDetail(id) {
const { data } = await OrderApi.getOrderDetail(id);
state.info = data;
}
onLoad((options) => {
getExpressDetail(options.id);
getOrderDetail(options.id);
});
function handlePhoneClick(data) {
handleClick(data);
}
function handleClick(data) {
const phoneNumber = data.phoneNumber;
if (!phoneNumber) return;
// 获取当前平台
const platform = uni.getSystemInfoSync().platform.toLowerCase();
if (platform === 'devtools') {
uni.showToast({ title: '真机才可拨打电话', icon: 'none' });
handleCopy(phoneNumber);
return;
}
if (platform === 'wechat') {
uni.showToast({ title: '请手动拨打', icon: 'none' });
handleCopy(phoneNumber);
return;
}
uni.makePhoneCall({
phoneNumber: phoneNumber,
success: () => {
console.log('拨打电话成功');
},
fail: (err) => {
console.error('拨打电话失败', err);
uni.showToast({ title: '拨号失败,请手动拨打', icon: 'none' });
handleCopy(phoneNumber);
},
});
}
function handleCopy(text) {
uni.setClipboardData({
data: text,
success: () => {
uni.showToast({ title: '已复制到剪贴板', icon: 'success' });
},
fail: () => {
uni.showToast({ title: '复制失败', icon: 'none' });
},
});
}
</script>
<style lang="scss" scoped>
.highlight {
color: red; /* 高亮颜色 */
font-weight: bold;
}
.swiper-box {
width: 200rpx;
height: 200rpx;
}
.log-card {
border-top: 2rpx solid rgba(#dfdfdf, 0.5);
padding: 20rpx;
background: #fff;
margin-bottom: 20rpx;
.log-card-img {
width: 200rpx;
height: 200rpx;
margin-right: 20rpx;
}
.log-card-msg {
font-size: 28rpx;
font-weight: 500;
width: 490rpx;
color: #333333;
.warning-color {
color: #999;
}
}
}
.log-content {
padding: 34rpx 20rpx 0rpx 20rpx;
background: #fff;
.log-content-box {
align-items: stretch;
}
.log-icon {
height: inherit;
.cicon-title {
color: #ccc;
font-size: 40rpx;
}
.activity-color {
color: #f0c785;
font-size: 40rpx;
}
.info-color {
color: #ccc;
font-size: 40rpx;
}
.line {
width: 1px;
height: 100%;
background: #d8d8d8;
}
}
.log-content-msg {
.log-msg-title {
font-size: 28rpx;
font-weight: bold;
color: #333333;
}
.log-msg-desc {
font-size: 24rpx;
font-weight: 400;
color: #333333;
line-height: 36rpx;
}
.log-msg-date {
font-size: 24rpx;
font-weight: 500;
color: #000000;
}
}
}
</style>
+265
View File
@@ -0,0 +1,265 @@
<!-- 订单列表 -->
<template>
<s-layout title="我的订单">
<card_pages
ref="cardPages"
:navList="tabMaps"
:currentTab="state.currentTab"
@upCallback="getData"
:pageSize="state.pageSize"
:height="height"
:oneShow="true"
>
<template #nav>
<view class="nav">
<scroll-view scroll-x show-scrollbar="false" class="scroll-x-wrapper w100 nowrap p-x-32">
<view class="flex-center ju-flex-start nowrap" style="width: auto">
<view
class="center flex-center m-r-58"
v-for="(v, i) in tabMaps"
:key="i"
@click="navChange(i)"
>
<view class="navItem size32" :class="{ activeItem: state.currentTab === i }">
{{ v.name }}
</view>
</view>
</view>
</scroll-view>
<view class="search flex-center">
<view class="flex1" style="background-color: #fff; border-radius: 32rpx"
><uni-easyinput
prefixIcon="search"
v-model="state.obj.keyWord"
placeholder="搜索商品名称/订单编号"
@iconClick="iconClick"
>
</uni-easyinput
></view>
<view class="searchBtn size32 c0" @click="downCallback(state.currentTab)">搜索</view>
</view>
</view>
</template>
<template #content>
<view class="orderCon" id="orderCon">
<view class="orderItem" v-for="(v, i) in state.list[state.currentTab]" :key="i">
<orderItem
:data="v"
@downData="downCallback(state.currentTab)"
:index="state.currentTab"
>
</orderItem>
</view>
</view>
</template>
</card_pages>
</s-layout>
</template>
<script setup>
import { ref, reactive, getCurrentInstance, onMounted } from 'vue';
import { onLoad, onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
import orderItem from '@/components/orderItem/orderItem.vue';
import {
fen2yuan,
formatOrderColor,
formatOrderStatus,
handleOrderButtons,
} from '@/sheep/hooks/useGoods';
import sheep from '@/sheep';
import _ from 'lodash-es';
import { isEmpty } from 'lodash-es';
import OrderApi from '@/sheep/api/trade/order';
import AfterSaleApi from '@/sheep/api/trade/afterSale';
import { resetPagination } from '@/sheep/helper/utils';
const instance = getCurrentInstance();
let cardPages = ref(null);
// 数据
const state = reactive({
currentTab: 0, // 选中的 tabMaps 下标
list: {},
pageSize: 10,
loadStatus: '',
obj: {
keyWord: '',
},
});
const tabMaps = [
{
id: 0,
name: '全部',
},
{
id: 1,
name: '待支付',
value: 0,
},
{
id: 10,
name: '待发货',
value: '10',
},
{
id: 2,
name: '待收货',
value: '20',
},
{
id: 3,
name: '已完成',
value: '30',
},
{
id: 4,
name: '退换/售后',
value: '50,60',
},
];
let dataList = ref([]);
async function getData(mescroll) {
let code = null;
let data = null;
dataList.value = [];
if (mescroll.dataObj.status != '50,60') {
let res = await OrderApi.getOrderPage({
pageNo: mescroll.num,
pageSize: mescroll.size,
status: mescroll.dataObj.status,
...state.obj,
});
code = res.code;
dataList.value[mescroll.dataObj.i] = res.data;
} else {
let res = await AfterSaleApi.getAfterSalePage({
pageNo: mescroll.num,
pageSize: mescroll.size,
});
code = res.code;
dataList.value[mescroll.dataObj.i] = res.data;
}
if (code !== 0) {
if (cardPages.value) {
cardPages.value.getState(false);
}
return;
}
dataList.value[mescroll.dataObj.i].list.forEach((order) => handleOrderButtons(order));
if (mescroll.num == 1) state.list[mescroll.dataObj.i] = [];
state.list[mescroll.dataObj.i] = state.list[mescroll.dataObj.i].concat(
dataList.value[mescroll.dataObj.i].list,
);
if (cardPages.value) {
cardPages.value.getState(true, dataList.value[mescroll.dataObj.i].list.length);
}
}
onLoad(async (options) => {
if (options.type) {
state.currentTab = Number(options.type);
}
// await getOrderList();
});
let sysInfo = uni.getSystemInfoSync();
let height =
sysInfo.windowHeight - sysInfo.statusBarHeight - uni.upx2px(100) - uni.upx2px(200) + 'px';
onMounted(() => {});
// 加载更多
function loadMore() {
if (state.loadStatus === 'noMore') {
return;
}
state.pagination.pageNo++;
getOrderList();
}
// 上拉加载更多
// onReachBottom(() => {
// loadMore();
// });
const navChange = (i) => {
state.currentTab = i;
console.log(state);
// if(cardPages.value){
// cardPages.value.downCallback()
// }
};
const downCallback = (i) => {
if (i && i === 0) {
navChange(i);
}
if (cardPages.value) {
cardPages.value.downCallback();
}
};
const iconClick = (e) => {
if (e == 'preefix') {
state.obj.keyWord = '';
downCallback(state.currentTab);
}
};
onShow(() => {
if (cardPages.value) {
cardPages.value.downCallback();
}
});
</script>
<style lang="scss" scoped>
.scroll-x-wrapper {
width: 100%;
white-space: nowrap;
}
.navItem {
padding: 18rpx 0;
}
.activeItem {
color: #ff3c48;
border-bottom: 6rpx solid #ff3c48;
}
.nav {
height: 200rpx;
background-color: #fff;
}
.search {
padding: 0 32rpx;
box-sizing: border-box;
margin-top: 32rpx;
margin-bottom: 16rpx;
}
.searchBtn {
margin-left: 16rpx;
}
:deep(.is-input-border) {
height: 72rpx;
border-radius: 36rpx;
background-color: #f7f8fa;
border: none;
}
:deep(.is-input-border) {
background: rgba(255, 255, 255, 0.34);
}
.orderCon {
padding: 32rpx 24rpx;
box-sizing: border-box;
// overflow: hidden;
}
.orderItem {
margin-bottom: 24rpx;
}
</style>
+260
View File
@@ -0,0 +1,260 @@
<template>
<view class="order-details">
<!-- 自提商品核销 -->
<view v-if="orderInfo.deliveryType === 2 && orderInfo.payStatus" class="writeOff borRadius14">
<view class="title">核销信息</view>
<view class="grayBg flex-center">
<view class="pictrue">
<image
v-if="!!painterImageUrl"
:src="painterImageUrl"
:style="{ width: `${state.qrcodeSize}px`, height: `${state.qrcodeSize}px` }"
:show-menu-by-longpress="true"
/>
</view>
</view>
<view class="gear">
<image :src="sheep.$url.static('/static/img/shop/writeOff.png')"></image>
</view>
<view class="num">{{ orderInfo.pickUpVerifyCode }}</view>
<view class="rules">
<view class="item">
<view class="rulesTitle flex flex-wrap align-center"> 核销时间 </view>
<view class="info">
每日:
<text class="time">{{ systemStore.openingTime }} - {{ systemStore.closingTime }}</text>
</view>
</view>
<view class="item">
<view class="rulesTitle flex flex-wrap align-center">
<text class="iconfont icon-shuoming1"></text>
使用说明
</view>
<view class="info">可将二维码出示给店员扫描或提供数字核销码</view>
</view>
</view>
</view>
<view
v-if="orderInfo.deliveryType === 2"
class="map flex flex-wrap align-center ss-row-between borRadius14"
>
<view>自提地址信息</view>
<view class="place cart-color flex flex-wrap flex-center" @tap="showMaoLocation">
查看位置
</view>
</view>
<!-- 海报画板:默认隐藏只用来生成海报。生成方式为主动调用 -->
<l-painter
v-if="showPainter"
isCanvasToTempFilePath
pathType="url"
@success="setPainterImageUrl"
hidden
ref="painterRef"
/>
</view>
</template>
<script setup>
import sheep from '@/sheep';
import { reactive, ref } from 'vue';
const props = defineProps({
orderInfo: {
type: Object,
default() {},
},
systemStore: {
type: Object,
default() {},
},
});
const state = reactive({
qrcodeSize: 145,
});
/**
* 打开地图
*/
const showMaoLocation = () => {
if (!props.systemStore.latitude || !props.systemStore.longitude) {
sheep.$helper.toast('缺少经纬度信息无法查看地图!');
return;
}
uni.openLocation({
latitude: props.systemStore.latitude,
longitude: props.systemStore.longitude,
scale: 8,
name: props.systemStore.name,
address: props.systemStore.areaName + props.systemStore.detailAddress,
});
};
/**
* 拨打电话
*/
const makePhone = () => {
uni.makePhoneCall({
phoneNumber: props.systemStore.phone,
});
};
const painterRef = ref(); // 海报画板
const painterImageUrl = ref(); // 海报 url
const showPainter = ref(true);
// 渲染海报
const renderPoster = async (poster) => {
await painterRef.value.render(poster);
};
// 获得生成的图片
const setPainterImageUrl = (path) => {
painterImageUrl.value = path;
showPainter.value = false;
};
/**
* 生成核销二维码
*/
const markCode = (text) => {
renderPoster({
css: {
width: `${state.qrcodeSize}px`,
height: `${state.qrcodeSize}px`,
},
views: [
{
type: 'qrcode',
text: text,
css: {
width: `${state.qrcodeSize}px`,
height: `${state.qrcodeSize}px`,
},
},
],
});
};
defineExpose({
markCode,
});
</script>
<style scoped lang="scss">
.borRadius14 {
border-radius: 14rpx !important;
}
.cart-color {
color: #e93323 !important;
border: 1px solid #e93323 !important;
}
.order-details {
border-radius: 10rpx;
margin: 0 20rpx 20rpx 20rpx;
}
.order-details .writeOff {
background-color: #fff;
margin-top: 15rpx;
padding-bottom: 50rpx;
}
.order-details .writeOff .title {
font-size: 30rpx;
color: #282828;
height: 87rpx;
border-bottom: 1px solid #f0f0f0;
padding: 0 24rpx;
line-height: 87rpx;
}
.order-details .writeOff .grayBg {
background-color: #f2f5f7;
width: 590rpx;
height: 384rpx;
border-radius: 20rpx 20rpx 0 0;
margin: 50rpx auto 0 auto;
padding-top: 55rpx;
}
.order-details .writeOff .grayBg .pictrue {
width: 290rpx;
height: 290rpx;
}
.order-details .writeOff .grayBg .pictrue image {
width: 100%;
height: 100%;
}
.order-details .writeOff .gear {
width: 590rpx;
height: 30rpx;
margin: 0 auto;
}
.order-details .writeOff .gear image {
width: 100%;
height: 100%;
}
.order-details .writeOff .num {
background-color: #f0c34c;
width: 590rpx;
height: 84rpx;
color: #282828;
font-size: 48rpx;
margin: 0 auto;
border-radius: 0 0 20rpx 20rpx;
text-align: center;
padding-top: 4rpx;
}
.order-details .writeOff .rules {
margin: 46rpx 30rpx 0 30rpx;
border-top: 1px solid #f0f0f0;
padding-top: 10rpx;
}
.order-details .writeOff .rules .item {
margin-top: 20rpx;
}
.order-details .writeOff .rules .item .rulesTitle {
font-size: 28rpx;
color: #282828;
}
.order-details .writeOff .rules .item .rulesTitle .iconfont {
font-size: 30rpx;
color: #333;
margin-right: 8rpx;
margin-top: 5rpx;
}
.order-details .writeOff .rules .item .info {
font-size: 28rpx;
color: #999;
margin-top: 7rpx;
}
.order-details .writeOff .rules .item .info .time {
margin-left: 20rpx;
}
.order-details .map {
height: 86rpx;
font-size: 30rpx;
color: #282828;
line-height: 86rpx;
border-bottom: 1px solid #f0f0f0;
margin-top: 15rpx;
background-color: #fff;
padding: 0 24rpx;
}
.order-details .map .place {
font-size: 26rpx;
width: 176rpx;
height: 50rpx;
border-radius: 25rpx;
line-height: 50rpx;
text-align: center;
}
</style>