s-coupon-get.vue,detail-tabbar.vue,详情加入购物车,其他模块优化
parent
c5b1f3ac93
commit
ef26268c8e
|
@ -148,11 +148,20 @@
|
|||
});
|
||||
if (res.code === 0) {
|
||||
// 拦截修改数据
|
||||
let obj2 = {
|
||||
2: '折扣',
|
||||
1: '满减'
|
||||
}
|
||||
let obj = {
|
||||
1: '可用',
|
||||
2: '已用',
|
||||
3: '过期'
|
||||
}
|
||||
let obj3 = {
|
||||
1: '已领取',
|
||||
2: '已使用',
|
||||
3: '已过期'
|
||||
}
|
||||
res.data.list = res.data.list.map(item => {
|
||||
return {
|
||||
...item,
|
||||
|
@ -160,7 +169,8 @@
|
|||
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]
|
||||
status_text: obj[item.status],
|
||||
type_text: obj2[item.discountType]
|
||||
}
|
||||
});
|
||||
if (page >= 2) {
|
||||
|
|
|
@ -2,50 +2,29 @@
|
|||
<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"></image>
|
||||
<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"></image>
|
||||
<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"></image>
|
||||
<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"></image>
|
||||
<view class="item-title">分享</view>
|
||||
</view>
|
||||
<slot></slot>
|
||||
|
@ -67,9 +46,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import { computed, reactive } from 'vue';
|
||||
import {
|
||||
computed,
|
||||
reactive
|
||||
} from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import { showShareModal } from '@/sheep/hooks/useModal';
|
||||
import {
|
||||
showShareModal
|
||||
} from '@/sheep/hooks/useModal';
|
||||
|
||||
// 数据
|
||||
const state = reactive({});
|
||||
|
@ -126,13 +110,22 @@
|
|||
uni.setStorageSync('tabbar', e);
|
||||
};
|
||||
async function onFavorite() {
|
||||
const { error } = await sheep.$api.user.favorite.do(props.modelValue.id);
|
||||
if (error === 0) {
|
||||
// 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) {
|
||||
props.modelValue.favorite = 0;
|
||||
data = await sheep.$api.user.favorite.dos(props.modelValue.id);
|
||||
} else {
|
||||
props.modelValue.favorite = 1;
|
||||
data = await sheep.$api.user.favorite.do(props.modelValue.id);
|
||||
}
|
||||
if (data.data) {
|
||||
props.modelValue.favorite = !props.modelValue.favorite;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,6 +140,7 @@
|
|||
.ui-tabbar-box {
|
||||
box-shadow: 0px -6px 10px 0px rgba(51, 51, 51, 0.2);
|
||||
}
|
||||
|
||||
.ui-tabbar {
|
||||
display: flex;
|
||||
height: 50px;
|
||||
|
|
|
@ -34,7 +34,8 @@
|
|||
<!-- 满减送/限时折扣活动的提示 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>
|
||||
|
@ -101,12 +102,22 @@
|
|||
</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 { formatSales, formatGoodsSwiper, fen2yuan, } from '@/sheep/hooks/useGoods';
|
||||
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';
|
||||
|
@ -116,7 +127,9 @@
|
|||
import detailCommentCard from './components/detail/detail-comment-card.vue';
|
||||
import detailContentCard from './components/detail/detail-content-card.vue';
|
||||
import detailActivityTip from './components/detail/detail-activity-tip.vue';
|
||||
import { isEmpty } from 'lodash';
|
||||
import {
|
||||
isEmpty
|
||||
} from 'lodash';
|
||||
|
||||
onPageScroll(() => {});
|
||||
|
||||
|
@ -140,6 +153,7 @@
|
|||
|
||||
// 添加购物车 TODO 芋艿:待测试
|
||||
function onAddCart(e) {
|
||||
console.log(e, '加入购物车');
|
||||
sheep.$store('cart').add(e);
|
||||
}
|
||||
|
||||
|
@ -166,10 +180,10 @@
|
|||
// 立即领取 TODO 芋艿:待测试
|
||||
async function onGet(id) {
|
||||
const {
|
||||
error,
|
||||
code,
|
||||
msg
|
||||
} = await sheep.$api.coupon.get(id);
|
||||
if (error === 0) {
|
||||
if (code === 0) {
|
||||
uni.showToast({
|
||||
title: msg,
|
||||
});
|
||||
|
@ -207,7 +221,7 @@
|
|||
}
|
||||
state.goodsId = options.id;
|
||||
// 1. 加载商品信息
|
||||
sheep.$api.goods.detail(state.goodsId).then((res) => {
|
||||
sheep.$api.goods.detail(state.goodsId).then(async (res) => {
|
||||
// 未找到商品
|
||||
if (res.code !== 0 || !res.data) {
|
||||
state.goodsInfo = null;
|
||||
|
@ -215,17 +229,60 @@
|
|||
}
|
||||
// 加载到商品
|
||||
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(state.goodsId,2, 10).then((res) => {
|
||||
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) {
|
||||
|
|
|
@ -281,7 +281,7 @@
|
|||
}
|
||||
|
||||
onLoad(async (options) => {
|
||||
console.log(options)
|
||||
console.log(options, '确认订单启动参数')
|
||||
if (options.data) {
|
||||
state.orderPayload = JSON.parse(options.data);
|
||||
changeConsignee();
|
||||
|
|
|
@ -12,8 +12,8 @@ export default {
|
|||
},
|
||||
}),
|
||||
append: (data) =>
|
||||
request({
|
||||
url: 'cart',
|
||||
request2({
|
||||
url: '/app-api/trade/cart/add',
|
||||
method: 'POST',
|
||||
custom: {
|
||||
showSuccess: true,
|
||||
|
@ -21,9 +21,22 @@ export default {
|
|||
},
|
||||
data: {
|
||||
...data,
|
||||
type: 'inc',
|
||||
// type: 'inc',
|
||||
},
|
||||
}),
|
||||
// append: (data) =>
|
||||
// request({
|
||||
// url: 'cart',
|
||||
// method: 'POST',
|
||||
// custom: {
|
||||
// showSuccess: true,
|
||||
// successMsg: '已添加到购物车~',
|
||||
// },
|
||||
// data: {
|
||||
// ...data,
|
||||
// type: 'inc',
|
||||
// },
|
||||
// }),
|
||||
// 删除购物车
|
||||
delete: (ids) =>
|
||||
request2({
|
||||
|
|
|
@ -33,10 +33,21 @@ export default {
|
|||
},
|
||||
}),
|
||||
get: (id) =>
|
||||
request({
|
||||
url: 'coupon/get/' + id,
|
||||
request2({
|
||||
url: 'promotion/coupon/take',
|
||||
method: 'POST',
|
||||
data: {
|
||||
templateId: id
|
||||
},
|
||||
params: {
|
||||
templateId: id
|
||||
},
|
||||
}),
|
||||
// get: (id) =>
|
||||
// request({
|
||||
// url: 'coupon/get/' + id,
|
||||
// method: 'POST',
|
||||
// }),
|
||||
listByGoods: (id) =>
|
||||
request({
|
||||
url: 'coupon/listByGoods/' + id,
|
||||
|
|
|
@ -4,8 +4,8 @@ import request2 from '@/sheep/request2';
|
|||
export default {
|
||||
// 商品详情
|
||||
detail: (id, params = {}) =>
|
||||
request2({
|
||||
url: 'product/spu/get-detail?id=' + id,
|
||||
request({
|
||||
url: '/app-api/product/spu/get-detail?id=' + id,
|
||||
method: 'GET',
|
||||
params,
|
||||
custom: {
|
||||
|
@ -16,8 +16,8 @@ export default {
|
|||
|
||||
// 商品列表
|
||||
list: (params) =>
|
||||
request2({
|
||||
url: 'product/spu/page',
|
||||
request({
|
||||
url: '/app-api/product/spu/page',
|
||||
method: 'GET',
|
||||
params,
|
||||
custom: {
|
||||
|
@ -40,8 +40,8 @@ export default {
|
|||
|
||||
// 商品评价列表
|
||||
comment: (id, params = {}) =>
|
||||
request2({
|
||||
url: 'product/comment/list?spuId=' + id,
|
||||
request({
|
||||
url: '/app-api/product/comment/list?spuId=' + id,
|
||||
method: 'GET',
|
||||
params,
|
||||
custom: {
|
||||
|
@ -77,4 +77,10 @@ export default {
|
|||
method: 'GET',
|
||||
params,
|
||||
}),
|
||||
// 检查是否收藏商品
|
||||
exits: (id) =>
|
||||
request({
|
||||
url: '/app-api/product/favorite/exits?spuId=' + id,
|
||||
method: 'GET',
|
||||
}),
|
||||
};
|
|
@ -65,18 +65,24 @@ export default {
|
|||
// 解决 SpringMVC 接受 List<Item> 参数的问题
|
||||
delete data2.items
|
||||
for (let i = 0; i < data.items.length; i++) {
|
||||
// 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[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 + '';
|
||||
}
|
||||
console.log(data2, '对比数据')
|
||||
console.log(data2, '手动转码的参数')
|
||||
return request2({
|
||||
url: 'trade/order/settlement',
|
||||
method: 'GET',
|
||||
// data,
|
||||
// data: data2,
|
||||
params: data2
|
||||
})
|
||||
},
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import request from '@/sheep/request';
|
||||
import request2 from '@/sheep/request2';
|
||||
|
||||
export default {
|
||||
// 获得优惠劵模板列表
|
||||
|
@ -6,15 +7,24 @@ export default {
|
|||
return request({
|
||||
url: '/app-api/promotion/coupon-template/list-by-ids',
|
||||
method: 'GET',
|
||||
params: { ids },
|
||||
params: {
|
||||
ids
|
||||
},
|
||||
});
|
||||
},
|
||||
// 获得优惠劵模版列表
|
||||
getCouponTemplateList: (spuId, productScope, count) => {
|
||||
return request({
|
||||
url: '/app-api/promotion/coupon-template/list',
|
||||
getCouponTemplateList: (params) => {
|
||||
return request2({
|
||||
url: `promotion/coupon/match-list?price=${params.price}&spuIds=${params.spuIds}&skuIds=${params.skuIds}&categoryIds=${params.categoryIds}`,
|
||||
method: 'GET',
|
||||
params: { spuId, productScope, count },
|
||||
// params,
|
||||
});
|
||||
},
|
||||
// getCouponTemplateList: (spuId, productScope, count) => {
|
||||
// return request({
|
||||
// url: '/app-api/promotion/coupon-template/list',
|
||||
// method: 'GET',
|
||||
// params: { spuId, productScope, count },
|
||||
// });
|
||||
// },
|
||||
};
|
|
@ -1,11 +1,10 @@
|
|||
import request from '@/sheep/request';
|
||||
import request2 from '@/sheep/request2';
|
||||
import $platform from '@/sheep/platform';
|
||||
|
||||
export default {
|
||||
getUnused: () =>
|
||||
request2({
|
||||
url: 'promotion/coupon/get-unused-count',
|
||||
request({
|
||||
url: '/app-api/promotion/coupon/get-unused-count',
|
||||
method: 'GET',
|
||||
custom: {
|
||||
showLoading: false,
|
||||
|
@ -13,8 +12,8 @@ export default {
|
|||
},
|
||||
}),
|
||||
profile: () =>
|
||||
request2({
|
||||
url: 'member/user/get',
|
||||
request({
|
||||
url: '/app-api/member/user/get',
|
||||
method: 'GET',
|
||||
custom: {
|
||||
showLoading: false,
|
||||
|
@ -22,7 +21,7 @@ export default {
|
|||
},
|
||||
}),
|
||||
balance: () =>
|
||||
request2({
|
||||
request({
|
||||
url: '/app-api/pay/wallet/get',
|
||||
method: 'GET',
|
||||
custom: {
|
||||
|
@ -30,28 +29,9 @@ 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) =>
|
||||
request2({
|
||||
url: 'member/user/update',
|
||||
request({
|
||||
url: '/app-api/member/user/update',
|
||||
method: 'PUT',
|
||||
custom: {
|
||||
showSuccess: true,
|
||||
|
@ -196,90 +176,48 @@ export default {
|
|||
}),
|
||||
|
||||
address: {
|
||||
// default: () =>
|
||||
// request({
|
||||
// url: 'user/address/default',
|
||||
// method: 'GET',
|
||||
// custom: {
|
||||
// showError: false,
|
||||
// },
|
||||
// }),
|
||||
default: () =>
|
||||
request2({
|
||||
url: 'member/address/get-default',
|
||||
request({
|
||||
url: '/app-api/member/address/get-default',
|
||||
method: 'GET',
|
||||
custom: {
|
||||
showError: false,
|
||||
},
|
||||
}),
|
||||
list: () =>
|
||||
request2({
|
||||
url: 'member/address/list',
|
||||
request({
|
||||
url: '/app-api/member/address/list',
|
||||
method: 'GET',
|
||||
custom: {},
|
||||
}),
|
||||
// list: () =>
|
||||
// request({
|
||||
// url: 'user/address',
|
||||
// method: 'GET',
|
||||
// custom: {},
|
||||
// }),
|
||||
create: (data) =>
|
||||
request2({
|
||||
url: 'member/address/create',
|
||||
request({
|
||||
url: '/app-api/member/address/create',
|
||||
method: 'POST',
|
||||
data,
|
||||
custom: {
|
||||
showSuccess: true,
|
||||
},
|
||||
}),
|
||||
// create: (data) =>
|
||||
// request({
|
||||
// url: 'user/address',
|
||||
// method: 'POST',
|
||||
// data,
|
||||
// custom: {
|
||||
// showSuccess: true,
|
||||
// },
|
||||
// }),
|
||||
update: (data) =>
|
||||
request2({
|
||||
url: 'member/address/update',
|
||||
request({
|
||||
url: '/app-api/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) =>
|
||||
request2({
|
||||
url: 'member/address/get?id=' + id,
|
||||
request({
|
||||
url: '/app-api/member/address/get?id=' + id,
|
||||
method: 'GET',
|
||||
}),
|
||||
// detail: (id) =>
|
||||
// request({
|
||||
// url: 'user/address/' + id,
|
||||
// method: 'GET',
|
||||
// }),
|
||||
delete: (id) =>
|
||||
request2({
|
||||
url: 'member/address/delete?id=' + id,
|
||||
request({
|
||||
url: '/app-api/member/address/delete?id=' + id,
|
||||
method: 'DELETE',
|
||||
}),
|
||||
// delete: (id) =>
|
||||
// request({
|
||||
// url: 'user/address/' + id,
|
||||
// method: 'DELETE',
|
||||
// }),
|
||||
},
|
||||
invoice: {
|
||||
list: () =>
|
||||
|
@ -319,17 +257,29 @@ export default {
|
|||
},
|
||||
favorite: {
|
||||
list: (params) =>
|
||||
request2({
|
||||
url: 'product/favorite/page',
|
||||
request({
|
||||
url: '/app-api/product/favorite/page',
|
||||
method: 'GET',
|
||||
params,
|
||||
}),
|
||||
do: (id) =>
|
||||
request({
|
||||
url: 'user/goodsLog/favorite',
|
||||
url: '/app-api/product/favorite/create',
|
||||
method: 'POST',
|
||||
data: {
|
||||
goods_id: id,
|
||||
spuId: id,
|
||||
},
|
||||
custom: {
|
||||
showSuccess: true,
|
||||
auth: true,
|
||||
},
|
||||
}),
|
||||
dos: (id) =>
|
||||
request({
|
||||
url: '/app-api/product/favorite/delete',
|
||||
method: 'DELETE',
|
||||
data: {
|
||||
spuId: id,
|
||||
},
|
||||
custom: {
|
||||
showSuccess: true,
|
||||
|
@ -338,8 +288,8 @@ export default {
|
|||
}),
|
||||
// 取消收藏
|
||||
cancel: (id) =>
|
||||
request2({
|
||||
url: 'product/favorite/delete-list',
|
||||
request({
|
||||
url: '/app-api/product/favorite/delete-list',
|
||||
method: 'DELETE',
|
||||
data: {
|
||||
spuIds: id.split(',').map(item => item * 1),
|
||||
|
@ -350,18 +300,6 @@ 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) =>
|
||||
|
@ -383,28 +321,21 @@ export default {
|
|||
},
|
||||
wallet: {
|
||||
log: (params) =>
|
||||
request2({
|
||||
request({
|
||||
// url: 'member/point/record/page',
|
||||
url: 'pay/wallet-transaction/page',
|
||||
url: '/app-api/pay/wallet-transaction/page',
|
||||
method: 'GET',
|
||||
params,
|
||||
custom: {},
|
||||
}),
|
||||
log2: (params) =>
|
||||
request2({
|
||||
url: 'member/point/record/page',
|
||||
request({
|
||||
url: '/app-api/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) =>
|
||||
|
@ -429,18 +360,9 @@ export default {
|
|||
}),
|
||||
},
|
||||
//数量接口
|
||||
// data: () =>
|
||||
// request({
|
||||
// url: 'user/user/data',
|
||||
// method: 'GET',
|
||||
// custom: {
|
||||
// showLoading: false,
|
||||
// auth: true,
|
||||
// },
|
||||
// }),
|
||||
data: () =>
|
||||
request2({
|
||||
url: 'trade/order/get-count',
|
||||
request({
|
||||
url: '/app-api/trade/order/get-count',
|
||||
method: 'GET',
|
||||
custom: {
|
||||
showLoading: false,
|
||||
|
@ -448,8 +370,8 @@ export default {
|
|||
},
|
||||
}),
|
||||
data2: () =>
|
||||
request2({
|
||||
url: 'trade/after-sale/get-applying-count',
|
||||
request({
|
||||
url: '/app-api/trade/after-sale/get-applying-count',
|
||||
method: 'GET',
|
||||
custom: {
|
||||
showLoading: false,
|
||||
|
|
|
@ -1,32 +1,17 @@
|
|||
<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>
|
||||
|
@ -37,7 +22,10 @@
|
|||
</su-popup>
|
||||
</template>
|
||||
<script setup>
|
||||
import { computed, reactive } from 'vue';
|
||||
import {
|
||||
computed,
|
||||
reactive
|
||||
} from 'vue';
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Object,
|
||||
|
@ -55,6 +43,7 @@
|
|||
couponId: '',
|
||||
});
|
||||
const getBuy = (id) => {
|
||||
console.log('应该是详情页领取优惠券')
|
||||
emits('get', id);
|
||||
};
|
||||
//立即领取
|
||||
|
@ -62,26 +51,31 @@
|
|||
<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;
|
||||
|
@ -90,6 +84,7 @@
|
|||
border-radius: 40rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
// 优惠券按钮
|
||||
.card-btn {
|
||||
// width: 144rpx;
|
||||
|
@ -101,6 +96,7 @@
|
|||
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;
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
<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="
|
||||
|
|
|
@ -55,7 +55,8 @@ 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
|
||||
|
@ -97,6 +98,7 @@ http.interceptors.request.use(
|
|||
config.header['tenant-id'] = '1';
|
||||
config.header['Authorization'] = 'Bearer test247';
|
||||
}
|
||||
// console.log(config, '看参数')
|
||||
return config;
|
||||
},
|
||||
(error) => {
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import { defineStore } from 'pinia';
|
||||
import {
|
||||
defineStore
|
||||
} from 'pinia';
|
||||
import cartApi from '@/sheep/api/cart';
|
||||
|
||||
const cart = defineStore({
|
||||
|
@ -14,9 +16,9 @@ const cart = defineStore({
|
|||
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;
|
||||
price += state.selectedIds.includes(item.id) ?
|
||||
Number(item.sku.price / 100) * item.count :
|
||||
0;
|
||||
});
|
||||
return price.toFixed(2);
|
||||
},
|
||||
|
@ -24,26 +26,36 @@ const cart = defineStore({
|
|||
actions: {
|
||||
// 获取购物车列表
|
||||
async getList() {
|
||||
const { data, code } = await cartApi.list();
|
||||
const {
|
||||
data,
|
||||
code
|
||||
} = await cartApi.list();
|
||||
if (code === 0) {
|
||||
this.list = data.validList;
|
||||
}
|
||||
},
|
||||
// 添加购物车
|
||||
async add(goodsInfo) {
|
||||
const { error } = await cartApi.append({
|
||||
goods_id: goodsInfo.goods_id,
|
||||
goods_num: goodsInfo.goods_num,
|
||||
goods_sku_price_id: goodsInfo.id,
|
||||
console.log()
|
||||
const {
|
||||
code
|
||||
} = await cartApi.append({
|
||||
// goods_id: goodsInfo.goods_id,
|
||||
// goods_num: goodsInfo.goods_num,
|
||||
// goods_sku_price_id: goodsInfo.id,
|
||||
count: goodsInfo.goods_num,
|
||||
skuId: goodsInfo.id,
|
||||
});
|
||||
if (error === 0) {
|
||||
if (code === 0) {
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
|
||||
// 更新购物车
|
||||
async update(goodsInfo) {
|
||||
const { error } = await cartApi.update({
|
||||
const {
|
||||
error
|
||||
} = await cartApi.update({
|
||||
id: goodsInfo.goods_id,
|
||||
count: goodsInfo.goods_num,
|
||||
goods_sku_price_id: goodsInfo.goods_sku_price_id,
|
||||
|
@ -58,7 +70,9 @@ const cart = defineStore({
|
|||
if (typeof ids === 'array') {
|
||||
ids = ids.join(',');
|
||||
}
|
||||
const { code } = await cartApi.delete(ids);
|
||||
const {
|
||||
code
|
||||
} = await cartApi.delete(ids);
|
||||
if (code === 0) {
|
||||
this.selectAll(false);
|
||||
this.getList();
|
||||
|
@ -97,11 +111,9 @@ const cart = defineStore({
|
|||
},
|
||||
persist: {
|
||||
enabled: true,
|
||||
strategies: [
|
||||
{
|
||||
strategies: [{
|
||||
key: 'cart-store',
|
||||
},
|
||||
],
|
||||
}, ],
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
// 配置
|
||||
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'),
|
||||
|
@ -16,10 +18,14 @@ 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: {
|
||||
|
@ -145,7 +151,8 @@ function decodeEntity (str, amp) {
|
|||
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',
|
||||
|
@ -171,7 +178,8 @@ 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
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -238,13 +246,15 @@ 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 */
|
||||
}
|
||||
|
@ -354,6 +364,7 @@ Parser.prototype.onAttrName = function (name) {
|
|||
* @private
|
||||
*/
|
||||
Parser.prototype.onAttrVal = function(val) {
|
||||
console.log(val, '解码转码')
|
||||
const name = this.attrName || ''
|
||||
if (name === 'style' || name === 'href') {
|
||||
// 部分属性进行实体解码
|
||||
|
@ -397,9 +408,11 @@ 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) {
|
||||
|
@ -439,7 +452,9 @@ 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 */
|
||||
|
@ -476,7 +491,8 @@ 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++) {
|
||||
|
@ -485,7 +501,8 @@ 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
|
||||
}
|
||||
|
@ -548,7 +565,8 @@ 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') {
|
||||
|
@ -569,7 +587,8 @@ 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 = []
|
||||
|
@ -745,7 +764,9 @@ 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
|
||||
}
|
||||
|
@ -774,7 +795,8 @@ 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()
|
||||
|
@ -790,7 +812,8 @@ 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++) {
|
||||
|
@ -907,7 +930,9 @@ 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)}`
|
||||
|
@ -960,7 +985,8 @@ Parser.prototype.popNode = function () {
|
|||
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 || ''}`
|
||||
|
@ -1016,7 +1042,8 @@ Parser.prototype.popNode = function () {
|
|||
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
|
||||
|
@ -1037,13 +1064,16 @@ 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%'
|
||||
|
@ -1058,7 +1088,8 @@ 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%'
|
||||
|
@ -1119,7 +1150,8 @@ 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
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
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';
|
||||
|
|
Loading…
Reference in New Issue