Merge remote-tracking branch 'yudao/develop' into dev
commit
1b02d0cefa
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
// 加载更多
|
// 加载更多
|
||||||
function loadMore() {
|
function loadMore() {
|
||||||
if (loadStatus !== 'noMore') {
|
if (loadStatus.value !== 'noMore') {
|
||||||
activityPageParams.pageNo += 1;
|
activityPageParams.pageNo += 1;
|
||||||
getActivityList();
|
getActivityList();
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -63,7 +63,7 @@
|
||||||
import { showShareModal } from '@/sheep/hooks/useModal';
|
import { showShareModal } from '@/sheep/hooks/useModal';
|
||||||
import SpuApi from '@/sheep/api/product/spu';
|
import SpuApi from '@/sheep/api/product/spu';
|
||||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||||
import { fen2yuan } from '../../sheep/hooks/useGoods';
|
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
pagination: {
|
pagination: {
|
||||||
|
@ -104,19 +104,29 @@
|
||||||
pageSize: state.pagination.pageSize,
|
pageSize: state.pagination.pageSize,
|
||||||
pageNo: state.pagination.pageNo,
|
pageNo: state.pagination.pageNo,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
|
state.loadStatus = 'error'; // 处理错误状态
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 使用 Promise.all 来等待所有佣金请求完成
|
||||||
|
await Promise.all(
|
||||||
|
data.list.map(async (item) => {
|
||||||
|
try {
|
||||||
|
const res = await BrokerageApi.getProductBrokeragePrice(item.id);
|
||||||
|
item.brokerageMinPrice = res.data.brokerageMinPrice;
|
||||||
|
item.brokerageMaxPrice = res.data.brokerageMaxPrice;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`获取商品【${item.name}】的佣金时出错:`, error);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
// 在所有请求完成后合并列表和更新状态
|
||||||
state.pagination.list = _.concat(state.pagination.list, data.list);
|
state.pagination.list = _.concat(state.pagination.list, data.list);
|
||||||
state.pagination.total = data.total;
|
state.pagination.total = data.total;
|
||||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
// 补充分佣金额
|
|
||||||
data.list.forEach((item) => {
|
|
||||||
BrokerageApi.getProductBrokeragePrice(item.id).then((res) => {
|
|
||||||
item.brokerageMinPrice = res.data.brokerageMinPrice;
|
|
||||||
item.brokerageMaxPrice = res.data.brokerageMaxPrice;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
|
|
|
@ -128,7 +128,7 @@
|
||||||
state.loadStatus = 'loading';
|
state.loadStatus = 'loading';
|
||||||
let { code, data } = await BrokerageApi.getBrokerageRecordPage({
|
let { code, data } = await BrokerageApi.getBrokerageRecordPage({
|
||||||
pageSize: state.pagination.pageSize,
|
pageSize: state.pagination.pageSize,
|
||||||
pageNo: state.pagination.pageSize,
|
pageNo: state.pagination.pageNo,
|
||||||
bizType: 1, // 获得推广佣金
|
bizType: 1, // 获得推广佣金
|
||||||
status: state.currentTab > 0 ? state.currentTab : undefined,
|
status: state.currentTab > 0 ? state.currentTab : undefined,
|
||||||
});
|
});
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -85,7 +85,7 @@
|
||||||
<view class="price-text ss-m-r-16">
|
<view class="price-text ss-m-r-16">
|
||||||
{{ fen2yuan(state.selectedSku.price || state.goodsInfo.price) }}
|
{{ fen2yuan(state.selectedSku.price || state.goodsInfo.price) }}
|
||||||
</view>
|
</view>
|
||||||
<view class="origin-price-text" v-if="state.goodsInfo.marketPrice > 0">
|
<view class="origin-price-text" v-if="state.goodsInfo.marketPrice > state.goodsInfo.price">
|
||||||
{{ fen2yuan(state.selectedSku.marketPrice || state.goodsInfo.marketPrice) }}
|
{{ fen2yuan(state.selectedSku.marketPrice || state.goodsInfo.marketPrice) }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -361,7 +361,7 @@
|
||||||
// 选择有 promotionPrice 且最小的
|
// 选择有 promotionPrice 且最小的
|
||||||
state.settlementSku = state.goodsInfo.skus
|
state.settlementSku = state.goodsInfo.skus
|
||||||
.filter((sku) => sku.stock > 0 && sku.promotionPrice > 0)
|
.filter((sku) => sku.stock > 0 && sku.promotionPrice > 0)
|
||||||
.reduce((prev, curr) => (prev.promotionPrice < curr.promotionPrice ? prev : curr));
|
.reduce((prev, curr) => (prev.promotionPrice < curr.promotionPrice ? prev : curr), []);
|
||||||
|
|
||||||
// 设置满减送活动
|
// 设置满减送活动
|
||||||
if (data.rewardActivity) {
|
if (data.rewardActivity) {
|
||||||
|
|
|
@ -7,7 +7,10 @@
|
||||||
<detailSkeleton v-if="state.skeletonLoading" />
|
<detailSkeleton v-if="state.skeletonLoading" />
|
||||||
<!-- 下架/售罄提醒 -->
|
<!-- 下架/售罄提醒 -->
|
||||||
<s-empty
|
<s-empty
|
||||||
v-else-if="state.goodsInfo === null || state.goodsInfo.activity_type !== PromotionActivityTypeEnum.POINT.type"
|
v-else-if="
|
||||||
|
state.goodsInfo === null ||
|
||||||
|
state.goodsInfo.activity_type !== PromotionActivityTypeEnum.POINT.type
|
||||||
|
"
|
||||||
text="活动不存在或已结束"
|
text="活动不存在或已结束"
|
||||||
icon="/static/soldout-empty.png"
|
icon="/static/soldout-empty.png"
|
||||||
showAction
|
showAction
|
||||||
|
@ -37,7 +40,9 @@
|
||||||
></image>
|
></image>
|
||||||
<text class="point-text ss-m-r-16">
|
<text class="point-text ss-m-r-16">
|
||||||
{{ getShowPrice.point }}
|
{{ getShowPrice.point }}
|
||||||
{{ !getShowPrice.price || getShowPrice.price === 0 ? '' : `+¥${getShowPrice.price}` }}
|
{{
|
||||||
|
!getShowPrice.price || getShowPrice.price === 0 ? '' : `+¥${getShowPrice.price}`
|
||||||
|
}}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="sales-text">
|
<view class="sales-text">
|
||||||
|
@ -87,21 +92,19 @@
|
||||||
<button
|
<button
|
||||||
class="ss-reset-button btn-box ss-flex-col"
|
class="ss-reset-button btn-box ss-flex-col"
|
||||||
@tap="state.showSelectSku = true"
|
@tap="state.showSelectSku = true"
|
||||||
:class="
|
:class="state.goodsInfo.stock != 0 ? 'check-btn-box' : 'disabled-btn-box'"
|
||||||
state.goodsInfo.stock != 0
|
|
||||||
? 'check-btn-box'
|
|
||||||
: 'disabled-btn-box'
|
|
||||||
"
|
|
||||||
:disabled="state.goodsInfo.stock === 0"
|
:disabled="state.goodsInfo.stock === 0"
|
||||||
>
|
>
|
||||||
<view class="price-box ss-flex">
|
<view class="price-box ss-flex">
|
||||||
<image
|
<image
|
||||||
:src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
|
:src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
|
||||||
style="width: 36rpx;height: 36rpx;margin: 0 4rpx;"
|
style="width: 36rpx; height: 36rpx; margin: 0 4rpx"
|
||||||
></image>
|
></image>
|
||||||
<text class="point-text ss-m-r-16">
|
<text class="point-text ss-m-r-16">
|
||||||
{{ getShowPrice.point }}
|
{{ getShowPrice.point }}
|
||||||
{{ !getShowPrice.price || getShowPrice.price === 0 ? '' : `+¥${getShowPrice.price}` }}
|
{{
|
||||||
|
!getShowPrice.price || getShowPrice.price === 0 ? '' : `+¥${getShowPrice.price}`
|
||||||
|
}}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="state.goodsInfo.stock === 0">已售罄</view>
|
<view v-if="state.goodsInfo.stock === 0">已售罄</view>
|
||||||
|
@ -135,8 +138,7 @@
|
||||||
const seckillBg = sheep.$url.css('/static/img/shop/goods/seckill-tip-bg.png');
|
const seckillBg = sheep.$url.css('/static/img/shop/goods/seckill-tip-bg.png');
|
||||||
const grouponBg = sheep.$url.css('/static/img/shop/goods/groupon-tip-bg.png');
|
const grouponBg = sheep.$url.css('/static/img/shop/goods/groupon-tip-bg.png');
|
||||||
|
|
||||||
onPageScroll(() => {
|
onPageScroll(() => {});
|
||||||
});
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
skeletonLoading: true,
|
skeletonLoading: true,
|
||||||
goodsInfo: {},
|
goodsInfo: {},
|
||||||
|
@ -178,6 +180,7 @@
|
||||||
title: activity.value.name,
|
title: activity.value.name,
|
||||||
image: sheep.$url.cdn(state.goodsInfo.picUrl),
|
image: sheep.$url.cdn(state.goodsInfo.picUrl),
|
||||||
params: {
|
params: {
|
||||||
|
// TODO @puhui:page 相关,要不搞个枚举,然后都弄过去;
|
||||||
page: '6',
|
page: '6',
|
||||||
query: activity.value.id,
|
query: activity.value.id,
|
||||||
},
|
},
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<image class="goods-img" :src="item.picUrl" mode="aspectFit" />
|
<image class="goods-img" :src="item.picUrl" mode="aspectFit" />
|
||||||
</view>
|
</view>
|
||||||
<view class="goods-content">
|
<view class="goods-content">
|
||||||
<view class="goods-title ss-line-1 ss-m-b-28">{{ item.title }}</view>
|
<view class="goods-title ss-line-1 ss-m-b-28">{{ item.name }}</view>
|
||||||
<view class="goods-price">¥{{ fen2yuan(item.price) }}</view>
|
<view class="goods-price">¥{{ fen2yuan(item.price) }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
@ -37,14 +37,14 @@
|
||||||
<text class="_icon-forward"></text>
|
<text class="_icon-forward"></text>
|
||||||
</view>
|
</view>
|
||||||
<view class="tool-btn-box ss-flex ss-col-center ss-row-right ss-p-r-20">
|
<view class="tool-btn-box ss-flex ss-col-center ss-row-right ss-p-r-20">
|
||||||
<!-- TODO 功能缺失:填写退货信息 -->
|
|
||||||
<view>
|
<view>
|
||||||
<button
|
<button
|
||||||
class="ss-reset-button tool-btn"
|
class="ss-reset-button tool-btn"
|
||||||
@tap.stop="onApply(order.id)"
|
@tap.stop="onApply(order.id)"
|
||||||
v-if="order?.buttons.includes('cancel')"
|
v-if="order?.buttons.includes('cancel')"
|
||||||
>取消申请</button
|
|
||||||
>
|
>
|
||||||
|
取消申请
|
||||||
|
</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
@ -204,32 +204,46 @@ async function uploadFiles(choosePromise, { onChooseFile, onUploadProgress }) {
|
||||||
|
|
||||||
// 如果是前端直连上传
|
// 如果是前端直连上传
|
||||||
if (UPLOAD_TYPE.CLIENT === import.meta.env.SHOPRO_UPLOAD_TYPE) {
|
if (UPLOAD_TYPE.CLIENT === import.meta.env.SHOPRO_UPLOAD_TYPE) {
|
||||||
for (const file of files) {
|
// 为上传创建一组 Promise
|
||||||
// 1.1 获取文件预签名地址
|
const uploadPromises = files.map(async (file) => {
|
||||||
const { data: presignedInfo } = await FileApi.getFilePresignedUrl(file.name);
|
try {
|
||||||
// 1.2 获取二进制文件对象
|
// 1.1 获取文件预签名地址
|
||||||
const fileBuffer = await convertToArrayBuffer(file);
|
const { data: presignedInfo } = await FileApi.getFilePresignedUrl(file.name);
|
||||||
// 1.3 上传文件
|
// 1.2 获取二进制文件对象
|
||||||
await uni.request({
|
const fileBuffer = await convertToArrayBuffer(file);
|
||||||
url: presignedInfo.uploadUrl, // 预签名的上传 URL
|
|
||||||
method: 'PUT', // 使用 PUT 方法
|
// 返回上传的 Promise
|
||||||
header: {
|
return new Promise((resolve, reject) => {
|
||||||
'Content-Type': file.fileType + '/' + file.name.substring(file.name.lastIndexOf('.') + 1), // 设置内容类型
|
uni.request({
|
||||||
},
|
url: presignedInfo.uploadUrl, // 预签名的上传 URL
|
||||||
data: fileBuffer, // 文件的路径,适用于小程序
|
method: 'PUT', // 使用 PUT 方法
|
||||||
success: (res) => {
|
header: {
|
||||||
// 1.4. 记录文件信息到后端(异步)
|
'Content-Type':
|
||||||
createFile(presignedInfo, file);
|
file.fileType + '/' + file.name.substring(file.name.lastIndexOf('.') + 1), // 设置内容类型
|
||||||
// 1.5. 重新赋值
|
},
|
||||||
file.url = presignedInfo.url;
|
data: fileBuffer, // 文件的路径,适用于小程序
|
||||||
console.log('上传成功:', res);
|
success: (res) => {
|
||||||
},
|
// 1.4. 记录文件信息到后端(异步)
|
||||||
fail: (err) => {
|
createFile(presignedInfo, file);
|
||||||
console.error('上传失败:', err);
|
// 1.5. 重新赋值
|
||||||
},
|
file.url = presignedInfo.url;
|
||||||
});
|
console.log('上传成功:', res);
|
||||||
}
|
resolve(file);
|
||||||
return files;
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('上传失败:', err);
|
||||||
|
reject(err);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('上传失败:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 等待所有上传完成
|
||||||
|
return await Promise.all(uploadPromises); // 返回已上传的文件列表
|
||||||
} else {
|
} else {
|
||||||
// 后端上传
|
// 后端上传
|
||||||
for (let file of files) {
|
for (let file of files) {
|
||||||
|
|
|
@ -44,13 +44,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { chooseAndUploadFile, uploadCloudFiles } from './choose-and-upload-file.js';
|
import { chooseAndUploadFile, uploadCloudFiles } from './choose-and-upload-file.js';
|
||||||
import {
|
import { get_extname, get_files_and_is_max, get_file_data } from './utils.js';
|
||||||
get_file_ext,
|
|
||||||
get_extname,
|
|
||||||
get_files_and_is_max,
|
|
||||||
get_file_info,
|
|
||||||
get_file_data,
|
|
||||||
} from './utils.js';
|
|
||||||
import uploadImage from './upload-image.vue';
|
import uploadImage from './upload-image.vue';
|
||||||
import uploadFile from './upload-file.vue';
|
import uploadFile from './upload-file.vue';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
|
@ -352,22 +346,21 @@
|
||||||
/**
|
/**
|
||||||
* 选择文件并上传
|
* 选择文件并上传
|
||||||
*/
|
*/
|
||||||
chooseFiles() {
|
async chooseFiles() {
|
||||||
const _extname = get_extname(this.fileExtname);
|
const _extname = get_extname(this.fileExtname);
|
||||||
// 获取后缀
|
// 获取后缀
|
||||||
uniCloud
|
await chooseAndUploadFile({
|
||||||
.chooseAndUploadFile({
|
type: this.fileMediatype,
|
||||||
type: this.fileMediatype,
|
compressed: false,
|
||||||
compressed: false,
|
sizeType: this.sizeType,
|
||||||
sizeType: this.sizeType,
|
// TODO 如果为空,video 有问题
|
||||||
// TODO 如果为空,video 有问题
|
extension: _extname.length > 0 ? _extname : undefined,
|
||||||
extension: _extname.length > 0 ? _extname : undefined,
|
count: this.limitLength - this.files.length, //默认9
|
||||||
count: this.limitLength - this.files.length, //默认9
|
onChooseFile: this.chooseFileCallback,
|
||||||
onChooseFile: this.chooseFileCallback,
|
onUploadProgress: (progressEvent) => {
|
||||||
onUploadProgress: (progressEvent) => {
|
this.setProgress(progressEvent, progressEvent.index);
|
||||||
this.setProgress(progressEvent, progressEvent.index);
|
},
|
||||||
},
|
})
|
||||||
})
|
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.setSuccessAndError(result);
|
this.setSuccessAndError(result);
|
||||||
})
|
})
|
||||||
|
@ -587,7 +580,7 @@
|
||||||
path: v.path,
|
path: v.path,
|
||||||
size: v.size,
|
size: v.size,
|
||||||
fileID: v.fileID,
|
fileID: v.fileID,
|
||||||
url: v.path,
|
url: v.url,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return newFilesData;
|
return newFilesData;
|
||||||
|
|
|
@ -17,12 +17,11 @@ export const get_file_ext = (name) => {
|
||||||
*/
|
*/
|
||||||
export const get_extname = (fileExtname) => {
|
export const get_extname = (fileExtname) => {
|
||||||
if (!Array.isArray(fileExtname)) {
|
if (!Array.isArray(fileExtname)) {
|
||||||
let extname = fileExtname.replace(/(\[|\])/g, '');
|
let extname = fileExtname.replace(/([\[\]])/g, '');
|
||||||
return extname.split(',');
|
return extname.split(',');
|
||||||
} else {
|
} else {
|
||||||
return fileExtname;
|
return fileExtname;
|
||||||
}
|
}
|
||||||
return [];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,7 +90,7 @@ export const get_file_data = async (files, type = 'image') => {
|
||||||
extname: extname || '',
|
extname: extname || '',
|
||||||
cloudPath: files.cloudPath,
|
cloudPath: files.cloudPath,
|
||||||
fileType: files.fileType,
|
fileType: files.fileType,
|
||||||
url: files.path || files.path,
|
url: files.url || files.path,
|
||||||
size: files.size, //单位是字节
|
size: files.size, //单位是字节
|
||||||
image: {},
|
image: {},
|
||||||
path: files.path,
|
path: files.path,
|
||||||
|
|
|
@ -416,7 +416,7 @@ export function appendSettlementProduct(spus, settlementInfos) {
|
||||||
// 选择价格最小的 SKU 设置到 SPU 上
|
// 选择价格最小的 SKU 设置到 SPU 上
|
||||||
const settlementSku = settlementInfo.skus
|
const settlementSku = settlementInfo.skus
|
||||||
.filter((sku) => sku.promotionPrice > 0)
|
.filter((sku) => sku.promotionPrice > 0)
|
||||||
.reduce((prev, curr) => (prev.promotionPrice < curr.promotionPrice ? prev : curr));
|
.reduce((prev, curr) => (prev.promotionPrice < curr.promotionPrice ? prev : curr), []);
|
||||||
if (settlementSku) {
|
if (settlementSku) {
|
||||||
spu.promotionType = settlementSku.promotionType;
|
spu.promotionType = settlementSku.promotionType;
|
||||||
spu.promotionPrice = settlementSku.promotionPrice;
|
spu.promotionPrice = settlementSku.promotionPrice;
|
||||||
|
|
Loading…
Reference in New Issue