Merge remote-tracking branch 'origin/master-vue3' into master-vue3

pull/28/head
owen 2023-12-15 12:08:10 +08:00
commit 062ede78a2
59 changed files with 4887 additions and 4961 deletions

View File

@ -260,16 +260,6 @@
"auth": true,
"title": "物流轨迹"
}
},
{
"path": "express/list",
"style": {
"navigationBarTitleText": "订单包裹"
},
"meta": {
"auth": true,
"title": "订单包裹"
}
}
]
},

View File

@ -13,36 +13,48 @@
</view>
</view>
<view class='list acea-row row-between-wrapper'
style='padding: 0 30rpx; height:240rpx;display: flex;justify-content: space-between;align-items: center;'>
<view class='item' v-for="(item,index) in state.signConfigList" :key="index">
<!-- (index + 1 === state.signConfigList.length ? 'reward' : '') + -->
<view :class=" ' ' +( state.continuousDay >= item.day ? 'rewardTxt' : '')">
{{item.day}}
</view>
<view class='venus'
:class="(index + 1 === state.signConfigList.length ? 'reward' : '') + ' ' +( state.continuousDay >= item.day ? 'venusSelect' : '')">
</view>
<view class='num' :class='state.continuousDay >= item.day ? "on" : ""'>+{{ item.point }}
</view>
</view>
</view>
<!-- 切换年月 -->
<view class="bar ss-flex ss-col-center ss-row-center">
<!-- <view class="bar ss-flex ss-col-center ss-row-center">
<view class="previous" @tap="handleCalendar(0)"><text class="cicon-back"></text></view>
<view class="date ss-m-x-20">{{ state.cur_year || '--' }} {{ state.cur_month || '--' }} </view>
<view class="next" @tap="handleCalendar(1)"><text class="cicon-forward"></text></view>
</view>
</view> -->
<!-- 显示星期 -->
<view class="week ss-flex">
<!-- <view class="week ss-flex">
<view class="week-item ss-flex ss-row-center" v-for="(item, index) in state.weeks_ch" :key="index">
{{ item.title }}
</view>
</view>
</view> -->
<!-- 日历表 -->
<view class="myDateTable">
<view v-for="(item, j) in state.data.days" :key="j" class="dateCell ss-flex ss-row-center ss-col-center">
<!-- 空格 -->
<!-- <view v-for="(item, j) in state.data.days" :key="j"
class="dateCell ss-flex ss-row-center ss-col-center">
<view class="ss-flex ss-row-center ss-col-center">
<text :decode="true">&nbsp;&nbsp;</text>
</view>
<view>
<!-- 已签到日期 -->
<view v-if="item.is_sign" class="is-sign ss-flex ss-row-center">
<view class="is-sign-num">{{ item.day < 10 ? '0' + item.day : item.day }}</view>
<image class="is-sign-image" :src="sheep.$url.static('/static/img/shop/app/correct.png')">
<image class="is-sign-image"
:src="sheep.$url.static('/static/img/shop/app/correct.png')">
</image>
</view>
<!-- 未签到日期 -->
<view class="is-sign ss-flex ss-row-center" v-if="item.is_replenish == 1"
@tap="onShowRetroactive(item.date)">
<view class="cell-num">{{ item.day < 10 ? '0' + item.day : item.day }}</view>
@ -52,7 +64,7 @@
<view class="cell-num">{{ item.day < 10 ? '0' + item.day : item.day }}</view>
</view>
</view>
</view>
</view> -->
<!-- 签到按钮 -->
<view class="ss-flex ss-col-center ss-row-center sign-box ss-m-y-40">
@ -124,13 +136,21 @@
</template>
<script setup>
import sheep from '@/sheep';
import { onLoad, onReady } from '@dcloudio/uni-app';
import { computed, reactive } from 'vue';
import sheep from '@/sheep';
import {
onLoad,
onReady
} from '@dcloudio/uni-app';
import {
computed,
reactive
} from 'vue';
const headerBg = sheep.$url.css('/static/img/shop/app/sign.png');
const headerBg = sheep.$url.css('/static/img/shop/app/sign.png');
const state = reactive({
const state = reactive({
signConfigList: [],
continuousDay: [],
data: {
days: [], //
rules: {}, //
@ -138,8 +158,7 @@ const state = reactive({
cur_year: 0, //
cur_month: 0, //
cur_day: 0, //
weeks_ch: [
{
weeks_ch: [{
title: '日',
value: '0',
},
@ -175,38 +194,52 @@ const state = reactive({
date: '', //
isSign: 0, //
loading: true,
});
async function onSign() {
const { error, data } = await sheep.$api.activity.signAdd();
});
async function onSign() {
//
const {
code: error,
data
} = await sheep.$api.activity.signAdd();
if (error === 0) {
state.showModel = true;
state.signin = data;
// getData();
}
}
}
function onShowRetroactive(e) {
function onShowRetroactive(e) {
state.showRetroactive = true;
state.date = e;
}
//
function onConfirm() {
}
//
function onConfirm() {
state.showModel = false;
getData();
}
//
async function onRetroactive() {
const { error, data } = await sheep.$api.activity.replenish({
}
//
async function onRetroactive() {
const {
error,
data
} = await sheep.$api.activity.replenish({
date: state.date,
});
if (error === 0) {
state.showRetroactive = false;
getData();
}
}
}
async function getData(mouth) {
const { error, data } = await sheep.$api.activity.signList(mouth);
async function getData(mouth) {
const {
error,
data
} = await sheep.$api.activity.signList(mouth);
const res = await sheep.$api.activity.configLise();
const res2 = await sheep.$api.activity.recordPage();
//
const ren = await sheep.$api.activity.getSummary();
if (error === 0) {
state.data = data;
} else {
@ -236,16 +269,23 @@ async function getData(mouth) {
}
});
}
state.continue_days = data.continue_days;
if (res.code == 0) {
state.signConfigList = res.data;
}
if (res2.code == 0) {
state.continuousDay = res2.data.list;
}
state.isSign = ren.data.todaySignIn ? 1 : 0;
state.continue_days = ren.data.continuousDay;
}
}
}
onReady(() => {
onReady(() => {
getData();
});
});
//
const handleCalendar = (type) => {
//
const handleCalendar = (type) => {
const cur_year = parseInt(state.cur_year);
const cur_month = parseInt(state.cur_month);
var newMonth;
@ -271,16 +311,16 @@ const handleCalendar = (type) => {
getData({
month: newYear + '-' + newMonth,
});
};
};
</script>
<style lang="scss" scoped>
.header-box {
.header-box {
border-top: 2rpx solid rgba(#dfdfdf, 0.5);
}
}
//
.calendar {
//
.calendar {
background: #fff;
.sign-everyday {
@ -359,9 +399,9 @@ const handleCalendar = (type) => {
color: rgba(51, 51, 51, 1);
}
}
}
}
.is-sign {
.is-sign {
width: 48rpx;
height: 48rpx;
position: relative;
@ -380,26 +420,26 @@ const handleCalendar = (type) => {
width: 48rpx;
height: 48rpx;
}
}
}
.cell-num {
.cell-num {
font-size: 24rpx;
font-family: OPPOSANS;
font-weight: 500;
color: #333333;
line-height: normal;
}
}
.cicon-title {
.cicon-title {
position: absolute;
right: -10rpx;
top: -6rpx;
font-size: 20rpx;
color: red;
}
}
//
.sign-box {
//
.sign-box {
height: 140rpx;
width: 100%;
@ -421,9 +461,9 @@ const handleCalendar = (type) => {
font-size: 30rpx;
font-weight: 500;
}
}
}
.model-box {
.model-box {
width: 520rpx;
// height: 590rpx;
background: linear-gradient(177deg, #ff6000 0%, #fe832a 100%);
@ -493,20 +533,69 @@ const handleCalendar = (type) => {
line-height: normal;
}
}
}
}
//
.activity-title {
//
.activity-title {
font-size: 32rpx;
font-weight: 500;
color: #333333;
line-height: normal;
}
}
.activity-des {
.activity-des {
font-size: 26rpx;
font-weight: 500;
color: #666666;
line-height: 40rpx;
}
}
.reward {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAAA4CAYAAAC1+AWFAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQyIDc5LjE2MDkyNCwgMjAxNy8wNy8xMy0wMTowNjozOSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowYWFmYjU3Mi03MGJhLTRiNDctOTI2Yi0zOThlZDkzZDkxMDkiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RUEyNzZEM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width: 75rpx;
height: 56rpx;
}
.rewardTxt {
width: 74rpx;
height: 32rpx;
background-color: #f4b409;
border-radius: 16rpx;
font-size: 20rpx;
color: #a57d3f;
line-height: 32rpx;
}
.venusSelect {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQyIDc5LjE2MDkyNCwgMjAxNy8wNy8xMy0wMTowNjozOSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowYWFmYjU3Mi03MGJhLTRiNDctOTI2Yi0zOThlZDkzZDkxMDkiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QzkwRkI4NEFEMDFCMTFFODhDNDdBMDVGOTBBN0U2NTQiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QzkwRkI4NDlEMDFCMTFFODhDNDdBMDVGOTBBN0U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/EBr8Nl5ZUO6jPJRGCg0dJie/d3WbPZlMpPMwpZsN0Y2sOVb7PcOzou22CGe3u7fB3J3Cd+udvvScG9soT0Kt13tAZj4UVRwHmWtZClcj+azX6vxx0GN8ECUFyHjnsEp+KlM8b3TBTKBCDqkA/SIFV20jCbO3duk8OIcgHF7G9ttbinVYFLcTBgeAAP+vc4mAkJVywLibARpZvOjWWA36rApYSI1+DSMhltkJPpRGIyJrXAZeWiWiCnk9kNU4RGl8m5MN1VLFzwWKobLm83kQtZbnMb8lgYJ2aIYH//3g73lEHQ5ECAXYUSu7QWZeCKqmoCcqSyPkQgd8lHbne3uSMRbWenSwNtU476BxtT9oJQOZ3OKKloq6SmmXBlyoZKb3nG4wnXyt1ul9261UkN9ggjvd497mDOz885KGN3pfvKg1OuixY15JCHh2/ymFjUms2AMqD9BFB/qwUQg5ZtrVY9b7H/LxtmZSCbaCr9KgGmpEeG6qpzM2tQBHudb5eKNLfKiUMzgAIyL6uRreHklB9qX4MDlQfLpHUV4AY6AB+rzl4ZyIqa+0aHiX6UlDTwMcK2CqQoEGmEE5+RfFK4N636vWjKh0Cp5ceS38k8JXko8yHQ7W7PXKBPBvYwGegNF4/q12g05mV7HXClqgs1ffEr+/LmaTIx0nCb+uI3U5M64Tadi5aBrBXORLKdB1k7nKndhID8GqUaErze/coEXJ1OJm9CY2bw3wr+FGAAoa6PIUihovYAAAAASUVORK5CYII=');
background-repeat: no-repeat;
background-size: 100% 100%;
width: 56rpx;
height: 56rpx;
margin: 10rpx 0;
}
.num {
font-size: 36rpx;
font-family: 'Guildford Pro';
}
.item {
align-items: center;
justify-content: space-between;
border-bottom: 1px solid #eee;
height: 130rpx;
}
.reward {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAAA4CAYAAAC1+AWFAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2t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pK8dWUYXhN2mwEdCWEwsL1rFjTeV1EFosLp5ixv3BgwcMmsndueXlZV9L9UridqoafFwIYNKQ0509+3TU40WThpxtdXWFwzKrwWdxtykBrPFkb2dRdweApK1erxvDCltoP2IPv8eQGJbwiOK+4YxuCabS/jDNQgkINldDwSNhFVWBIaDJ/YatWlaqn4UWAYbqoTh8FZ8Fxlo0gdUOrg6LgxSxjsruIC5L+VyVUVNBYZmCMkYrMI0KLGrLxOMhzN9RlTqCEhUYjsfjI9MoPyAeKNMl1bgVzzmg6P+diWbd5BXUS3IFVbFV8XzWXBiwqGg+ac0+rESs6bGxU1I9nxVn4G9FnSylR1e13ElIpK0DzBQUb0hh3iS5nkZ7s3i0+zqHZdR0csmUoJBevJ0WVCaweLuYZjBRwFKC8jioH7OYZCawSLsGJLg5i/tswWwX79fp8wKE27cbKmDI/YRDwBHvFaBw7px0vUJEvxesHD7aLaBd5QPc4H+6jff87+I7yFnOq4DB7eMuTLvdYbfuFWEAzjnPryE3Zb9pzIPSUUzxtzvLJH9a4b+hqfPJvKB5zRsccidlv+awZvyzX11gOqDMVvU/9LPf0C15FKBmarOmACw3oPICSwb2OQlu4+Cxv8/yBCoPNitsAcdWDv9Vwb8CDACdCFE+P8dk8gAAAABJRU5ErkJggg==');
width: 75rpx;
height: 56rpx;
}
</style>

View File

@ -6,38 +6,26 @@
<view class="detail-wrap ss-p-20">
<view class="detail-box">
<view class="tag-box ss-flex ss-col-center ss-row-center">
<image
class="tag-image"
:src="sheep.$url.static('/static/img/shop/app/coupon_icon.png')"
mode="aspectFit"
></image>
<image class="tag-image" :src="sheep.$url.static('/static/img/shop/app/coupon_icon.png')"
mode="aspectFit"></image>
</view>
<view class="top ss-flex-col ss-col-center">
<view class="title ss-m-t-50 ss-m-b-20 ss-m-x-20">{{ state.list.name }}</view>
<view class="subtitle ss-m-b-50">{{ state.list.amount_text }}</view>
<button
class="ss-reset-button ss-m-b-30"
:class="
<view class="subtitle ss-m-b-50">{{ state.list.enough }}{{ state.list.amount }}</view>
<!-- (state.list.get_status != 'can_get' && state.list.get_status != 'can_use') ||
state.userCouponId -->
<button class="ss-reset-button ss-m-b-30" :class="
state.list.get_status == 'can_get' || state.list.get_status == 'can_use'
? 'use-btn'
: 'disable-btn'
"
:disabled="
(state.list.get_status != 'can_get' && state.list.get_status != 'can_use') ||
state.userCouponId
"
@click="getCoupon"
>
{{ state.list.get_status_text }}
: 'disable-btn' " :disabled="state.list.status_text=='已过期'" @click="getCoupon">
<!-- {{ state.list.get_status_text }} -->
立即使用
</button>
<view
class="time ss-m-y-30"
v-if="
<view class="time ss-m-y-30" v-if="
state.list.get_status == 'can_get' ||
state.list.get_status == 'cannot_get' ||
state.list.get_status == 'get_over'
"
>
">
领取时间{{ state.list.get_start_time }}{{ state.list.get_end_time }}
</view>
<view class="time ss-m-y-30" v-else>
@ -61,79 +49,51 @@
</view>
</view>
<!-- 适用商品 -->
<view
class="all-user ss-flex ss-row-center ss-col-center"
v-if="state.list.use_scope == 'all_use'"
>
<view class="all-user ss-flex ss-row-center ss-col-center" v-if="state.list.use_scope == 'all_use'">
{{ state.list.use_scope_text }}
</view>
<su-sticky v-else bgColor="#fff">
<view class="goods-title ss-p-20">{{ state.list.use_scope_text }}</view>
<su-tabs
:scrollable="true"
:list="state.tabMaps"
@change="onTabsChange"
:current="state.currentTab"
v-if="state.list.use_scope == 'category'"
></su-tabs>
<su-tabs :scrollable="true" :list="state.tabMaps" @change="onTabsChange" :current="state.currentTab"
v-if="state.list.use_scope == 'category'"></su-tabs>
</su-sticky>
<view v-if="state.list.use_scope == 'goods' || state.list.use_scope == 'disabled_goods'">
<view v-for="(item, index) in state.list.items_value" :key="index">
<s-goods-column
class="ss-m-20"
size="lg"
:data="item"
<s-goods-column class="ss-m-20" size="lg" :data="item"
:titleColor="props.goodsFieldsStyle?.title?.color"
:subTitleColor="props.goodsFieldsStyle?.subtitle?.color"
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
:goodsFields="{
@click="sheep.$router.go('/pages/goods/index', { id: item.id })" :goodsFields="{
title: { show: true },
subtitle: { show: true },
price: { show: true },
original_price: { show: true },
sales: { show: true },
stock: { show: false },
}"
:buttonShow="state.list.use_scope != 'disabled_goods'"
></s-goods-column>
}" :buttonShow="state.list.use_scope != 'disabled_goods'"></s-goods-column>
</view>
</view>
<view v-if="state.list.use_scope == 'category'">
<view v-for="(item, index) in state.pagination.data" :key="index">
<s-goods-column
class="ss-m-20"
size="lg"
:data="item"
<s-goods-column class="ss-m-20" size="lg" :data="item"
:titleColor="props.goodsFieldsStyle?.title?.color"
:subTitleColor="props.goodsFieldsStyle?.subtitle?.color"
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
:goodsFields="{
@click="sheep.$router.go('/pages/goods/index', { id: item.id })" :goodsFields="{
title: { show: true },
subtitle: { show: true },
price: { show: true },
original_price: { show: true },
sales: { show: true },
stock: { show: false },
}"
:buttonShow="state.list.use_scope != 'disabled_goods'"
></s-goods-column>
}" :buttonShow="state.list.use_scope != 'disabled_goods'"></s-goods-column>
</view>
</view>
<uni-load-more
v-if="state.pagination.total > 0 && state.list.use_scope == 'category'"
:status="state.loadStatus"
:content-text="{
<uni-load-more v-if="state.pagination.total > 0 && state.list.use_scope == 'category'"
:status="state.loadStatus" :content-text="{
contentdown: '上拉加载更多',
}"
@tap="loadmore"
/>
<s-empty
v-if="state.list.use_scope == 'category' && state.pagination.total === 0"
paddingTop="0"
icon="/static/soldout-empty.png"
text="暂无商品"
>
}" @tap="loadmore" />
<s-empty v-if="state.list.use_scope == 'category' && state.pagination.total === 0" paddingTop="0"
icon="/static/soldout-empty.png" text="暂无商品">
</s-empty>
</view>
</s-layout>
@ -141,8 +101,13 @@
<script setup>
import sheep from '@/sheep';
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
import { reactive } from 'vue';
import {
onLoad,
onReachBottom
} from '@dcloudio/uni-app';
import {
reactive
} from 'vue';
import _ from 'lodash';
const pagination = {
@ -170,7 +135,7 @@
const props = defineProps({
includes: {
type: Array,
default() {
default () {
return [];
},
},
@ -180,11 +145,11 @@
},
goodsFieldsStyle: {
type: Object,
default() {},
default () {},
},
buyData: {
type: Object,
default() {},
default () {},
},
});
@ -216,7 +181,10 @@
}
}
async function getCoupon() {
const { error, msg } = await sheep.$api.coupon.get(state.couponId);
const {
error,
msg
} = await sheep.$api.coupon.get(state.couponId);
if (error === 0) {
uni.showToast({
title: msg,
@ -227,10 +195,15 @@
}
}
async function getCouponContent(id, c) {
const { data } = await sheep.$api.coupon.detail(id, c);
const {
data
} = await sheep.$api.coupon.detail(id, c);
state.list = data;
data.items_value.forEach((i) => {
state.tabMaps.push({ name: i.name, value: i.id });
state.tabMaps.push({
name: i.name,
value: i.id
});
});
state.pagination = pagination;
if (state.list.use_scope == 'category') {
@ -244,6 +217,12 @@
}
}
onLoad((options) => {
if (options.data) {
let data = JSON.parse(options.data);
console.log(data);
state.list = data;
return;
}
state.couponId = options.id;
state.userCouponId = options.user_coupon_id;
getCouponContent(state.couponId, state.userCouponId);
@ -262,13 +241,11 @@
}
.detail-wrap {
background: linear-gradient(
180deg,
background: linear-gradient(180deg,
var(--ui-BG-Main),
var(--ui-BG-Main-gradient),
var(--ui-BG-Main),
#fff
);
#fff);
}
.detail-box {
@ -276,6 +253,7 @@
border-radius: 6rpx;
position: relative;
margin-top: 100rpx;
.tag-box {
width: 140rpx;
height: 140rpx;

View File

@ -7,12 +7,11 @@
<s-empty v-if="state.pagination.total === 0" icon="/static/coupon-empty.png" text="暂无优惠券"></s-empty>
<template v-if="state.currentTab == '0'">
<view v-for="item in state.pagination.list" :key="item.id">
<s-coupon-list :data="item">
<!-- @tap="
<s-coupon-list :data="item" @tap="
sheep.$router.go('/pages/coupon/detail', {
id: item.id,
})
" -->
data: JSON.stringify(item),
})">
<template #default>
<button class="ss-reset-button card-btn ss-flex ss-row-center ss-col-center"
:class="item.get_status != 'can_get' ? 'border-btn' : ''" @click.stop="getBuy(item.id)"
@ -26,12 +25,12 @@
</template>
<template v-else>
<view v-for="item in state.pagination.list" :key="item.id">
<s-coupon-list :data="item" type="user">
<!-- @tap="
<s-coupon-list :data="item" type="user" @tap="
sheep.$router.go('/pages/coupon/detail', {
id: item.id,
data: JSON.stringify(item),
})
" -->
">
<template #default>
<button class="ss-reset-button card-btn ss-flex ss-row-center ss-col-center" :class="
item.status == 'can_get' || item.status == 'can_use'
@ -148,19 +147,14 @@
});
if (res.code === 0) {
//
let obj2 = {
2: '折扣',
1: '满减'
}
let obj = {
1: '可用',
2: '已用',
3: '过期'
}
let obj3 = {
1: '已领取',
2: '已使用',
3: '已过期'
let obj2 = {
1: '满减',
2: '折扣'
}
res.data.list = res.data.list.map(item => {
return {

View File

@ -3,35 +3,34 @@
<s-layout title="评价">
<view>
<view v-for="(item, index) in state.orderInfo.items" :key="item.id">
<view v-if="item.btns.includes('comment')">
<view>
<view class="commont-from-wrap">
<!-- 评价商品 -->
<s-goods-item :img="item.goods_image" :title="item.goods_title" :skuText="item.goods_sku_text"
:price="item.goods_price" :num="item.goods_num"></s-goods-item>
<s-goods-item
:img="item.picUrl"
:title="item.spuName"
:skuText="item.properties.map((property) => property.valueName).join(' ')"
:price="item.payPrice"
:num="item.count"
/>
</view>
<view class="form-item">
<!-- 评分 -->
<view class="star-box ss-flex ss-col-center">
<view class="star-title ss-m-r-40">
<!-- {{ rateMap[state.commentList[index].level] }} -->
商品质量
</view>
<uni-rate v-model="state.commentList[index].level" />
<view class="star-title ss-m-r-40">商品质量</view>
<uni-rate v-model="state.commentList[index].descriptionScores" />
</view>
<view class="star-box ss-flex ss-col-center">
<view class="star-title ss-m-r-40">
<!-- {{ rateMap[state.commentList[index].level] }} -->
服务态度
</view>
<uni-rate v-model="state.commentList[index].level2" />
<view class="star-title ss-m-r-40">服务态度</view>
<uni-rate v-model="state.commentList[index].benefitScores" />
</view>
<!-- 评价 -->
<view class="area-box">
<uni-easyinput :inputBorder="false" type="textarea" maxlength="120" autoHeight
v-model="state.commentList[index].content"
placeholder="宝贝满足你的期待吗?说说你的使用心得,分享给想买的他们吧~"></uni-easyinput>
placeholder="宝贝满足你的期待吗?说说你的使用心得,分享给想买的他们吧~" />
<!-- TODO 芋艿文件上传 -->
<view class="img-box">
<s-uploader v-model:url="state.commentList[index].images" fileMediatype="image"
limit="9" mode="grid" :imageStyles="{ width: '168rpx', height: '168rpx' }" />
@ -41,6 +40,7 @@
</view>
</view>
</view>
<!-- TODO 芋艿是否匿名 -->
<su-fixed bottom placeholder>
<view class="foot_box ss-flex ss-row-center ss-col-center">
@ -54,113 +54,49 @@
<script setup>
import sheep from '@/sheep';
import {
onLoad
} from '@dcloudio/uni-app';
import {
computed,
reactive
} from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { reactive } from 'vue';
import OrderApi from '@/sheep/api/trade/order';
const state = reactive({
orderInfo: {},
commentList: [],
orderId: null
id: null
});
const rateMap = {
1: '糟糕',
2: '差评',
3: '一般',
4: '良好',
5: '好评',
};
async function onSubmit() {
//
// console.log(state.orderInfo);
// return;
let obj = {
anonymous: false,
benefitScores: state.commentList[0].level2,
content: state.commentList[0].content,
descriptionScores: state.commentList[0].level,
orderItemId: state.commentList[0].item_id,
picUrls: 'https://t7.baidu.com/it/u=2531125946,3055766435&fm=193&f=GIF'
//
for (const comment of state.commentList) {
await OrderApi.createOrderItemComment(comment);
}
const {
code
} = await sheep.$api.order.comment(obj);
if (code === 0) {
//
sheep.$router.back();
}
}
onLoad(async (options) => {
let id = '';
if (options.orderSN) {
id = options.orderSN;
}
if (options.id) {
id = options.id;
}
if (options.orderId) {
state.orderId = options.orderId
if (!options.id) {
sheep.$helper.toast(`缺少订单信息,请检查`);
return
}
state.id = options.id;
const res = await sheep.$api.order.detail(id);
if (res.code === 0) {
let obj = {
10: ['待发货', '等待买家付款', ["apply_refund"]],
30: ['待评价', '等待买家评价', ["express", "comment"]]
}
res.data.status_text = obj[res.data.status][0];
res.data.status_desc = obj[res.data.status][1];
res.data.btns = obj[res.data.status][2];
res.data.address = {
province_name: res.data.receiverAreaName.split(' ')[0],
district_name: res.data.receiverAreaName.split(' ')[2],
city_name: res.data.receiverAreaName.split(' ')[1],
address: res.data.receiverDetailAddress,
consignee: res.data.receiverName,
mobile: res.data.receiverMobile,
}
res.data.pay_fee = res.data.payPrice / 100
res.data.create_time = sheep.$helper.timeFormat(res.data.createTime, 'yyyy-mm-dd hh:MM:ss')
res.data.order_sn = res.data.no
res.data.id = res.data.id
res.data.goods_amount = res.data.totalPrice / 100
res.data.dispatch_amount = res.data.deliveryPrice / 100
res.data.pay_types_text = res.data.payChannelName.split(',')
res.data.items = res.data.items.map(ite => {
return {
...ite,
btns: obj[res.data.status][2],
goods_title: ite.spuName,
goods_num: ite.count,
goods_price: ite.price / 100,
goods_image: ite.picUrl,
goods_sku_text: ite.properties.reduce((it0, it1) => it0 + it1.valueName + ' ', '')
}
})
if (res.data.btns.includes('comment')) {
state.orderInfo = res.data;
state.orderInfo.items.forEach((item) => {
if (item.btns.includes('comment')) {
state.commentList.push({
item_id: item.id,
level: 5,
content: '',
images: [],
});
}
});
console.log(state.orderInfo.items, '循环')
return;
}
}
const { code, data } = await sheep.$api.order.detail(state.id);
if (code !== 0) {
sheep.$helper.toast('无待评价订单');
return
}
//
data.items.forEach((item) => {
state.commentList.push({
anonymous: false,
orderItemId: item.id,
descriptionScores: 5,
benefitScores: 5,
content: '',
picUrls: []
});
});
state.orderInfo = data;
});
</script>

View File

@ -1,30 +1,52 @@
<!-- 商品详情的底部导航 -->
<template>
<su-fixed bottom placeholder bg="bg-white">
<view class="ui-tabbar-box">
<view class="ui-tabbar ss-flex ss-col-center ss-row-between">
<view v-if="collectIcon" class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
@tap="onFavorite">
<view
v-if="collectIcon"
class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
@tap="onFavorite"
>
<block v-if="modelValue.favorite">
<image class="item-icon" :src="sheep.$url.static('/static/img/shop/goods/collect_1.gif')"
mode="aspectFit"></image>
<image
class="item-icon"
:src="sheep.$url.static('/static/img/shop/goods/collect_1.gif')"
mode="aspectFit"
/>
<view class="item-title">已收藏</view>
</block>
<block v-else>
<image class="item-icon" :src="sheep.$url.static('/static/img/shop/goods/collect_0.png')"
mode="aspectFit"></image>
<image
class="item-icon"
:src="sheep.$url.static('/static/img/shop/goods/collect_0.png')"
mode="aspectFit"
/>
<view class="item-title">收藏</view>
</block>
</view>
<view v-if="serviceIcon" class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
@tap="onChat">
<image class="item-icon" :src="sheep.$url.static('/static/img/shop/goods/message.png')"
mode="aspectFit"></image>
<view
v-if="serviceIcon"
class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
@tap="onChat"
>
<image
class="item-icon"
:src="sheep.$url.static('/static/img/shop/goods/message.png')"
mode="aspectFit"
/>
<view class="item-title">客服</view>
</view>
<view v-if="shareIcon" class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
@tap="showShareModal">
<image class="item-icon" :src="sheep.$url.static('/static/img/shop/goods/share.png')"
mode="aspectFit"></image>
<view
v-if="shareIcon"
class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
@tap="showShareModal"
>
<image
class="item-icon"
:src="sheep.$url.static('/static/img/shop/goods/share.png')"
mode="aspectFit"
/>
<view class="item-title">分享</view>
</view>
<slot></slot>
@ -42,18 +64,11 @@
* @property {String} ui - 自定义样式Class
* @property {Boolean} noFixed - 是否定位
* @property {Boolean} topRadius - 上圆角
*
*
*/
import {
computed,
reactive
} from 'vue';
import { reactive } from 'vue';
import sheep from '@/sheep';
import {
showShareModal
} from '@/sheep/hooks/useModal';
import { showShareModal } from '@/sheep/hooks/useModal';
import FavoriteApi from '@/sheep/api/product/favorite';
//
const state = reactive({});
@ -62,7 +77,7 @@
const props = defineProps({
modelValue: {
type: Object,
default () {},
default() {},
},
bg: {
type: String,
@ -70,7 +85,7 @@
},
bgStyles: {
type: Object,
default () {},
default() {},
},
ui: {
type: String,
@ -98,34 +113,24 @@
default: true,
},
});
const elStyles = computed(() => {
return {
'border-top-left-radius': props.topRadius + 'rpx',
'border-top-right-radius': props.topRadius + 'rpx',
overflow: 'hidden',
};
});
const tabbarheight = (e) => {
uni.setStorageSync('tabbar', e);
};
async function onFavorite() {
// const { error } = await sheep.$api.user.favorite.do(props.modelValue.id);
// if (error === 0) {
// if (props.modelValue.favorite) {
// props.modelValue.favorite = 0;
// } else {
// props.modelValue.favorite = 1;
// }
// }
let data;
//
if (props.modelValue.favorite) {
data = await sheep.$api.user.favorite.dos(props.modelValue.id);
} else {
data = await sheep.$api.user.favorite.do(props.modelValue.id);
const { code } = await FavoriteApi.deleteFavorite(props.modelValue.id);
if (code !== 0) {
return
}
if (data.data) {
props.modelValue.favorite = !props.modelValue.favorite;
sheep.$helper.toast('取消收藏');
props.modelValue.favorite = false;
//
} else {
const { code } = await FavoriteApi.createFavorite(props.modelValue.id);
if (code !== 0) {
return
}
sheep.$helper.toast('收藏成功');
props.modelValue.favorite = true;
}
}
@ -140,7 +145,6 @@
.ui-tabbar-box {
box-shadow: 0px -6px 10px 0px rgba(51, 51, 51, 0.2);
}
.ui-tabbar {
display: flex;
height: 50px;

View File

@ -12,7 +12,9 @@
<block v-else>
<view class="detail-swiper-selector">
<!-- 商品轮播图 -->
<su-swiper class="ss-m-b-14" isPreview :list="formatGoodsSwiper(state.goodsInfo.sliderPicUrls)" dotStyle="tag" imageMode="widthFix" dotCur="bg-mask-40" :seizeHeight="750" />
<su-swiper class="ss-m-b-14" isPreview :list="formatGoodsSwiper(state.goodsInfo.sliderPicUrls)"
dotStyle="tag" imageMode="widthFix" dotCur="bg-mask-40" :seizeHeight="750" />
<!-- 价格+标题 -->
<view class="title-card detail-card ss-p-y-40 ss-p-x-20">
<view class="ss-flex ss-row-between ss-col-center ss-m-b-26">
@ -30,15 +32,15 @@
</view>
<view class="discounts-box ss-flex ss-row-between ss-m-b-28">
<!-- 满减送/限时折扣活动的提示 TODO 芋艿promos 未写 -->
<div class="tag-content">
<!-- 满减送/限时折扣活动的提示 TODO 芋艿promos 未写 -->
<div class="tag-content">
<view class="tag-box ss-flex">
<view class="tag ss-m-r-10" v-for="promos in state.goodsInfo.promos" :key="promos.id" @tap="onActivity">
<view class="tag ss-m-r-10" v-for="promos in state.goodsInfo.promos"
:key="promos.id" @tap="onActivity">
{{ promos.title }}
</view>
</view>
</div>
<!-- 优惠劵 -->
<view class="get-coupon-box ss-flex ss-col-center ss-m-l-20" @tap="state.showModel = true"
v-if="state.couponInfo.length">
@ -86,12 +88,11 @@
<button class="ss-reset-button disabled-btn" disabled> 已售罄 </button>
</view>
</detail-tabbar>
<!-- 优惠劵弹窗 -->
<s-coupon-get v-model="state.couponInfo" :show="state.showModel" @close="state.showModel = false" @get="onGet" />
<!-- 满减送/限时折扣活动弹窗 -->
<!-- 优惠劵弹窗 -->
<s-coupon-get v-model="state.couponInfo" :show="state.showModel" @close="state.showModel = false" @get="onGet" />
<s-coupon-get v-model="state.couponInfo" :show="state.showModel" @close="state.showModel = false"
@get="onGet" />
<!-- 满减送/限时折扣活动弹窗 -->
<s-activity-pop v-model="state.activityInfo" :show="state.showActivityModel"
@close="state.showActivityModel = false" />
@ -101,19 +102,23 @@
</template>
<script setup>
import { reactive, computed } from 'vue';
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
import {
reactive,
computed
} from 'vue';
import {
onLoad,
onPageScroll
} from '@dcloudio/uni-app';
import sheep from '@/sheep';
import CouponApi from '@/sheep/api/promotion/coupon';
import ActivityApi from '@/sheep/api/promotion/activity';
import FavoriteApi from '@/sheep/api/product/favorite';
import {
formatSales,
formatGoodsSwiper,
fen2yuan,
} from '@/sheep/hooks/useGoods';
import CouponApi from '@/sheep/api/promotion/coupon';
import ActivityApi from '@/sheep/api/promotion/activity';
import { formatSales, formatGoodsSwiper, fen2yuan, } from '@/sheep/hooks/useGoods';
import detailNavbar from './components/detail/detail-navbar.vue';
import detailCellSku from './components/detail/detail-cell-sku.vue';
import detailCellService from './components/detail/detail-cell-service.vue';
@ -147,20 +152,28 @@
// TODO
function onAddCart(e) {
console.log(e, '加入购物车');
if (!e.id) {
sheep.$helper.toast('请选择商品规格');
return;
}
sheep.$store('cart').add(e);
}
// TODO
//
function onBuy(e) {
if (!state.selectedSku.id) {
sheep.$helper.toast('请选择商品规格');
return;
}
sheep.$router.go('/pages/order/confirm', {
data: JSON.stringify({
order_type: 'goods',
goods_list: [{
goods_id: e.goods_id,
goods_num: e.goods_num,
goods_sku_price_id: e.id,
}, ],
items: [{
skuId: state.selectedSku.id,
count: 1
}],
// TODO 2
deliveryType: 1,
pointStatus: false,
}),
});
}
@ -174,10 +187,10 @@
// TODO
async function onGet(id) {
const {
code,
error,
msg
} = await sheep.$api.coupon.get(id);
if (code === 0) {
if (error === 0) {
uni.showToast({
title: msg,
});
@ -188,7 +201,6 @@
}
// TODO
const shareInfo = computed(() => {
if (isEmpty(state.goodsInfo)) return {};
return sheep.$platform.share.getShareInfo({
@ -202,8 +214,9 @@
}, {
type: 'goods', //
title: state.goodsInfo.name, //
image: sheep.$url.cdn(state.goodsInfo.image), //
price: state.goodsInfo.price[0], //
// image: sheep.$url.cdn(state.goodsInfo.image), //
image: sheep.$url.cdn(state.goodsInfo.picUrl), //
price: state.goodsInfo.price, //
original_price: state.goodsInfo.original_price, //
}, );
});
@ -216,75 +229,6 @@
}
state.goodsId = options.id;
// 1.
sheep.$api.goods.detail(state.goodsId).then(async (res) => {
//
if (res.code !== 0 || !res.data) {
state.goodsInfo = null;
return;
}
//
state.skeletonLoading = false;
//
let dasa = await sheep.$api.goods.exits(options.id);
res.data.favorite = dasa.data;
state.goodsInfo = res.data;
console.log(state.goodsInfo, '商品信息');
//
// 2.
CouponApi.getCouponTemplateList({
price: state.goodsInfo.price,
spuIds: [state.goodsInfo.id],
skuIds: state.goodsInfo.skus.map(item => item.id),
//
categoryIds: [52]
}).then((res) => {
console.log(res, '优惠券信息进行对接')
if (res.code !== 0) {
return;
}
//
let obj2 = {
2: '折扣',
1: '满减'
}
let obj = {
1: '可用',
2: '已用',
3: '过期'
}
let obj3 = {
1: '已领取',
2: '已使用',
3: '已过期'
}
res.data = res.data.map(item => {
return {
...item,
enough: (item.usePrice / 100).toFixed(2),
amount: (item.discountPrice / 100).toFixed(2),
use_start_time: sheep.$helper.timeFormat(item
.validStartTime,
'yyyy-mm-dd hh:MM:ss'),
use_end_time: sheep.$helper.timeFormat(item.validEndTime,
'yyyy-mm-dd hh:MM:ss'),
status_text: obj[item.status],
type_text: obj2[item.discountType],
get_status_text: obj3[item.status],
type_text: obj2[item.discountType]
}
});
state.couponInfo = res.data;
});
});
// return;
// 3.
ActivityApi.getActivityListBySpuId(state.goodsId).then((res) => {
if (res.code !== 0) {
return;
}
state.activityList = res.data;
});
sheep.$api.goods.detail(state.goodsId).then((res) => {
//
if (res.code !== 0 || !res.data) {
@ -294,10 +238,18 @@
//
state.skeletonLoading = false;
state.goodsInfo = res.data;
//
FavoriteApi.isFavoriteExists(state.goodsId, 'goods').then((res) => {
if (res.code !== 0) {
return;
}
state.goodsInfo.favorite = res.data;
});
});
// 2.
CouponApi.getCouponTemplateList(state.goodsId,2, 10).then((res) => {
CouponApi.getCouponTemplateList(state.goodsId, 2, 10).then((res) => {
if (res.code !== 0) {
return;
}

View File

@ -1,22 +1,12 @@
<template>
<s-layout
navbar="normal"
:leftWidth="0"
:rightWidth="0"
tools="search"
:defaultSearch="state.keyword"
@search="onSearch"
>
<s-layout navbar="normal" :leftWidth="0" :rightWidth="0" tools="search" :defaultSearch="state.keyword"
@search="onSearch">
<!-- 筛选 -->
<su-sticky bgColor="#fff">
<view class="ss-flex">
<view class="ss-flex-1">
<su-tabs
:list="state.tabList"
:scrollable="false"
@change="onTabsChange"
:current="state.currentTab"
></su-tabs>
<su-tabs :list="state.tabList" :scrollable="false" @change="onTabsChange"
:current="state.currentTab"></su-tabs>
</view>
<view class="list-icon" @tap="state.iconStatus = !state.iconStatus">
<text v-if="state.iconStatus" class="sicon-goods-list"></text>
@ -26,58 +16,29 @@
</su-sticky>
<!-- 弹窗 -->
<su-popup
:show="state.showFilter"
type="top"
round="10"
:space="sys_navBar + 38"
backgroundColor="#F6F6F6"
:zIndex="10"
@close="state.showFilter = false"
>
<su-popup :show="state.showFilter" type="top" round="10" :space="sys_navBar + 38" backgroundColor="#F6F6F6"
:zIndex="10" @close="state.showFilter = false">
<view class="filter-list-box">
<view
class="filter-item"
v-for="(item, index) in state.tabList[state.currentTab].list"
:key="item.value"
:class="[{ 'filter-item-active': index == state.curFilter }]"
@tap="onFilterItem(index)"
>
<view class="filter-item" v-for="(item, index) in state.tabList[state.currentTab].list"
:key="item.value" :class="[{ 'filter-item-active': index == state.curFilter }]"
@tap="onFilterItem(index)">
{{ item.label }}
</view>
</view>
</su-popup>
<view v-if="state.iconStatus && state.pagination.total > 0" class="goods-list ss-m-t-20">
<view
class="ss-p-l-20 ss-p-r-20 ss-m-b-20"
v-for="item in state.pagination.data"
:key="item.id"
>
<s-goods-column
class=""
size="lg"
:data="item"
:topRadius="10"
:bottomRadius="10"
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
></s-goods-column>
<view class="ss-p-l-20 ss-p-r-20 ss-m-b-20" v-for="item in state.pagination.data" :key="item.id">
<s-goods-column class="" size="lg" :data="item" :topRadius="10" :bottomRadius="10"
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"></s-goods-column>
</view>
</view>
<view
v-if="!state.iconStatus && state.pagination.total > 0"
class="ss-flex ss-flex-wrap ss-p-x-20 ss-m-t-20 ss-col-top"
>
<view v-if="!state.iconStatus && state.pagination.total > 0"
class="ss-flex ss-flex-wrap ss-p-x-20 ss-m-t-20 ss-col-top">
<view class="goods-list-box">
<view class="left-list" v-for="item in state.leftGoodsList" :key="item.id">
<s-goods-column
class="goods-md-box"
size="md"
:data="item"
:topRadius="10"
:bottomRadius="10"
<s-goods-column class="goods-md-box" size="md" :data="item" :topRadius="10" :bottomRadius="10"
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
@getHeight="mountMasonry($event, 'left')"
>
@getHeight="mountMasonry($event, 'left')">
<template v-slot:cart>
<button class="ss-reset-button cart-btn"> </button>
</template>
@ -86,15 +47,9 @@
</view>
<view class="goods-list-box">
<view class="right-list" v-for="item in state.rightGoodsList" :key="item.id">
<s-goods-column
class="goods-md-box"
size="md"
:topRadius="10"
:bottomRadius="10"
:data="item"
<s-goods-column class="goods-md-box" size="md" :topRadius="10" :bottomRadius="10" :data="item"
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
@getHeight="mountMasonry($event, 'right')"
>
@getHeight="mountMasonry($event, 'right')">
<template v-slot:cart>
<button class="ss-reset-button cart-btn"> </button>
</template>
@ -102,22 +57,22 @@
</view>
</view>
</view>
<uni-load-more
v-if="state.pagination.total > 0"
:status="state.loadStatus"
:content-text="{
<uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{
contentdown: '上拉加载更多',
}"
@tap="loadmore"
/>
}" @tap="loadmore" />
<s-empty v-if="state.pagination.total === 0" icon="/static/soldout-empty.png" text="暂无商品">
</s-empty>
</s-layout>
</template>
<script setup>
import { reactive } from 'vue';
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
import {
reactive
} from 'vue';
import {
onLoad,
onReachBottom
} from '@dcloudio/uni-app';
import sheep from '@/sheep';
import _ from 'lodash';
@ -145,12 +100,10 @@
showFilter: false,
iconStatus: false,
categoryId: 0,
tabList: [
{
tabList: [{
name: '综合推荐',
// value: '',
list: [
{
list: [{
label: '综合推荐',
// sort: '',
// order: true,
@ -169,6 +122,8 @@
},
{
name: '销量',
sort: 'salesCount',
order: false,
// value: 'salesCount',
},
{
@ -233,8 +188,8 @@
state.currentTab = e.index;
}
emptyList();
getList(e.value, state.currentOrder, state.categoryId, state.keyword);
console.log(e, '6666')
getList(e.sort, e.order, state.categoryId, state.keyword);
}
//
@ -262,9 +217,9 @@
sortField: Sort,
sortAsc: Order,
category_id: !keyword ? categoryId : '',
pageSize:list_rows,
pageSize: list_rows,
keyword: keyword,
pageNo:page,
pageNo: page,
});
if (res.code === 0) {
let couponList = _.concat(state.pagination.data, res.data.list);
@ -307,54 +262,68 @@
.goods-list-box {
width: 50%;
box-sizing: border-box;
.left-list {
margin-right: 10rpx;
margin-bottom: 20rpx;
}
.right-list {
margin-left: 10rpx;
margin-bottom: 20rpx;
}
}
.goods-box {
&:nth-last-of-type(1) {
margin-bottom: 0 !important;
}
&:nth-child(2n) {
margin-right: 0;
}
}
.list-icon {
width: 80rpx;
.sicon-goods-card {
font-size: 40rpx;
}
.sicon-goods-list {
font-size: 40rpx;
}
}
.goods-card {
margin-left: 20rpx;
}
.list-filter-tabs {
background-color: #fff;
}
.filter-list-box {
padding: 28rpx 52rpx;
.filter-item {
font-size: 28rpx;
font-weight: 500;
color: #333333;
line-height: normal;
margin-bottom: 24rpx;
&:nth-last-child(1) {
margin-bottom: 0;
}
}
.filter-item-active {
color: var(--ui-BG-Main);
}
}
.tab-item {
height: 50px;
position: relative;

View File

@ -1,11 +1,6 @@
<!-- 购物车界面 -->
<template>
<s-layout title="购物车" tabbar="/pages/index/cart" :bgStyle="{ color: '#fff' }">
<s-empty
v-if="state.list.length === 0"
text="购物车空空如也,快去逛逛吧~"
icon="/static/cart-empty.png"
/>
<s-empty v-if="state.list.length === 0" text="购物车空空如也,快去逛逛吧~" icon="/static/cart-empty.png" />
<!-- 头部 -->
<view class="cart-box ss-flex ss-flex-col ss-row-between" v-if="state.list.length">
@ -24,72 +19,47 @@
</button>
</view>
</view>
<!-- 内容 -->
<view class="cart-content ss-flex-1 ss-p-x-30 ss-m-b-40">
<view class="goods-box ss-r-10 ss-m-b-14" v-for="item in state.list" :key="item.id">
<view class="ss-flex ss-col-center">
<label class="check-box ss-flex ss-col-center ss-p-l-10" @tap="onSelectSingle(item.id)">
<radio
:checked="state.selectedIds.includes(item.id)"
color="var(--ui-BG-Main)"
style="transform: scale(0.8)"
@tap.stop="onSelectSingle(item.id)"
/>
<radio :checked="state.selectedIds.includes(item.id)" color="var(--ui-BG-Main)"
style="transform: scale(0.8)" @tap.stop="onSelectSingle(item.id)" />
</label>
<s-goods-item
:title="item.spu.name"
:img="item.sku.picUrl || item.spu.picUrl"
:price="fen2yuan(item.sku.price)"
:skuText="item.sku.properties.map((property) => property.valueName).join(' ')"
priceColor="#FF3000"
:titleWidth="400"
>
<s-goods-item :title="item.spu.name" :img="item.spu.picUrl || item.goods.image"
:price="item.sku.price/100"
:skuText="item.sku.properties.length>1? item.sku.properties.reduce((items2,items)=>items2.valueName+' '+items.valueName):item.sku.properties[0].valueName"
priceColor="#FF3000" :titleWidth="400">
<template v-if="!state.editMode" v-slot:tool>
<su-number-box
:min="0"
:max="item.sku.stock"
:step="1"
v-model="item.count"
@change="onNumberChange($event, item)"
/>
<su-number-box :min="0" :max="item.sku.stock" :step="1" v-model="item.count"
@change="onNumberChange($event, item)"></su-number-box>
</template>
</s-goods-item>
</view>
</view>
</view>
<!-- 底部 -->
<su-fixed bottom :val="48" placeholder v-if="state.list.length > 0" :isInset="false">
<view class="cart-footer ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom">
<view class="footer-left ss-flex ss-col-center">
<label class="check-box ss-flex ss-col-center ss-p-r-30" @tap="onSelectAll">
<radio
:checked="state.isAllSelected"
color="var(--ui-BG-Main)"
style="transform: scale(0.8)"
@tap.stop="onSelectAll"
/>
<radio :checked="state.isAllSelected" color="var(--ui-BG-Main)"
style="transform: scale(0.8)" @tap.stop="onSelectAll" />
<view class="ss-m-l-8"> 全选 </view>
</label>
<text>合计</text>
<view class="text-price price-text">
{{ fen2yuan(state.totalPriceSelected) }}
{{ state.totalPriceSelected }}
</view>
</view>
<view class="footer-right">
<button
v-if="state.editMode"
class="ss-reset-button ui-BG-Main-Gradient pay-btn ui-Shadow-Main"
@tap="onDelete"
>
<button v-if="state.editMode" class="ss-reset-button ui-BG-Main-Gradient pay-btn ui-Shadow-Main"
@tap="onDelete">
删除
</button>
<button
v-else
class="ss-reset-button ui-BG-Main-Gradient pay-btn ui-Shadow-Main"
@tap="onConfirm"
>
<button v-else class="ss-reset-button ui-BG-Main-Gradient pay-btn ui-Shadow-Main"
@tap="onConfirm">
去结算
{{ state.selectedIds?.length ? `(${state.selectedIds.length})` : '' }}
</button>
@ -102,26 +72,28 @@
<script setup>
import sheep from '@/sheep';
import { computed, reactive } from 'vue';
import { fen2yuan } from '@/sheep/hooks/useGoods';
import { property } from 'lodash/util';
import {
computed,
reactive,
unref
} from 'vue';
const sys_navBar = sheep.$platform.navbar;
const cart = sheep.$store('cart');
const state = reactive({
editMode: false,
list: computed(() => cart.list), //
list: computed(() => cart.list),
selectedList: [],
selectedIds: computed(() => cart.selectedIds),
isAllSelected: computed(() => cart.isAllSelected),
totalPriceSelected: computed(() => cart.totalPriceSelected),
});
//
//
function onSelectSingle(id) {
console.log('单选')
cart.selectSingle(id);
}
//
function onSelectAll() {
cart.selectAll(!state.isAllSelected);
@ -129,24 +101,36 @@
//
function onConfirm() {
const items = state.list
.filter((item) => state.selectedIds.includes(item.id))
.map((item) => {
return {
let items = []
let goods_list = [];
state.selectedList = state.list.filter((item) => state.selectedIds.includes(item.id));
state.selectedList.map((item) => {
console.log(item, '便利');
//
items.push({
skuId: item.sku.id,
count: item.count,
cartId: item.id,
};
})
goods_list.push({
// goods_id: item.goods_id,
goods_id: item.spu.id,
// goods_num: item.goods_num,
goods_num: item.count,
// id
// goods_sku_price_id: item.goods_sku_price_id,
});
if (items.length === 0) {
});
// return;
if (goods_list.length === 0) {
sheep.$helper.toast('请选择商品');
return;
}
sheep.$router.go('/pages/order/confirm', {
data: JSON.stringify({
items,
// order_type: 'goods',
// goods_list,
items,
// from: 'cart',
deliveryType: 1,
pointStatus: false,
@ -154,23 +138,19 @@
});
}
//
function onNumberChange(number, cartItem) {
if (number === 0) {
cart.delete([cartItem.id]);
function onNumberChange(e, cartItem) {
if (e === 0) {
cart.delete(cartItem.id);
return;
}
if (cartItem.goods_num === number) {
return;
}
cartItem.goods_num = number;
if (cartItem.goods_num === e) return;
cartItem.goods_num = e;
cart.update({
goods_id: cartItem.id,
goods_num: number,
goods_num: e,
goods_sku_price_id: cartItem.goods_sku_price_id,
});
}
//
async function onDelete() {
cart.delete(state.selectedIds);
}

View File

@ -1,7 +1,12 @@
<template>
<s-layout title="我的" tabbar="/pages/index/user" navbar="custom" :bgStyle="template.page"
:navbarStyle="template.style?.navbar" onShareAppMessage>
<s-layout
title="我的"
tabbar="/pages/index/user"
navbar="custom"
:bgStyle="template.page"
:navbarStyle="template.style?.navbar"
onShareAppMessage
>
<s-block v-for="(item, index) in template.components" :key="index" :styles="item.property.style">
<s-block-item :type="item.id" :data="item.property" :styles="item.property.style" />
</s-block>
@ -9,14 +14,8 @@
</template>
<script setup>
import {
computed
} from 'vue';
import {
onShow,
onPageScroll,
onPullDownRefresh
} from '@dcloudio/uni-app';
import { computed } from 'vue';
import { onShow, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
import sheep from '@/sheep';
// tabBar
@ -31,7 +30,7 @@
onPullDownRefresh(() => {
sheep.$store('user').updateUserData();
setTimeout(function() {
setTimeout(function () {
uni.stopPullDownRefresh();
}, 800);
});

View File

@ -1,4 +1,4 @@
<!-- 订单详情 -->
<!-- 售后申请 -->
<template>
<s-layout title="申请售后">
<!-- 售后商品 -->

View File

@ -0,0 +1,215 @@
<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>
<picker mode='selector' class='num' @change="bindPickerChange" :value="state.expressIndex"
:range="state.expresses" range-key="name">
<view class="picker acea-row row-between-wrapper">
<view class='reason'>{{ state.expresses[state.expressIndex].name }}</view>
<text class='iconfont icon-jiantou'></text>
</view>
</picker>
</view>
<view class='item textarea acea-row row-between' style="display: flex;align-items: center;">
<view>物流单号</view>
<input placeholder='请填写物流单号' class='num' name="logisticsNo"
placeholder-class='placeholder' />
</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 sheep from '@/sheep';
import {
onLoad,
onReachBottom,
onPullDownRefresh
} from '@dcloudio/uni-app';
import {
computed,
watch,
ref,
reactive,
unref
} from 'vue';
const state = reactive({
expressIndex: 0,
expresses: [{
"id": 1,
"name": "申通快递"
},
{
"id": 2,
"name": "顺丰速运"
},
{
"id": 3,
"name": "中通快递"
},
{
"id": 4,
"name": "韵达快递"
}
], //
})
function bindPickerChange(e) {
state.expressIndex = e.detail.value;
}
function subRefund(e) {
const formData = e.detail.value;
console.log(formData, '表单数据');
console.log(state.expresses[state.expressIndex].id, '物流公司id');
return;
//
AfterSaleApi.deliveryAfterSale({
id: this.id,
logisticsId: this.expresses[this.expressIndex].id,
logisticsNo: formData.logisticsNo,
}).then(res => {
this.$util.Tips({
title: '填写退货成功',
icon: 'success'
}, {
tab: 5,
url: '/pages/users/user_return_detail/index?id=' + this.id
});
}).catch(err => {
return this.$util.Tips({
title: err
});
})
}
function getList() {
}
onLoad(() => {
// 退
})
</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>

View File

@ -1,57 +1,35 @@
<!-- 售后日志的每一项展示 -->
<template>
<view class="log-item ss-flex">
<view class="log-icon ss-flex-col ss-col-center ss-m-r-20">
<text class="cicon-title" :class="index === 0 ? 'activity-color' : ''"></text>
<view v-if="data.length - 1 != index" class="line"></view>
<text class="cicon-title" :class="index === 0 ? 'activity-color' : ''" />
<view v-if="data.length - 1 !== index" class="line" />
</view>
<view>
<view class="text">{{ item.log_type_text }}</view>
<mp-html class="richtext" :content="item.content"></mp-html>
<view class="" v-if="item.images?.length">
<scroll-view class="scroll-box" scroll-x scroll-anchoring>
<view class="ss-flex">
<view v-for="i in item.images" :key="i" class="ss-m-r-20">
<su-image
class="content-img"
isPreview
:previewList="state.commentImages"
:current="index"
:src="i"
:height="120"
:width="120"
mode="aspectFit"
></su-image>
<view class="text">{{ item.content }}</view>
<view class="date">
{{ sheep.$helper.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}
</view>
</view>
</scroll-view>
</view>
<view class="date">{{ item.create_time }}</view>
</view>
</view>
</template>
<script setup>
import sheep from '@/sheep';
import { reactive } from 'vue';
const props = defineProps({
item: {
type: Object,
type: Object, //
default() {},
},
index: {
type: Number,
type: Number, // item data
default: 0,
},
data: {
type: Object,
type: Object, //
default() {},
},
});
const state = reactive({
commentImages: [],
});
props.item.images?.forEach((i) => {
state.commentImages.push(sheep.$url.cdn(i));
});
</script>
<style lang="scss" scoped>
.log-item {

View File

@ -1,45 +1,29 @@
<!-- 售后进度 -->
<!-- 售后日志列表 -->
<template>
<s-layout title="售后进度">
<view class="log-box">
<view v-for="(item, index) in state.info" :key="item.title">
<log-item :item="item" :index="index" :data="state.info"></log-item>
<view v-for="(item, index) in state.list" :key="item.id">
<log-item :item="item" :index="index" :data="state.list" />
</view>
</view>
</s-layout>
</template>
<script setup>
import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app';
import { computed, reactive } from 'vue';
import { reactive } from 'vue';
import logItem from './log-item.vue';
import AfterSaleApi from '@/sheep/api/trade/afterSale';
const state = reactive({
active: 1,
list: [
{
title: '买家下单',
desc: '2018-11-11',
},
{
title: '卖家发货',
desc: '2018-11-12',
},
{
title: '买家签收',
desc: '2018-11-13',
},
{
title: '交易完成',
desc: '2018-11-14',
},
],
list: [],
});
async function getDetail(id) {
const { data } = await sheep.$api.order.aftersale.detail(id);
state.info = data.logs;
const { data } = await AfterSaleApi.getAfterSaleLogList(id);
state.list = data;
}
onLoad((options) => {
state.aftersaleId = options.id;
getDetail(options.id);

View File

@ -1,146 +1,125 @@
<template>
<s-layout title="确认订单">
<!-- TODO这个判断先删除 v-if="state.orderInfo.need_address === 1" -->
<!-- v-if="state.orderInfo.need_address === 1" -->
<!-- 这个判断先删除 -->
<view class="bg-white address-box ss-m-b-14 ss-r-b-10" @tap="onSelectAddress">
<s-address-item :item="state.addressInfo" :hasBorderBottom="false">
<view class="ss-rest-button">
<text class="_icon-forward" />
</view>
<view class="ss-rest-button"><text class="_icon-forward"></text></view>
</s-address-item>
</view>
<!-- 商品信息 -->
<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"
/>
<s-goods-item v-for="item in state.orderInfo.goods_list" :key="item.goods_id"
:img="item.current_sku_price.image || item.goods.image" :title="item.goods.title"
:skuText="item.current_sku_price?.goods_sku_text" :price="item.current_sku_price.price"
:num="item.goods_num" marginBottom="10">
<template #top>
<view class="order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white">
<view class="item-title">配送方式</view>
<view class="ss-flex ss-col-center">
<text class="item-value">{{ item.dispatch_type_text }}</text>
</view>
</view>
</template>
</s-goods-item>
<view class="order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10">
<view class="item-title">订单备注</view>
<view class="ss-flex ss-col-center">
<uni-easyinput
maxlength="20"
placeholder="建议留言前先与商家沟通"
v-model="state.orderPayload.remark"
:inputBorder="false"
:clearable="false"
/>
<uni-easyinput maxlength="20" placeholder="建议留言前先与商家沟通" v-model="state.orderPayload.remark"
:inputBorder="false" :clearable="false"></uni-easyinput>
</view>
</view>
</view>
<!-- 价格信息 -->
<!-- 合计 -->
<view class="bg-white 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>
<text class="item-value ss-m-r-24">{{ state.orderInfo.goods_amount }}</text>
</view>
</view>
<!-- TODO 芋艿接入积分 -->
<view
class="order-item ss-flex ss-col-center ss-row-between"
v-if="state.orderPayload.order_type === 'score'"
>
<view class="order-item ss-flex ss-col-center ss-row-between"
v-if="state.orderPayload.order_type === 'score'">
<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"
/>
<image :src="sheep.$url.static('/static/img/shop/goods/score1.svg')" class="score-img"></image>
<text class="item-value ss-m-r-24">{{ state.orderInfo.score_amount }}</text>
</view>
</view>
<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.deliveryPrice) }}
</text>
<text class="item-value ss-m-r-24">+{{ state.orderInfo.dispatch_amount }}</text>
</view>
</view>
<!-- 优惠劵只有 type = 0 普通订单非拼团秒杀砍价才可以使用优惠劵 -->
<view
class="order-item ss-flex ss-col-center ss-row-between"
v-if="state.orderInfo.type === 0"
>
<view class="order-item ss-flex ss-col-center ss-row-between"
v-if="state.orderPayload.order_type != 'score'">
<!-- <view v-if="state.orderInfo.coupon_discount_fee > 0" class="order-item ss-flex ss-col-center ss-row-between"> -->
<view class="item-title">优惠券</view>
<view class="ss-flex ss-col-center" @tap="state.showCoupon = true">
<text class="item-value text-red" v-if="state.orderPayload.couponId > 0">
-{{ fen2yuan(state.orderInfo.price.couponPrice) }}
</text>
<text
class="item-value"
:class="state.couponInfo.length > 0 ? 'text-red' : 'text-disabled'"
v-else
>
{{
state.couponInfo.length > 0 ? state.couponInfo.length + ' 张可用' : '暂无可用优惠券'
}}
</text>
<text class="_icon-forward item-icon" />
<text class="item-value text-red"
v-if="state.orderPayload.coupon_id">-{{ state.orderInfo.coupon_discount_fee }}</text>
<text class="item-value"
:class="state.couponInfo.can_use?.length > 0 ? 'text-red' : 'text-disabled'" v-else>{{
state.couponInfo.can_use?.length > 0
? state.couponInfo.can_use?.length + '张可用'
: '暂无可用优惠券'
}}</text>
<text class="_icon-forward item-icon"></text>
</view>
</view>
<view
class="order-item ss-flex ss-col-center ss-row-between"
v-if="state.orderInfo.price.discountPrice > 0"
>
<view class="order-item ss-flex ss-col-center ss-row-between"
v-if="state.orderInfo.promo_infos?.length">
<!-- <view v-if="state.orderInfo.promo_discount_fee > 0" class="order-item ss-flex ss-col-center ss-row-between"> -->
<view class="item-title">活动优惠</view>
<view class="ss-flex ss-col-center">
<!-- @tap="state.showDiscount = true" TODO 芋艿后续要把优惠信息打进去 -->
<text class="item-value text-red">
-{{ fen2yuan(state.orderInfo.price.discountPrice) }}
</text>
<text class="_icon-forward item-icon" />
<view class="ss-flex ss-col-center" @tap="state.showDiscount = true">
<text class="item-value text-red"> -{{ state.orderInfo.promo_discount_fee }} </text>
<text class="_icon-forward item-icon"></text>
</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">
{{ state.orderInfo.items.reduce((acc, item) => acc + item.count, 0) }}
</view>
<view class="total-num ss-m-r-20">{{ state.totalNumber }}</view>
<view>合计</view>
<view class="total-num text-red"> {{ fen2yuan(state.orderInfo.price.payPrice) }} </view>
<view class="total-num text-red"> {{ state.orderInfo.pay_fee }} </view>
<view class="ss-flex" v-if="state.orderPayload.order_type === 'score'">
<view class="total-num ss-font-30 text-red ss-m-l-4"> + </view>
<image :src="sheep.$url.static('/static/img/shop/goods/score1.svg')" class="score-img"></image>
<view class="total-num ss-font-30 text-red">{{ state.orderInfo.score_amount }}</view>
</view>
</view>
</view>
<!-- 发票 -->
<view class="bg-white ss-p-20 ss-r-20">
<view class="order-item ss-flex ss-col-center ss-row-between">
<view class="item-title">发票申请</view>
<view class="ss-flex ss-col-center" @tap="onSelectInvoice">
<text class="item-value">{{ state.invoiceInfo.name || '无需开具发票' }}</text>
<text class="_icon-forward item-icon"></text>
</view>
</view>
</view>
<!-- 选择优惠券弹框 -->
<s-coupon-select
v-model="state.couponInfo"
:show="state.showCoupon"
@confirm="onSelectCoupon"
@close="state.showCoupon = false"
/>
<!-- 满额折扣弹框 TODO 芋艿后续要把优惠信息打进去 -->
<s-discount-list
v-model="state.orderInfo"
:show="state.showDiscount"
@close="state.showDiscount = false"
/>
<s-coupon-select v-model="state.couponInfo" :show="state.showCoupon" @confirm="onSelectCoupon"
@close="state.showCoupon = false" />
<!-- 满额折扣弹框 -->
<s-discount-list v-model="state.orderInfo" :show="state.showDiscount" @close="state.showDiscount = false" />
<!-- 底部 -->
<su-fixed bottom :opacity="false" bg="bg-white" 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 class="total-num ss-font-30 text-red"> {{ state.orderInfo.pay_fee }} </view>
<view v-if="state.orderPayload.order_type === 'score'" class="ss-flex">
<view class="total-num ss-font-30 text-red ss-m-l-4">+</view>
<image :src="sheep.$url.static('/static/img/shop/goods/score1.svg')" class="score-img"></image>
<view class="total-num ss-font-30 text-red">{{ state.orderInfo.score_amount }}</view>
</view>
</view>
<button
class="ss-reset-button ui-BG-Main-Gradient ss-r-40 submit-btn ui-Shadow-Main"
@tap="onConfirm"
>
提交订单
<button class="ss-reset-button ui-BG-Main-Gradient ss-r-40 submit-btn ui-Shadow-Main" @tap="onConfirm">
{{ exchangeNow ? '立即兑换' : '提交订单' }}
</button>
</view>
</su-fixed>
@ -148,26 +127,36 @@
</template>
<script setup>
import { reactive } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import {
reactive,
computed
} from 'vue';
import {
onLoad,
onPageScroll,
onShow
} from '@dcloudio/uni-app';
import sheep from '@/sheep';
import { isEmpty } from 'lodash';
import OrderApi from '@/sheep/api/trade/order';
import CouponApi from '@/sheep/api/promotion/coupon';
import { fen2yuan } from '@/sheep/hooks/useGoods';
import {
isEmpty
} from 'lodash';
const state = reactive({
orderPayload: {},
orderInfo: {
items: [], //
price: {}, //
},
addressInfo: {}, //
showCoupon: false, //
couponInfo: [], //
showDiscount: false, //
orderInfo: {},
addressInfo: {},
invoiceInfo: {},
totalNumber: 0,
showCoupon: false,
couponInfo: [],
showDiscount: false,
});
// ()
const exchangeNow = computed(
() => state.orderPayload.order_type === 'score' && state.orderInfo.pay_fee == 0,
);
//
function onSelectAddress() {
uni.$once('SELECT_ADDRESS', (e) => {
@ -178,91 +167,128 @@
// &
async function changeConsignee(addressInfo = {}) {
if (isEmpty(addressInfo)) {
const {
code,
data
} = await sheep.$api.user.address.default();
console.log(data, '默认收货地址');
if (code === 0 && !isEmpty(data)) {
console.log('执行赋值')
addressInfo = data;
}
}
if (!isEmpty(addressInfo)) {
state.addressInfo = addressInfo;
state.orderPayload.address_id = state.addressInfo.id;
}
await getOrderInfo();
getOrderInfo();
}
//
async function onSelectCoupon(couponId) {
state.orderPayload.couponId = couponId || 0;
await getOrderInfo();
async function onSelectCoupon(e) {
state.orderPayload.coupon_id = e || 0;
getOrderInfo();
state.showCoupon = false;
}
//
//
function onSelectInvoice() {
uni.$once('SELECT_INVOICE', (e) => {
state.invoiceInfo = e.invoiceInfo;
state.orderPayload.invoice_id = e.invoiceInfo.id || 0;
});
sheep.$router.go('/pages/user/invoice/list');
}
// /
function onConfirm() {
if (!state.addressInfo.id) {
if (!state.orderPayload.address_id && state.orderInfo.need_address === 1) {
sheep.$helper.toast('请选择收货地址');
return;
}
if (exchangeNow.value) {
uni.showModal({
title: '提示',
content: '确定使用积分立即兑换?',
cancelText: '再想想',
success: async function(res) {
if (res.confirm) {
submitOrder();
}
},
});
} else {
submitOrder();
}
}
// &
async function submitOrder() {
const { code, data } = await OrderApi.createOrder({
items: state.orderPayload.items,
couponId: state.orderPayload.couponId,
addressId: state.addressInfo.id,
deliveryType: 1, // TODO
pointStatus: false, // TODO
});
if (code !== 0) {
return;
}
//
if (state.orderPayload.items[0].cartId > 0) {
const {
error,
data
} = await sheep.$api.order.create(state.orderPayload);
if (error === 0) {
//
if (state.orderPayload.from === 'cart') {
sheep.$store('cart').getList();
}
//
sheep.$router.redirect('/pages/pay/index', {
orderSN: data.payOrderId,
if (exchangeNow.value) {
sheep.$router.redirect('/pages/pay/result', {
orderSN: data.order_sn,
});
} else {
sheep.$router.redirect('/pages/pay/index', {
orderSN: data.order_sn,
});
}
}
}
// &
// &
async function getOrderInfo() {
//
const { data, code } = await OrderApi.settlementOrder({
items: state.orderPayload.items,
couponId: state.orderPayload.couponId,
addressId: state.addressInfo.id,
deliveryType: 1, // TODO
pointStatus: false, // TODO
console.log(state.orderPayload, '计算价格传参')
// let {code, data} = await sheep.$api.order.calc(state.orderPayload);
// let data = await sheep.$api.order.calc(state.orderPayload);
console.log(state.orderPayload.items)
let data = await sheep.$api.order.calc({
deliveryType: 1,
pointStatus: false,
items: state.orderPayload.items
});
if (code !== 0) {
console.log(data, '修改后的获取订单详细数据')
return;
}
if (error === 0) {
state.totalNumber = 0;
state.orderInfo = data;
//
if (state.orderInfo.address) {
state.addressInfo = state.orderInfo.address;
state.orderInfo.goods_list.forEach((item) => {
state.totalNumber += item.goods_num;
});
}
}
//
async function getCoupons() {
const { code, data } = await CouponApi.getMatchCouponList(
state.orderInfo.price.payPrice,
state.orderInfo.items.map((item) => item.spuId),
state.orderPayload.items.map((item) => item.skuId),
state.orderPayload.items.map((item) => item.categoryId),
);
if (code === 0) {
const {
error,
data
} = await sheep.$api.order.coupons(state.orderPayload);
if (error === 0) {
state.couponInfo = data;
}
}
onLoad(async (options) => {
if (!options.data) {
sheep.$helper.toast('参数不正确,请检查!');
return;
}
console.log(options)
if (options.data) {
state.orderPayload = JSON.parse(options.data);
await getOrderInfo();
await getCoupons();
changeConsignee();
if (state.orderPayload.order_type !== 'score') {
getCoupons();
}
}
});
</script>

View File

@ -232,7 +232,7 @@
<button
class="ss-reset-button cancel-btn"
v-if="state.orderInfo.buttons?.includes('comment')"
@tap="onComment(state.orderInfo.id, state.orderInfo)"
@tap="onComment(state.orderInfo.id)"
>
评价
</button>
@ -299,10 +299,10 @@
});
}
// TODO
async function onExpress(orderId) {
sheep.$router.go('/pages/order/express/list', {
orderId,
//
async function onExpress(id) {
sheep.$router.go('/pages/order/express/log', {
id,
});
}
@ -362,10 +362,9 @@
// #endif
//
function onComment(orderSN, orderId) {
function onComment(id) {
sheep.$router.go('/pages/goods/comment/add', {
orderSN,
orderId,
id
});
}
@ -377,7 +376,7 @@
merchant_trade_no: state.merchantTradeNo,
});
} else {
res = await sheep.$api.order.detail(id);
res = await OrderApi.getOrder(id);
}
if (res.code === 0) {
state.orderInfo = res.data;

View File

@ -1,104 +0,0 @@
<!-- 物流包裹-->
<template>
<s-layout title="物流包裹">
<view class="express-wrap">
<su-sticky bgColor="#FFE2B6">
<view class="header ss-flex ss-p-l-24">{{ state.list.length }}个包裹已派送</view>
</su-sticky>
<view
class="express-box"
v-for="item in state.list"
:key="item.type"
@tap="sheep.$router.go('/pages/order/express/log', { id: item.id, orderId: state.orderId })"
>
<view class="express-box-header ss-flex ss-row-between">
<view class="express-box-header-type">{{ item.status_text }}</view>
<view class="express-box-header-num">{{
item.express_name + ' : ' + item.express_no
}}</view>
</view>
<view class="express-box-content">
<view class="content-address">{{ item.logs[0]?.content }}</view>
<view class="" v-if="item.items?.length">
<scroll-view class="scroll-box" scroll-x scroll-anchoring>
<view class="ss-flex">
<view v-for="i in item.items" :key="i" class="ss-m-r-20"
><image class="content-img" :src="sheep.$url.static(i.goods_image)" />
</view>
</view>
</scroll-view>
</view>
</view>
<view class="express-box-foot">{{ item.items.length }}件商品</view>
</view>
</view>
</s-layout>
</template>
<script setup>
import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app';
import { computed, reactive } from 'vue';
const state = reactive({
list: [],
orderId: '',
});
async function getExpressList(id) {
const { data } = await sheep.$api.order.express(id, '');
state.list = data;
}
onLoad((Option) => {
state.orderId = Option.orderId;
getExpressList(state.orderId);
});
</script>
<style lang="scss" scoped>
.header {
height: 84rpx;
font-size: 30rpx;
font-weight: 500;
color: #a8700d;
}
.express-box {
background: #fff;
padding-bottom: 30rpx;
box-sizing: border-box;
margin-bottom: 20rpx;
.express-box-header {
height: 76rpx;
padding: 0 24rpx;
border-bottom: 2rpx solid rgba(#dfdfdf, 0.5);
.express-box-header-type {
font-size: 26rpx;
font-weight: 500;
color: #999;
}
.express-box-header-num {
font-size: 26rpx;
font-weight: 400;
color: #999999;
}
}
.express-box-content {
padding: 20rpx 24rpx;
.content-address {
font-size: 28rpx;
font-weight: 400;
color: #333333;
line-height: normal;
margin-bottom: 20rpx;
}
.content-img {
width: 180rpx;
height: 180rpx;
}
}
.express-box-foot {
padding: 0 24rpx;
font-size: 24rpx;
font-weight: 400;
color: #999999;
}
}
</style>

View File

@ -2,65 +2,46 @@
<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" @change="change">
<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)"></image>
<image class="log-card-img" :src="sheep.$url.static(item.image)" />
</swiper-item>
</swiper>
</uni-swiper-dot>
<view class="log-card-msg">
<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.express_no }}</view>
<view>快递公司{{ state.info.express_name }}</view>
<!-- 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.info.logs"
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
v-if="state.info.logs[index].status === state.info.logs[index - 1]?.status"
class="cicon-title"
></text>
<text
v-if="state.info.logs[index].status != state.info.logs[index - 1]?.status"
:class="[
index === 0 ? 'activity-color' : 'info-color',
item.status === 'transport'
? 'sicon-transport'
: item.status === 'delivery'
? 'sicon-delivery'
: item.status === 'collect'
? 'sicon-a-collectmaterials'
: item.status === 'fail' || item.status === 'back' || item.status === 'refuse'
? 'sicon-circleclose'
: item.status === 'signfor'
? 'sicon-circlecheck'
: 'sicon-warning-outline',
]"
></text>
<view v-if="state.info.logs.length - 1 != index" class="line"></view>
<text class="cicon-title" />
<view v-if="state.tracks.length - 1 !== index" class="line" />
</view>
<view class="log-content-msg">
<view
v-if="
item.status_text &&
state.info.logs[index].status != state.info.logs[index - 1]?.status
"
class="log-msg-title ss-m-b-20"
>{{ item.status_text }}</view
>
<!-- 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-date ss-m-b-40">{{ item.change_date }}</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>
@ -72,31 +53,38 @@
import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app';
import { computed, reactive } from 'vue';
import OrderApi from '@/sheep/api/trade/order';
const state = reactive({
info: [],
current: 0,
tracks: [],
});
const goodsImages = computed(() => {
let array = [];
if (state.info.items) {
state.info.items.forEach((item) => {
array.push({
image: item.goods_image,
image: item.picUrl,
});
});
}
return array;
});
function change(e) {
state.current = e.detail.current;
async function getExpressDetail(id) {
const { data } = await OrderApi.getOrderExpressTrackList(id);
state.tracks = data.reverse();
}
async function getExpressdetail(id, orderId) {
const { data } = await sheep.$api.order.express(id, orderId);
async function getOrderDetail(id) {
const { data } = await OrderApi.getOrder(id)
state.info = data;
}
onLoad((Option) => {
getExpressdetail(Option.id, Option.orderId);
onLoad((options) => {
getExpressDetail(options.id);
getOrderDetail(options.id);
});
</script>

View File

@ -55,7 +55,7 @@
取消订单
</button>
<button v-if="order.buttons.includes('comment')" class="tool-btn ss-reset-button"
@tap.stop="onComment(order.order_sn)">
@tap.stop="onComment(order.id)">
评价
</button>
<button v-if="order.buttons.includes('delete')" class="delete-btn ss-reset-button"
@ -164,10 +164,10 @@
});
}
// TODO
function onComment(orderSN) {
//
function onComment(id) {
sheep.$router.go('/pages/goods/comment/add', {
orderSN,
id,
});
}
@ -228,10 +228,10 @@
}
// #endif
// TODO
async function onExpress(orderId) {
sheep.$router.go('/pages/order/express/list', {
orderId,
//
async function onExpress(id) {
sheep.$router.go('/pages/order/express/log', {
id,
});
}

View File

@ -2,17 +2,14 @@
<template>
<s-layout title="收银台">
<view class="bg-white ss-modal-box ss-flex-col">
<!-- 订单信息 -->
<view class="modal-header ss-flex-col ss-col-center ss-row-center">
<view class="money-box ss-m-b-20">
<text class="money-text">{{ fen2yuan(state.orderInfo.price) }}</text>
<text class="money-text">{{ state.orderInfo.pay_fee }}</text>
</view>
<view class="time-text">
<text>{{ payDescText }}</text>
</view>
</view>
<!-- 支付方式 -->
<view class="modal-content ss-flex-1">
<view class="pay-title ss-p-l-30 ss-m-y-30">选择支付方式</view>
<radio-group @change="onTapPay">
@ -20,6 +17,7 @@
<view
class="pay-item ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom"
:class="{ 'disabled-pay-item': item.disabled }"
v-if="allowedPayment.includes(item.value)"
>
<view class="ss-flex ss-col-center">
<image
@ -27,19 +25,25 @@
v-if="item.disabled"
:src="sheep.$url.static('/static/img/shop/pay/cod_disabled.png')"
mode="aspectFit"
/>
></image>
<image
class="pay-icon"
v-else
:src="sheep.$url.static(item.icon)"
mode="aspectFit"
/>
></image>
<text class="pay-title">{{ item.title }}</text>
</view>
<view class="check-box ss-flex ss-col-center ss-p-l-10">
<view class="userInfo-money ss-m-r-10" v-if="item.value === 'wallet'">
<view class="userInfo-money ss-m-r-10" v-if="item.value == 'money'">
余额: {{ userInfo.money }}
</view>
<view
class="userInfo-money ss-m-r-10"
v-if="item.value == 'offline' && item.disabled"
>
部分商品不支持
</view>
<radio
:value="item.value"
color="var(--ui-BG-Main)"
@ -52,7 +56,6 @@
</label>
</radio-group>
</view>
<!-- 工具 -->
<view class="modal-footer ss-flex ss-row-center ss-col-center ss-m-t-80 ss-m-b-40">
<button v-if="state.payStatus === 0" class="ss-reset-button past-due-btn">
@ -78,49 +81,95 @@
import { computed, reactive } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import sheep from '@/sheep';
import { fen2yuan, useDurationTime } from '@/sheep/hooks/useGoods';
import PayOrderApi from '@/sheep/api/pay/order';
import PayChannelApi from '@/sheep/api/pay/channel';
import { getPayMethods } from '@/sheep/platform/pay';
import { useDurationTime } from '@/sheep/hooks/useGoods';
const userInfo = computed(() => sheep.$store('user').userInfo);
//
const state = reactive({
orderType: 'goods', // ; goods - , recharge -
orderInfo: {}, //
orderType: 'goods',
payment: '',
orderInfo: {},
payStatus: 0, // 0=, -2= -1= 1=2=
payMethods: [], //
payment: '', //
payMethods: [],
});
const allowedPayment = computed(() => {
if(state.orderType === 'recharge') {
return sheep.$store('app').platform.recharge_payment
}
return sheep.$store('app').platform.payment
});
const payMethods = [
{
icon: '/static/img/shop/pay/wechat.png',
title: '微信支付',
value: 'wechat',
disabled: false,
},
{
icon: '/static/img/shop/pay/alipay.png',
title: '支付宝支付',
value: 'alipay',
disabled: false,
},
{
icon: '/static/img/shop/pay/wallet.png',
title: '余额支付',
value: 'money',
disabled: false,
},
{
icon: '/static/img/shop/pay/apple.png',
title: 'Apple Pay',
value: 'apple',
disabled: false,
},
{
icon: '/static/img/shop/pay/cod.png',
title: '货到付款',
value: 'offline',
disabled: false,
},
];
const onPay = () => {
if (state.payment === '') {
sheep.$helper.toast('请选择支付方式');
return;
}
if (state.payment === 'wallet') {
if (state.payment === 'money') {
uni.showModal({
title: '提示',
content: '确定要支付吗?',
success: function (res) {
if (res.confirm) {
sheep.$platform.pay(state.payment, state.orderType, state.orderInfo.id);
sheep.$platform.pay(state.payment, state.orderType, state.orderInfo.order_sn);
}
},
});
} else if (state.payment === 'offline') {
uni.showModal({
title: '提示',
content: '确定要下单吗?',
success: function (res) {
if (res.confirm) {
sheep.$platform.pay(state.payment, state.orderType, state.orderInfo.order_sn);
}
},
});
} else {
sheep.$platform.pay(state.payment, state.orderType, state.orderInfo.id);
sheep.$platform.pay(state.payment, state.orderType, state.orderInfo.order_sn);
}
};
//
const payDescText = computed(() => {
if (state.payStatus === 2) {
return '该订单已支付';
}
if (state.payStatus === 1) {
const time = useDurationTime(state.orderInfo.expireTime);
if (state.payStatus === 1 && state.orderInfo.ext.expired_time !== 0) {
const time = useDurationTime(state.orderInfo.ext.expired_time);
if (time.ms <= 0) {
state.payStatus = -1;
return '';
@ -130,65 +179,86 @@
if (state.payStatus === -2) {
return '未查询到支付单信息';
}
return '';
});
// payOrder.status => payStatus
function checkPayStatus() {
if (state.orderInfo.status === 10
|| state.orderInfo.status === 20 ) { //
state.payStatus = 2;
if (state.orderInfo.status === 'unpaid') {
state.payStatus = 1;
return;
}
if (state.orderInfo.status === 30) { //
if (state.orderInfo.status === 'closed') {
state.payStatus = -1;
return;
}
state.payStatus = 1; //
state.payStatus = 2;
}
//
function onTapPay(e) {
state.payment = e.detail.value;
}
//
async function setOrder(id) {
//
const { data, code } = await PayOrderApi.getOrder(id);
if (code !== 0 || !data) {
state.payStatus = -2;
return;
}
async function setRechargeOrder(id) {
const { data, error } = await sheep.$api.trade.order(id);
if (error === 0) {
state.orderInfo = data;
//
await setPayMethods();
//
state.payMethods = payMethods;
checkPayStatus();
} else {
state.payStatus = -2;
}
}
//
async function setPayMethods() {
const { data, code } = await PayChannelApi.getEnableChannelCodeList(state.orderInfo.appId)
if (code !== 0) {
return
async function setGoodsOrder(id) {
const { data, error } = await sheep.$api.order.detail(id);
if (error === 0) {
state.orderInfo = data;
if (state.orderInfo.ext.offline_status === 'none') {
payMethods.forEach((item, index, array) => {
if (item.value === 'offline') {
array.splice(index, 1);
}
});
} else if (state.orderInfo.ext.offline_status === 'disabled') {
payMethods.forEach((item) => {
if (item.value === 'offline') {
item.disabled = true;
}
});
}
state.payMethods = payMethods;
checkPayStatus();
} else {
state.payStatus = -2;
}
state.payMethods = getPayMethods(data)
}
onLoad((options) => {
if (sheep.$platform.name === 'WechatOfficialAccount'
&& sheep.$platform.os === 'ios'
&& !sheep.$platform.landingPage.includes('pages/pay/index')) {
if (
sheep.$platform.name === 'WechatOfficialAccount' &&
sheep.$platform.os === 'ios' &&
!sheep.$platform.landingPage.includes('pages/pay/index')
) {
location.reload();
return;
}
//
let id = options.id;
if (options.orderType) {
state.orderType = options.orderType;
let id = '';
if (options.orderSN) {
id = options.orderSN;
}
if (options.id) {
id = options.id;
}
if (options.type === 'recharge') {
state.orderType = 'recharge';
//
setRechargeOrder(id);
} else {
state.orderType = 'goods';
//
setGoodsOrder(id);
}
setOrder(id);
});
</script>

View File

@ -17,15 +17,17 @@
<view class="input-label ss-m-b-50">充值金额</view>
<view class="input-box ss-flex border-bottom ss-p-b-20" v-if="state.data.custom_status">
<view class="unit"></view>
<uni-easyinput v-model="state.recharge_money" type="digit" placeholder="请输入充值金额" :inputBorder="false">
<uni-easyinput v-model="state.recharge_money" type="digit" placeholder="请输入充值金额"
:inputBorder="false">
</uni-easyinput>
</view>
<view class="face-value-box ss-flex ss-flex-wrap ss-m-y-40">
<button class="ss-reset-button face-value-btn" v-for="item in state.faceValueList" :key="item.money"
:class="[{ 'btn-active': state.recharge_money == parseFloat(item.money) }]" @tap="onCard(item.money)">
<text class="face-value-title">{{ item.money }}</text>
<view v-if="item.gift" class="face-value-tag">
{{ item.gift }}{{ state.data.gift_type == 'money' ? '元' : '积分' }}</view>
:class="[{ 'btn-active': state.recharge_money == parseFloat(item.money) }]"
@tap="onCard(item.payPrice/100)">
<text class="face-value-title">{{ item.payPrice/100 }}</text>
<view v-if="item.bonusPrice" class="face-value-tag">
{{ item.bonusPrice/100 }}{{ state.data.gift_type == 'money' ? '元' : '积分' }}</view>
</button>
</view>
<button class="ss-reset-button save-btn ui-BG-Main-Gradient ss-m-t-60 ui-Shadow-Main" @tap="onConfirm">
@ -38,61 +40,77 @@
</template>
<script setup>
import { computed, reactive } from 'vue';
import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app';
import {
computed,
reactive
} from 'vue';
import sheep from '@/sheep';
import {
onLoad
} from '@dcloudio/uni-app';
const userInfo = computed(() => sheep.$store('user').userInfo);
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
const userInfo = computed(() => sheep.$store('user').userInfo);
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
const state = reactive({
const state = reactive({
recharge_money: '',
data: {},
faceValueList: [],
});
//
});
//
function onCard(e) {
function onCard(e) {
state.recharge_money = e;
}
async function getRechargeTabs() {
}
async function getRechargeTabs() {
const res = await sheep.$api.trade.rechargeRules();
const res2 = await sheep.$api.trade.rechargeRules2();
if (res.error === 0) {
state.data = res.data;
state.data.status = res.data.status;
state.faceValueList = res.data.quick_amounts;
console.log(res);
console.log(res2);
// state.faceValueList = res.data.quick_amounts;
state.faceValueList = res2.data;
}
}
}
function onChange(e) {
function onChange(e) {
state.data.gift_type = e.detail.value;
}
}
async function onConfirm() {
const { error, data } = await sheep.$api.trade.recharge({
recharge_money: state.recharge_money,
async function onConfirm() {
const {
code,
data
} = await sheep.$api.trade.recharge({
packageId: 0,
payPrice: state.recharge_money * 100
});
if (error === 0) {
if (code === 0) {
// #ifdef MP
sheep.$platform.useProvider('wechat').subscribeMessage('money_change');
// #endif
sheep.$router.go('/pages/pay/index', { orderSN: data.order_sn, type: 'recharge' });
sheep.$router.go('/pages/pay/index', {
orderSN: data.order_sn,
type: 'recharge'
});
}
}
onLoad(() => {
}
onLoad(() => {
getRechargeTabs();
});
});
</script>
<style lang="scss" scoped>
:deep() {
:deep() {
.uni-input-input {
font-family: OPPOSANS !important;
}
}
}
.wallet-num-box {
.wallet-num-box {
padding: 0 40rpx 80rpx;
background: var(--ui-BG-Main) v-bind(headerBg) center/750rpx 100% no-repeat;
border-radius: 0 0 5% 5%;
@ -122,22 +140,22 @@ onLoad(() => {
font-weight: 500;
color: $white;
}
}
}
.recharge-box {
.recharge-box {
position: relative;
padding: 0 30rpx;
margin-top: -60rpx;
}
}
.save-btn {
.save-btn {
width: 620rpx;
height: 86rpx;
border-radius: 44rpx;
font-size: 30rpx;
}
}
.recharge-card-box {
.recharge-card-box {
width: 690rpx;
background: var(--ui-BG);
border-radius: 20rpx;
@ -246,5 +264,5 @@ onLoad(() => {
font-family: OPPOSANS;
}
}
}
}
</style>

View File

@ -2,27 +2,34 @@
<template>
<s-layout title="支付结果" :bgStyle="{ color: '#FFF' }">
<view class="pay-result-box ss-flex-col ss-row-center ss-col-center">
<!-- 信息展示 -->
<view class="pay-waiting ss-m-b-30" v-if="payResult === 'waiting'" />
<view class="pay-waiting ss-m-b-30" v-if="payResult === 'waiting'"> </view>
<image
class="pay-img ss-m-b-30"
v-if="payResult === 'success'"
:src="sheep.$url.static('/static/img/shop/order/order_pay_success.gif')"
/>
></image>
<image
class="pay-img ss-m-b-30"
v-if="['failed', 'closed'].includes(payResult)"
:src="sheep.$url.static('/static/img/shop/order/order_paty_fail.gif')"
/>
<view class="tip-text ss-m-b-30" v-if="payResult === 'success'"></view>
<view class="tip-text ss-m-b-30" v-if="payResult === 'failed'"></view>
<view class="tip-text ss-m-b-30" v-if="payResult === 'closed'"></view>
<view class="tip-text ss-m-b-30" v-if="payResult === 'waiting'">...</view>
></image>
<view class="tip-text ss-m-b-30" v-if="payResult == 'success'">{{
state.orderInfo.pay_mode === 'offline' ? '下单成功' : '支付成功'
}}</view>
<view class="tip-text ss-m-b-30" v-if="payResult == 'failed'"></view>
<view class="tip-text ss-m-b-30" v-if="payResult == 'closed'"></view>
<view class="tip-text ss-m-b-30" v-if="payResult == 'waiting'">...</view>
<view class="pay-total-num ss-flex" v-if="payResult === 'success'">
<view>{{ fen2yuan(state.orderInfo.price) }}</view>
<view v-if="Number(state.orderInfo.pay_fee) > 0">{{ state.orderInfo.pay_fee }}</view>
<view v-if="state.orderInfo.score_amount && Number(state.orderInfo.pay_fee) > 0">+</view>
<view class="price-text ss-flex ss-col-center" v-if="state.orderInfo.score_amount">
<image
:src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
class="score-img"
></image>
<view>{{ state.orderInfo.score_amount }}</view>
</view>
</view>
<!-- 操作区 -->
<view class="btn-box ss-flex ss-row-center ss-m-t-50">
<button class="back-btn ss-reset-button" @tap="sheep.$router.go('/pages/index/index')">
返回首页
@ -30,29 +37,30 @@
<button
class="check-btn ss-reset-button"
v-if="payResult === 'failed'"
@tap="
sheep.$router.redirect('/pages/pay/index', { id: state.id, orderType: state.orderType })
"
@tap="sheep.$router.redirect('/pages/pay/index', { orderSN: state.orderId })"
>
重新支付
</button>
<button class="check-btn ss-reset-button" v-if="payResult === 'success'" @tap="onOrder">
查看订单
</button>
<!-- TODO 芋艿拼团接入 -->
<button
class="check-btn ss-reset-button"
v-if="payResult === 'success' && state.tradeOrder.type === 3"
v-if="
payResult === 'success' &&
['groupon', 'groupon_ladder'].includes(state.orderInfo.activity_type)
"
@tap="sheep.$router.redirect('/pages/activity/groupon/order')"
>
我的拼团
</button>
</view>
<!-- TODO 芋艿订阅 -->
<!-- #ifdef MP -->
<view class="subscribe-box ss-flex ss-m-t-44">
<image class="subscribe-img" :src="sheep.$url.static('/static/img/shop/order/cargo.png')" />
<image
class="subscribe-img"
:src="sheep.$url.static('/static/img/shop/order/cargo.png')"
></image>
<view class="subscribe-title ss-m-r-48 ss-m-l-16">获取实时发货信息与订单状态</view>
<view class="subscribe-start" @tap="subscribeMessage"></view>
</view>
@ -66,20 +74,15 @@
import { reactive, computed } from 'vue';
import { isEmpty } from 'lodash';
import sheep from '@/sheep';
import PayOrderApi from '@/sheep/api/pay/order';
import { fen2yuan } from '../../sheep/hooks/useGoods';
import OrderApi from '@/sheep/api/trade/order';
const state = reactive({
id: 0, //
orderType: 'goods', //
orderId: 0,
orderType: 'goods',
result: 'unpaid', //
orderInfo: {}, //
tradeOrder: {}, // orderType goods
orderInfo: {}, //
counter: 0, //
});
// result => payResult
const payResult = computed(() => {
if (state.result === 'unpaid') {
return 'waiting';
@ -90,65 +93,57 @@
if (state.result === 'failed') {
return 'failed';
}
if (state.result === 'closed') {
return 'closed';
}
});
//
async function getOrderInfo(id) {
async function getOrderInfo(orderId) {
let checkPayResult;
state.counter++;
// 1.
const { data, code } = await PayOrderApi.getOrder(id);
if (code === 0) {
if (state.orderType === 'recharge') {
checkPayResult = sheep.$api.trade.order;
} else {
checkPayResult = sheep.$api.order.detail;
}
const { data, error } = await checkPayResult(orderId);
if (error === 0) {
state.orderInfo = data;
if (!state.orderInfo || state.orderInfo.status === 30) {
//
if (state.orderInfo.status === 'closed') {
state.result = 'closed';
return;
}
if (state.orderInfo.status !== 0) {
// 退
if (state.orderInfo.status !== 'unpaid') {
state.result = 'paid';
// #ifdef MP
subscribeMessage();
// #endif
//
if (state.orderType === 'goods') {
const { data, code } = await OrderApi.getOrder(state.orderInfo.merchantOrderId);
if (code === 0) {
state.tradeOrder = data;
}
}
return;
}
}
// 2.1
if (state.counter < 3 && state.result === 'unpaid') {
setTimeout(() => {
getOrderInfo(id);
getOrderInfo(orderId);
}, 1500);
}
// 2.2
//
if (state.counter >= 3) {
state.result = 'failed';
}
}
function onOrder() {
// TODO
if (state.orderType === 'recharge') {
if ((state.orderType === 'recharge')) {
sheep.$router.redirect('/pages/pay/recharge-log');
} else {
sheep.$router.redirect('/pages/order/list');
}
}
// TODO
// #ifdef MP
function subscribeMessage() {
let event = ['order_dispatched'];
if (state.tradeOrder.type === 3) {
if (['groupon', 'groupon_ladder'].includes(state.orderInfo.activity_type)) {
event.push('groupon_finish');
event.push('groupon_fail');
}
@ -157,13 +152,18 @@
// #endif
onLoad(async (options) => {
let id = '';
//
if (options.id) {
state.id = options.id;
if (options.orderSN) {
id = options.orderSN;
}
//
if (options.orderType) {
state.orderType = options.orderType;
if (options.id) {
id = options.id;
}
state.orderId = id;
if (options.orderType === 'recharge') {
state.orderType = 'recharge';
}
//
@ -171,16 +171,14 @@
state.result = 'failed';
} else {
//
await getOrderInfo(state.id);
getOrderInfo(state.orderId);
}
});
onShow(() => {
if (isEmpty(state.orderInfo)) {
return;
}
getOrderInfo(state.id);
});
if(isEmpty(state.orderInfo)) return;
getOrderInfo(state.orderId);
})
onHide(() => {
state.result = 'unpaid';

View File

@ -101,6 +101,7 @@
},
);
const onRegionConfirm = (e) => {
console.log(e);
state.model = {
...state.model,
...e,
@ -186,7 +187,13 @@
if (options.data) {
let data = JSON.parse(options.data);
console.log(data)
const areaData = uni.getStorageSync('areaData');
let provinceArr = areaData.filter(item => item.name == data.province_name);
data.province_id = provinceArr[0].id;
let provinceArr2 = provinceArr[0].children.filter(item => item.name == data.city_name);
data.city_id = provinceArr2[0].id;
let provinceArr3 = provinceArr2[0].children.filter(item => item.name == data.district_name);
data.district_id = provinceArr3[0].id;
state.model = {
...state.model,
...data,

View File

@ -1,12 +1,11 @@
<!-- 我的商品收藏 -->
<template>
<s-layout title="商品收藏">
<view class="cart-box ss-flex ss-flex-col ss-row-between">
<!-- 头部 -->
<view class="cart-header ss-flex ss-col-center ss-row-between ss-p-x-30">
<view class="header-left ss-flex ss-col-center ss-font-26">
<text class="goods-number ui-TC-Main ss-flex">{{ state.pagination.total }}</text>
件商品
<text class="goods-number ui-TC-Main ss-flex">{{ state.pagination.total }}</text> 件商品
</view>
<view class="header-right">
<button
@ -20,15 +19,16 @@
v-if="!state.editMode && state.pagination.total"
class="ss-reset-button ui-TC-Main"
@tap="state.editMode = true"
>编辑</button
>
编辑
</button>
</view>
</view>
<!-- 内容 -->
<view class="cart-content">
<view
class="goods-box ss-r-10 ss-m-b-14"
v-for="item in state.pagination.data"
v-for="item in state.pagination.list"
:key="item.id"
>
<view class="ss-flex ss-col-center">
@ -44,12 +44,10 @@
@tap.stop="onSelect(item.spuId)"
/>
</label>
<!-- :skuText="item.goods.subtitle" -->
<s-goods-item
:title="item.spuName"
:img="item.picUrl"
:price="item.price"
priceColor="#FF3000"
:titleWidth="400"
@tap="
@ -57,11 +55,11 @@
id: item.spuId,
})
"
>
</s-goods-item>
/>
</view>
</view>
</view>
<!-- 底部 -->
<su-fixed bottom :val="0" placeholder v-show="state.editMode">
<view class="cart-footer ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom">
@ -79,9 +77,9 @@
<view class="footer-right">
<button
class="ss-reset-button ui-BG-Main-Gradient pay-btn ss-font-28 ui-Shadow-Main"
@tap="onCancel"
>取消收藏</button
>
@tap="onCancel">
取消收藏
</button>
</view>
</view>
</su-fixed>
@ -92,7 +90,7 @@
:content-text="{
contentdown: '上拉加载更多',
}"
@tap="loadmore"
@tap="loadMore"
/>
<s-empty v-if="state.pagination.total === 0" text="暂无收藏" icon="/static/collect-empty.png" />
</s-layout>
@ -103,98 +101,89 @@
import { reactive } from 'vue';
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
import _ from 'lodash';
import FavoriteApi from '@/sheep/api/product/favorite';
import { resetPagination } from '@/sheep/util';
const sys_navBar = sheep.$platform.navbar;
const pagination = {
data: [],
current_page: 1,
total: 1,
last_page: 1,
};
const state = reactive({
pagination: {
data: [],
current_page: 1,
total: 1,
last_page: 1,
list: [],
total: 0,
pageNo: 1,
pageSize: 6,
},
loadStatus: '',
editMode: false,
selectedCollectList: [],
selectedCollectList: [], // SPU
selectAll: false,
});
async function getData(page = 1, list_rows = 6) {
async function getData() {
state.loadStatus = 'loading';
let res = await sheep.$api.user.favorite.list({
pageSize:list_rows,
pageNo:page,
const { code, data } = await FavoriteApi.getFavoritePage({
pageNo: state.pagination.pageNo,
pageSize: state.pagination.pageSize,
});
if (res.code === 0) {
console.log('yudao收藏列表',res)
let orderList = _.concat(state.pagination.data, res.data.list);
state.pagination = {
...res.data,
data: orderList,
};
//
if (state.pagination.current_page < state.pagination.last_page) {
state.loadStatus = 'more';
} else {
state.loadStatus = 'noMore';
if (code !== 0) {
return;
}
}
}
//
function formatPrice(e) {
return e.length === 1 ? e[0] : e.join('~');
state.pagination.list = _.concat(state.pagination.list, data.list)
state.pagination.total = data.total;
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
}
//
const onSelect = (id) => {
if (!state.selectedCollectList.includes(id)) {
state.selectedCollectList.push(id);
const onSelect = (spuId) => {
if (!state.selectedCollectList.includes(spuId)) {
state.selectedCollectList.push(spuId);
} else {
state.selectedCollectList.splice(state.selectedCollectList.indexOf(id), 1);
state.selectedCollectList.splice(state.selectedCollectList.indexOf(spuId), 1);
}
state.selectAll = state.selectedCollectList.length === state.pagination.data.length;
state.selectAll = state.selectedCollectList.length === state.pagination.list.length;
};
//
const onSelectAll = () => {
state.selectAll = !state.selectAll;
if (!state.selectAll) {
state.selectedCollectList = [];
} else {
state.pagination.data.forEach((item) => {
if (state.selectedCollectList.includes(item.goods_id)) {
state.selectedCollectList.splice(state.selectedCollectList.indexOf(item.goods_id), 1);
}
state.selectedCollectList.push(item.goods_id);
});
state.selectedCollectList = state.pagination.list.map((item) => item.spuId);
}
};
async function onCancel() {
if (state.selectedCollectList) {
state.selectedCollectList = state.selectedCollectList.toString();
const { code } = await sheep.$api.user.favorite.cancel(state.selectedCollectList);
if (code === 0) {
if (!state.selectedCollectList) {
return;
}
//
for (const spuId of state.selectedCollectList) {
await FavoriteApi.deleteFavorite(spuId);
}
// +
state.editMode = false;
state.selectedCollectList = [];
state.selectAll = false;
state.pagination = pagination;
resetPagination(state.pagination);
await getData();
}
//
function loadMore() {
if (state.loadStatus === 'noMore') {
return
}
state.pagination.pageNo++;
getData();
}
}
}
//
function loadmore() {
if (state.loadStatus !== 'noMore') {
getData(state.pagination.current_page + 1);
}
}
onReachBottom(() => {
loadmore();
loadMore();
});
onLoad(() => {
getData();
});

View File

@ -26,9 +26,24 @@ export default {
}),
signAdd: () =>
request({
url: 'activity/signin',
url: '/app-api/member/sign-in/record/create',
method: 'POST',
}),
configLise: () =>
request({
url: '/app-api/member/sign-in/config/list',
method: 'GET',
}),
recordPage: () =>
request({
url: '/app-api/member/sign-in/record/page',
method: 'GET',
}),
// signAdd: () =>
// request({
// url: 'activity/signin',
// method: 'POST',
// }),
replenish: (data) =>
request({
url: 'activity/signin/replenish',
@ -40,4 +55,10 @@ export default {
url: 'activity/activity/' + id,
method: 'GET',
}),
getSummary: () =>
request({
url: '/app-api/member/sign-in/record/get-summary',
method: 'GET',
}),
};

View File

@ -115,13 +115,11 @@ export default {
formData: {
group,
},
// TODO 芋艿:临时写死
header: {
// Accept: 'text/json',
// Authorization: token,
Accept : '*/*',
'tenant-id' :'1',
'terminal': 20,
Authorization: 'Bearer test247',
},
success: (uploadFileRes) => {

View File

@ -1,9 +1,10 @@
import request from '@/sheep/request';
import request2 from '@/sheep/request2';
export default {
list: (data) =>
request({
url: '/app-api/trade/cart/list',
request2({
url: 'trade/cart/list',
method: 'GET',
custom: {
showLoading: false,
@ -12,40 +13,26 @@ export default {
}),
append: (data) =>
request({
url: '/app-api/trade/cart/add',
url: 'cart',
method: 'POST',
// TODO 芋艿:这里没提示
custom: {
showSuccess: true,
successMsg: '已添加到购物车~',
},
data: {
...data,
// type: 'inc',
type: 'inc',
},
}),
// append: (data) =>
// request({
// url: 'cart',
// method: 'POST',
// custom: {
// showSuccess: true,
// successMsg: '已添加到购物车~',
// },
// data: {
// ...data,
// type: 'inc',
// },
// }),
// 删除购物车
delete: (ids) =>
request({
url: '/app-api/trade/cart/delete?ids=' + ids,
request2({
url: 'trade/cart/delete?ids=' + ids,
method: 'DELETE',
}),
update: (data) =>
request({
url: '/app-api/trade/cart/update-count',
request2({
url: 'trade/cart/update-count',
method: 'PUT',
data: {
...data,

View File

@ -1,7 +1,9 @@
import request2 from '@/sheep/request2';
export default {
list: (params) =>
request({
url: '/app-api/product/category/list',
request2({
url: 'product/category/list',
method: 'GET',
params,
}),

View File

@ -1,4 +1,5 @@
import request from '@/sheep/request';
import request2 from '@/sheep/request2';
export default {
// 我的拼团
@ -12,8 +13,8 @@ export default {
},
}),
userCoupon: (params) =>
request({
url: '/app-api/promotion/coupon/page',
request2({
url: 'promotion/coupon/page',
method: 'GET',
params,
}),
@ -33,20 +34,9 @@ export default {
}),
get: (id) =>
request({
url: '/app-api/promotion/coupon/take',
url: 'coupon/get/' + id,
method: 'POST',
data: {
templateId: id
},
params: {
templateId: id
},
}),
// get: (id) =>
// request({
// url: 'coupon/get/' + id,
// method: 'POST',
// }),
listByGoods: (id) =>
request({
url: 'coupon/listByGoods/' + id,

View File

@ -1,9 +1,10 @@
import request from '@/sheep/request';
import request2 from '@/sheep/request2';
export default {
area: () =>
request({
url: '/app-api/system/area/tree',
request2({
url: 'system/area/tree',
method: 'GET',
}),
// area: () =>

View File

@ -1,10 +1,11 @@
import request from '@/sheep/request';
import request2 from '@/sheep/request2';
export default {
// 商品详情
detail: (id, params = {}) =>
request({
url: '/app-api/product/spu/get-detail?id=' + id,
request2({
url: 'product/spu/get-detail?id=' + id,
method: 'GET',
params,
custom: {
@ -15,8 +16,8 @@ export default {
// 商品列表
list: (params) =>
request({
url: '/app-api/product/spu/page',
request2({
url: 'product/spu/page',
method: 'GET',
params,
custom: {
@ -36,10 +37,11 @@ export default {
showError: false,
},
}),
// 商品评价列表
comment: (id, params = {}) =>
request({
url: '/app-api/product/comment/list?spuId=' + id,
request2({
url: 'product/comment/list?spuId=' + id,
method: 'GET',
params,
custom: {
@ -75,10 +77,4 @@ export default {
method: 'GET',
params,
}),
// 检查是否收藏商品
exits: (id) =>
request({
url: '/app-api/product/favorite/exits?spuId=' + id,
method: 'GET',
}),
};

View File

@ -1,14 +1,14 @@
import request from '@/sheep/request';
import request2 from '@/sheep/request2';
export default {
decorate: () =>
request({
url: '/app-api/promotion/decorate/list?page=1',
request2({
url: 'promotion/decorate/list?page=1',
method: 'GET',
}),
spids: () =>
request({
url: '/app-api/product/spu/page?recommendType=best&pageNo=1&pageSize=10',
request2({
url: 'product/spu/page?recommendType=best&pageNo=1&pageSize=10',
method: 'GET',
}),
};

View File

@ -1,10 +1,11 @@
import request from '@/sheep/request';
import request2 from '@/sheep/request2';
export default {
// 订单详情
detail: (id, params) =>
request({
url: '/app-api/trade/order/get-detail?id=' + id,
request2({
url: 'trade/order/get-detail?id=' + id,
method: 'GET',
params,
}),
@ -37,7 +38,16 @@ export default {
showLoading: false,
},
}),
// 订单列表
list: (params) =>
request2({
url: 'trade/order/page',
method: 'GET',
params,
custom: {
showLoading: false,
},
}),
// list: (params) =>
// request({
// url: 'order/order',
@ -55,27 +65,27 @@ export default {
// 解决 SpringMVC 接受 List<Item> 参数的问题
delete data2.items
for (let i = 0; i < data.items.length; i++) {
// 此处转码问题,待解决方案
data2[encodeURIComponent('items[' + i + '' + '].skuId')] = data.items[i].skuId + '';
data2[encodeURIComponent('items[' + i + '' + '].count')] = data.items[i].count + '';
data2[encodeURIComponent('items[' + i + '' + '].cartId')] = data.items[i].cartId + '';
// data2['items' + `[${i}]` + '.skuId'] = data.items[i].skuId + '';
// data2['items' + `[${i}]` + '.count'] = data.items[i].count + '';
// data2['items' + `[${i}]` + '.cartId'] = data.items[i].cartId + '';
// data2['items' + `%5B${i}%5D` + '.skuId'] = data.items[i].skuId + '';
// data2['items' + `%5B${i}%5D` + '.count'] = data.items[i].count + '';
// data2['items' + `%5B${i}%5D` + '.cartId'] = data.items[i].cartId + '';
// data2['items[' + i + '' + '].skuId'] = data.items[i].skuId + '';
// data2['items[' + i + '' + '].count'] = data.items[i].count + '';
// data2['items[' + i + '' + '].cartId'] = data.items[i].cartId + '';
data2['items' + `%5B${i}%5D` + '.skuId'] = data.items[i].skuId + '';
data2['items' + `%5B${i}%5D` + '.count'] = data.items[i].count + '';
data2['items' + `%5B${i}%5D` + '.cartId'] = data.items[i].cartId + '';
}
console.log(data2, '手动转码的参数')
return request({
url: '/app-api/trade/order/settlement',
console.log(data2, '对比数据')
return request2({
url: 'trade/order/settlement',
method: 'GET',
// data: data2,
// data,
params: data2
})
},
// calc: (data) =>
// request({
// url: 'order/order/calc',
// method: 'POST',
// data,
// }),
// 创建订单
create: (data) =>
request({
@ -98,8 +108,8 @@ export default {
}),
// 评价订单
comment: (data) =>
request({
url: '/app-api/trade/order/item/create-comment',
request2({
url: 'trade/order/item/create-comment',
method: 'POST',
data,
}),
@ -129,15 +139,31 @@ export default {
}),
// 售后
aftersale: {
list: (params) =>
// 申请售后
apply: (data) =>
request({
url: '/app-api/trade/after-sale/page',
url: 'order/aftersale',
method: 'POST',
data,
}),
list: (params) =>
request2({
url: 'trade/after-sale/page',
method: 'GET',
params,
custom: {
showLoading: false,
},
}),
// list: (params) =>
// request({
// url: 'order/aftersale',
// method: 'GET',
// params,
// custom: {
// showLoading: false,
// },
// }),
//取消售后
cancel: (id) =>
request({
@ -150,10 +176,10 @@ export default {
url: 'order/aftersale/' + id,
method: 'DELETE',
}),
// 售后详情 DONE
// 售后详情
detail: (id) =>
request({
url: '/app-api/trade/after-sale/get?id=' + id,
request2({
url: 'trade/after-sale/get?id=' + id,
method: 'GET',
}),
},

View File

@ -1,14 +0,0 @@
import request from '@/sheep/request';
const PayChannelApi = {
// 获得指定应用的开启的支付渠道编码列表
getEnableChannelCodeList: (appId) => {
return request({
url: '/app-api/pay/channel/get-enable-code-list',
method: 'GET',
params: { appId }
});
},
};
export default PayChannelApi;

View File

@ -1,22 +0,0 @@
import request from '@/sheep/request';
const PayOrderApi = {
// 获得支付订单
getOrder: (id) => {
return request({
url: '/app-api/pay/order/get',
method: 'GET',
params: { id }
});
},
// 提交支付订单
submitOrder: (data) => {
return request({
url: '/app-api/pay/order/submit',
method: 'POST',
data
});
}
};
export default PayOrderApi;

View File

@ -1,7 +1,6 @@
import request from '@/sheep/request';
const CommentApi = {
// 获得商品评价分页
getCommentPage: (spuId, pageNo, pageSize, type) => {
return request({

View File

@ -0,0 +1,44 @@
import request from '@/sheep/request';
const FavoriteApi = {
// 获得商品收藏分页
getFavoritePage: (data) => {
return request({
url: '/app-api/product/favorite/page',
method: 'GET',
params: data
});
},
// 检查是否收藏过商品
isFavoriteExists: (spuId) => {
return request({
url: '/app-api/product/favorite/exits',
method: 'GET',
params: {
spuId
}
});
},
// 添加商品收藏
createFavorite: (spuId) => {
return request({
url: '/app-api/product/favorite/create',
method: 'POST',
data: {
spuId
}
});
},
// 取消商品收藏
deleteFavorite: (spuId) => {
return request({
url: '/app-api/product/favorite/delete',
method: 'DELETE',
data: {
spuId
}
});
}
};
export default FavoriteApi;

View File

@ -1,9 +1,9 @@
import request from '@/sheep/request';
import request2 from '@/sheep/request2';
const ActivityApi = {
// 获得单个商品,近期参与的每个活动
getActivityListBySpuId: (spuId) => {
return request({
return request2({
url: '/app-api/promotion/activity/list-by-spu-id',
method: 'GET',
params: {

View File

@ -1,22 +1,20 @@
import request from "@/sheep/request";
import request2 from "@/sheep/request2";
// 拼团 API
const CombinationApi = {
// 获得拼团活动列表
getCombinationActivityList: (count) => {
return request({
url: "/app-api/promotion/combination-activity/list",
return request2({
url: "promotion/combination-activity/list",
method: 'GET',
params: {
count
}
params: {count}
});
},
// 获得拼团活动分页
getCombinationActivityPage: (params) => {
return request({
url: "/app-api/promotion/combination-activity/page",
return request2({
url: "promotion/combination-activity/page",
method: 'GET',
params
});
@ -24,8 +22,8 @@ const CombinationApi = {
// 获得拼团活动明细
getCombinationActivity: (id) => {
return request({
url: "/app-api/promotion/combination-activity/get-detail",
return request2({
url: "promotion/combination-activity/get-detail",
method: 'GET',
params: {
id
@ -35,8 +33,8 @@ const CombinationApi = {
// 获得最近 n 条拼团记录(团长发起的)
getHeadCombinationRecordList: (activityId, status, count) => {
return request({
url: "/app-api/promotion/combination-record/get-head-list",
return request2({
url: "promotion/combination-record/get-head-list",
method: 'GET',
params: {
activityId,
@ -48,8 +46,8 @@ const CombinationApi = {
// 获得拼团记录明细
getCombinationRecordDetail: (id) => {
return request({
url: "/app-api/promotion/combination-record/get-detail",
return request2({
url: "promotion/combination-record/get-detail",
method: 'GET',
params: {
id
@ -59,8 +57,8 @@ const CombinationApi = {
// 获得拼团记录的概要信息
getCombinationRecordSummary: () => {
return request({
url: "/app-api/promotion/combination-record/get-summary",
return request2({
url: "promotion/combination-record/get-summary",
method: 'GET',
});
}

View File

@ -17,17 +17,4 @@ export default {
params: { spuId, productScope, count },
});
},
// 获得匹配指定商品的优惠劵列表
getMatchCouponList: (price, spuIds, skuIds, categoryIds) => {
return request({
url: '/app-api/promotion/coupon/match-list',
method: 'GET',
params: {
price,
spuIds: spuIds.join(','),
skuIds: skuIds.join(','),
categoryIds: categoryIds.join(','),
},
});
}
};

View File

@ -1,28 +1,19 @@
import request from "@/sheep/request";
import request2 from "@/sheep/request2";
const SeckillApi = {
// 获得秒杀时间段列表
getSeckillConfigList: () => {
return request({
url: '/app-api/promotion/seckill-config/list',
method: 'GET'
});
return request2({ url: 'promotion/seckill-config/list', method: 'GET' });
},
// 获得当前秒杀活动
getNowSeckillActivity: () => {
return request({
url: '/app-api/promotion/seckill-activity/get-now',
method: 'GET'
});
return request2({ url: 'promotion/seckill-activity/get-now', method: 'GET' });
},
// 获得秒杀活动分页
getSeckillActivityPage: () => {
return request({
url: '/app-api/promotion/seckill-activity/page',
method: 'GET'
});
return request2({ url: 'promotion/seckill-activity/page', method: 'GET' });
},
/**
@ -31,12 +22,10 @@ const SeckillApi = {
* @return {*}
*/
getSeckillActivity: (id) => {
return request({
url: '/app-api/promotion/seckill-activity/get-detail',
return request2({
url: 'promotion/seckill-activity/get-detail',
method: 'GET',
params: {
id
}
params: { id }
});
}
}

View File

@ -28,9 +28,18 @@ export default {
showLoading: false,
},
}),
rechargeRules2: () =>
request({
url: '/app-api/pay/wallet-recharge-package/list',
method: 'GET',
custom: {
showError: false,
showLoading: false,
},
}),
recharge: (data) =>
request({
url: 'trade/order/recharge',
url: '/app-api/pay/wallet-recharge/create',
method: 'POST',
data,
}),

View File

@ -29,6 +29,16 @@ const AfterSaleApi = {
id,
},
});
},
// 获得售后日志列表
getAfterSaleLogList: (afterSaleId) => {
return request2({
url: `/app-api/trade/after-sale-log/list`,
method: 'GET',
params: {
afterSaleId,
},
});
}
};

View File

@ -1,47 +0,0 @@
import request2 from '@/sheep/request2';
const CartApi = {
addCart: (data) => {
return request2({
url: '/app-api/trade/cart/add',
method: 'POST',
data: data,
// TODO 芋艿:这里没提示
custom: {
showSuccess: true,
successMsg: '已添加到购物车~',
}
});
},
updateCartCount: (data) => {
return request2({
url: '/app-api/trade/cart/update-count',
method: 'PUT',
data: data
});
},
updateCartSelected: (data) => {
return request2({
url: '/app-api/trade/cart/update-selected',
method: 'PUT',
data: data
});
},
deleteCart: (ids) => {
return request2({
url: '/app-api/trade/cart/delete',
method: 'DELETE',
params: {
ids
}
});
},
getCartList: () => {
return request2({
url: '/app-api/trade/cart/list',
method: 'GET',
});
},
};
export default CartApi;

View File

@ -1,95 +0,0 @@
import request2 from '@/sheep/request2';
import request from '@/sheep/request';
const OrderApi = {
// 计算订单信息
settlementOrder: (data) => {
const data2 = {
...data,
};
// 移除多余字段
if (!(data.couponId > 0)) {
delete data2.couponId;
}
if (!(data.addressId > 0)) {
delete data2.addressId;
}
// 解决 SpringMVC 接受 List<Item> 参数的问题
delete data2.items;
for (let i = 0; i < data.items.length; i++) {
data2[encodeURIComponent('items[' + i + '' + '].skuId')] = data.items[i].skuId + '';
data2[encodeURIComponent('items[' + i + '' + '].count')] = data.items[i].count + '';
if (data.items[i].cartId) {
data2[encodeURIComponent('items[' + i + '' + '].cartId')] = data.items[i].cartId + '';
}
}
const queryString = Object.keys(data2)
.map((key) => key + '=' + data2[key])
.join('&');
return request2({
url: `trade/order/settlement?${queryString}`,
method: 'GET',
});
},
// 创建订单
createOrder: (data) => {
return request2({
url: `trade/order/create`,
method: 'POST',
data,
});
},
// 获得订单
getOrder: (id) => {
return request2({
url: `trade/order/get-detail`,
method: 'GET',
params: {
id,
},
});
},
// 订单列表
getOrderPage: (params) => {
return request({
url: '/app-api/trade/order/page',
method: 'GET',
params,
custom: {
showLoading: false,
},
});
},
// 确认收货
receiveOrder: (id) => {
return request2({
url: `/app-api/trade/order/receive`,
method: 'PUT',
params: {
id,
},
});
},
// 取消订单
cancelOrder: (id) => {
return request2({
url: `/app-api/trade/order/cancel`,
method: 'DELETE',
params: {
id,
},
});
},
// 删除订单
deleteOrder: (id) => {
return request2({
url: `/app-api/trade/order/delete`,
method: 'DELETE',
params: {
id,
},
});
},
};
export default OrderApi;

View File

@ -1,10 +1,11 @@
import request from '@/sheep/request';
import request2 from '@/sheep/request2';
import $platform from '@/sheep/platform';
export default {
getUnused: () =>
request({
url: '/app-api/promotion/coupon/get-unused-count',
request2({
url: 'promotion/coupon/get-unused-count',
method: 'GET',
custom: {
showLoading: false,
@ -12,8 +13,8 @@ export default {
},
}),
profile: () =>
request({
url: '/app-api/member/user/get',
request2({
url: 'member/user/get',
method: 'GET',
custom: {
showLoading: false,
@ -21,7 +22,7 @@ export default {
},
}),
balance: () =>
request({
request2({
url: '/app-api/pay/wallet/get',
method: 'GET',
custom: {
@ -29,9 +30,28 @@ export default {
auth: true,
},
}),
// profile: () =>
// request({
// url: '/user/api/user/profile',
// method: 'GET',
// custom: {
// showLoading: false,
// auth: true,
// },
// }),
// update: (data) =>
// request({
// url: '/user/api/user/update',
// method: 'POST',
// custom: {
// showSuccess: true,
// auth: true,
// },
// data,
// }),
update: (data) =>
request({
url: '/app-api/member/user/update',
request2({
url: 'member/user/update',
method: 'PUT',
custom: {
showSuccess: true,
@ -176,48 +196,90 @@ export default {
}),
address: {
// default: () =>
// request({
// url: 'user/address/default',
// method: 'GET',
// custom: {
// showError: false,
// },
// }),
default: () =>
request({
url: '/app-api/member/address/get-default',
request2({
url: 'member/address/get-default',
method: 'GET',
custom: {
showError: false,
},
}),
list: () =>
request({
url: '/app-api/member/address/list',
request2({
url: 'member/address/list',
method: 'GET',
custom: {},
}),
// list: () =>
// request({
// url: 'user/address',
// method: 'GET',
// custom: {},
// }),
create: (data) =>
request({
url: '/app-api/member/address/create',
request2({
url: 'member/address/create',
method: 'POST',
data,
custom: {
showSuccess: true,
},
}),
// create: (data) =>
// request({
// url: 'user/address',
// method: 'POST',
// data,
// custom: {
// showSuccess: true,
// },
// }),
update: (data) =>
request({
url: '/app-api/member/address/update',
request2({
url: 'member/address/update',
method: 'PUT',
data,
custom: {
showSuccess: true,
},
}),
// update: (id, data) =>
// request({
// url: 'user/address/' + id,
// method: 'PUT',
// data,
// custom: {
// showSuccess: true,
// },
// }),
detail: (id) =>
request({
url: '/app-api/member/address/get?id=' + id,
request2({
url: 'member/address/get?id=' + id,
method: 'GET',
}),
// detail: (id) =>
// request({
// url: 'user/address/' + id,
// method: 'GET',
// }),
delete: (id) =>
request({
url: '/app-api/member/address/delete?id=' + id,
request2({
url: 'member/address/delete?id=' + id,
method: 'DELETE',
}),
// delete: (id) =>
// request({
// url: 'user/address/' + id,
// method: 'DELETE',
// }),
},
invoice: {
list: () =>
@ -257,29 +319,17 @@ export default {
},
favorite: {
list: (params) =>
request({
url: '/app-api/product/favorite/page',
request2({
url: 'product/favorite/page',
method: 'GET',
params,
}),
do: (id) =>
request({
url: '/app-api/product/favorite/create',
url: 'user/goodsLog/favorite',
method: 'POST',
data: {
spuId: id,
},
custom: {
showSuccess: true,
auth: true,
},
}),
dos: (id) =>
request({
url: '/app-api/product/favorite/delete',
method: 'DELETE',
data: {
spuId: id,
goods_id: id,
},
custom: {
showSuccess: true,
@ -288,8 +338,8 @@ export default {
}),
// 取消收藏
cancel: (id) =>
request({
url: '/app-api/product/favorite/delete-list',
request2({
url: 'product/favorite/delete-list',
method: 'DELETE',
data: {
spuIds: id.split(',').map(item => item * 1),
@ -300,6 +350,18 @@ export default {
auth: true,
},
}),
// cancel: (id) =>
// request({
// url: 'user/goodsLog/favorite',
// method: 'POST',
// data: {
// goods_ids: id,
// },
// custom: {
// showSuccess: true,
// auth: true,
// },
// }),
},
view: {
list: (params) =>
@ -321,21 +383,28 @@ export default {
},
wallet: {
log: (params) =>
request({
request2({
// url: 'member/point/record/page',
url: '/app-api/pay/wallet-transaction/page',
url: 'pay/wallet-transaction/page',
method: 'GET',
params,
custom: {},
}),
log2: (params) =>
request({
url: '/app-api/member/point/record/page',
request2({
url: 'member/point/record/page',
// url: 'pay/wallet-transaction/page',
method: 'GET',
params,
custom: {},
}),
// log: (params) =>
// request({
// url: '/user/api/walletLog',
// method: 'GET',
// params,
// custom: {},
// }),
},
account: {
info: (params) =>
@ -360,9 +429,18 @@ export default {
}),
},
//数量接口
// data: () =>
// request({
// url: 'user/user/data',
// method: 'GET',
// custom: {
// showLoading: false,
// auth: true,
// },
// }),
data: () =>
request({
url: '/app-api/trade/order/get-count',
request2({
url: 'trade/order/get-count',
method: 'GET',
custom: {
showLoading: false,
@ -370,8 +448,8 @@ export default {
},
}),
data2: () =>
request({
url: '/app-api/trade/after-sale/get-applying-count',
request2({
url: 'trade/after-sale/get-applying-count',
method: 'GET',
custom: {
showLoading: false,

View File

@ -1,17 +1,32 @@
<template>
<su-popup :show="show" type="bottom" round="20" @close="emits('close')" showClose backgroundColor="#f2f2f2">
<su-popup
:show="show"
type="bottom"
round="20"
@close="emits('close')"
showClose
backgroundColor="#f2f2f2"
>
<view class="model-box">
<view class="title ss-m-t-16 ss-m-l-20 ss-flex">优惠券</view>
<scroll-view class="model-content" scroll-y :scroll-with-animation="false" :enable-back-to-top="true">
<scroll-view
class="model-content"
scroll-y
:scroll-with-animation="false"
:enable-back-to-top="true"
>
<view class="subtitle ss-m-l-20">可使用优惠券</view>
<view v-for="item in state.couponInfo" :key="item.id">
<s-coupon-list :data="item">
<template #default>
<button class="ss-reset-button card-btn ss-flex ss-row-center ss-col-center" :class="
<button
class="ss-reset-button card-btn ss-flex ss-row-center ss-col-center"
:class="
item.get_status != 'can_get' && item.get_status != 'can_use' ? 'boder-btn' : ''
" @click.stop="getBuy(item.id)">
<!-- 此处对接领取优惠券先将限制解除 -->
<!-- :disabled="item.get_status != 'can_get' && item.get_status != 'can_use'" -->
"
@click.stop="getBuy(item.id)"
:disabled="item.get_status != 'can_get' && item.get_status != 'can_use'"
>
{{ item.get_status_text }}
</button>
</template>
@ -22,14 +37,11 @@
</su-popup>
</template>
<script setup>
import {
computed,
reactive
} from 'vue';
import { computed, reactive } from 'vue';
const props = defineProps({
modelValue: {
type: Object,
default () {},
default() {},
},
show: {
type: Boolean,
@ -43,7 +55,6 @@
couponId: '',
});
const getBuy = (id) => {
console.log('应该是详情页领取优惠券')
emits('get', id);
};
//
@ -51,31 +62,26 @@
<style lang="scss" scoped>
.model-box {
height: 60vh;
.title {
font-size: 36rpx;
height: 80rpx;
font-weight: bold;
color: #333333;
}
.subtitle {
font-size: 26rpx;
font-weight: 500;
color: #333333;
}
}
.model-content {
height: 54vh;
}
.modal-footer {
width: 100%;
height: 120rpx;
background: #fff;
}
.confirm-btn {
width: 710rpx;
margin-left: 20rpx;
@ -84,7 +90,6 @@
border-radius: 40rpx;
color: #fff;
}
//
.card-btn {
// width: 144rpx;
@ -96,7 +101,6 @@
font-size: 24rpx;
font-weight: 400;
}
.boder-btn {
background: linear-gradient(90deg, var(--ui-BG-Main-opacity-4), var(--ui-BG-Main-light));
color: #fff !important;

View File

@ -1,9 +1,13 @@
<template>
<view class="ss-m-20" :style="{ opacity: disabled ? '0.5' : '1' }">
<view class="content">
<view class="tag ss-flex ss-row-center" :class="
<!-- <view
class="tag ss-flex ss-row-center"
:class="
data.status == 'expired' || data.status == 'used' ? 'disabled-bg-color' : 'info-bg-color'
">{{ data.type_text }}</view>
"
>{{ data.type_text }}</view
> -->
<view class="title ss-m-x-30 ss-p-t-18">
<view class="ss-flex ss-row-between">
<view class="value-text ss-flex-1 ss-m-r-10" :class="

View File

@ -1,4 +1,3 @@
<!-- 订单确认的优惠劵选择弹窗 -->
<template>
<su-popup
:show="show"
@ -17,21 +16,20 @@
:enable-back-to-top="true"
>
<view class="subtitle ss-m-l-20">可使用优惠券</view>
<view v-for="(item, index) in state.couponInfo" :key="index">
<view v-for="(item, index) in state.couponInfo.can_use" :key="index">
<s-coupon-list :data="item" type="user" :disabled="false">
<template #default>
<label class="ss-flex ss-col-center" @tap="radioChange(item.id)">
<radio
color="var(--ui-BG-Main)"
style="transform: scale(0.8)"
:checked="state.couponId === item.id"
:checked="state.couponId == item.id"
@tap.stop="radioChange(item.id)"
/>
</label>
</template>
</s-coupon-list>
</view>
<!-- TODO 芋艿未来接口需要支持下
<view class="subtitle ss-m-t-40 ss-m-l-20">不可使用优惠券</view>
<view v-for="item in state.couponInfo.cannot_use" :key="item.id">
<s-coupon-list :data="item" type="user" :disabled="true">
@ -43,7 +41,6 @@
</template>
</s-coupon-list>
</view>
-->
</scroll-view>
</view>
<view class="modal-footer ss-flex">
@ -53,9 +50,8 @@
</template>
<script setup>
import { computed, reactive } from 'vue';
const props = defineProps({
modelValue: { //
modelValue: {
type: Object,
default() {},
},
@ -64,27 +60,21 @@
default: false,
},
});
const emits = defineEmits(['confirm', 'close']);
const state = reactive({
couponInfo: computed(() => props.modelValue), //
couponId: 0, //
couponInfo: computed(() => props.modelValue),
couponId: 0,
});
//
function radioChange(couponId) {
if (state.couponId === couponId) {
if (state.couponId == couponId) {
state.couponId = 0;
} else {
state.couponId = couponId;
}
}
//
const onConfirm = () => {
emits('confirm', state.couponId);
}
};
</script>
<style lang="scss" scoped>
:deep() {

View File

@ -54,7 +54,7 @@
<script setup>
import sheep from '@/sheep';
import { computed } from 'vue';
import { fen2yuan } from '../../hooks/useGoods';
import { fen2yuan } from '@/sheep/hooks/useGoods';
/**
* 订单卡片
*

View File

@ -3,17 +3,14 @@
<view>
<su-popup :show="state.showShareGuide" :showClose="false" @close="onCloseGuide"></su-popup>
<view v-if="state.showShareGuide" class="guide-wrap">
<image
class="guide-image"
:src="sheep.$url.static('/static/img/shop/share/share_guide.png')"
></image>
<image class="guide-image" :src="sheep.$url.static('/static/img/shop/share/share_guide.png')"></image>
</view>
<su-popup :show="show" round="10" :showClose="false" @close="closeShareModal">
<!-- 分享tools -->
<view class="share-box">
<view class="share-list-box ss-flex">
<button
<!-- <button
v-if="shareConfig.methods.includes('forward')"
class="share-item share-btn ss-flex-col ss-col-center"
open-type="share"
@ -25,20 +22,14 @@
mode=""
></image>
<text class="share-title">微信好友</text>
</button>
<button
v-if="shareConfig.methods.includes('poster')"
class="share-item share-btn ss-flex-col ss-col-center"
@tap="onShareByPoster"
>
<image
class="share-img"
:src="sheep.$url.static('/static/img/shop/share/share_poster.png')"
mode=""
></image>
</button> -->
<button v-if="shareConfig.methods.includes('poster')"
class="share-item share-btn ss-flex-col ss-col-center" @tap="onShareByPoster">
<image class="share-img" :src="sheep.$url.static('/static/img/shop/share/share_poster.png')"
mode=""></image>
<text class="share-title">生成海报</text>
</button>
<!--
<button
v-if="shareConfig.methods.includes('link')"
class="share-item share-btn ss-flex-col ss-col-center"
@ -50,7 +41,7 @@
mode=""
></image>
<text class="share-title">复制链接</text>
</button>
</button> -->
</view>
<view class="share-foot ss-flex ss-row-center ss-col-center" @tap="closeShareModal">
取消
@ -58,22 +49,27 @@
</view>
</su-popup>
<!-- 分享海报 -->
<canvas-poster
ref="SharePosterRef"
:show="state.showPosterModal"
:shareInfo="shareInfo"
@close="state.showPosterModal = false"
/>
<canvas-poster ref="SharePosterRef" :show="state.showPosterModal" :shareInfo="shareInfo"
@close="state.showPosterModal = false" />
</view>
</template>
<script setup>
/**
* 分享弹窗
*/
import { ref, unref, reactive, computed } from 'vue';
import {
ref,
unref,
reactive,
computed
} from 'vue';
import sheep from '@/sheep';
import canvasPoster from './canvas-poster/index.vue';
import { showShareModal, closeShareModal, showAuthModal } from '@/sheep/hooks/useModal';
import {
showShareModal,
closeShareModal,
showAuthModal
} from '@/sheep/hooks/useModal';
const show = computed(() => sheep.$store('modal').share);
const shareConfig = computed(() => sheep.$store('app').platform.share);
@ -82,7 +78,7 @@
const props = defineProps({
shareInfo: {
type: Object,
default() {},
default () {},
},
});

View File

@ -3,20 +3,19 @@ import sheep from '@/sheep';
import $wxsdk from '@/sheep/libs/sdk-h5-weixin';
// #endif
import { getRootUrl } from '@/sheep/helper';
import PayOrderApi from '@/sheep/api/pay/order';
/**
* 支付
*
* @param {String} payment = ['wechat','alipay','wallet','offline'] - 支付方式
* @param {String} orderType = ['goods','recharge','groupon'] - 订单类型
* @param {String} id - 订单号
* @param {String} orderSN - 订单号
*/
export default class SheepPay {
constructor(payment, orderType, id) {
constructor(payment, orderType, orderSN) {
this.payment = payment;
this.id = id;
this.orderSN = orderSN;
this.orderType = orderType;
this.payAction();
}
@ -30,8 +29,8 @@ export default class SheepPay {
alipay: () => {
this.redirectPay(); // 现在公众号可以直接跳转支付宝页面
},
wallet: () => {
this.walletPay();
money: () => {
this.moneyPay();
},
offline: () => {
this.offlinePay();
@ -44,8 +43,8 @@ export default class SheepPay {
alipay: () => {
this.copyPayLink();
},
wallet: () => {
this.walletPay();
money: () => {
this.moneyPay();
},
offline: () => {
this.offlinePay();
@ -58,8 +57,8 @@ export default class SheepPay {
alipay: () => {
this.alipay();
},
wallet: () => {
this.walletPay();
money: () => {
this.moneyPay();
},
offline: () => {
this.offlinePay();
@ -72,8 +71,8 @@ export default class SheepPay {
alipay: () => {
this.redirectPay();
},
wallet: () => {
this.walletPay();
money: () => {
this.moneyPay();
},
offline: () => {
this.offlinePay();
@ -84,21 +83,18 @@ export default class SheepPay {
}
// 预支付
prepay(channel) {
prepay() {
return new Promise((resolve, reject) => {
let data = {
id: this.id,
channelCode: channel,
channelExtras: {}
order_sn: this.orderSN,
payment: this.payment,
};
if (uni.getStorageSync('openid')) {
data.openid = uni.getStorageSync('openid');
}
PayOrderApi.submitOrder(data).then((res) => {
// 成功时
res.code === 0 && resolve(res);
// 失败时
if (res.code !== 0 && res.msg === 'miss_openid') {
sheep.$api.pay.prepay(data).then((res) => {
res.error === 0 && resolve(res);
if (res.error === -1 && res.msg === 'miss_openid') {
uni.showModal({
title: '微信支付',
content: '请先绑定微信再使用微信支付',
@ -113,7 +109,7 @@ export default class SheepPay {
});
}
// #ifdef H5
// 微信公众号JSSDK支付 TODO 芋艿:待接入
// 微信公众号JSSDK支付
async wechatOfficialAccountPay() {
let that = this;
let { error, data, msg } = await this.prepay();
@ -134,21 +130,21 @@ export default class SheepPay {
});
}
//浏览器微信H5支付 TODO 芋艿:待接入
//浏览器微信H5支付
async wechatWapPay() {
const { error, data } = await this.prepay();
if (error === 0) {
const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${this.payment
const redirect_url = `${getRootUrl()}pages/pay/result?orderSN=${this.orderSN}&payment=${this.payment
}&orderType=${this.orderType}`;
location.href = `${data.pay_data.h5_url}&redirect_url=${encodeURIComponent(redirect_url)}`;
}
}
// 支付链接 TODO 芋艿:待接入
// 支付链接
async redirectPay() {
let { error, data } = await this.prepay();
if (error === 0) {
const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${this.payment
const redirect_url = `${getRootUrl()}pages/pay/result?orderSN=${this.orderSN}&payment=${this.payment
}&orderType=${this.orderType}`;
location.href = data.pay_data + encodeURIComponent(redirect_url);
}
@ -156,7 +152,7 @@ export default class SheepPay {
// #endif
// 微信小程序支付 TODO 芋艿:待接入
// 微信小程序支付
async wechatMiniProgramPay() {
let that = this;
let result = await this.prepay();
@ -177,18 +173,18 @@ export default class SheepPay {
}
// 余额支付
async walletPay() {
const { code } = await this.prepay('wallet');
code === 0 && this.payResult('success');
async moneyPay() {
const { error } = await this.prepay();
error === 0 && this.payResult('success');
}
// 货到付款 TODO 芋艿:待接入
// 货到付款
async offlinePay() {
const { error } = await this.prepay();
error === 0 && this.payResult('success');
}
// 支付宝复制链接支付 TODO 芋艿:待接入
// 支付宝复制链接支付
async copyPayLink() {
let that = this;
let { error, data } = await this.prepay();
@ -207,7 +203,7 @@ export default class SheepPay {
}
}
// 支付宝支付 TODO 芋艿:待接入
// 支付宝支付
async alipay() {
let that = this;
const { error, data } = await this.prepay();
@ -229,7 +225,7 @@ export default class SheepPay {
}
}
// 微信支付 TODO 芋艿:待接入
// 微信支付
async wechatAppPay() {
let that = this;
let { error, data } = await this.prepay();
@ -250,72 +246,10 @@ export default class SheepPay {
// 支付结果跳转,success:成功fail:失败
payResult(resultType) {
sheep.$router.redirect('/pages/pay/result', {
id: this.id,
orderSN: this.orderSN,
payment: this.payment, //重新支付的时候使用
payState: resultType,
orderType: this.orderType,
payState: resultType
});
}
}
export function getPayMethods(channels) {
const payMethods = [
{
icon: '/static/img/shop/pay/wechat.png',
title: '微信支付',
value: 'wechat',
disabled: true,
},
{
icon: '/static/img/shop/pay/alipay.png',
title: '支付宝支付',
value: 'alipay',
disabled: true,
},
{
icon: '/static/img/shop/pay/wallet.png',
title: '余额支付',
value: 'wallet',
disabled: true,
},
{
icon: '/static/img/shop/pay/apple.png',
title: 'Apple Pay',
value: 'apple',
disabled: true,
},
{
icon: '/static/img/shop/pay/wallet.png',
title: '模拟支付',
value: 'mock',
disabled: true,
}
];
const platform = sheep.$platform.name
// 1. 处理【微信支付】
const wechatMethod = payMethods[0];
if ((platform === 'WechatOfficialAccount' && channels.includes('wx_pub'))
|| platform === 'WechatMiniProgram' && channels.includes('wx_lite')
|| platform === 'App' && channels.includes('wx_app')) {
wechatMethod.disabled = false;
}
// 2. 处理【支付宝支付】
const alipayMethod = payMethods[1];
if ((platform === 'WechatOfficialAccount' && channels.includes('alipay_wap'))
|| platform === 'WechatMiniProgram' && channels.includes('alipay_wap')
|| platform === 'App' && channels.includes('alipay_app')) {
alipayMethod.disabled = false;
}
// 3. 处理【余额支付】
const walletMethod = payMethods[2];
if (channels.includes('wallet')) {
walletMethod.disabled = false;
}
// 4. 处理【苹果支付】TODO 芋艿:未来接入
// 5. 处理【模拟支付】
const mockMethod = payMethods[4];
if (channels.includes('mock')) {
mockMethod.disabled = false;
}
return payMethods;
}

View File

@ -55,8 +55,7 @@ const http = new Request({
method: 'GET',
header: {
Accept: 'text/json',
'Content-Type': 'application/json',
// ;charset=UTF-8
'Content-Type': 'application/json;charset=UTF-8',
platform: $platform.name,
},
// #ifdef APP-PLUS
@ -99,7 +98,6 @@ http.interceptors.request.use(
config.header['terminal'] = '20';
config.header['Authorization'] = 'Bearer test247';
}
// console.log(config, '看参数')
return config;
},
(error) => {

View File

@ -23,8 +23,8 @@ const app = defineStore({
copytime: '', // 版权信息 II
},
platform: {
payment: [], // 支持的支付方式 TODO 芋艿:可删除
recharge_payment: [], // 支持的充值支付方式 TODO 芋艿:可删除
payment: [], // 支持的支付方式
recharge_payment: [], // 支持的充值支付方式
share: {
methods: [], // 支持的分享方式
forwardInfo: {}, // 默认转发信息

View File

@ -1,93 +1,98 @@
import { defineStore } from 'pinia';
import CartApi from '@/sheep/api/trade/cart';
import cartApi from '@/sheep/api/cart';
const cart = defineStore({
id: 'cart',
state: () => ({
list: [], // 购物车列表
selectedIds: [], // 已选列表
isAllSelected: false, // 是否全选
totalPriceSelected: 0, // 选中项总金额
isAllSelected: false, //是否全选
cartSelectedTotalPrice: '0.00', // 选中项总金额
}),
getters: {
totalPriceSelected: (state) => {
let price = 0;
if (!state.selectedIds.length) return price.toFixed(2);
state.list.forEach((item) => {
price += state.selectedIds.includes(item.id)
? Number(item.sku.price/100) * item.count
: 0;
});
return price.toFixed(2);
},
},
actions: {
// 获取购物车列表
async getList() {
const { data, code } = await CartApi.getCartList();
const { data, code } = await cartApi.list();
if (code === 0) {
this.list = data.validList;
// 计算各种关联属性
this.selectedIds = [];
this.isAllSelected = true;
this.totalPriceSelected = 0;
this.list.forEach((item) => {
if (item.selected) {
this.selectedIds.push(item.id);
this.totalPriceSelected += item.count * item.sku.price;
} else {
this.isAllSelected = false;
}
});
}
},
// 添加购物车
async add(goodsInfo) {
// 添加购物项
const { code } = await CartApi.addCart({
skuId: goodsInfo.id,
count: goodsInfo.goods_num,
const { error } = await cartApi.append({
goods_id: goodsInfo.goods_id,
goods_num: goodsInfo.goods_num,
goods_sku_price_id: goodsInfo.id,
});
// 刷新购物车列表
if (code === 0) {
await this.getList();
if (error === 0) {
this.getList();
}
},
// 更新购物车
async update(goodsInfo) {
const { code } = await CartApi.updateCartCount({
const { error } = await cartApi.update({
id: goodsInfo.goods_id,
count: goodsInfo.goods_num,
goods_sku_price_id: goodsInfo.goods_sku_price_id,
});
if (code === 0) {
await this.getList();
if (error === 0) {
// this.getList();
}
},
// 移除购物车
async delete(ids) {
const { code } = await CartApi.deleteCart(ids.join(','));
if (typeof ids === 'array') {
ids = ids.join(',');
}
const { code } = await cartApi.delete(ids);
if (code === 0) {
await this.getList();
this.selectAll(false);
this.getList();
}
},
// 单选购物车商品
async selectSingle(goodsId) {
const { code } = await CartApi.updateCartSelected({
ids: [goodsId],
selected: !this.selectedIds.includes(goodsId), // 取反
});
if (code === 0) {
await this.getList();
// 选择购物车商品
selectSingle(goodsId) {
if (!this.selectedIds.includes(goodsId)) {
this.selectedIds.push(goodsId);
} else {
this.selectedIds.splice(this.selectedIds.indexOf(goodsId), 1);
}
this.isAllSelected = this.selectedIds.length === this.list.length;
},
// 全选购物车商品
async selectAll(flag) {
const { code } = await CartApi.updateCartSelected({
ids: this.list.map((item) => item.id),
selected: flag
// 全选
selectAll(flag) {
this.isAllSelected = flag;
if (!flag) {
this.selectedIds = [];
} else {
this.list.forEach((item) => {
this.selectedIds.push(item.id);
});
if (code === 0) {
await this.getList();
}
},
// 清空购物车
async emptyList() {
await this.delete(this.list.map((item) => item.id));
emptyList() {
this.list = [];
this.selectedIds = [];
this.isAllSelected = false;
this.cartSelectedTotalPrice = '0.00';
},
},
persist: {

View File

@ -100,3 +100,16 @@ export function handleTree(data, id = 'id', parentId = 'parentId', children = 'c
});
return treeData !== '' ? treeData : data;
}
/**
* 重置分页对象
*
* TODO 芋艿需要处理其它页面
*
* @param pagination 分页对象
*/
export function resetPagination(pagination) {
pagination.list = [];
pagination.total = 0;
pagination.pageNo = 1;
}

View File

@ -5,9 +5,7 @@
// 配置
const config = {
// 信任的标签(保持标签名不变)
trustTags: makeMap(
'a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,ruby,rt,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video'
),
trustTags: makeMap('a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,ruby,rt,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video'),
// 块级标签(转为 div其他的非信任标签转为 span
blockTags: makeMap('address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section'),
@ -18,14 +16,10 @@ const config = {
// #endif
// 要移除的标签
ignoreTags: makeMap(
'area,base,canvas,embed,frame,head,iframe,input,link,map,meta,param,rp,script,source,style,textarea,title,track,wbr'
),
ignoreTags: makeMap('area,base,canvas,embed,frame,head,iframe,input,link,map,meta,param,rp,script,source,style,textarea,title,track,wbr'),
// 自闭合的标签
voidTags: makeMap(
'area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'
),
voidTags: makeMap('area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'),
// html 实体
entities: {
@ -80,7 +74,7 @@ const config = {
repeatdur: 'repeatDur'
}
}
const tagSelector = {}
const tagSelector={}
const {
windowWidth,
// #ifdef MP-WEIXIN
@ -105,7 +99,7 @@ config.ignoreTags.style = undefined
* @description 创建 map
* @param {String} str 逗号分隔
*/
function makeMap(str) {
function makeMap (str) {
const map = Object.create(null)
const list = str.split(',')
for (let i = list.length; i--;) {
@ -120,7 +114,7 @@ function makeMap(str) {
* @param {Boolean} amp 要不要解码 &amp;
* @returns {String} 解码后的字符串
*/
function decodeEntity(str, amp) {
function decodeEntity (str, amp) {
let i = str.indexOf('&')
while (i !== -1) {
const j = str.indexOf(';', i + 3)
@ -148,11 +142,10 @@ function decodeEntity(str, amp) {
* @description 合并多个块级标签加快长内容渲染
* @param {Array} nodes 要合并的标签数组
*/
function mergeNodes(nodes) {
function mergeNodes (nodes) {
let i = nodes.length - 1
for (let j = i; j >= -1; j--) {
if (j === -1 || nodes[j].c || !nodes[j].name || (nodes[j].name !== 'div' && nodes[j].name !== 'p' && nodes[j]
.name[0] !== 'h') || (nodes[j].attrs.style || '').includes('inline')) {
if (j === -1 || nodes[j].c || !nodes[j].name || (nodes[j].name !== 'div' && nodes[j].name !== 'p' && nodes[j].name[0] !== 'h') || (nodes[j].attrs.style || '').includes('inline')) {
if (i - j >= 5) {
nodes.splice(j + 1, i - j, {
name: 'div',
@ -169,7 +162,7 @@ function mergeNodes(nodes) {
* @description html 解析器
* @param {Object} vm 组件实例
*/
function Parser(vm) {
function Parser (vm) {
this.options = vm || {}
this.tagStyle = Object.assign({}, config.tagStyle, this.options.tagStyle)
this.imgList = vm.imgList || []
@ -178,15 +171,14 @@ function Parser(vm) {
this.attrs = Object.create(null)
this.stack = []
this.nodes = []
this.pre = (this.options.containerStyle || '').includes('white-space') && this.options.containerStyle.includes(
'pre') ? 2 : 0
this.pre = (this.options.containerStyle || '').includes('white-space') && this.options.containerStyle.includes('pre') ? 2 : 0
}
/**
* @description 执行解析
* @param {String} content 要解析的文本
*/
Parser.prototype.parse = function(content) {
Parser.prototype.parse = function (content) {
// 插件处理
for (let i = this.plugins.length; i--;) {
if (this.plugins[i].onUpdate) {
@ -208,7 +200,7 @@ Parser.prototype.parse = function(content) {
/**
* @description 将标签暴露出来不被 rich-text 包含
*/
Parser.prototype.expose = function() {
Parser.prototype.expose = function () {
// #ifndef APP-PLUS-NVUE
for (let i = this.stack.length; i--;) {
const item = this.stack[i]
@ -223,7 +215,7 @@ Parser.prototype.expose = function() {
* @param {Object} node 要处理的标签
* @returns {Boolean} 是否要移除此标签
*/
Parser.prototype.hook = function(node) {
Parser.prototype.hook = function (node) {
for (let i = this.plugins.length; i--;) {
if (this.plugins[i].onParse && this.plugins[i].onParse(node, this) === false) {
return false
@ -237,7 +229,7 @@ Parser.prototype.hook = function(node) {
* @param {String} url 需要拼接的链接
* @returns {String} 拼接后的链接
*/
Parser.prototype.getUrl = function(url) {
Parser.prototype.getUrl = function (url) {
const domain = this.options.domain
if (url[0] === '/') {
if (url[1] === '/') {
@ -246,15 +238,13 @@ Parser.prototype.getUrl = function(url) {
} else if (domain) {
// 否则补充整个域名
url = domain + url
} /* #ifdef APP-PLUS */
else {
} /* #ifdef APP-PLUS */ else {
url = plus.io.convertLocalFileSystemURL(url)
} /* #endif */
} else if (!url.includes('data:') && !url.includes('://')) {
if (domain) {
url = domain + '/' + url
} /* #ifdef APP-PLUS */
else {
} /* #ifdef APP-PLUS */ else {
url = plus.io.convertLocalFileSystemURL(url)
} /* #endif */
}
@ -266,7 +256,7 @@ Parser.prototype.getUrl = function(url) {
* @param {Object} node 标签
* @returns {Object}
*/
Parser.prototype.parseStyle = function(node) {
Parser.prototype.parseStyle = function (node) {
const attrs = node.attrs
const list = (this.tagStyle[node.name] || '').split(';').concat((attrs.style || '').split(';'))
const styleObj = {}
@ -327,7 +317,7 @@ Parser.prototype.parseStyle = function(node) {
* @param {String} name 标签名
* @private
*/
Parser.prototype.onTagName = function(name) {
Parser.prototype.onTagName = function (name) {
this.tagName = this.xml ? name : name.toLowerCase()
if (this.tagName === 'svg') {
this.xml = (this.xml || 0) + 1 // svg 标签内大小写敏感
@ -339,7 +329,7 @@ Parser.prototype.onTagName = function(name) {
* @param {String} name 属性名
* @private
*/
Parser.prototype.onAttrName = function(name) {
Parser.prototype.onAttrName = function (name) {
name = this.xml ? name : name.toLowerCase()
if (name.substr(0, 5) === 'data-') {
if (name === 'data-src' && !this.attrs.src) {
@ -363,8 +353,7 @@ Parser.prototype.onAttrName = function(name) {
* @param {String} val 属性值
* @private
*/
Parser.prototype.onAttrVal = function(val) {
// console.log(val, '解码转码')
Parser.prototype.onAttrVal = function (val) {
const name = this.attrName || ''
if (name === 'style' || name === 'href') {
// 部分属性进行实体解码
@ -382,7 +371,7 @@ Parser.prototype.onAttrVal = function(val) {
* @param {Boolean} selfClose 是否有自闭合标识 />
* @private
*/
Parser.prototype.onOpenTag = function(selfClose) {
Parser.prototype.onOpenTag = function (selfClose) {
// 拼装 node
const node = Object.create(null)
node.name = this.tagName
@ -408,11 +397,9 @@ Parser.prototype.onOpenTag = function(selfClose) {
// #ifndef H5 || APP-PLUS
const src = attrs.src || ''
// 按照后缀名和 type 将 embed 转为 video 或 audio
if (src.includes('.mp4') || src.includes('.3gp') || src.includes('.m3u8') || (attrs.type || '').includes(
'video')) {
if (src.includes('.mp4') || src.includes('.3gp') || src.includes('.m3u8') || (attrs.type || '').includes('video')) {
node.name = 'video'
} else if (src.includes('.mp3') || src.includes('.wav') || src.includes('.aac') || src.includes('.m4a') || (
attrs.type || '').includes('audio')) {
} else if (src.includes('.mp3') || src.includes('.wav') || src.includes('.aac') || src.includes('.m4a') || (attrs.type || '').includes('audio')) {
node.name = 'audio'
}
if (attrs.autostart) {
@ -452,9 +439,7 @@ Parser.prototype.onOpenTag = function(selfClose) {
// 通过 base 标签设置主域名
if (node.name === 'base' && !this.options.domain) {
this.options.domain = attrs.href
} /* #ifndef APP-PLUS-NVUE */
else if (node.name === 'source' && parent && (parent.name === 'video' || parent.name === 'audio') &&
attrs.src) {
} /* #ifndef APP-PLUS-NVUE */ else if (node.name === 'source' && parent && (parent.name === 'video' || parent.name === 'audio') && attrs.src) {
// 设置 source 标签(仅父节点为 video 或 audio 时有效)
parent.src.push(attrs.src)
} /* #endif */
@ -491,8 +476,7 @@ Parser.prototype.onOpenTag = function(selfClose) {
}
// #ifndef H5 || APP-PLUS
const style = item.attrs.style || ''
if (style.includes('flex:') && !style.includes('flex:0') && !style.includes('flex: 0') && (!
styleObj.width || parseInt(styleObj.width) > 100)) {
if (style.includes('flex:') && !style.includes('flex:0') && !style.includes('flex: 0') && (!styleObj.width || parseInt(styleObj.width) > 100)) {
styleObj.width = '100% !important'
styleObj.height = ''
for (let j = i + 1; j < this.stack.length; j++) {
@ -501,8 +485,7 @@ Parser.prototype.onOpenTag = function(selfClose) {
} else if (style.includes('flex') && styleObj.width === '100%') {
for (let j = i + 1; j < this.stack.length; j++) {
const style = this.stack[j].attrs.style || ''
if (!style.includes(';width') && !style.includes(' width') && style.indexOf(
'width') !== 0) {
if (!style.includes(';width') && !style.includes(' width') && style.indexOf('width') !== 0) {
styleObj.width = ''
break
}
@ -565,8 +548,7 @@ Parser.prototype.onOpenTag = function(selfClose) {
if (!isNaN(parseInt(styleObj.width))) {
node.w = 'T'
}
if (!isNaN(parseInt(styleObj.height)) && (!styleObj.height.includes('%') || (parent && (parent.attrs
.style || '').includes('height')))) {
if (!isNaN(parseInt(styleObj.height)) && (!styleObj.height.includes('%') || (parent && (parent.attrs.style || '').includes('height')))) {
node.h = 'T'
}
} else if (node.name === 'svg') {
@ -587,8 +569,7 @@ Parser.prototype.onOpenTag = function(selfClose) {
}
// #endif
} else {
if ((node.name === 'pre' || ((attrs.style || '').includes('white-space') && attrs.style.includes('pre'))) &&
this.pre !== 2) {
if ((node.name === 'pre' || ((attrs.style || '').includes('white-space') && attrs.style.includes('pre'))) && this.pre !== 2) {
this.pre = node.pre = 1
}
node.children = []
@ -604,7 +585,7 @@ Parser.prototype.onOpenTag = function(selfClose) {
* @param {String} name 标签名
* @private
*/
Parser.prototype.onCloseTag = function(name) {
Parser.prototype.onCloseTag = function (name) {
// 依次出栈到匹配为止
name = this.xml ? name : name.toLowerCase()
let i
@ -631,7 +612,7 @@ Parser.prototype.onCloseTag = function(name) {
* @description 处理标签出栈
* @private
*/
Parser.prototype.popNode = function() {
Parser.prototype.popNode = function () {
const node = this.stack.pop()
let attrs = node.attrs
const children = node.children
@ -669,7 +650,7 @@ Parser.prototype.popNode = function() {
return
}
// #ifdef APP-PLUS-NVUE
(function traversal(node) {
(function traversal (node) {
if (node.name) {
// 调整 svg 的大小写
node.name = config.svgDict[node.name] || node.name
@ -690,7 +671,7 @@ Parser.prototype.popNode = function() {
const style = attrs.style
attrs.style = ''
attrs.xmlns = 'http://www.w3.org/2000/svg';
(function traversal(node) {
(function traversal (node) {
if (node.type === 'text') {
src += node.text
return
@ -764,9 +745,7 @@ Parser.prototype.popNode = function() {
} else if (size > 7) {
size = 7
}
styleObj['font-size'] = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', 'xxx-large'][
size - 1
]
styleObj['font-size'] = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', 'xxx-large'][size - 1]
}
attrs.size = undefined
}
@ -795,8 +774,7 @@ Parser.prototype.popNode = function() {
if (node.name === 'a' || node.name === 'ad'
// #ifdef H5 || APP-PLUS
||
node.name === 'iframe' // eslint-disable-line
|| node.name === 'iframe' // eslint-disable-line
// #endif
) {
this.expose()
@ -812,8 +790,7 @@ Parser.prototype.popNode = function() {
}
}
if (this.options.pauseVideo) {
str +=
' onplay="this.dispatchEvent(new CustomEvent(\'vplay\',{bubbles:!0}));for(var e=document.getElementsByTagName(\'video\'),t=0;t<e.length;t++)e[t]!=this&&e[t].pause()"'
str += ' onplay="this.dispatchEvent(new CustomEvent(\'vplay\',{bubbles:!0}));for(var e=document.getElementsByTagName(\'video\'),t=0;t<e.length;t++)e[t]!=this&&e[t].pause()"'
}
str += '>'
for (let i = 0; i < node.src.length; i++) {
@ -875,7 +852,7 @@ Parser.prototype.popNode = function() {
const cells = [] // 保存新的单元格
const map = {}; // 被合并单元格占用的格子
(function traversal(nodes) {
(function traversal (nodes) {
for (let i = 0; i < nodes.length; i++) {
if (nodes[i].name === 'tr') {
trList.push(nodes[i])
@ -930,9 +907,7 @@ Parser.prototype.popNode = function() {
style += ';justify-content: right'
}
}
style = (border ? `;border:${border}px ${borderstyle || 'solid'} ${bordercolor || 'gray'}` +
(spacing ? '' : ';border-right:0;border-bottom:0') : '') + (padding ?
`;padding:${padding}px` : '') + ';' + style
style = (border ? `;border:${border}px ${borderstyle || 'solid'} ${bordercolor || 'gray'}` + (spacing ? '' : ';border-right:0;border-bottom:0') : '') + (padding ? `;padding:${padding}px` : '') + ';' + style
// 处理列合并
if (td.attrs.colspan) {
style += `;grid-column-start:${col};grid-column-end:${col + parseInt(td.attrs.colspan)}`
@ -980,13 +955,12 @@ Parser.prototype.popNode = function() {
}
if (border || padding) {
// 遍历
(function traversal(nodes) {
(function traversal (nodes) {
for (let i = 0; i < nodes.length; i++) {
const td = nodes[i]
if (td.name === 'th' || td.name === 'td') {
if (border) {
td.attrs.style =
`border:${border}px ${borderstyle || 'solid'} ${bordercolor || 'gray'};${td.attrs.style || ''}`
td.attrs.style = `border:${border}px ${borderstyle || 'solid'} ${bordercolor || 'gray'};${td.attrs.style || ''}`
}
if (padding) {
td.attrs.style = `padding:${padding}px;${td.attrs.style || ''}`
@ -1037,13 +1011,12 @@ Parser.prototype.popNode = function() {
}
}
} else if (node.c) {
(function traversal(node) {
(function traversal (node) {
node.c = 2
for (let i = node.children.length; i--;) {
const child = node.children[i]
// #ifdef (MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE3
if (child.name && (config.inlineTags[child.name] || ((child.attrs.style || '').includes(
'inline') && child.children)) && !child.c) {
if (child.name && (config.inlineTags[child.name] || ((child.attrs.style || '').includes('inline') && child.children)) && !child.c) {
traversal(child)
}
// #endif
@ -1064,16 +1037,13 @@ Parser.prototype.popNode = function() {
}
}
// flex 布局时部分样式需要提取到 rich-text 外层
const flex = parent && ((parent.attrs.style || '').includes('flex') || (parent.attrs.style || '').includes(
'grid'))
const flex = parent && ((parent.attrs.style || '').includes('flex') || (parent.attrs.style || '').includes('grid'))
// #ifdef MP-WEIXIN
// 检查基础库版本 virtualHost 是否可用
&&
!(node.c && wx.getNFCAdapter) // eslint-disable-line
&& !(node.c && wx.getNFCAdapter) // eslint-disable-line
// #endif
// #ifndef MP-WEIXIN || MP-QQ || MP-BAIDU || MP-TOUTIAO
&&
!node.c // eslint-disable-line
&& !node.c // eslint-disable-line
// #endif
if (flex) {
node.f = ';max-width:100%'
@ -1088,8 +1058,7 @@ Parser.prototype.popNode = function() {
if (styleObj[key]) {
const val = `;${key}:${styleObj[key].replace(' !important', '')}`
/* #ifndef APP-PLUS-NVUE */
if (flex && ((key.includes('flex') && key !== 'flex-direction') || key === 'align-self' || key.includes(
'grid') || styleObj[key][0] === '-' || (key.includes('width') && val.includes('%')))) {
if (flex && ((key.includes('flex') && key !== 'flex-direction') || key === 'align-self' || key.includes('grid') || styleObj[key][0] === '-' || (key.includes('width') && val.includes('%')))) {
node.f += val
if (key === 'width') {
attrs.style += ';width:100%'
@ -1113,7 +1082,7 @@ Parser.prototype.popNode = function() {
* @description 解析到文本
* @param {String} text 文本内容
*/
Parser.prototype.onText = function(text) {
Parser.prototype.onText = function (text) {
if (!this.pre) {
// 合并空白符
let trim = ''
@ -1150,8 +1119,7 @@ Parser.prototype.onText = function(text) {
node.text = decodeEntity(text)
if (this.hook(node)) {
// #ifdef MP-WEIXIN
if (this.options.selectable === 'force' && system.includes('iOS') && !uni.canIUse(
'rich-text.user-select')) {
if (this.options.selectable === 'force' && system.includes('iOS') && !uni.canIUse('rich-text.user-select')) {
this.expose()
}
// #endif
@ -1164,7 +1132,7 @@ Parser.prototype.onText = function(text) {
* @description html 词法分析器
* @param {Object} handler 高层处理器
*/
function Lexer(handler) {
function Lexer (handler) {
this.handler = handler
}
@ -1172,7 +1140,7 @@ function Lexer(handler) {
* @description 执行解析
* @param {String} content 要解析的文本
*/
Lexer.prototype.parse = function(content) {
Lexer.prototype.parse = function (content) {
this.content = content || ''
this.i = 0 // 标记解析位置
this.start = 0 // 标记一个单词的开始位置
@ -1188,7 +1156,7 @@ Lexer.prototype.parse = function(content) {
* @returns {Boolean} 是否闭合
* @private
*/
Lexer.prototype.checkClose = function(method) {
Lexer.prototype.checkClose = function (method) {
const selfClose = this.content[this.i] === '/'
if (this.content[this.i] === '>' || (selfClose && this.content[this.i + 1] === '>')) {
if (method) {
@ -1216,7 +1184,7 @@ Lexer.prototype.checkClose = function(method) {
* @description 文本状态
* @private
*/
Lexer.prototype.text = function() {
Lexer.prototype.text = function () {
this.i = this.content.indexOf('<', this.i) // 查找最近的标签
if (this.i === -1) {
// 没有标签了
@ -1264,7 +1232,7 @@ Lexer.prototype.text = function() {
* @description 标签名状态
* @private
*/
Lexer.prototype.tagName = function() {
Lexer.prototype.tagName = function () {
if (blankChar[this.content[this.i]]) {
// 解析到标签名
this.handler.onTagName(this.content.substring(this.start, this.i))
@ -1282,7 +1250,7 @@ Lexer.prototype.tagName = function() {
* @description 属性名状态
* @private
*/
Lexer.prototype.attrName = function() {
Lexer.prototype.attrName = function () {
let c = this.content[this.i]
if (blankChar[c] || c === '=') {
// 解析到属性名
@ -1317,7 +1285,7 @@ Lexer.prototype.attrName = function() {
* @description 属性值状态
* @private
*/
Lexer.prototype.attrVal = function() {
Lexer.prototype.attrVal = function () {
const c = this.content[this.i]
const len = this.content.length
if (c === '"' || c === "'") {
@ -1347,7 +1315,7 @@ Lexer.prototype.attrVal = function() {
* @returns {String} 结束的标签名
* @private
*/
Lexer.prototype.endTag = function() {
Lexer.prototype.endTag = function () {
const c = this.content[this.i]
if (blankChar[c] || c === '>' || c === '/') {
this.handler.onCloseTag(this.content.substring(this.start, this.i))

View File

@ -1,6 +1,4 @@
import {
loadEnv
} from 'vite';
import { loadEnv } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
import path from 'path';
// import viteCompression from 'vite-plugin-compression';