Merge branch 'test' of https://newgitea.sxczgkj.cn/czg_team/cashier_app into test
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="fixed-wrap" :style="{ '--num': `${numValue}px` }" v-if="isShow">
|
<view class="fixed-wrap" :style="{ '--num': `${numValue}px` }">
|
||||||
<view class="fixed-btn" :class="[type]" id="targetRef">
|
<view class="fixed-btn" :class="[type]" id="targetRef">
|
||||||
<div class="btn">
|
<div class="btn">
|
||||||
<u-button type="primary" :shape="shape" size="large" @click="emits('confirm')">{{ confirmText }}</u-button>
|
<u-button type="primary" :color="confirmColor" :shape="shape" size="large" @click="emits('confirm')">{{ confirmText }}</u-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn" v-if="showCancel">
|
<div class="btn" v-if="showCancel">
|
||||||
<u-button :shape="shape" size="large" @click="emits('cancel')">取消</u-button>
|
<u-button :shape="shape" size="large" @click="emits('cancel')">取消</u-button>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, nextTick, getCurrentInstance, computed } from 'vue';
|
import { ref, onMounted, nextTick, getCurrentInstance, computed } from 'vue';
|
||||||
import { isMainShop } from '@/store/account.js';
|
// import { isMainShop } from '@/store/account.js';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
type: {
|
type: {
|
||||||
@@ -28,6 +28,10 @@ const props = defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
default: '保存'
|
default: '保存'
|
||||||
},
|
},
|
||||||
|
confirmColor: {
|
||||||
|
type: String,
|
||||||
|
default: '#3C9CFF'
|
||||||
|
},
|
||||||
showCancel: {
|
showCancel: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
@@ -37,12 +41,13 @@ const props = defineProps({
|
|||||||
default: 'circle' // squre circle
|
default: 'circle' // squre circle
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const isShow = computed(() => {
|
|
||||||
if (props.isOpenPermission) {
|
// const isShow = computed(() => {
|
||||||
return isMainShop();
|
// if (props.isOpenPermission) {
|
||||||
}
|
// return isMainShop();
|
||||||
return true;
|
// }
|
||||||
});
|
// return true;
|
||||||
|
// });
|
||||||
|
|
||||||
const numValue = computed(() => {
|
const numValue = computed(() => {
|
||||||
let num = 0;
|
let num = 0;
|
||||||
|
|||||||
@@ -1,89 +1,89 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="upload-file" @click="chooseImage">
|
<view class="upload-file" @click="chooseImage">
|
||||||
<slot v-if="$slots.default"></slot>
|
<slot v-if="$slots.default"></slot>
|
||||||
<view class="icon" v-if="!modelValue"> + </view>
|
<view class="icon" v-if="!modelValue">+</view>
|
||||||
<image class="img" v-else :src="modelValue"></image>
|
<image class="img" v-else :src="modelValue"></image>
|
||||||
|
|
||||||
<view class="close" @click.stop="()=>{}" v-if="modelValue">
|
<view class="close" @click.stop="() => {}" v-if="modelValue">
|
||||||
<up-icon name="close-circle" color="#333" size="14" @click="clearImg" ></up-icon>
|
<up-icon name="close-circle" color="#333" size="14" @click="clearImg"></up-icon>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { uploadFile } from "@/http/api/index.js";
|
import { uploadFile } from '@/http/api/index.js';
|
||||||
|
|
||||||
import { reactive, ref, watch } from "vue";
|
import { reactive, ref, watch } from 'vue';
|
||||||
|
|
||||||
const modelValue = defineModel({
|
const modelValue = defineModel({
|
||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
function chooseImage() {
|
function chooseImage() {
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1, //默认9
|
count: 1, //默认9
|
||||||
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||||
sourceType: ["album", "camera "],
|
sourceType: ['album', 'camera'],
|
||||||
success: async function (res) {
|
success: async function (res) {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: "上传中",
|
title: '上传中'
|
||||||
});
|
});
|
||||||
console.log(res);
|
console.log(res);
|
||||||
const fileRes = await uploadFile(res.tempFiles[0]);
|
const fileRes = await uploadFile(res.tempFiles[0]);
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
if (fileRes) {
|
if (fileRes) {
|
||||||
modelValue.value = fileRes;
|
modelValue.value = fileRes;
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "上传失败",
|
title: '上传失败',
|
||||||
icon: "none",
|
icon: 'none'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearImg(){
|
function clearImg() {
|
||||||
modelValue.value=""
|
modelValue.value = '';
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.upload-file {
|
.upload-file {
|
||||||
$size: 128rpx;
|
$size: 128rpx;
|
||||||
width: $size;
|
width: $size;
|
||||||
height: $size;
|
height: $size;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border: 1px dashed #d9d9d9;
|
border: 1px dashed #d9d9d9;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
position: relative;
|
position: relative;
|
||||||
.close{
|
.close {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: -10rpx;
|
right: -10rpx;
|
||||||
top: -10rpx;
|
top: -10rpx;
|
||||||
}
|
}
|
||||||
.img {
|
.img {
|
||||||
width: $size;
|
width: $size;
|
||||||
height: $size;
|
height: $size;
|
||||||
}
|
}
|
||||||
.icon {
|
.icon {
|
||||||
width: 36rpx;
|
width: 36rpx;
|
||||||
height: 36rpx;
|
height: 36rpx;
|
||||||
border: 4rpx solid #999;
|
border: 4rpx solid #999;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #999;
|
color: #999;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const request = http.request
|
|||||||
* 获取商品分页
|
* 获取商品分页
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function getProductPage(data, urlType = 'product' ,showLoading) {
|
export function getProductPage(data, urlType = 'product', showLoading) {
|
||||||
return request({
|
return request({
|
||||||
url: `${urlType}/admin/product/page`,
|
url: `${urlType}/admin/product/page`,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -20,7 +20,7 @@ export function getProductPage(data, urlType = 'product' ,showLoading) {
|
|||||||
* 获取商品列表
|
* 获取商品列表
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function getProductList(data, urlType = 'product' ,showLoading) {
|
export function getProductList(data, urlType = 'product', showLoading) {
|
||||||
return request({
|
return request({
|
||||||
url: `${urlType}/admin/product/list`,
|
url: `${urlType}/admin/product/list`,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -36,11 +36,11 @@ export function getProductList(data, urlType = 'product' ,showLoading) {
|
|||||||
* 获取商品详情
|
* 获取商品详情
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function getProductDetail (id, urlType = 'product') {
|
export function getProductDetail(id, urlType = 'product') {
|
||||||
return request({
|
return request({
|
||||||
url: `${urlType}/admin/product/${id}`,
|
url: `${urlType}/admin/product/${id}`,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ export function delProduct(id, urlType = 'product') {
|
|||||||
* 商品上下架
|
* 商品上下架
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function productOnOff (data, urlType = 'product') {
|
export function productOnOff(data, urlType = 'product') {
|
||||||
return request({
|
return request({
|
||||||
url: `${urlType}/admin/product/onOff`,
|
url: `${urlType}/admin/product/onOff`,
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -87,7 +87,7 @@ export function productOnOff (data, urlType = 'product') {
|
|||||||
* 商品售罄
|
* 商品售罄
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function productMarkIsSoldOut (data, urlType = 'product') {
|
export function productMarkIsSoldOut(data, urlType = 'product') {
|
||||||
return request({
|
return request({
|
||||||
url: `${urlType}/admin/product/markIsSoldOut`,
|
url: `${urlType}/admin/product/markIsSoldOut`,
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -262,7 +262,7 @@ export function delSpec(id, urlType = 'product') {
|
|||||||
return request({
|
return request({
|
||||||
url: `${urlType}/admin/prod/spec/${id}`,
|
url: `${urlType}/admin/prod/spec/${id}`,
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,4 +343,28 @@ export function delProdGroup(id, urlType = 'product') {
|
|||||||
url: `${urlType}/admin/prod/group/${id}`,
|
url: `${urlType}/admin/prod/group/${id}`,
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库单识别
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function stockOcr(data, urlType = 'product') {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/product/stock/ocr`,
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ocr识别结果
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function ocrResult(data, urlType = 'product') {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/product/stock/ocrResult`,
|
||||||
|
method: "get",
|
||||||
|
data
|
||||||
|
})
|
||||||
}
|
}
|
||||||
@@ -15,6 +15,18 @@ export function getVendorPage(data, urlType = 'product') {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取供应商列表/无分页
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getVendorList(urlType = 'product') {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/product/vendor/list`,
|
||||||
|
method: "GET"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加供应商
|
* 添加供应商
|
||||||
* @returns
|
* @returns
|
||||||
@@ -52,5 +64,4 @@ export function delVendor(id, urlType = 'product') {
|
|||||||
url: `${urlType}/admin/product/vendor/${id}`,
|
url: `${urlType}/admin/product/vendor/${id}`,
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,6 +122,17 @@ export function checkout(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团商品:拼团商品详情
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function wareDetail(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ware/ware/detail`,
|
||||||
|
method: "get",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 套餐推广:添加套餐
|
* 套餐推广:添加套餐
|
||||||
@@ -274,4 +285,19 @@ export function packageCheckout(data) {
|
|||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:获取套餐详情
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageDetail(data) {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package/detail/${data.id}`,
|
||||||
|
method: 'GET',
|
||||||
|
data: {
|
||||||
|
shopId: data.shopId
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
773
pageConsumables/batch_in.vue
Normal file
773
pageConsumables/batch_in.vue
Normal file
@@ -0,0 +1,773 @@
|
|||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<u-form ref="formRef" :model="form" :rules="rules" label-position="top">
|
||||||
|
<view class="card">
|
||||||
|
<u-form-item>
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">第一步:上传图片</text>
|
||||||
|
<view class="btn">
|
||||||
|
<u-button type="primary" :disabled="!img" shape="circle" text="开始解析" @click="startCheckOcrRes"></u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<my-upload-img v-model="img"></my-upload-img>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
</view>
|
||||||
|
<view class="card" v-if="form.bodyList">
|
||||||
|
<u-form-item>
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">第二步:编辑信息</text>
|
||||||
|
</view>
|
||||||
|
<view class="top" style="margin-top: 10px">
|
||||||
|
<text class="t">供应商信息</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view style="flex: 1">
|
||||||
|
<selectVendor v-model="form.vendorId" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item>
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">耗材信息</text>
|
||||||
|
<view class="btn">
|
||||||
|
<u-button type="primary" shape="circle" text="选择耗材" @click="openSelectCons" v-if="!stockInStatus"></u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view class="list-wrap">
|
||||||
|
<view class="top-tips">
|
||||||
|
<text class="tb">共{{ form.bodyList.length }}种耗材,</text>
|
||||||
|
<text class="tb">
|
||||||
|
金额合计:¥{{
|
||||||
|
multiplyAndFormat(
|
||||||
|
form.bodyList.reduce((sum, item) => sum + (item.purchasePrice || 0) * (item.inOutNumber || 0), 0),
|
||||||
|
1
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
<view class="item" v-for="(item, index) in form.bodyList" :key="index">
|
||||||
|
<view class="name">
|
||||||
|
<text class="t">{{ item.conName }}</text>
|
||||||
|
<view class="error-text" v-if="stockInStatus">
|
||||||
|
<u-text type="success" v-if="item.conId" text="入库成功" size="12"></u-text>
|
||||||
|
<u-text v-else type="error" :text="`入库失败:${item.failReason}`" size="12"></u-text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="content">
|
||||||
|
<view class="ctt-item">
|
||||||
|
<text class="t1">单价</text>
|
||||||
|
<text class="t2">{{ item.purchasePrice }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="ctt-item">
|
||||||
|
<text class="t1">单位</text>
|
||||||
|
<text class="t2">{{ item.unitName }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="ctt-item">
|
||||||
|
<text class="t1">数量</text>
|
||||||
|
<text class="t2">{{ item.inOutNumber }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="ctt-item">
|
||||||
|
<text class="t1">小计</text>
|
||||||
|
<text class="t2">{{ multiplyAndFormat(item.purchasePrice || 0, item.inOutNumber || 0) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="footer-btn-wrap">
|
||||||
|
<view>
|
||||||
|
<u-text type="primary" text="编辑" @click="editorFormHandle(item, index)"></u-text>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<u-text type="error" text="删除" @click="form.bodyList.splice(index, 1)"></u-text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item>
|
||||||
|
<view class="result_wrap" v-if="stockInStatus">
|
||||||
|
上传完成 共{{ form.bodyList.length }}条数据,其中成功
|
||||||
|
<u-text type="success" :text="form.bodyList.filter((item) => item.conId).length"></u-text>
|
||||||
|
条,失败
|
||||||
|
<u-text type="error" :text="form.bodyList.filter((item) => !item.conId).length"></u-text>
|
||||||
|
条
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
</view>
|
||||||
|
</u-form>
|
||||||
|
<u-popup :show="showEditorPopup" round="20" closeable @close="showEditorPopup = false">
|
||||||
|
<view class="editor-popup" v-if="form.bodyList && form.bodyList.length">
|
||||||
|
<view class="title">
|
||||||
|
<text class="t">{{ form.bodyList[editorIndex].conName }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="form">
|
||||||
|
<u-form ref="editorFormRef" :model="editorForm" :rules="editorFormRules" label-width="60px">
|
||||||
|
<u-form-item label="名称" prop="conName" required>
|
||||||
|
<u-input v-model="editorForm.conName" :maxlength="50" placeholder="请输入耗材名称"></u-input>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="单价" prop="purchasePrice" required>
|
||||||
|
<u-input
|
||||||
|
v-model="editorForm.purchasePrice"
|
||||||
|
placeholder="请输入耗材单价"
|
||||||
|
:maxlength="8"
|
||||||
|
@change="
|
||||||
|
(e) =>
|
||||||
|
mySetTimeout(() => {
|
||||||
|
editorForm.purchasePrice = filterNumberInput(e);
|
||||||
|
}, 50)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<template #suffix>
|
||||||
|
<text>元</text>
|
||||||
|
</template>
|
||||||
|
</u-input>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="单位" prop="unitName" required>
|
||||||
|
<u-input v-model="editorForm.unitName" :maxlength="20" placeholder="请选择耗材单位"></u-input>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="数量" prop="inOutNumber" required>
|
||||||
|
<u-input
|
||||||
|
v-model="editorForm.inOutNumber"
|
||||||
|
placeholder="请输入耗材数量"
|
||||||
|
:maxlength="8"
|
||||||
|
@change="
|
||||||
|
(e) =>
|
||||||
|
mySetTimeout(() => {
|
||||||
|
editorForm.inOutNumber = filterNumberInput(e, 1);
|
||||||
|
}, 50)
|
||||||
|
"
|
||||||
|
></u-input>
|
||||||
|
</u-form-item>
|
||||||
|
</u-form>
|
||||||
|
</view>
|
||||||
|
<view class="footer">
|
||||||
|
<view class="btn">
|
||||||
|
<u-button style="width: 100%" shape="circle" @click="showEditorPopup = false">取消</u-button>
|
||||||
|
</view>
|
||||||
|
<view class="btn">
|
||||||
|
<u-button type="primary" style="width: 100%" shape="circle" @click="editorFormSubmitHandle">确认</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
<my-footer-btn type="horizontal" showCancel @confirm="submitHandle" @cancel="backHandle"></my-footer-btn>
|
||||||
|
<!-- 选择耗材 -->
|
||||||
|
<selectCons ref="selectConsRef" @success="selectConsSuccess" />
|
||||||
|
<view class="loading-page" v-if="checkLoading">
|
||||||
|
<view class="loader"></view>
|
||||||
|
<text class="t">{{ loadingText }}</text>
|
||||||
|
<view class="btn">
|
||||||
|
<u-button type="primary" @click="closeCheckOcrHandle">取消查询</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import _ from 'lodash';
|
||||||
|
import { ref, computed } from 'vue';
|
||||||
|
import { multiplyAndFormat, filterNumberInput } from '@/utils/index.js';
|
||||||
|
import { stockOcr, ocrResult } from '@/http/api/product.js';
|
||||||
|
import { consStockIn } from '@/http/api/cons.js';
|
||||||
|
import selectVendor from './components/select-vendor.vue';
|
||||||
|
import selectCons from './components/select-cons.vue';
|
||||||
|
|
||||||
|
const selectConsRef = ref(null);
|
||||||
|
function selectConsSuccess(e) {
|
||||||
|
console.log('selectVendorHandle===', e);
|
||||||
|
let arr = e.map((item) => ({
|
||||||
|
id: item.id,
|
||||||
|
conId: item.id,
|
||||||
|
conName: item.conName,
|
||||||
|
purchasePrice: item.price,
|
||||||
|
unitName: item.conUnit,
|
||||||
|
inOutNumber: 1
|
||||||
|
}));
|
||||||
|
form.value.bodyList.push(...arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
function openSelectCons() {
|
||||||
|
const comp = selectConsRef.value;
|
||||||
|
if (comp && typeof comp.show === 'function') {
|
||||||
|
comp.show();
|
||||||
|
} else {
|
||||||
|
console.warn('selectConsRef not ready or show() not available', comp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 封装全局定时器,适配多端
|
||||||
|
const mySetTimeout = (fn, delay) => {
|
||||||
|
if (typeof uni !== 'undefined') {
|
||||||
|
return setTimeout(fn, delay); // 小程序
|
||||||
|
} else {
|
||||||
|
return window.setTimeout(fn, delay); // H5
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 编辑耗材 start
|
||||||
|
const showEditorPopup = ref(false);
|
||||||
|
const editorFormRef = ref(null);
|
||||||
|
const editorIndex = ref(0);
|
||||||
|
const editorForm = ref({
|
||||||
|
conName: '',
|
||||||
|
purchasePrice: '',
|
||||||
|
unitName: '',
|
||||||
|
inOutNumber: ''
|
||||||
|
});
|
||||||
|
const editorFormRules = ref({
|
||||||
|
conName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (editorForm.value.conName === '') {
|
||||||
|
return callback(new Error('请输入耗材名称'));
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
purchasePrice: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (editorForm.value.purchasePrice === '') {
|
||||||
|
return callback(new Error('请输入耗材单价'));
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
unitName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (editorForm.value.unitName === '') {
|
||||||
|
return callback(new Error('请选择耗材单位'));
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
inOutNumber: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (editorForm.value.inOutNumber === '') {
|
||||||
|
return callback(new Error('请输入耗材数量'));
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
// 显示编辑
|
||||||
|
function editorFormHandle(item, index) {
|
||||||
|
editorForm.value = _.cloneDeep(item);
|
||||||
|
editorIndex.value = index;
|
||||||
|
showEditorPopup.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function editorFormSubmitHandle() {
|
||||||
|
editorFormRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
form.value.bodyList[editorIndex.value] = _.cloneDeep(editorForm.value);
|
||||||
|
showEditorPopup.value = false;
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
// 编辑耗材 end
|
||||||
|
|
||||||
|
const resId = ref(null);
|
||||||
|
const img = ref('');
|
||||||
|
const stockInStatus = ref(false);
|
||||||
|
const form = ref({});
|
||||||
|
// const form = ref({
|
||||||
|
// actualPaymentAmount: null,
|
||||||
|
// amountPayable: 1680,
|
||||||
|
// batchNo: 'XS25110410003',
|
||||||
|
// bodyList: [
|
||||||
|
// { conId: '', conName: '哈根达斯-小杯(草莓)', failReason: '', inOutNumber: 24, purchasePrice: 35, subTotal: 840, unitName: '杯' },
|
||||||
|
// { conId: '', conName: '哈根达斯-小杯(香草)', failReason: '', inOutNumber: 24, purchasePrice: 35, subTotal: 840, unitName: '杯' },
|
||||||
|
// { conId: '', conName: '哈根达斯-小杯(比利时巧克力)', failReason: '', inOutNumber: 12, purchasePrice: 0, subTotal: 0, unitName: '杯' },
|
||||||
|
// { conId: '', conName: '哈根达斯-小杯(夏威夷果仁)', failReason: '', inOutNumber: 12, purchasePrice: 0, subTotal: 0, unitName: '杯' }
|
||||||
|
// ],
|
||||||
|
// inOutDate: '2025-11-04',
|
||||||
|
// ocrSaleOrder: {
|
||||||
|
// customerName: '大客河景餐厅',
|
||||||
|
// date: '2025-11-04',
|
||||||
|
// documentType: '销售单',
|
||||||
|
// items: [
|
||||||
|
// { conName: '哈根达斯-小杯(草莓)', inOutNumber: '24', purchasePrice: '35', spec: '81g', subTotal: '840', unitName: '杯' },
|
||||||
|
// { conName: '哈根达斯-小杯(香草)', inOutNumber: '24', purchasePrice: '35', spec: '81g', subTotal: '840', unitName: '杯' },
|
||||||
|
// { conName: '哈根达斯-小杯(比利时巧克力)', inOutNumber: '12', purchasePrice: '0', spec: '81g', subTotal: '0', unitName: '杯' },
|
||||||
|
// { conName: '哈根达斯-小杯(夏威夷果仁)', inOutNumber: '12', purchasePrice: '0', spec: '81g', subTotal: '0', unitName: '杯' }
|
||||||
|
// ],
|
||||||
|
// operator: '陈钦楠',
|
||||||
|
// orderNumber: 'XS25110410003',
|
||||||
|
// remark: '',
|
||||||
|
// totalAmount: '1680'
|
||||||
|
// },
|
||||||
|
// paymentDate: null,
|
||||||
|
// remark: '',
|
||||||
|
// unInCons: [],
|
||||||
|
// vendorId: null
|
||||||
|
// });
|
||||||
|
|
||||||
|
const rules = ref({});
|
||||||
|
|
||||||
|
// 查询OCR结果
|
||||||
|
async function startCheckOcrRes() {
|
||||||
|
try {
|
||||||
|
resId.value = await stockOcr({ url: img.value });
|
||||||
|
stockInStatus.value = false;
|
||||||
|
startQueryInterval()
|
||||||
|
.then((res) => {
|
||||||
|
// console.log('查询成功', JSON.stringify(res));
|
||||||
|
form.value = res;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('查询失败', error);
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开始查询ocr结果
|
||||||
|
// 启动查询方法,每5秒查询一次,五分钟后超时停止查询
|
||||||
|
const checkLoading = ref(false);
|
||||||
|
const speed = 10000; // 查询间隔时间,单位毫秒
|
||||||
|
const timeout = 300000; // 超时时间,单位毫秒
|
||||||
|
// const timeout = 15000; // 超时时间,单位毫秒
|
||||||
|
const interval = ref(null);
|
||||||
|
const checkNumber = ref(0);
|
||||||
|
const loadingText = computed(() => `每${speed / 1000}秒查询1次,已查询:${checkNumber.value}次`);
|
||||||
|
function startQueryInterval() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (!resId.value) {
|
||||||
|
reject(new Error('无效的 resId,无法查询'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置计数并显示 loading
|
||||||
|
checkNumber.value = 0;
|
||||||
|
checkLoading.value = true;
|
||||||
|
|
||||||
|
const startTime = Date.now();
|
||||||
|
interval.value = null;
|
||||||
|
|
||||||
|
async function checkOnce() {
|
||||||
|
try {
|
||||||
|
checkNumber.value++;
|
||||||
|
console.log('ocr checkNumber:', checkNumber.value);
|
||||||
|
checkLoading.value = true;
|
||||||
|
const res = await ocrResult({ id: resId.value });
|
||||||
|
if (res && res.batchNo) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '查询成功',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
checkLoading.value = false;
|
||||||
|
}, 1000);
|
||||||
|
clearInterval(interval.value);
|
||||||
|
resolve(res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果还未超时,则继续等待下一轮查询
|
||||||
|
if (Date.now() - startTime >= timeout) {
|
||||||
|
setTimeout(() => {
|
||||||
|
checkLoading.value = false;
|
||||||
|
}, 1000);
|
||||||
|
uni.showToast({
|
||||||
|
title: '查询超时',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
clearInterval(interval.value);
|
||||||
|
reject(new Error('查询超时'));
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '查询失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
checkLoading.value = false;
|
||||||
|
}, 1000);
|
||||||
|
clearInterval(interval.value);
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 立即执行一次查询,然后按间隔继续查询
|
||||||
|
checkOnce();
|
||||||
|
interval.value = setInterval(checkOnce, speed);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消查询
|
||||||
|
function closeCheckOcrHandle() {
|
||||||
|
checkLoading.value = false;
|
||||||
|
clearInterval(interval.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交批量入库
|
||||||
|
async function submitHandle() {
|
||||||
|
try {
|
||||||
|
console.log('submitHandle', form.value);
|
||||||
|
uni.showLoading({
|
||||||
|
title: '提交中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
const res = await consStockIn(form.value);
|
||||||
|
form.value = res;
|
||||||
|
stockInStatus.value = true;
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '提交成功',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
function backHandle() {
|
||||||
|
uni.navigateBack();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
page {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.container {
|
||||||
|
padding: 28upx;
|
||||||
|
}
|
||||||
|
.card {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20px;
|
||||||
|
padding: 28upx;
|
||||||
|
&:not(:last-child) {
|
||||||
|
margin-bottom: 28upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.switch-wrap {
|
||||||
|
flex: 1;
|
||||||
|
width: 100%;
|
||||||
|
.top {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
&.column {
|
||||||
|
align-items: flex-start;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.two {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding-right: 28upx;
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.tips {
|
||||||
|
font-size: 24upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
padding-top: 16upx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16upx;
|
||||||
|
.i {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.ipt {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 24upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.list-wrap {
|
||||||
|
flex: 1;
|
||||||
|
.top-tips {
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.item {
|
||||||
|
margin-top: 28upx;
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
border-radius: 12upx;
|
||||||
|
padding: 20upx;
|
||||||
|
.name {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.error-text {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
display: flex;
|
||||||
|
padding: 28upx 0;
|
||||||
|
|
||||||
|
.ctt-item {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
&:last-child {
|
||||||
|
align-items: flex-end;
|
||||||
|
}
|
||||||
|
.t1 {
|
||||||
|
color: #666;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
.t2 {
|
||||||
|
color: #333;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.footer-btn-wrap {
|
||||||
|
display: flex;
|
||||||
|
gap: 28upx;
|
||||||
|
justify-content: flex-end;
|
||||||
|
.btn {
|
||||||
|
width: 160upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.package-wrap {
|
||||||
|
flex: 1;
|
||||||
|
.list {
|
||||||
|
.item {
|
||||||
|
border: 1px solid #ececec;
|
||||||
|
border-radius: 12upx;
|
||||||
|
padding: 20upx;
|
||||||
|
&:not(:first-child) {
|
||||||
|
margin-top: 28upx;
|
||||||
|
}
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding-bottom: 20upx;
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.del {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.input-wrap {
|
||||||
|
display: flex;
|
||||||
|
gap: 20upx;
|
||||||
|
padding-bottom: 20upx;
|
||||||
|
.btn {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12upx;
|
||||||
|
.t {
|
||||||
|
color: #318afe;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.table-wrap {
|
||||||
|
padding-bottom: 20upx;
|
||||||
|
margin-bottom: 20upx;
|
||||||
|
.tab-head {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
.tr {
|
||||||
|
display: flex;
|
||||||
|
gap: 12upx;
|
||||||
|
padding: 20upx;
|
||||||
|
border-bottom: 1px solid #ececec;
|
||||||
|
.td {
|
||||||
|
flex: 1;
|
||||||
|
&:nth-child(1) {
|
||||||
|
flex: 2;
|
||||||
|
}
|
||||||
|
&:last-child {
|
||||||
|
flex: 0.5;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.del {
|
||||||
|
color: red;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.select_num_wrap {
|
||||||
|
padding-bottom: 28upx;
|
||||||
|
.label {
|
||||||
|
padding-bottom: 20upx;
|
||||||
|
.t {
|
||||||
|
color: #333;
|
||||||
|
font-size: 32upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.package-wrap-btn {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
padding-top: 28upx;
|
||||||
|
.btn {
|
||||||
|
display: flex;
|
||||||
|
gap: 8upx;
|
||||||
|
align-items: center;
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #318afe;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.step-wrap {
|
||||||
|
flex: 1;
|
||||||
|
.table-wrap {
|
||||||
|
padding-bottom: 20upx;
|
||||||
|
margin-bottom: 20upx;
|
||||||
|
.tab-head {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
.tr {
|
||||||
|
display: flex;
|
||||||
|
gap: 12upx;
|
||||||
|
padding: 20upx;
|
||||||
|
border-bottom: 1px solid #ececec;
|
||||||
|
.td {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
gap: 20upx;
|
||||||
|
align-items: center;
|
||||||
|
&:last-child {
|
||||||
|
flex: 0.6;
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.edit {
|
||||||
|
color: #318afe;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
.del {
|
||||||
|
color: red;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.editor-popup {
|
||||||
|
padding: 0 28upx;
|
||||||
|
.title {
|
||||||
|
padding: 28upx 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
.t {
|
||||||
|
font-size: 32upx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.form {
|
||||||
|
padding: 28upx;
|
||||||
|
}
|
||||||
|
.footer {
|
||||||
|
display: flex;
|
||||||
|
gap: 28upx;
|
||||||
|
.btn {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.result_wrap {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
.loading-page {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
gap: 20upx;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: #fff;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 999;
|
||||||
|
padding-bottom: 10vh;
|
||||||
|
.loader {
|
||||||
|
width: 50px;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: radial-gradient(farthest-side, #ffa516 94%, #0000) top/8px 8px no-repeat, conic-gradient(#0000 30%, #ffa516);
|
||||||
|
-webkit-mask: radial-gradient(farthest-side, #0000 calc(100% - 8px), #000 0);
|
||||||
|
animation: l13 1s infinite linear;
|
||||||
|
}
|
||||||
|
@keyframes l13 {
|
||||||
|
100% {
|
||||||
|
transform: rotate(1turn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.btn {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 10%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
52
pageConsumables/components/select-cons.vue
Normal file
52
pageConsumables/components/select-cons.vue
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<template>
|
||||||
|
<u-picker
|
||||||
|
title="选择耗材"
|
||||||
|
:show="visable"
|
||||||
|
:columns="columns"
|
||||||
|
keyName="conName"
|
||||||
|
@close="visable = false"
|
||||||
|
closeOnClickOverlay
|
||||||
|
@cancel="visable = false"
|
||||||
|
@confirm="confirmHandle"
|
||||||
|
></u-picker>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted } from 'vue';
|
||||||
|
import { getConsList } from '@/http/api/cons.js';
|
||||||
|
|
||||||
|
const visable = ref(false);
|
||||||
|
|
||||||
|
const columns = ref([]);
|
||||||
|
|
||||||
|
const emits = defineEmits(['success']);
|
||||||
|
|
||||||
|
function confirmHandle(e) {
|
||||||
|
emits('success', e.value);
|
||||||
|
visable.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取耗材列表
|
||||||
|
async function getConsListAjax() {
|
||||||
|
try {
|
||||||
|
const res = await getConsList();
|
||||||
|
columns.value = [res];
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function show() {
|
||||||
|
visable.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
show
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getConsListAjax();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
||||||
56
pageConsumables/components/select-vendor.vue
Normal file
56
pageConsumables/components/select-vendor.vue
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<!-- 选择供应商 -->
|
||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<view @click="show = true">
|
||||||
|
<u-input v-model="vendorName" readonly suffixIcon="arrow-down" placeholder="请选择供应商"></u-input>
|
||||||
|
</view>
|
||||||
|
<u-picker
|
||||||
|
title="选择供应商"
|
||||||
|
:show="show"
|
||||||
|
:columns="columns"
|
||||||
|
keyName="name"
|
||||||
|
@close="show = false"
|
||||||
|
closeOnClickOverlay
|
||||||
|
@cancel="show = false"
|
||||||
|
@confirm="confirmHandle"
|
||||||
|
></u-picker>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted } from 'vue';
|
||||||
|
import { getVendorList } from '@/http/api/vendor.js';
|
||||||
|
|
||||||
|
const vendorName = ref('');
|
||||||
|
|
||||||
|
const vendorId = defineModel({
|
||||||
|
type: [String, Number],
|
||||||
|
default: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
const show = ref(false);
|
||||||
|
const columns = ref([]);
|
||||||
|
|
||||||
|
function confirmHandle(e) {
|
||||||
|
let data = e.value[0];
|
||||||
|
vendorId.value = data.id;
|
||||||
|
vendorName.value = data.name;
|
||||||
|
show.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取供应商列表
|
||||||
|
async function getVendorListAjax() {
|
||||||
|
try {
|
||||||
|
const res = await getVendorList();
|
||||||
|
columns.value = [res];
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getVendorListAjax();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
||||||
@@ -1,453 +1,479 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="ConsumablesTop">
|
<view class="ConsumablesTop">
|
||||||
<view @tap="pageData.show = !pageData.show" style="display: flex;align-items: center;">
|
<view @tap="pageData.show = !pageData.show" style="display: flex; align-items: center">
|
||||||
{{pageData.title}}<up-icon name="arrow-down" size="12"></up-icon>
|
{{ pageData.title }}
|
||||||
|
<up-icon name="arrow-down" size="12"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<input v-model="pageData.query.conName" @input="inputEvent" type="text" placeholder="请输入耗材名称" />
|
<input v-model="pageData.query.conName" @input="inputEvent" type="text" placeholder="请输入耗材名称" />
|
||||||
</view>
|
</view>
|
||||||
<view @tap="toUrl('PAGES_ADD_TYPE') ">
|
<view @tap="toUrl('PAGES_ADD_TYPE')">新增类别</view>
|
||||||
新增类别
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="ConsumablesConent" v-if="pageData.list.length">
|
<view class="ConsumablesConent" v-if="pageData.list.length">
|
||||||
<view v-for="(item,index) in pageData.list" :key="index">
|
<view v-for="(item, index) in pageData.list" :key="index">
|
||||||
<view> {{item.conName}}
|
<view>
|
||||||
<view> {{item.consGroupName}} </view>
|
{{ item.conName }}
|
||||||
|
<view>{{ item.consGroupName }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view>
|
<view>
|
||||||
<view style="color: #333333;"> {{item.conUnit}} </view>
|
<view style="color: #333333">{{ item.conUnit }}</view>
|
||||||
<view> 耗材单位 </view>
|
<view>耗材单位</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view style="color: #318AFE;"> {{item.stockNumber}} </view>
|
<view style="color: #318afe">{{ item.stockNumber }}</view>
|
||||||
<view> 剩余库存 </view>
|
<view>剩余库存</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view style="background-color: #fff;" @tap="show=true;showData = filtersSproductId(item.productList)">
|
<view
|
||||||
|
style="background-color: #fff"
|
||||||
|
@tap="
|
||||||
|
show = true;
|
||||||
|
showData = filtersSproductId(item.productList);
|
||||||
|
"
|
||||||
|
>
|
||||||
所属商品:
|
所属商品:
|
||||||
{{ filtersSproductId(item.productList).length>7?filtersSproductId(item.productList).substring(0,6)+'...':filtersSproductId(item.productList)}}
|
{{ filtersSproductId(item.productList).length > 7 ? filtersSproductId(item.productList).substring(0, 6) + '...' : filtersSproductId(item.productList) }}
|
||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
<up-button shape="circle" type="primary" size="mini" color="#999"
|
<up-button
|
||||||
@tap="toUrl('PAGES_VIEWRECORDS',{item:JSON.stringify(item)})" :plain="true"
|
shape="circle"
|
||||||
text="查看记录"></up-button>
|
type="primary"
|
||||||
<up-button type="primary" shape="circle" size="mini" @click="toggle(item)" :plain="true"
|
size="mini"
|
||||||
text="更多操作"></up-button>
|
color="#999"
|
||||||
|
@tap="toUrl('PAGES_VIEWRECORDS', { item: JSON.stringify(item) })"
|
||||||
|
:plain="true"
|
||||||
|
text="查看记录"
|
||||||
|
></up-button>
|
||||||
|
|
||||||
|
<up-button type="primary" shape="circle" size="mini" @click="toggle(item)" :plain="true" text="更多操作"></up-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view style="background-color: rgba(0,0,0,0); height: 200rpx;"></view>
|
<view style="background-color: rgba(0, 0, 0, 0); height: 200rpx"></view>
|
||||||
</view>
|
</view>
|
||||||
<view v-else style="text-align: center;">
|
<view v-else style="text-align: center">
|
||||||
<image src="./bg.png" style="width: 325rpx;height: 335rpx;" mode=""></image>
|
<image src="./bg.png" style="width: 325rpx; height: 335rpx" mode=""></image>
|
||||||
<view style="font-size: 28rpx;color: #999;">暂无数据</view>
|
<view style="font-size: 28rpx; color: #999">暂无数据</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="ConsumablesBottom">
|
<view class="ConsumablesBottom">
|
||||||
<view @tap="toUrl('PAGES_ADD_CONSUMABLES')"> 新增耗材 </view>
|
<view @tap="toUrl('PAGES_ADD_CONSUMABLES')">新增耗材</view>
|
||||||
<view @tap="toUrl('PAGES_SUPPLIER')"> 供应商管理 </view>
|
<view @tap="toUrl('PAGES_SUPPLIER')">供应商管理</view>
|
||||||
</view>
|
</view>
|
||||||
<my-reportDamage ref="reportDamage" title="耗材报损" :item="report.data" @affirm="affirm"></my-reportDamage>
|
<my-reportDamage ref="reportDamage" title="耗材报损" :item="report.data" @affirm="affirm"></my-reportDamage>
|
||||||
|
<up-popup :show="show" :round="18" mode="center">
|
||||||
<up-popup :show="show" :round="18" mode="center" >
|
|
||||||
<view class="zhezhaopop">
|
<view class="zhezhaopop">
|
||||||
<view class="">
|
<view class="">
|
||||||
<span></span>
|
<span></span>
|
||||||
<span></span>
|
<span></span>
|
||||||
<up-icon @tap="show=false" name="close-circle-fill"></up-icon>
|
<up-icon @tap="show = false" name="close-circle-fill"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
{{showData}}
|
{{ showData }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</up-popup>
|
</up-popup>
|
||||||
<up-action-sheet :round="10" @select="actionSelect" @close="actions.show = false" cancelText="取消" :actions="actions.list"
|
<up-action-sheet :round="10" @select="actionSelect" @close="actions.show = false" cancelText="取消" :actions="actions.list" :show="actions.show"></up-action-sheet>
|
||||||
:show="actions.show"></up-action-sheet>
|
<up-picker :show="pageData.show" :columns="pageData.typeList" keyName="name" @cancel="pageData.show = false" @confirm="confirmConsGroup"></up-picker>
|
||||||
<up-picker :show="pageData.show" :columns="pageData.typeList" keyName="name" @cancel="pageData.show=false" @confirm="confirmConsGroup" ></up-picker>
|
<!-- 批量入库悬浮按钮 -->
|
||||||
|
<view class="fixed-in-btn" @click="toBatchPage">
|
||||||
|
<image class="img" src="https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/bd8cde310fc247f6855ad39fbda4d75d.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onShow, onLoad } from '@dcloudio/uni-app'
|
import { onShow, onLoad } from '@dcloudio/uni-app';
|
||||||
import { ref, reactive, computed } from 'vue';
|
import { ref, reactive, computed } from 'vue';
|
||||||
import myReportDamage from './components/my-reportDamage';
|
import myReportDamage from './components/my-reportDamage';
|
||||||
|
|
||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
import { hasPermission } from '@/commons/utils/hasPermission.js';
|
import { hasPermission } from '@/commons/utils/hasPermission.js';
|
||||||
import { getConsPage,getConsGrpupList } from '@/http/api/cons.js';
|
import { getConsPage, getConsGrpupList } from '@/http/api/cons.js';
|
||||||
|
|
||||||
let reportDamage = ref(null)
|
|
||||||
let show = ref(false)
|
|
||||||
let showData = ref()
|
|
||||||
const report = reactive({
|
|
||||||
data: {
|
|
||||||
name: "美式咖啡",
|
|
||||||
unit: "杯",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
let pageData = reactive({
|
|
||||||
show: false,
|
|
||||||
query: {
|
|
||||||
conName: '',
|
|
||||||
consGroupId: '',
|
|
||||||
size: 100,
|
|
||||||
page: 1
|
|
||||||
},
|
|
||||||
list: [],
|
|
||||||
// 类型列表
|
|
||||||
typeList: [],
|
|
||||||
title: '耗材类型'
|
|
||||||
})
|
|
||||||
|
|
||||||
/**
|
let reportDamage = ref(null);
|
||||||
* 更多操作列表
|
let show = ref(false);
|
||||||
*/
|
let showData = ref();
|
||||||
const actions = reactive({
|
const report = reactive({
|
||||||
list: [
|
data: {
|
||||||
{ name: '报损', color: 'red', fontSize: '16' },
|
name: '美式咖啡',
|
||||||
{ name: '编辑', color: '#333', fontSize: '16' },
|
unit: '杯'
|
||||||
{ name: '清点', color: '#333', fontSize: '16' },
|
}
|
||||||
{ name: '入库', color: '#333', fontSize: '16' },
|
});
|
||||||
{ name: '出库', color: '#333', fontSize: '16' },
|
let pageData = reactive({
|
||||||
],
|
show: false,
|
||||||
data: null,
|
query: {
|
||||||
show: false,
|
conName: '',
|
||||||
})
|
consGroupId: '',
|
||||||
|
size: 100,
|
||||||
|
page: 1
|
||||||
|
},
|
||||||
|
list: [],
|
||||||
|
// 类型列表
|
||||||
|
typeList: [],
|
||||||
|
title: '耗材类型'
|
||||||
|
});
|
||||||
|
|
||||||
onShow(() => {
|
/**
|
||||||
getList()
|
* 更多操作列表
|
||||||
gettbConsTypeList()
|
*/
|
||||||
})
|
const actions = reactive({
|
||||||
|
list: [
|
||||||
|
{ name: '报损', color: 'red', fontSize: '16' },
|
||||||
|
{ name: '编辑', color: '#333', fontSize: '16' },
|
||||||
|
{ name: '清点', color: '#333', fontSize: '16' },
|
||||||
|
{ name: '入库', color: '#333', fontSize: '16' },
|
||||||
|
{ name: '出库', color: '#333', fontSize: '16' }
|
||||||
|
],
|
||||||
|
data: null,
|
||||||
|
show: false
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
onShow(() => {
|
||||||
* 获取耗材列表
|
getList();
|
||||||
*/
|
gettbConsTypeList();
|
||||||
async function getList() {
|
});
|
||||||
getConsPage(pageData.query).then(res => {
|
|
||||||
pageData.list = res.records
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取耗材类别
|
|
||||||
*/
|
|
||||||
let gettbConsTypeList = () => {
|
|
||||||
getConsGrpupList({
|
|
||||||
page: 1,
|
|
||||||
size: 30,
|
|
||||||
}).then(res => {
|
|
||||||
pageData.typeList = [[{name:'全部',id:''},...res]]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function confirmConsGroup(e){
|
|
||||||
pageData.show = false
|
|
||||||
pageData.query.consGroupId = e.value[0].id
|
|
||||||
pageData.title = e.value[0].name
|
|
||||||
getList()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
// 跳转去批量入库
|
||||||
* 报损确认
|
function toBatchPage() {
|
||||||
*/
|
uni.navigateTo({
|
||||||
function affirm() {
|
url: '/pageConsumables/batch_in'
|
||||||
uni.showToast({
|
});
|
||||||
title:'操作成功',
|
}
|
||||||
icon:'none'
|
|
||||||
})
|
|
||||||
getList()
|
|
||||||
// 获取分类列表
|
|
||||||
gettbConsTypeList()
|
|
||||||
}
|
|
||||||
|
|
||||||
let toggle = (d) => {
|
/**
|
||||||
// refMoreSheet.value.open()
|
* 获取耗材列表
|
||||||
actions.show = true;
|
*/
|
||||||
actions.actions = d
|
async function getList() {
|
||||||
report.data.consId = d.id
|
getConsPage(pageData.query).then((res) => {
|
||||||
}
|
pageData.list = res.records;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let actionSelect = ( e ) => {
|
/**
|
||||||
if ( e.name == '报损' ) {
|
* 获取耗材类别
|
||||||
// 权限
|
*/
|
||||||
hasPermission('允许提交报损').then(ele => {
|
let gettbConsTypeList = () => {
|
||||||
if (ele) {
|
getConsGrpupList({
|
||||||
//打开报损弹窗
|
page: 1,
|
||||||
reportDamage.value.open(actions.actions.id);
|
size: 30
|
||||||
report.data.name = actions.actions.conName
|
}).then((res) => {
|
||||||
report.data.unit = actions.actions.conUnit
|
pageData.typeList = [[{ name: '全部', id: '' }, ...res]];
|
||||||
}
|
});
|
||||||
})
|
};
|
||||||
} else if ( e.name == '编辑' ) {
|
|
||||||
toUrl('PAGES_ADD_CONSUMABLES', {
|
|
||||||
item: JSON.stringify(actions.actions)
|
|
||||||
})
|
|
||||||
} else if ( e.name == '清点' ) {
|
|
||||||
hasPermission('允许耗材盘点').then(ele => {
|
|
||||||
if (ele) {
|
|
||||||
toUrl('PAGES_SALES_INVENTORYCHECK', {
|
|
||||||
item: JSON.stringify(actions.actions)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else if ( e.name == '入库' ) {
|
|
||||||
hasPermission('允许耗材入库').then(ele => {
|
|
||||||
if (ele) {
|
|
||||||
toUrl('PAGES_SALES_WAREHOUSEENTRY', {
|
|
||||||
consId: actions.actions.id,
|
|
||||||
item: JSON.stringify(actions.actions)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else if ( e.name == '出库' ) {
|
|
||||||
hasPermission('允许耗材出库').then(ele => {
|
|
||||||
if (ele) {
|
|
||||||
toUrl('PAGES_SALES_OUTBOUND', {
|
|
||||||
consId: actions.actions.id,
|
|
||||||
item: JSON.stringify(actions.actions)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function inputEvent(d) {
|
|
||||||
pageData.query.conName = d.detail.value.replace(/\s*/g, "");
|
|
||||||
getList()
|
|
||||||
}
|
|
||||||
|
|
||||||
function filtersSproductId(d) {
|
function confirmConsGroup(e) {
|
||||||
if (!d) return ''
|
pageData.show = false;
|
||||||
// const dataArr = d.split(',')
|
pageData.query.consGroupId = e.value[0].id;
|
||||||
let str = ''
|
pageData.title = e.value[0].name;
|
||||||
d.forEach(ele => {
|
getList();
|
||||||
// str += ele.name
|
}
|
||||||
// const startIndex = ele.indexOf('_')
|
|
||||||
// const productId = ele.slice(0, startIndex)
|
/**
|
||||||
// const productName = ele.slice(startIndex + 1, ele.length)
|
* 报损确认
|
||||||
str = ele.name + ',' + str
|
*/
|
||||||
})
|
function affirm() {
|
||||||
return str
|
uni.showToast({
|
||||||
}
|
title: '操作成功',
|
||||||
let toUrl = (url, d) => {
|
icon: 'none'
|
||||||
go.to(url, d)
|
});
|
||||||
|
getList();
|
||||||
|
// 获取分类列表
|
||||||
|
gettbConsTypeList();
|
||||||
|
}
|
||||||
|
|
||||||
|
let toggle = (d) => {
|
||||||
|
// refMoreSheet.value.open()
|
||||||
|
actions.show = true;
|
||||||
|
actions.actions = d;
|
||||||
|
report.data.consId = d.id;
|
||||||
|
};
|
||||||
|
|
||||||
|
let actionSelect = (e) => {
|
||||||
|
if (e.name == '报损') {
|
||||||
|
// 权限
|
||||||
|
hasPermission('允许提交报损').then((ele) => {
|
||||||
|
if (ele) {
|
||||||
|
//打开报损弹窗
|
||||||
|
reportDamage.value.open(actions.actions.id);
|
||||||
|
report.data.name = actions.actions.conName;
|
||||||
|
report.data.unit = actions.actions.conUnit;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (e.name == '编辑') {
|
||||||
|
toUrl('PAGES_ADD_CONSUMABLES', {
|
||||||
|
item: JSON.stringify(actions.actions)
|
||||||
|
});
|
||||||
|
} else if (e.name == '清点') {
|
||||||
|
hasPermission('允许耗材盘点').then((ele) => {
|
||||||
|
if (ele) {
|
||||||
|
toUrl('PAGES_SALES_INVENTORYCHECK', {
|
||||||
|
item: JSON.stringify(actions.actions)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (e.name == '入库') {
|
||||||
|
hasPermission('允许耗材入库').then((ele) => {
|
||||||
|
if (ele) {
|
||||||
|
toUrl('PAGES_SALES_WAREHOUSEENTRY', {
|
||||||
|
consId: actions.actions.id,
|
||||||
|
item: JSON.stringify(actions.actions)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (e.name == '出库') {
|
||||||
|
hasPermission('允许耗材出库').then((ele) => {
|
||||||
|
if (ele) {
|
||||||
|
toUrl('PAGES_SALES_OUTBOUND', {
|
||||||
|
consId: actions.actions.id,
|
||||||
|
item: JSON.stringify(actions.actions)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function inputEvent(d) {
|
||||||
|
pageData.query.conName = d.detail.value.replace(/\s*/g, '');
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
function filtersSproductId(d) {
|
||||||
|
if (!d) return '';
|
||||||
|
// const dataArr = d.split(',')
|
||||||
|
let str = '';
|
||||||
|
d.forEach((ele) => {
|
||||||
|
// str += ele.name
|
||||||
|
// const startIndex = ele.indexOf('_')
|
||||||
|
// const productId = ele.slice(0, startIndex)
|
||||||
|
// const productName = ele.slice(startIndex + 1, ele.length)
|
||||||
|
str = ele.name + ',' + str;
|
||||||
|
});
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
let toUrl = (url, d) => {
|
||||||
|
go.to(url, d);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
page {
|
page {
|
||||||
background-color: #f9f9f9;
|
background-color: #f9f9f9;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
ul,
|
ul,
|
||||||
li {
|
li {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ConsumablesTop {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
align-items: center;
|
||||||
|
padding-bottom: 22rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
> view:first-child,
|
||||||
|
> view:last-child {
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ConsumablesTop {
|
> view:last-child {
|
||||||
display: flex;
|
color: #318afe;
|
||||||
justify-content: space-around;
|
}
|
||||||
align-items: center;
|
|
||||||
padding-bottom: 22rpx;
|
|
||||||
background-color: #fff;
|
|
||||||
|
|
||||||
>view:first-child,
|
> view:nth-child(2) {
|
||||||
>view:last-child {
|
width: 414rpx;
|
||||||
font-size: 24rpx;
|
height: 60rpx;
|
||||||
|
line-height: 60rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
background: #f9f9f9;
|
||||||
|
border-radius: 32rpx 32rpx 32rpx 32rpx;
|
||||||
|
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ConsumablesConent {
|
||||||
|
min-height: 80vh;
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
padding-top: 1rpx;
|
||||||
|
|
||||||
|
> view {
|
||||||
|
width: 694rpx;
|
||||||
|
height: 332rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||||
|
padding: 32rpx 16rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 32rpx auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
> view:first-child {
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
font-size: 24rpx;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
}
|
.df;
|
||||||
|
|
||||||
>view:last-child {
|
> view {
|
||||||
color: #318AFE;
|
// width: 90rpx;
|
||||||
}
|
padding: 2rpx 10rpx;
|
||||||
|
height: 36rpx;
|
||||||
>view:nth-child(2) {
|
line-height: 36rpx;
|
||||||
width: 414rpx;
|
background: #ebf4fc;
|
||||||
height: 60rpx;
|
border-radius: 4rpx 4rpx 4rpx 4rpx;
|
||||||
line-height: 60rpx;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
background: #F9F9F9;
|
|
||||||
border-radius: 32rpx 32rpx 32rpx 32rpx;
|
|
||||||
|
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #999999;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ConsumablesConent {
|
|
||||||
min-height: 80vh;
|
|
||||||
background-color: #f9f9f9;
|
|
||||||
padding-top: 1rpx;
|
|
||||||
|
|
||||||
>view {
|
|
||||||
width: 694rpx;
|
|
||||||
height: 332rpx;
|
|
||||||
background: #FFFFFF;
|
|
||||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
|
||||||
padding: 32rpx 16rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
margin: 32rpx auto;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
>view:first-child {
|
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: #333333;
|
|
||||||
.df;
|
|
||||||
|
|
||||||
>view {
|
|
||||||
// width: 90rpx;
|
|
||||||
padding: 2rpx 10rpx;
|
|
||||||
height: 36rpx;
|
|
||||||
line-height: 36rpx;
|
|
||||||
background: #EBF4FC;
|
|
||||||
border-radius: 4rpx 4rpx 4rpx 4rpx;
|
|
||||||
text-align: center;
|
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: #318AFE;
|
|
||||||
margin-left: 12rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
>view:nth-child(2) {
|
|
||||||
width: 662rpx;
|
|
||||||
height: 128rpx;
|
|
||||||
background: #F9F9F9;
|
|
||||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
|
||||||
.df;
|
|
||||||
justify-content: space-around;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #666666;
|
color: #318afe;
|
||||||
|
margin-left: 12rpx;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
>view:last-child {
|
> view:nth-child(2) {
|
||||||
|
width: 662rpx;
|
||||||
|
height: 128rpx;
|
||||||
|
background: #f9f9f9;
|
||||||
|
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||||
|
.df;
|
||||||
|
justify-content: space-around;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
|
||||||
|
> view:last-child {
|
||||||
|
.df;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
> view:last-child {
|
||||||
.df;
|
.df;
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
>view:last-child {
|
> button {
|
||||||
.df;
|
width: 128rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
// border-radius: 28rpx 28rpx 28rpx 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
>button {
|
> button:last-child {
|
||||||
width: 128rpx;
|
margin-left: 24rpx;
|
||||||
height: 48rpx;
|
|
||||||
background: #FFFFFF;
|
|
||||||
// border-radius: 28rpx 28rpx 28rpx 28rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
>button:last-child {
|
|
||||||
margin-left: 24rpx;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.ConsumablesBottom {
|
.ConsumablesBottom {
|
||||||
.df;
|
.df;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 20rpx;
|
bottom: 20rpx;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translateX(-50%);
|
transform: translateX(-50%);
|
||||||
|
|
||||||
>view {
|
> view {
|
||||||
width: 346rpx;
|
width: 346rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
line-height: 80rpx;
|
line-height: 80rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border: 2rpx solid #318AFE;
|
border: 2rpx solid #318afe;
|
||||||
|
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
}
|
|
||||||
|
|
||||||
>view:first-child {
|
|
||||||
border-radius: 56rpx 0rpx 0rpx 56rpx;
|
|
||||||
color: #318AFE;
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
>view:last-child {
|
|
||||||
border-radius: 0 56rpx 56rpx 0;
|
|
||||||
background-color: #318AFE;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.popup-content {
|
> view:first-child {
|
||||||
padding: 15px;
|
border-radius: 56rpx 0rpx 0rpx 56rpx;
|
||||||
|
color: #318afe;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
margin: 0 auto;
|
}
|
||||||
|
|
||||||
>view {
|
> view:last-child {
|
||||||
|
border-radius: 0 56rpx 56rpx 0;
|
||||||
|
background-color: #318afe;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-content {
|
||||||
|
padding: 15px;
|
||||||
|
background-color: #fff;
|
||||||
|
margin: 0 auto;
|
||||||
|
|
||||||
|
> view {
|
||||||
|
height: 88rpx;
|
||||||
|
line-height: 88rpx;
|
||||||
|
width: 660rpx;
|
||||||
|
border-top: 10rpx solid #f9f9f9;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.operate {
|
||||||
|
> view {
|
||||||
height: 88rpx;
|
height: 88rpx;
|
||||||
line-height: 88rpx;
|
line-height: 88rpx;
|
||||||
width: 660rpx;
|
|
||||||
border-top: 10rpx solid #f9f9f9;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
width: 660rpx;
|
||||||
|
border-bottom: 2rpx solid #e5e5e5;
|
||||||
.operate {
|
|
||||||
>view {
|
|
||||||
height: 88rpx;
|
|
||||||
line-height: 88rpx;
|
|
||||||
text-align: center;
|
|
||||||
width: 660rpx;
|
|
||||||
border-bottom: 2rpx solid #E5E5E5;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.status {
|
.status {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
// top: 100%;
|
// top: 100%;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zhezhaopop {
|
.zhezhaopop {
|
||||||
padding: 34rpx 32rpx;
|
padding: 34rpx 32rpx;
|
||||||
width: 594rpx;
|
width: 594rpx;
|
||||||
|
|
||||||
>view:first-child {
|
> view:first-child {
|
||||||
|
.df;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
.df;
|
> span:nth-child(2) {
|
||||||
justify-content: space-between;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: bold;
|
||||||
>span:nth-child(2) {
|
font-size: 32rpx;
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
color: #333333;
|
||||||
font-weight: bold;
|
|
||||||
font-size: 32rpx;
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.df() {
|
.df() {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
}
|
||||||
|
.fixed-in-btn {
|
||||||
|
position: fixed;
|
||||||
|
right: 20upx;
|
||||||
|
bottom: 20%;
|
||||||
|
z-index: 999;
|
||||||
|
.img {
|
||||||
|
width: 120upx;
|
||||||
}
|
}
|
||||||
</style>
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -42,6 +42,9 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="footer-wrap" v-if="item.shopId == shopInfo.id">
|
<view class="footer-wrap" v-if="item.shopId == shopInfo.id">
|
||||||
|
<view class="btn">
|
||||||
|
<button class="wx-btn" type="primary" open-type="share" @click="setShareOptions(item)">分享</button>
|
||||||
|
</view>
|
||||||
<template v-if="!item.onlineStatus">
|
<template v-if="!item.onlineStatus">
|
||||||
<view class="btn">
|
<view class="btn">
|
||||||
<u-button shape="circle" @click="delHandle(item)">删除</u-button>
|
<u-button shape="circle" @click="delHandle(item)">删除</u-button>
|
||||||
@@ -77,6 +80,13 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, reactive, ref } from 'vue';
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
import { getGbWarePage, editOnlineStatus, deleteGbWare } from '@/http/api/ware.js';
|
import { getGbWarePage, editOnlineStatus, deleteGbWare } from '@/http/api/ware.js';
|
||||||
|
|
||||||
|
const emits = defineEmits(['share']);
|
||||||
|
function setShareOptions(item) {
|
||||||
|
item.wareImgs = item.wareImgs.split(',');
|
||||||
|
emits('share', item);
|
||||||
|
}
|
||||||
|
|
||||||
const shopInfo = ref('');
|
const shopInfo = ref('');
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -281,6 +291,13 @@ onMounted(() => {
|
|||||||
gap: 28upx;
|
gap: 28upx;
|
||||||
.btn {
|
.btn {
|
||||||
width: 140upx;
|
width: 140upx;
|
||||||
|
.wx-btn {
|
||||||
|
border-radius: 100px;
|
||||||
|
height: 40px;
|
||||||
|
line-height: 40px;
|
||||||
|
font-size: 28upx;
|
||||||
|
background-color: #318afe;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<goodsList ref="goodsListRef" name="goodsList" key="goodsList" :top="headHeight + 54" v-if="tabsActive == 0" />
|
<goodsList ref="goodsListRef" name="goodsList" key="goodsList" :top="headHeight + 54" v-if="tabsActive == 0" @share="shareCallback" />
|
||||||
<orderList ref="orderListRef" name="orderList" key="orderList" :top="headHeight + 54" v-if="tabsActive == 1" />
|
<orderList ref="orderListRef" name="orderList" key="orderList" :top="headHeight + 54" v-if="tabsActive == 1" />
|
||||||
</view>
|
</view>
|
||||||
<my-footer-btn confirmText="添加" v-if="tabsActive == 0" @confirm="toAdd"></my-footer-btn>
|
<my-footer-btn confirmText="添加" v-if="tabsActive == 0" @confirm="toAdd"></my-footer-btn>
|
||||||
@@ -27,13 +27,33 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
import { onLoad, onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
|
import { onLoad, onShow, onReachBottom, onPullDownRefresh, onShareAppMessage } from '@dcloudio/uni-app';
|
||||||
import goodsList from './components/goodsList.vue';
|
import goodsList from './components/goodsList.vue';
|
||||||
import orderList from './components/orderList.vue';
|
import orderList from './components/orderList.vue';
|
||||||
import { upShopConfig } from '@/http/api/ware.js';
|
import { upShopConfig } from '@/http/api/ware.js';
|
||||||
import { getShopInfo } from '@/http/api/shop.js';
|
import { getShopInfo } from '@/http/api/shop.js';
|
||||||
import { isMainShop } from '@/store/account.js';
|
import { isMainShop } from '@/store/account.js';
|
||||||
|
|
||||||
|
const path = '/pageMarket/groupGoods/share';
|
||||||
|
const shareOptions = ref({
|
||||||
|
title: '',
|
||||||
|
path: '',
|
||||||
|
imageUrl: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
onShareAppMessage(() => {
|
||||||
|
console.log(shareOptions.value);
|
||||||
|
return shareOptions.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
function shareCallback(item) {
|
||||||
|
console.log('shareCallback', item);
|
||||||
|
|
||||||
|
shareOptions.value.title = item.wareName;
|
||||||
|
shareOptions.value.path = `${path}?shopId=${item.shopId}&id=${item.id}`;
|
||||||
|
shareOptions.value.imageUrl = item.wareImgs[0];
|
||||||
|
}
|
||||||
|
|
||||||
const goodsListRef = ref(null);
|
const goodsListRef = ref(null);
|
||||||
const orderListRef = ref(null);
|
const orderListRef = ref(null);
|
||||||
|
|
||||||
|
|||||||
531
pageMarket/groupGoods/share.vue
Normal file
531
pageMarket/groupGoods/share.vue
Normal file
@@ -0,0 +1,531 @@
|
|||||||
|
<!-- 套餐分享页 -->
|
||||||
|
<template>
|
||||||
|
<view class="color-333 u-font-28 min-page bg-f7" v-if="item.id">
|
||||||
|
<view class="relative">
|
||||||
|
<up-swiper height="428rpx" :list="item.wareImgs.split(',')" @click="prveImg"></up-swiper>
|
||||||
|
<view class="share-box">
|
||||||
|
分享
|
||||||
|
<button class="share" open-type="share" @click="shareCallback">分享</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="sku">
|
||||||
|
<view class="u-flex u-col-center">
|
||||||
|
<text class="price">¥{{ item.groupPrice }}</text>
|
||||||
|
<text class="old-price">¥{{ item.originalPrice }}</text>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<view class="u-m-t-16 text" v-if="item.limitBuyNum">限购{{ item.limitBuyNum }}份</view>
|
||||||
|
<view class="text u-m-t-10">已售:{{ item.saleNum || 0 }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="goods">
|
||||||
|
<view class="goods-name">{{ item.wareName }}</view>
|
||||||
|
<!-- <view class="u-m-t-20 color-666">
|
||||||
|
{{ item.description }}
|
||||||
|
</view> -->
|
||||||
|
</view>
|
||||||
|
<view class="bg-f7" style="height: 32rpx"></view>
|
||||||
|
<view class="desc">
|
||||||
|
<view class="u-flex">
|
||||||
|
<view class="color-666 no-wrap" style="min-width: 180rpx">可核销门店:</view>
|
||||||
|
<view class="">{{ item.shopName }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-m-t-16 u-col-baseline">
|
||||||
|
<view class="color-666 no-wrap" style="min-width: 180rpx">门店地址:</view>
|
||||||
|
<view class="">{{ item.shopAddress }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- <template v-if="flase">
|
||||||
|
<view class="bg-f7" style="height: 32rpx"></view>
|
||||||
|
<view class="groups">
|
||||||
|
<view class="color-000 u-m-b-28 u-font-32 font-700">立即拼团</view>
|
||||||
|
<view class="item u-flex" v-for="(item, index) in item.gbOrderList" :key="index">
|
||||||
|
<up-avatar size="76rpx" :src="item.avatar"></up-avatar>
|
||||||
|
<view class="u-flex u-flex-1 u-p-l-22 u-col-center u-row-between">
|
||||||
|
<view>
|
||||||
|
<view class="color-000 u-line-1" style="max-width: 180rpx">{{ item.nickName }}</view>
|
||||||
|
<view class="main-color u-m-t-2">差{{ returnNeedPerpole(item) }}人拼成</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-22">
|
||||||
|
<text class="color-666">剩余:</text>
|
||||||
|
<text class="main-color">{{ getRemainingHMS(item) }}</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="btn" @click="fastBuy(item)">快速拼成</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template> -->
|
||||||
|
<!-- <view class="bg-f7" style="height: 24rpx"></view>
|
||||||
|
<view class="goods-group">
|
||||||
|
<view class="u-flex u-row-between">
|
||||||
|
<view class="name">套餐商品</view>
|
||||||
|
<view class="u-flex color-666" @click="showGroup = !showGroup" style="align-items: baseline">
|
||||||
|
<text class="u-m-r-18">{{ showGroup ? '收起' : '展开' }}</text>
|
||||||
|
<view class="guodu" :class="{ rotate: !showGroup }">
|
||||||
|
<up-icon name="arrow-down" bold></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="" v-if="showGroup">
|
||||||
|
<view class="u-m-t-48" v-for="(item, index) in item.packageContent" :key="index">
|
||||||
|
<view class="font-bold">
|
||||||
|
<text class="">{{ item.name }}</text>
|
||||||
|
<text class="u-m-l-30">{{ item.packageProducts.length }}选{{ item.num }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="">
|
||||||
|
<view class="u-flex u-m-t-24 u-row-between" v-for="(goods, goodsIndex) in item.packageProducts" :key="goodsIndex">
|
||||||
|
<text>{{ goods.name }}</text>
|
||||||
|
<view class="u-flex text-right">
|
||||||
|
<text class="color-666 u-m-r-42">x{{ goods.num }}</text>
|
||||||
|
<view style="min-width: 110rpx">¥{{ goods.price }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="desc" v-if="item.tieredDiscount && item.tieredDiscount.length > 0">
|
||||||
|
<view class="u-flex u-row-between">
|
||||||
|
<view class="name">分享说明</view>
|
||||||
|
<view class="u-flex color-666" @click="showDesc = !showDesc" style="align-items: baseline">
|
||||||
|
<text class="u-m-r-18">{{ showDesc ? '收起' : '展开' }}</text>
|
||||||
|
<view class="guodu" :class="{ rotate: !showDesc }">
|
||||||
|
<up-icon name="arrow-down" bold></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<template v-if="showDesc">
|
||||||
|
<view class="u-m-t-26 text-center table">
|
||||||
|
<view class="u-flex header color-666">
|
||||||
|
<view class="u-flex-1 u-p-t-32 u-p-b-32">分享人数</view>
|
||||||
|
<view class="u-flex-1 u-p-t-32 u-p-b-32">购买价格(元)</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex row" v-for="(step, index) in item.tieredDiscount" :key="index">
|
||||||
|
<view class="u-flex-1 u-p-t-32 u-p-b-32">{{ step.peopleNum }}</view>
|
||||||
|
<view class="u-flex-1 u-p-t-32 u-p-b-32">¥{{ step.price }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="u-m-t-26">
|
||||||
|
<view>分享期限(小时):{{ item.expireHours }}</view>
|
||||||
|
<view class="u-m-t-10">规定期限内的助力才会被计入</view>
|
||||||
|
<view class="u-m-t-40">如何才是分享成功?被分享人只需要点击《助力》,提示助力成功后即可</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
<view class="desc">
|
||||||
|
<view class="u-flex u-row-between">
|
||||||
|
<view class="name">使用说明</view>
|
||||||
|
<view class="u-flex color-666" @click="useDescShow = !useDescShow" style="align-items: baseline">
|
||||||
|
<text class="u-m-r-18">{{ useDescShow ? '收起' : '展开' }}</text>
|
||||||
|
<view class="guodu" :class="{ rotate: !useDescShow }">
|
||||||
|
<up-icon name="arrow-down" bold></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<template v-if="useDescShow">
|
||||||
|
<view class="u-m-t-16 color-666">
|
||||||
|
<view>1、可用时间段:{{ canuseTime }}</view>
|
||||||
|
<view v-if="item.otherDesc">2、其他使用说明:{{ item.otherDesc }}</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</view> -->
|
||||||
|
<view class="goods-detail">
|
||||||
|
<view class="u-flex u-row-center">
|
||||||
|
<view class="title">商品详情</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<image class="w-full" v-for="(item, index) in item.wareCommentImgs.split(',')" :key="index" mode="widthFix" :src="item"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<my-footer-btn confirmColor="#E3AD7F" confirmText="立即参加" @confirm="toMiniApp"></my-footer-btn>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { ref, computed, reactive } from 'vue';
|
||||||
|
import { onLoad, onShareAppMessage } from '@dcloudio/uni-app';
|
||||||
|
import { wareDetail } from '@/http/api/ware.js';
|
||||||
|
|
||||||
|
const showGroup = ref(true);
|
||||||
|
const showDesc = ref(true);
|
||||||
|
const useDescShow = ref(true);
|
||||||
|
|
||||||
|
const canuseTime = computed(() => {
|
||||||
|
return item.useWeeks.join('、') + ' ' + item.useTimes;
|
||||||
|
});
|
||||||
|
|
||||||
|
function prveImg(index) {
|
||||||
|
uni.previewImage({
|
||||||
|
urls: coverImgs.value,
|
||||||
|
current: index
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const query = reactive({
|
||||||
|
shopId: '',
|
||||||
|
id: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
const coverImgs = ref([]);
|
||||||
|
const item = reactive({
|
||||||
|
goodsDescription: []
|
||||||
|
});
|
||||||
|
|
||||||
|
function getDetail() {
|
||||||
|
wareDetail({
|
||||||
|
shopId: query.shopId,
|
||||||
|
wareId: query.id
|
||||||
|
}).then((res) => {
|
||||||
|
Object.assign(item, res);
|
||||||
|
coverImgs.value = res.images;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onLoad((options) => {
|
||||||
|
if (options.id) {
|
||||||
|
query.id = options.id;
|
||||||
|
query.shopId = options.shopId;
|
||||||
|
getDetail();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const path = '/pageMarket/packagePopularize/share';
|
||||||
|
const shareOptions = ref({
|
||||||
|
title: '',
|
||||||
|
path: '',
|
||||||
|
imageUrl: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
function shareCallback() {
|
||||||
|
shareOptions.value.title = item.packageName;
|
||||||
|
shareOptions.value.path = `${path}?shopId=${item.shopId}&id=${item.id}`;
|
||||||
|
shareOptions.value.imageUrl = item.images[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
onShareAppMessage(() => {
|
||||||
|
console.log('onShareAppMessage', shareOptions.value);
|
||||||
|
return shareOptions.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 跳转到用户小程序
|
||||||
|
function toMiniApp() {
|
||||||
|
uni.navigateToMiniProgram({
|
||||||
|
appId: 'wxd88fffa983758a30',
|
||||||
|
path: `/groupBuying/goodsDetail/goodsDetail?wareId=${query.id}&shopId=${query.shopId}`,
|
||||||
|
envVersion: 'trial', // 环境版本:release(正式版)、trial(体验版)、develop(开发版)
|
||||||
|
success: () => {},
|
||||||
|
fail: () => {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
$topHeight: 350rpx;
|
||||||
|
|
||||||
|
.top-img {
|
||||||
|
width: 750rpx;
|
||||||
|
height: $topHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top {
|
||||||
|
margin: 14rpx 18rpx;
|
||||||
|
background-size: cover;
|
||||||
|
height: $topHeight;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding-left: 70rpx;
|
||||||
|
padding-top: 95rpx;
|
||||||
|
|
||||||
|
.name {
|
||||||
|
color: #000000;
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
color: #333333;
|
||||||
|
font-size: 48rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-top: 62rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.sku {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 20rpx 36rpx;
|
||||||
|
align-items: center;
|
||||||
|
background: linear-gradient(90deg, #ff4a63 0%, #fd1f48 100%);
|
||||||
|
|
||||||
|
.price {
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.old-price {
|
||||||
|
margin-left: 16rpx;
|
||||||
|
color: #e7e7e7;
|
||||||
|
opacity: 0.85;
|
||||||
|
font-weight: 700;
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
color: #fff;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods {
|
||||||
|
padding: 20rpx 28rpx;
|
||||||
|
background: #fff;
|
||||||
|
|
||||||
|
.goods-name {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.desc {
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-detail {
|
||||||
|
padding: 32rpx;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
position: relative;
|
||||||
|
padding: 0 22rpx;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
right: 100%;
|
||||||
|
width: 70rpx;
|
||||||
|
height: 2rpx;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
background: linear-gradient(90deg, #f7f8f9 0%, #c9cbcc 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
left: 100%;
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
display: block;
|
||||||
|
width: 70rpx;
|
||||||
|
height: 2rpx;
|
||||||
|
background: linear-gradient(90deg, #c9cbcc 0%, #f7f8f9 100%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fixed-bottom {
|
||||||
|
position: fixed;
|
||||||
|
left: 98rpx;
|
||||||
|
right: 98rpx;
|
||||||
|
padding-bottom: 30px;
|
||||||
|
padding-top: 32rpx;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 10;
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding: 22rpx;
|
||||||
|
border-radius: 200rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #fff;
|
||||||
|
width: 556rpx;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #e8ad7b;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
|
||||||
|
&.gray {
|
||||||
|
background: #fff;
|
||||||
|
color: #e8ad7b;
|
||||||
|
border-color: #e8ad7b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.waring {
|
||||||
|
background-color: rgba(255, 204, 0, 0.09);
|
||||||
|
padding: 32rpx 24rpx;
|
||||||
|
color: #ff8d28;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-content {
|
||||||
|
font-size: 28rpx;
|
||||||
|
min-height: 300px;
|
||||||
|
|
||||||
|
.popup-content-top {
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
border-bottom: 1px solid #ededed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-info {
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
border-bottom: 1px solid #ededed;
|
||||||
|
|
||||||
|
.cover {
|
||||||
|
width: 184rpx;
|
||||||
|
height: 184rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
background: #d9d9d9;
|
||||||
|
|
||||||
|
&.bg-fff {
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.price {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #ed5a2e;
|
||||||
|
line-height: 46rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.old-price {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #999;
|
||||||
|
text-decoration-line: line-through;
|
||||||
|
line-height: 48rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.limitBuyNum {
|
||||||
|
color: #666;
|
||||||
|
line-height: 42rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
padding: 20rpx;
|
||||||
|
border-bottom: 1px solid #ededed;
|
||||||
|
|
||||||
|
.price {
|
||||||
|
color: #ed5a2e;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
display: flex;
|
||||||
|
padding: 22rpx 214rpx;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 20rpx;
|
||||||
|
border-radius: 66rpx;
|
||||||
|
background: #e8ad7b;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 700;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.w-full {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.groups {
|
||||||
|
padding: 28rpx 22rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
padding: 28rpx 0;
|
||||||
|
border-bottom: 2rpx solid #ededed;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-color {
|
||||||
|
color: #ed5a2e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding: 8rpx 26rpx;
|
||||||
|
border-radius: 36rpx;
|
||||||
|
background: #e8ad7b;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.share-box {
|
||||||
|
top: 0;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
padding: 4rpx 30rpx;
|
||||||
|
border-radius: 0 0 0 24rpx;
|
||||||
|
color: #ed5a2e;
|
||||||
|
font-weight: 700;
|
||||||
|
background: #fff;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.share {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-group {
|
||||||
|
padding: 32rpx 46rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
.name {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rotate {
|
||||||
|
transform: rotate(-90deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.desc {
|
||||||
|
padding: 32rpx 46rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
margin-top: 32rpx;
|
||||||
|
|
||||||
|
.name {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
border: 2rpx solid #ededed;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
margin: 0 52rpx;
|
||||||
|
|
||||||
|
.header {
|
||||||
|
background: #f8f8f88f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row {
|
||||||
|
border-top: 2rpx solid #ededed;
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.rotate {
|
||||||
|
transform: rotate(-90deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.guodu {
|
||||||
|
transition: all 0.3s;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -45,6 +45,9 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="footer-wrap" v-if="item.shopId == shopInfo.id">
|
<view class="footer-wrap" v-if="item.shopId == shopInfo.id">
|
||||||
|
<view class="btn">
|
||||||
|
<button class="wx-btn" type="primary" open-type="share" @click="setShareOptions(item)">分享</button>
|
||||||
|
</view>
|
||||||
<template v-if="!item.onlineStatus">
|
<template v-if="!item.onlineStatus">
|
||||||
<view class="btn">
|
<view class="btn">
|
||||||
<u-button shape="circle" @click="delHandle(item)">删除</u-button>
|
<u-button shape="circle" @click="delHandle(item)">删除</u-button>
|
||||||
@@ -80,6 +83,12 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, reactive, ref } from 'vue';
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
import { packageGet, packageOnline, packageDel } from '@/http/api/ware.js';
|
import { packageGet, packageOnline, packageDel } from '@/http/api/ware.js';
|
||||||
|
|
||||||
|
const emits = defineEmits(['share']);
|
||||||
|
function setShareOptions(item) {
|
||||||
|
emits('share', item);
|
||||||
|
}
|
||||||
|
|
||||||
const shopInfo = ref('');
|
const shopInfo = ref('');
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -290,6 +299,13 @@ onMounted(() => {
|
|||||||
gap: 28upx;
|
gap: 28upx;
|
||||||
.btn {
|
.btn {
|
||||||
width: 140upx;
|
width: 140upx;
|
||||||
|
.wx-btn {
|
||||||
|
border-radius: 100px;
|
||||||
|
height: 40px;
|
||||||
|
line-height: 40px;
|
||||||
|
font-size: 28upx;
|
||||||
|
background-color: #318afe;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<goodsList ref="goodsListRef" name="goodsList" key="goodsList" :top="headHeight + 54" v-if="tabsActive == 0" />
|
<goodsList ref="goodsListRef" name="goodsList" key="goodsList" :top="headHeight + 54" v-if="tabsActive == 0" @share="shareCallback" />
|
||||||
<orderList ref="orderListRef" name="orderList" key="orderList" :top="headHeight + 54" v-if="tabsActive == 1" />
|
<orderList ref="orderListRef" name="orderList" key="orderList" :top="headHeight + 54" v-if="tabsActive == 1" />
|
||||||
</view>
|
</view>
|
||||||
<my-footer-btn confirmText="添加" v-if="tabsActive == 0" @confirm="toAdd"></my-footer-btn>
|
<my-footer-btn confirmText="添加" v-if="tabsActive == 0" @confirm="toAdd"></my-footer-btn>
|
||||||
@@ -28,11 +28,29 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
import { onLoad, onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
|
import { onLoad, onShow, onReachBottom, onPullDownRefresh, onShareAppMessage } from '@dcloudio/uni-app';
|
||||||
import goodsList from './components/goodsList.vue';
|
import goodsList from './components/goodsList.vue';
|
||||||
import orderList from './components/orderList.vue';
|
import orderList from './components/orderList.vue';
|
||||||
import { packageSwitchGet, packageSwitchPut } from '@/http/api/ware.js';
|
import { packageSwitchGet, packageSwitchPut } from '@/http/api/ware.js';
|
||||||
|
|
||||||
|
const path = '/pageMarket/packagePopularize/share';
|
||||||
|
const shareOptions = ref({
|
||||||
|
title: '',
|
||||||
|
path: '',
|
||||||
|
imageUrl: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
onShareAppMessage(() => {
|
||||||
|
console.log(shareOptions.value);
|
||||||
|
return shareOptions.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
function shareCallback(item) {
|
||||||
|
shareOptions.value.title = item.packageName;
|
||||||
|
shareOptions.value.path = `${path}?shopId=${item.shopId}&id=${item.id}`;
|
||||||
|
shareOptions.value.imageUrl = item.images[0];
|
||||||
|
}
|
||||||
|
|
||||||
const goodsListRef = ref(null);
|
const goodsListRef = ref(null);
|
||||||
const orderListRef = ref(null);
|
const orderListRef = ref(null);
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ const list = ref([]);
|
|||||||
// 选择商品
|
// 选择商品
|
||||||
function selectGoods(item) {
|
function selectGoods(item) {
|
||||||
uni.setStorageSync('packageSelectGoods', {
|
uni.setStorageSync('packageSelectGoods', {
|
||||||
|
id: item.id,
|
||||||
coverImg: item.coverImg,
|
coverImg: item.coverImg,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
price: returnPrice(item.skuList)
|
price: returnPrice(item.skuList)
|
||||||
|
|||||||
528
pageMarket/packagePopularize/share.vue
Normal file
528
pageMarket/packagePopularize/share.vue
Normal file
@@ -0,0 +1,528 @@
|
|||||||
|
<!-- 套餐分享页 -->
|
||||||
|
<template>
|
||||||
|
<view class="color-333 u-font-28 min-page bg-f7" v-if="item.id">
|
||||||
|
<view class="relative">
|
||||||
|
<up-swiper height="428rpx" :list="item.images" @click="prveImg"></up-swiper>
|
||||||
|
<view class="share-box">
|
||||||
|
分享
|
||||||
|
<button class="share" open-type="share" @click="shareCallback">分享</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="sku">
|
||||||
|
<view class="u-flex u-col-center">
|
||||||
|
<text class="price">¥{{ item.price }}</text>
|
||||||
|
<text class="old-price">¥{{ item.originPrice }}</text>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<view class="u-m-t-16 text" v-if="item.limitBuyNum">限购{{ item.limitBuyNum }}份</view>
|
||||||
|
<view class="text u-m-t-10">已售:{{ item.saleNum || 0 }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="goods">
|
||||||
|
<view class="goods-name">{{ item.packageName }}</view>
|
||||||
|
<view class="u-m-t-20 color-666">
|
||||||
|
{{ item.description }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="bg-f7" style="height: 32rpx"></view>
|
||||||
|
<view class="desc">
|
||||||
|
<view class="u-flex">
|
||||||
|
<view class="color-666 no-wrap" style="min-width: 180rpx">可核销门店:</view>
|
||||||
|
<view class="">{{ item.shopName }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-m-t-16 u-col-baseline">
|
||||||
|
<view class="color-666 no-wrap" style="min-width: 180rpx">门店地址:</view>
|
||||||
|
<view class="">{{ item.shopAddress }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- <template v-if="flase">
|
||||||
|
<view class="bg-f7" style="height: 32rpx"></view>
|
||||||
|
<view class="groups">
|
||||||
|
<view class="color-000 u-m-b-28 u-font-32 font-700">立即拼团</view>
|
||||||
|
<view class="item u-flex" v-for="(item, index) in item.gbOrderList" :key="index">
|
||||||
|
<up-avatar size="76rpx" :src="item.avatar"></up-avatar>
|
||||||
|
<view class="u-flex u-flex-1 u-p-l-22 u-col-center u-row-between">
|
||||||
|
<view>
|
||||||
|
<view class="color-000 u-line-1" style="max-width: 180rpx">{{ item.nickName }}</view>
|
||||||
|
<view class="main-color u-m-t-2">差{{ returnNeedPerpole(item) }}人拼成</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-22">
|
||||||
|
<text class="color-666">剩余:</text>
|
||||||
|
<text class="main-color">{{ getRemainingHMS(item) }}</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="btn" @click="fastBuy(item)">快速拼成</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template> -->
|
||||||
|
<view class="bg-f7" style="height: 24rpx"></view>
|
||||||
|
<view class="goods-group">
|
||||||
|
<view class="u-flex u-row-between">
|
||||||
|
<view class="name">套餐商品</view>
|
||||||
|
<view class="u-flex color-666" @click="showGroup = !showGroup" style="align-items: baseline">
|
||||||
|
<text class="u-m-r-18">{{ showGroup ? '收起' : '展开' }}</text>
|
||||||
|
<view class="guodu" :class="{ rotate: !showGroup }">
|
||||||
|
<up-icon name="arrow-down" bold></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="" v-if="showGroup">
|
||||||
|
<view class="u-m-t-48" v-for="(item, index) in item.packageContent" :key="index">
|
||||||
|
<view class="font-bold">
|
||||||
|
<text class="">{{ item.name }}</text>
|
||||||
|
<text class="u-m-l-30">{{ item.packageProducts.length }}选{{ item.num }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="">
|
||||||
|
<view class="u-flex u-m-t-24 u-row-between" v-for="(goods, goodsIndex) in item.packageProducts" :key="goodsIndex">
|
||||||
|
<text>{{ goods.name }}</text>
|
||||||
|
<view class="u-flex text-right">
|
||||||
|
<text class="color-666 u-m-r-42">x{{ goods.num }}</text>
|
||||||
|
<view style="min-width: 110rpx">¥{{ goods.price }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="desc" v-if="item.tieredDiscount && item.tieredDiscount.length > 0">
|
||||||
|
<view class="u-flex u-row-between">
|
||||||
|
<view class="name">分享说明</view>
|
||||||
|
<view class="u-flex color-666" @click="showDesc = !showDesc" style="align-items: baseline">
|
||||||
|
<text class="u-m-r-18">{{ showDesc ? '收起' : '展开' }}</text>
|
||||||
|
<view class="guodu" :class="{ rotate: !showDesc }">
|
||||||
|
<up-icon name="arrow-down" bold></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<template v-if="showDesc">
|
||||||
|
<view class="u-m-t-26 text-center table">
|
||||||
|
<view class="u-flex header color-666">
|
||||||
|
<view class="u-flex-1 u-p-t-32 u-p-b-32">分享人数</view>
|
||||||
|
<view class="u-flex-1 u-p-t-32 u-p-b-32">购买价格(元)</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex row" v-for="(step, index) in item.tieredDiscount" :key="index">
|
||||||
|
<view class="u-flex-1 u-p-t-32 u-p-b-32">{{ step.peopleNum }}</view>
|
||||||
|
<view class="u-flex-1 u-p-t-32 u-p-b-32">¥{{ step.price }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="u-m-t-26">
|
||||||
|
<view>分享期限(小时):{{ item.expireHours }}</view>
|
||||||
|
<view class="u-m-t-10">规定期限内的助力才会被计入</view>
|
||||||
|
<view class="u-m-t-40">如何才是分享成功?被分享人只需要点击《助力》,提示助力成功后即可</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
<view class="desc">
|
||||||
|
<view class="u-flex u-row-between">
|
||||||
|
<view class="name">使用说明</view>
|
||||||
|
<view class="u-flex color-666" @click="useDescShow = !useDescShow" style="align-items: baseline">
|
||||||
|
<text class="u-m-r-18">{{ useDescShow ? '收起' : '展开' }}</text>
|
||||||
|
<view class="guodu" :class="{ rotate: !useDescShow }">
|
||||||
|
<up-icon name="arrow-down" bold></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<template v-if="useDescShow">
|
||||||
|
<view class="u-m-t-16 color-666">
|
||||||
|
<view>1、可用时间段:{{ canuseTime }}</view>
|
||||||
|
<view v-if="item.otherDesc">2、其他使用说明:{{ item.otherDesc }}</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
<view class="goods-detail" v-if="item.goodsCategory != '优惠券'">
|
||||||
|
<view class="u-flex u-row-center">
|
||||||
|
<view class="title">商品详情</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<image class="w-full" v-for="(item, index) in item.detailImages" :key="index" mode="widthFix" :src="item"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<my-footer-btn confirmColor="#E3AD7F" confirmText="立即参加" @confirm="toMiniApp"></my-footer-btn>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { ref, computed, reactive } from 'vue';
|
||||||
|
import { onLoad, onShareAppMessage } from '@dcloudio/uni-app';
|
||||||
|
import { packageDetail } from '@/http/api/ware.js';
|
||||||
|
|
||||||
|
const showGroup = ref(true);
|
||||||
|
const showDesc = ref(true);
|
||||||
|
const useDescShow = ref(true);
|
||||||
|
|
||||||
|
const canuseTime = computed(() => {
|
||||||
|
return item.useWeeks.join('、') + ' ' + item.useTimes;
|
||||||
|
});
|
||||||
|
|
||||||
|
function prveImg(index) {
|
||||||
|
uni.previewImage({
|
||||||
|
urls: coverImgs.value,
|
||||||
|
current: index
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const query = reactive({
|
||||||
|
shopId: '',
|
||||||
|
id: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
const coverImgs = ref([]);
|
||||||
|
const item = reactive({
|
||||||
|
goodsDescription: []
|
||||||
|
});
|
||||||
|
|
||||||
|
function getDetail() {
|
||||||
|
packageDetail(query).then((res) => {
|
||||||
|
Object.assign(item, res);
|
||||||
|
coverImgs.value = res.images;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onLoad((options) => {
|
||||||
|
if (options.id) {
|
||||||
|
query.id = options.id;
|
||||||
|
query.shopId = options.shopId;
|
||||||
|
getDetail();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const path = '/pageMarket/packagePopularize/share';
|
||||||
|
const shareOptions = ref({
|
||||||
|
title: '',
|
||||||
|
path: '',
|
||||||
|
imageUrl: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
function shareCallback() {
|
||||||
|
shareOptions.value.title = item.packageName;
|
||||||
|
shareOptions.value.path = `${path}?shopId=${item.shopId}&id=${item.id}`;
|
||||||
|
shareOptions.value.imageUrl = item.images[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
onShareAppMessage(() => {
|
||||||
|
console.log('onShareAppMessage', shareOptions.value);
|
||||||
|
return shareOptions.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 跳转到用户小程序
|
||||||
|
function toMiniApp() {
|
||||||
|
uni.navigateToMiniProgram({
|
||||||
|
appId: 'wxd88fffa983758a30',
|
||||||
|
path: `/userPackage/goodsDetail/goodsDetail?id=${query.id}&shopId=${query.shopId}`,
|
||||||
|
envVersion: 'trial', // 环境版本:release(正式版)、trial(体验版)、develop(开发版)
|
||||||
|
success: () => {},
|
||||||
|
fail: () => {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
$topHeight: 350rpx;
|
||||||
|
|
||||||
|
.top-img {
|
||||||
|
width: 750rpx;
|
||||||
|
height: $topHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top {
|
||||||
|
margin: 14rpx 18rpx;
|
||||||
|
background-size: cover;
|
||||||
|
height: $topHeight;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding-left: 70rpx;
|
||||||
|
padding-top: 95rpx;
|
||||||
|
|
||||||
|
.name {
|
||||||
|
color: #000000;
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
color: #333333;
|
||||||
|
font-size: 48rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-top: 62rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.sku {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 20rpx 36rpx;
|
||||||
|
align-items: center;
|
||||||
|
background: linear-gradient(90deg, #ff4a63 0%, #fd1f48 100%);
|
||||||
|
|
||||||
|
.price {
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.old-price {
|
||||||
|
margin-left: 16rpx;
|
||||||
|
color: #e7e7e7;
|
||||||
|
opacity: 0.85;
|
||||||
|
font-weight: 700;
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
color: #fff;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods {
|
||||||
|
padding: 20rpx 28rpx;
|
||||||
|
background: #fff;
|
||||||
|
|
||||||
|
.goods-name {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.desc {
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-detail {
|
||||||
|
padding: 32rpx;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
position: relative;
|
||||||
|
padding: 0 22rpx;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
right: 100%;
|
||||||
|
width: 70rpx;
|
||||||
|
height: 2rpx;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
background: linear-gradient(90deg, #f7f8f9 0%, #c9cbcc 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
left: 100%;
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
display: block;
|
||||||
|
width: 70rpx;
|
||||||
|
height: 2rpx;
|
||||||
|
background: linear-gradient(90deg, #c9cbcc 0%, #f7f8f9 100%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fixed-bottom {
|
||||||
|
position: fixed;
|
||||||
|
left: 98rpx;
|
||||||
|
right: 98rpx;
|
||||||
|
padding-bottom: 30px;
|
||||||
|
padding-top: 32rpx;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 10;
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding: 22rpx;
|
||||||
|
border-radius: 200rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #fff;
|
||||||
|
width: 556rpx;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #e8ad7b;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
|
||||||
|
&.gray {
|
||||||
|
background: #fff;
|
||||||
|
color: #e8ad7b;
|
||||||
|
border-color: #e8ad7b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.waring {
|
||||||
|
background-color: rgba(255, 204, 0, 0.09);
|
||||||
|
padding: 32rpx 24rpx;
|
||||||
|
color: #ff8d28;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-content {
|
||||||
|
font-size: 28rpx;
|
||||||
|
min-height: 300px;
|
||||||
|
|
||||||
|
.popup-content-top {
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
border-bottom: 1px solid #ededed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-info {
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
border-bottom: 1px solid #ededed;
|
||||||
|
|
||||||
|
.cover {
|
||||||
|
width: 184rpx;
|
||||||
|
height: 184rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
background: #d9d9d9;
|
||||||
|
|
||||||
|
&.bg-fff {
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.price {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #ed5a2e;
|
||||||
|
line-height: 46rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.old-price {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #999;
|
||||||
|
text-decoration-line: line-through;
|
||||||
|
line-height: 48rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.limitBuyNum {
|
||||||
|
color: #666;
|
||||||
|
line-height: 42rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
padding: 20rpx;
|
||||||
|
border-bottom: 1px solid #ededed;
|
||||||
|
|
||||||
|
.price {
|
||||||
|
color: #ed5a2e;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
display: flex;
|
||||||
|
padding: 22rpx 214rpx;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 20rpx;
|
||||||
|
border-radius: 66rpx;
|
||||||
|
background: #e8ad7b;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 700;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.w-full {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.groups {
|
||||||
|
padding: 28rpx 22rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
padding: 28rpx 0;
|
||||||
|
border-bottom: 2rpx solid #ededed;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-color {
|
||||||
|
color: #ed5a2e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding: 8rpx 26rpx;
|
||||||
|
border-radius: 36rpx;
|
||||||
|
background: #e8ad7b;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.share-box {
|
||||||
|
top: 0;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
padding: 4rpx 30rpx;
|
||||||
|
border-radius: 0 0 0 24rpx;
|
||||||
|
color: #ed5a2e;
|
||||||
|
font-weight: 700;
|
||||||
|
background: #fff;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.share {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-group {
|
||||||
|
padding: 32rpx 46rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
.name {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rotate {
|
||||||
|
transform: rotate(-90deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.desc {
|
||||||
|
padding: 32rpx 46rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
margin-top: 32rpx;
|
||||||
|
|
||||||
|
.name {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
border: 2rpx solid #ededed;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
margin: 0 52rpx;
|
||||||
|
|
||||||
|
.header {
|
||||||
|
background: #f8f8f88f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row {
|
||||||
|
border-top: 2rpx solid #ededed;
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.rotate {
|
||||||
|
transform: rotate(-90deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.guodu {
|
||||||
|
transition: all 0.3s;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
File diff suppressed because it is too large
Load Diff
20
pages.json
20
pages.json
@@ -540,6 +540,12 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "账单付款记录"
|
"navigationBarTitleText": "账单付款记录"
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
"pageId": "PAGES_BATCH_IN",
|
||||||
|
"path": "batch_in",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "批量入库"
|
||||||
|
}
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -845,6 +851,13 @@
|
|||||||
"navigationBarTitleText": "拼团商品"
|
"navigationBarTitleText": "拼团商品"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_MARKET_GROUP_GOODS_SHARE",
|
||||||
|
"path": "groupGoods/share",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "分享"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"pageId": "PAGES_MARKET_GROUP_GOODS_ADDGOODS",
|
"pageId": "PAGES_MARKET_GROUP_GOODS_ADDGOODS",
|
||||||
"path": "groupGoods/addGoods",
|
"path": "groupGoods/addGoods",
|
||||||
@@ -879,6 +892,13 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "选择商品"
|
"navigationBarTitleText": "选择商品"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_MARKET_PACKAGE_POPULARIZE_SHARE",
|
||||||
|
"path": "packagePopularize/share",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "分享"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
||||||
dayjs.extend(customParseFormat); // 注册插件
|
dayjs.extend(customParseFormat); // 注册插件
|
||||||
|
import {
|
||||||
|
BigNumber
|
||||||
|
} from "bignumber.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 过滤输入,只允许数字和最多两位小数
|
* 过滤输入,只允许数字和最多两位小数
|
||||||
@@ -114,4 +117,30 @@ export function includesString(target, searchStr, options = {}) {
|
|||||||
|
|
||||||
// 4. 执行包含判断
|
// 4. 执行包含判断
|
||||||
return processedTarget.includes(processedSearch);
|
return processedTarget.includes(processedSearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 乘法计算并格式化结果
|
||||||
|
* @param {string|number} num1 - 第一个乘数
|
||||||
|
* @param {string|number} num2 - 第二个乘数
|
||||||
|
* @returns {string} 保留两位小数的结果(不四舍五入,补零)
|
||||||
|
*/
|
||||||
|
export const multiplyAndFormat = (num1, num2) => {
|
||||||
|
try {
|
||||||
|
// 转换为BigNumber(使用字符串构造避免精度问题)
|
||||||
|
const bigNum1 = new BigNumber(num1.toString());
|
||||||
|
const bigNum2 = new BigNumber(num2.toString());
|
||||||
|
|
||||||
|
// 1. 乘法计算
|
||||||
|
const product = bigNum1.multipliedBy(bigNum2);
|
||||||
|
|
||||||
|
// 2. 截断到两位小数(不四舍五入)
|
||||||
|
const truncated = product.decimalPlaces(2, BigNumber.ROUND_DOWN);
|
||||||
|
|
||||||
|
// 3. 格式化保留两位小数(补零)
|
||||||
|
return truncated.toFixed(2);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('计算错误:', error);
|
||||||
|
return '0.00'; // 出错时返回默认值
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user