移除无用文件

This commit is contained in:
2026-01-16 03:58:57 +08:00
parent 3fb9b37708
commit 345ee6dbb0
48 changed files with 100 additions and 9467 deletions

View File

@@ -1,342 +0,0 @@
<template>
<nut-noticebar v-if="!audit" :text="cart_txt" :background="`rgba(251, 248, 220, 1)`"
:custom-color="`#D9500B`"></nut-noticebar>
<nut-noticebar v-else text="各位员工选定商品后统一给仓库管理员处理" :background="`rgba(251, 248, 220, 1)`"
:custom-color="`#D9500B`"></nut-noticebar>
<view class="content">
<view class="cart-goods-list">
<nut-empty v-if="goods_list.length === 0" description="你还没有添加商品哦">
<template #image>
<image src="@/static/empty.png" />
</template>
</nut-empty>
<nut-checkbox-group v-model="selectedGoodsIds">
<view class="cart-goods" v-for="(item, idx) in goods_list" :name="String(item.goods_id)" :key="idx">
<nut-checkbox :label="item.goods_id" />
<image class="goods-img" :src="item.goods_house.image[0]?.file_path" mode="scaleToFill"
@click="navigateTo('/pages/mall/item/index?id=' + item.goods_id)" />
<view class="middle" @click="navigateTo('/pages/mall/item/index?id=' + item.goods_id)">
<view class="middle-header">
<nut-tag custom-color="#1a1a1a">{{ item.goods_house?.degree?.degree_name }}</nut-tag>
<text class="title">{{ item.goods_house?.goods_name }}</text>
</view>
<nut-price :price="item.goods_house?.goods_price" :need-symbol="true" />
<view class="middle-footer" @click.stop>
<view class="countdown">
<nut-countdown :end-time="item.deadline_time * 1000"></nut-countdown>
<text class="t">自动移除购物车</text>
</view>
</view>
</view>
<view class="goods-del-btn" @click="confirmDel(item.goods_id)">
<nut-icon name="del2" size="24"></nut-icon>
</view>
</view>
</nut-checkbox-group>
</view>
</view>
<view class="fixed_footer" v-if="!audit">
<view>
<nut-checkbox v-model="toggle_all_val" @change="toggleAll()">全选</nut-checkbox>
</view>
<view style="display: flex; flex-direction: row; gap: 10px">
<view class="price">
<text v-if="selectedGoodsIds.length > 0">{{ selectedGoodsIds.length }}&nbsp;</text>
<text>合计:</text>
<nut-price :price="total_price" size="large" :need-symbol="true" />
</view>
<nut-button type="primary" @click="submitOrder()">立即下单</nut-button>
</view>
</view>
<view class="fixed_footer" v-else>
<view>
<nut-checkbox v-model="toggle_all_val" @change="toggleAll()">全选</nut-checkbox>
</view>
<view style="display: flex; flex-direction: row; gap: 10px">
<view class="price">
<text v-if="selectedGoodsIds.length > 0">{{ selectedGoodsIds.length }}&nbsp;</text>
<text>合计:</text>
<nut-price :price="total_price" size="large" :need-symbol="true" />
</view>
<nut-button type="primary" @click="submitOrderGL()">立即下单</nut-button>
</view>
</view>
</template>
<script setup>
import {
computed,
onMounted,
reactive,
ref
} from 'vue';
import {
onLoad,
onShow,
onHide
} from '@dcloudio/uni-app';
import {
fetchDelCart,
fetchCartList
} from '@/api/goods';
import {
fetchConfig
} from '@/api/index';
import {
navigateTo
} from '@/utils/helper';
const audit = ref(true);
const selectedGoodsIds = ref([]);
const goods_cart_ids = ref([]);
const cart_txt = ref('')
const goods_list = reactive([]);
const toggle_all_val = ref(false);
const confirmDel = id => {
uni.showModal({
content: '确定要删除吗?',
success(res) {
if (res.confirm) {
delGoodsCart(id);
}
},
});
};
const delGoodsCart = id => {
fetchDelCart(id).then(res => {
let tmp_goods_list = goods_list.filter(item => item.goods_id !== id);
goods_list.length = 0;
Object.assign(goods_list, tmp_goods_list);
uni.setTabBarBadge({
index: 1,
text: goods_list.length.toString()
})
});
};
const toggleAll = () => {
let goods_ids = goods_list.reduce((acc, item) => {
if ('goods_id' in item) {
acc.push(item.goods_id);
}
return acc;
}, []);
if (toggle_all_val.value === true) {
selectedGoodsIds.value = goods_ids;
} else {
selectedGoodsIds.value.length = 0;
}
};
const submitOrderGL = () =>{
uni.showToast({
title: '仓管已收到清单',
icon: 'none',
});
return;
}
const submitOrder = () => {
if (selectedGoodsIds.value.length === 0) {
uni.showToast({
title: '请选择商品',
icon: 'none',
});
return;
}
navigateTo('/pages/order/preview/index?ids=' + selectedGoodsIds.value + '&from=cart');
};
const init = () => {
console.log("手机购物车初始化");
// 加载配置
fetchConfig().then(res => {
audit.value = (res.audit === "true");
console.log('audit', audit.value);
console.log(res.cart_txt);
cart_txt.value = res.cart_txt
})
// 进来购物车就清空已经选择的
selectedGoodsIds.value = [];
toggle_all_val.value = false;
console.log("手机购物车选中商品ids", selectedGoodsIds.value);
goods_list.length = 0;
fetchCartList().then(res => {
Object.assign(goods_list, res.list);
uni.setTabBarBadge({
index: 1,
text: goods_list.length.toString()
})
});
};
onMounted(() => {
// 进入购物车就清空已经选择的
// selectedGoodsIds.value = [];
// toggle_all_val.value = false;
// console.log('1111', selectedGoodsIds.value);
init();
});
onShow(() => {
console.log("onshow");
init();
});
// 计算总价格
const total_price = computed(() => {
let total_price = 0;
console.log('goods_list', goods_list);
goods_list.forEach((item, idx) => {
if (selectedGoodsIds.value.includes(item.goods_id)) {
total_price = parseFloat(total_price) + parseFloat(item.goods_house.goods_price);
}
});
return total_price;
});
</script>
<style scoped lang="scss">
.content {
display: flex;
flex-direction: column;
/* align-items: center; */
// justify-content: center;
background-color: #f2f3f5;
padding: 20rpx;
// height: calc(100% - 140rpx);
}
.fixed_footer {
position: fixed;
bottom: 0;
left: 0;
height: 100rpx;
background: #fff;
width: calc(100% - 40rpx);
display: flex;
align-items: center;
justify-content: space-between;
margin: 0 auto;
padding: 10rpx 20rpx;
.price {
display: flex;
justify-content: center;
align-items: center;
}
}
.cart-goods-list {
background: #fff;
display: flex;
height: calc(100vh - 230rpx);
gap: 30rpx;
flex-direction: column;
border-radius: 10rpx;
--nut-checkbox-label-margin-left: 0rpx;
--nut-checkbox-margin-right: 0rpx;
overflow-y: auto;
// padding-bottom: 20rpx;
.cart-goods {
display: flex;
align-items: center;
gap: 30rpx;
width: calc(100% - 40rpx);
padding: 20rpx;
background: #fff;
margin-top: 20rpx;
.goods-img {
flex-shrink: 0;
width: 140rpx;
height: 140rpx;
border-radius: 10rpx;
}
.middle {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
justify-content: center;
gap: 5rpx;
width: 100%;
.middle-header {
display: flex;
gap: 10rpx;
.title {
font-size: 30rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
flex: 1;
min-width: 0;
}
}
.middle-footer {
display: flex;
flex-direction: row;
align-items: center;
gap: 20rpx;
.countdown {
display: flex;
align-items: center;
--nut-countdown-color: #000;
--nut-countdown-font-size: 26rpx;
.t {
color: #000;
font-size: 26rpx;
}
}
}
}
// 删除按钮
.goods-del-btn {
// width: 140rpx;
height: 100%;
color: #fa2c19;
display: flex;
justify-content: center;
align-items: center;
}
}
}
.touch-dom {
width: 100rpx;
// height: 100rpx;
background: #f52222;
border-radius: 10rpx;
display: flex;
justify-content: center;
align-items: center;
}
</style>

View File

@@ -1,429 +0,0 @@
<template>
<view class="page-content">
<nut-searchbar shape="square" placeholder="请输入商品串号" clearable v-model="search_val" input-background="#eee" @search="onSearch"
@clear="onClear">
<template #rightout>
<nut-icon @click="onScan" name="scan2" size="30" custom-color="#000000" />
</template>
</nut-searchbar>
<view v-if="goods_ids_with_goods_no_list.length > 0" class="list">
<view @click="getGoodsDetail(item.goods_id)" class="list-item" :key="idx"
v-for="(item,idx) in goods_ids_with_goods_no_list">
{{ item.goods_no }}
</view>
</view>
<view v-if="is_show_detail" style=" padding: 20rpx;">
<nut-form>
<nut-form-item label="名称">
<nut-input v-model="form.goods_name" class="nut-input-text" placeholder="请输入名称" type="text" />
</nut-form-item>
<nut-form-item label="价格">
<nut-input v-model="form.goods_price" class="nut-input-text" placeholder="请输入价格" type="nubmer" />
</nut-form-item>
<nut-form-item label="串号">
<nut-input v-model="form.goods_no" class="nut-input-text" placeholder="请输入串号" type="text" readonly disabled/>
</nut-form-item>
<nut-form-item label="介绍">
<nut-textarea v-model="form.content" autosize placeholder="请输入介绍" type="text" />
</nut-form-item>
<!-- <nut-form-item label="上架人">
<nut-input v-model="form.add_person" class="nut-input-text" placeholder="请输入上架人" type="text" />
</nut-form-item> -->
<!-- <nut-form-item label="排序">
<nut-input v-model="form.goods_sort" class="nut-input-text" placeholder="请输入排序" type="number" />
</nut-form-item> -->
<!-- <nut-form-item label="状态">
<nut-radio-group direction="horizontal" v-model="form.goods_status">
<nut-radio label="10">上架</nut-radio>
<nut-radio label="20">下架</nut-radio>
</nut-radio-group>
</nut-form-item> -->
<nut-form-item>
<template v-slot:label>成色</template>
<template v-slot:default>
<view style="color: black;" @click="show_degree_popup = true">
<text>{{form.degree_name}}</text>
</view>
</template>
</nut-form-item>
<nut-form-item>
<template v-slot:label>机型</template>
<template v-slot:default>
<view style="color: black;" @click="show_product_cascader = true">
<text>{{form.type_name}},{{form.brand_name}},{{form.product_name}}</text>
</view>
</template>
</nut-form-item>
<nut-form-item>
<template v-slot:label>商品图片</template>
<template v-slot:default>
<shmily-drag-image v-model="form.images" :number=9 :add-image="addGoodsImg"
keyName="file_path"></shmily-drag-image></template>
</nut-form-item>
<nut-form-item>
<template v-slot:label>验机报告</template>
<template v-slot:default>
<view @click="show_report_tags_popup = true">
<text>点击勾选</text>
</view>
</template>
</nut-form-item>
<view style="align-items: center;text-align: center; padding: 20rpx 0rpx;">
<nut-button type="primary" @click="onSubmit">
保存修改
</nut-button>
</view>
</nut-form>
</view>
<nut-popup :custom-style="{ height: '50%' }" v-model:visible="show_report_tags_popup" position="bottom"
safe-area-inset-bottom>
<view style="margin-left: 200rpx; margin-top: 30rpx;">
<!-- <DaTree ref="DaTreeRef" :data="report_tags" childrenField="value_list" labelField="name" valueField="id"
defaultExpandAll showCheckbox @change="handleTreeChange">
</DaTree> -->
<DaTree ref="DaTreeRef" :data="report_tags" childrenField="value_list" labelField="name" valueField="id"
:defaultExpandedKeys="defaultExpandKeys" showCheckbox @change="handleTreeChange">
</DaTree>
</view>
</nut-popup>
<nut-popup v-model:visible="show_degree_popup" position="bottom" safe-area-inset-bottom>
<nut-picker v-model="popup_degree_val" :columns="filter_params.degree_list"
:field-names="{text:'degree_name',value:'degree_id'}" title="选择成色" @confirm="onConfirmDegree"
@cancel="show_degree_popup = false">
</nut-picker>
</nut-popup>
<nut-cascader title="机型选择" v-model:visible="show_product_cascader" v-model="cascader_product_val"
@change="onProductChange" @pathChange="onProcutPathChange" text-key="label" value-key="value"
:title-ellipsis="false" children-key="children" :options="filter_params.drop_down_options"></nut-cascader>
</view>
</template>
<script setup>
import {
onMounted,
reactive,
ref,
toValue
} from 'vue';
import {
fetchGoodsDetail,
fetchGoodsList,
fetchFilterParmas,
fetchGoodsReportTags,
} from '../../../api/goods';
import {
getUploadImageUrl
} from '../../../api/request';
import {
DaTree
} from '@/components/da-tree/index.vue'
import {
fetchControlEditGoods,
fetchControlGoodsDetail,
fetchGoodsListByGoodsNo,
} from '../../../api/control';
import {
clearReactiveData
} from '../../../utils/helper';
// 是否显示结果页
const is_show_detail = ref(false);
// 搜索内容
const search_val = ref('')
// 商品详情
const detail = reactive({})
const filter_params = reactive({})
const report_tags = reactive([])
const all_report_tag_ids = ref([])
// 默认展开
const defaultExpandKeys = ref([0])
// 显示机型选择
const show_product_cascader = ref(false)
// 显示成色
const show_degree_popup = ref(false)
// 显示验机报告
const show_report_tags_popup = ref(false)
const popup_degree_val = ref([])
const cascader_product_val = ref([])
const DaTreeRef = ref()
// 搜索串号列表
const goods_ids_with_goods_no_list = ref([])
// 搜索
const onSearch = () => {
goods_ids_with_goods_no_list.value = [];
is_show_detail.value = false;
fetchGoodsListByGoodsNo(search_val.value).then(res => {
goods_ids_with_goods_no_list.value = res || []
})
}
// 清空搜索内容
const onClear = () => {
search_val.value = ''
is_show_detail.value = false;
goods_ids_with_goods_no_list.value = []
}
const form = reactive({
goods_name: '',
goods_id: 0,
content: '',
goods_price: '',
goods_no: '',
images: [],
// add_person: '',
// goods_status: '10',
// goods_sort: 0,
degree_id: 0,
degree_name: '未选择',
type_id: 0,
type_name: '未选择',
brand_id: 0,
brand_name: '未选择',
product_id: 0,
product_name: '未选择',
report_tag_ids: []
})
// 获取商品详情
const getGoodsDetail = (id) => {
fetchControlGoodsDetail(id).then(res => {
// 显示商品详情
is_show_detail.value = true;
Object.assign(detail, res)
goods_ids_with_goods_no_list.value = []
form.goods_name = res.goods_name
form.goods_id = res.goods_id
form.content = res.content
form.goods_price = res.goods_price
form.goods_no = res.goods_no
// form.add_person = res.add_person
// form.goods_status = res.goods_status.value.toString()
// form.goods_sort = res.goods_sort
form.degree_id = res.degree?.degree_id ?? 0
form.degree_name = res.degree?.degree_name ?? '未选择'
form.type_id = res.type?.type_id ?? 0
form.type_name = res.type?.name ?? '未选择'
form.brand_id = res.brand?.brand_id ?? 0
form.brand_name = res.brand?.name ?? '未选择'
form.product_id = res.product?.product_id ?? 0
form.product_name = res.product?.name ?? '未选择'
form.images = []
DaTreeRef.value?.setCheckedKeys(all_report_tag_ids.value, false)
let tag_ids = (res.report_tag_ids?.split(',') || []).map(Number)
form.report_tag_ids = tag_ids
DaTreeRef.value?.setCheckedKeys(tag_ids, true)
popup_degree_val.value = [res.degree?.degree_id ?? 0]
cascader_product_val.value = [res.type?.type_id ?? 0, res.brand?.brand_id ?? 0, res.product?.product_id??0]
res.image?.forEach(item => {
form.images.push({
id: item.image_id,
file_path: item.file_path,
})
})
})
}
const onProductChange = (...args) => {
// console.log(0,...args)
// console.log(cascader_product_val)
}
const handleTreeChange = (allSelectedKeys, currentItem) => {
form.report_tag_ids = allSelectedKeys
// console.log('handleTreeChange ==>', allSelectedKeys, currentItem)
}
const onSubmit = () => {
fetchControlEditGoods(form).then(res => {
uni.showToast({
icon: 'none',
title: '成功'
})
setTimeout(() => {
uni.redirectTo({
url: '/pages/control/goods/index',
success: res => {},
fail: () => {},
complete: () => {}
});
}, 500)
})
}
const onProcutPathChange = (args) => {
console.log(args);
form.type_id = 0
form.type_name = ''
form.brand_id = 0
form.brand_name = ''
form.product_id = 0
form.product_name = ''
if (args.length >= 1 && args[0] !== null) {
form.type_id = args[0].value
form.type_name = args[0].text
}
if (args.length >= 2 && args[1] !== null) {
form.brand_id = args[1].value
form.brand_name = args[1].text
}
if (args.length >= 3 && args[2] !== null) {
form.product_id = args[2].value
form.product_name = args[2].text
}
}
const onConfirmDegree = () => {
form.degree_id = popup_degree_val.value[0]
filter_params.degree_list.forEach(item => {
if (item.degree_id === form.degree_id) {
form.degree_name = item.degree_name
}
})
show_degree_popup.value = false
}
// 扫码
const onScan = () => {
uni.scanCode({
onlyFromCamera: true,
success: (res) => {
form.goods_no = res.result
search_val.value = res.result
fetchGoodsListByGoodsNo(res.result).then(res => {
if (res.length >= 1) {
getGoodsDetail(res[0]?.goods_id)
}
})
},
fail: () => {
uni.showToast({
icon: 'none',
title: '扫码失败'
})
}
})
}
onMounted(() => {
fetchFilterParmas(1).then(res => {
Object.assign(filter_params, res)
filter_params.degree_list.unshift({
degree_id: 0,
degree_name: '未选择'
})
console.log(filter_params)
})
fetchGoodsReportTags().then(res => {
Object.assign(report_tags, res)
console.log('report_tags',report_tags);
all_report_tag_ids.value = []
report_tags.forEach((report_tag, i) => {
all_report_tag_ids.value.push(report_tag.id)
console.log(report_tag.value_list)
report_tag.value_list.forEach((val, ii) => {
all_report_tag_ids.value.push(val.id)
val.value_list.forEach((vv, iii) => {
all_report_tag_ids.value.push(vv.id)
})
})
})
console.log(all_report_tag_ids)
})
})
// 上传商品图片
const addGoodsImg = () => {
uni.chooseImage({
count: 9 - (detail.image?.length || 0),
sourceType: ['album', 'camera'],
success: res => {
res.tempFiles.forEach(file => {
uni.uploadFile({
url: getUploadImageUrl(),
filePath: file.path,
name: 'iFile',
formData: {
group_id: 1,
},
success: (res) => {
let data = JSON.parse(res.data).data
form.images.push({
id: parseInt(data.file_id),
file_path: data.file_path,
})
}
})
})
}
})
}
</script>
<style lang="scss" scoped>
.page-content {
min-height: 100vh;
background-color: #f2f3f5;
}
.list {
display: flex;
justify-content: center;
flex-direction: column;
background: #ffffff;
align-items: center;
max-height: 300rpx;
overflow-y: scroll;
padding: 10px;
.list-item {
border-bottom: 1px solid #eee;
padding: 20rpx 10rpx;
}
}
</style>

View File

@@ -1,283 +0,0 @@
<template>
<page-meta :page-style="'overflow:'+(is_lock_scroll?'hidden':'visible')"></page-meta>
<IndexCustomNavigationbar :statusBarHeight="statusBarHeight" :windowWidth="windowWidth"
:navbarHeight="navbarHeight" :onIndexPageSearch="onIndexPageSearch" :onIndexPageClear="onIndexPageClear"/>
<view class="content">
<view class="index-content-inner"></view>
<view class="index-class-card-box">
<view class="index-class-card-body">
<view class="navbar-list-content">
<view v-for="(item,idx) in nav_list" :key="idx" class="navbar-item-content"
@click="navigateTo('/pages/mall/index/index?brand_id='+item.brand_id + '&type_id=' + item.type_id)">
<image class="navbar-item-content-img" :src='item.image?.file_path'></image>
<view class="navbar-item-content-name">{{item.name}}</view>
</view>
</view>
</view>
</view>
<view class="index-kefu-card-box">
<view class="index-kefu-card-header">
<text class="index-kefu-card-header-title">远阳数码售后</text>
<text class="index-kefu-card-header-text">7天内有质量问题可退可换</text>
<text class="index-kefu-card-header-text">30天内有质量问题只换不修</text>
</view>
<view class="index-kefu-card-body">
<view class="index-kefu-item">
<view class="index-kefu-item-profile">
<image class="index-kefu-item-profile-avatar" @click="showWechatImg()" src="/static/wechat.jpg"
alt="陈汉彬" />
<view class="index-kefu-item-profile-info">
<view class="index-kefu-item-profile-info-name-phone">
<text class="index-kefu-item-profile-info-name-phone-name">陈一鸣</text>
<text class="index-kefu-item-profile-info-name-phone-phone">13156107870</text>
</view>
<view class="index-kefu-item-profile-info-address">山东省济南市天桥区凤凰广场B座803室</view>
</view>
</view>
</view>
<view class="index-kefu-item">
<view class="index-kefu-item-profile">
<image class="index-kefu-item-profile-avatar" @click="showWechatImg()" src="/static/wechat.jpg"
alt="陈汉阳" />
<view class="index-kefu-item-profile-info">
<view class="index-kefu-item-profile-info-name-phone">
<text class="index-kefu-item-profile-info-name-phone-name">陈一鸣</text>
<text class="index-kefu-item-profile-info-name-phone-phone">13156107870</text>
</view>
<view class="index-kefu-item-profile-info-address">山东省济南市天桥区凤凰广场B座803室</view>
</view>
</view>
</view>
</view>
</view>
</view>
<MallFilter :offset-top="topHeight" :is-lock-scroll="isLockScroll" ref="mall_filter" :offset="mall_offset" />
<!-- <TabBar v-model="currentTab" /> -->
</template>
<script setup>
// import TabBar from '@/components/TabBar/TabBar.vue';
import {
nextTick,
onMounted,
reactive,
ref
} from 'vue'
import IndexCustomNavigationbar from '@/components/index-custom-navigationbar/index.vue'
import MallFilter from '@/components/mall-filter/index.vue'
import {
fetchFilterParmas,
fetchNavList
} from '../../api'
import {
navigateTo,
showWechatImg
} from '@/utils/helper.ts'
import {
onPullDownRefresh,
onShareAppMessage
} from '@dcloudio/uni-app'
const statusBarHeight = uni.getWindowInfo().statusBarHeight
const windowWidth = uni.getWindowInfo().windowWidth
const menu_top = ref(0)
const menu_bottom = ref(0)
// #ifdef MP
const menu_button_info = uni.getMenuButtonBoundingClientRect()
menu_top.value = menu_button_info.top
menu_bottom.value = menu_button_info.bottom
// #endif
const navbarHeight = (menu_bottom.value - statusBarHeight) + (menu_top.value - statusBarHeight)
const topHeight = navbarHeight + statusBarHeight + 50
// const topHeight = navbarHeight + statusBarHeight
const nav_list = reactive([])
const mall_filter = ref(null)
const mall_offset = ref(0)
// 默认选中第一个tab
const currentTab = ref(0);
onMounted(() => {
mall_offset.value = topHeight + 48
fetchNavList().then(res => {
Object.assign(nav_list, res.list)
})
})
onPullDownRefresh(async () => {
await mall_filter.value?.refresh()
uni.stopPullDownRefresh()
})
const onIndexPageSearch = (val) => {
mall_filter.value?.filterGoodsName(val)
}
const onIndexPageClear = () => {
mall_filter.value?.filterGoodsName('')
}
const is_lock_scroll = ref(false)
const isLockScroll = (e) => {
is_lock_scroll.value = e
/* uni.pageScrollTo({
scrollTop: uni.getWindowInfo().windowHeight - mall_filter.value.offsetTop,
duration: 0
}) */
}
</script>
<style scoped lang="scss">
.content {
display: flex;
flex-direction: column;
/* align-items: center; */
justify-content: center;
background-color: #f2f3f5;
}
.index-content-inner {
padding-top: 10px
}
.index-class-card-box {
flex: 1;
border-radius: 10px;
margin: 0 10px 10px;
}
.index-class-card-body {
background-color: #fff;
background: #fff;
border-radius: 10px;
}
.navbar-list-content {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}
.navbar-item-content {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
width: 20%;
padding-top: 10px;
padding-bottom: 10px;
.navbar-item-content-img {
width: 37px;
height: 37px;
}
.navbar-item-content-name {
font-size: 10px;
}
}
/*************客服******************/
.index-kefu-card-box {
flex: 1;
border-radius: 10px;
margin: 0 10px 10px;
overflow: hidden;
background-image: -webkit-gradient(linear, left top, right top, from(#8d7bfb), color-stop(30%, #8d7bfb), to(#8d7bfb));
background-image: -webkit-linear-gradient(left, #8d7bfb, #8d7bfb 30%, #8d7bfb);
background-image: linear-gradient(90deg, #8d7bfb 0, #8d7bfb 30%, #8d7bfb);
}
.index-kefu-card-header {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
/* 垂直居中 */
padding: 5px 20px
}
.index-kefu-card-header-title {
font-size: 32rpx;
font-weight: bold;
color: white;
}
.index-kefu-card-header-text {
flex: 1;
font-size: 13px;
color: #e7e8ea;
}
.index-kefu-card-body {
display: flex;
justify-content: space-between;
overflow: hidden;
padding: 10px;
background-color: white;
background: #fff;
border-radius: 10px;
}
.index-kefu-item {
width: 49%;
box-sizing: border-box;
display: flex;
flex-direction: column;
background-color: #e7e8ea;
padding: 5px;
border-radius: 5px;
}
.index-kefu-item-profile {
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
}
.index-kefu-item-profile-avatar {
width: 45px;
height: 45px;
border-radius: 10%;
}
.index-kefu-item-profile-info {
text-align: left;
margin-left: 5px;
}
.index-kefu-item-profile-info-name-phone {
display: flex;
align-items: center;
}
.index-kefu-item-profile-info-name-phone-name {
font-size: 13px;
color: #333;
margin-right: 3px;
}
.index-kefu-item-profile-info-name-phone-phone {
font-size: 11px;
color: #888;
}
.index-kefu-item-profile-info-address {
font-size: 10px;
color: #888;
}
/*************客服******************/
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -1,717 +0,0 @@
<template>
<view class="page-content">
<z-paging ref="paging" :refresher-enabled="false" :auto-clean-list-when-reload="false"
:auto-scroll-to-top-when-reload="false" v-model="dataList" @query="queryList">
<view style="z-index: 10000;position: sticky;" :style="'top:0px'">
<view class="top-bar">
<nut-button type="primary" block plain @click="navigateTo('/pages/index/orderAdd')">
新增订单
</nut-button>
</view>
<!-- <nut-searchbar placeholder="请输入商品名称" clearable v-model="state.search_val" input-background="#eee"
@search="onSearch" @clear="onClear">
<template #rightout>
<nut-button type="primary" @click="onSearch">搜索</nut-button>
</template>
</nut-searchbar> -->
</view>
<view class="goods-item" v-for="(item, index) in dataList" :key="index">
<view class="goods-item-image">
<!-- @click="showGoodsImages(item)" -->
<image class="goods-item-image-img" :src="getImg(item)" @click="navigateTo('/pages/config/goodsDetail?id=' + item.goods_id)"
mode="scaleToFill">
</image>
</view>
<view class="goods-item-content">
<!-- @click="navigateTo('/pages/control/goods/edit?id=' + item.goods_id)" -->
<view class="goods-item-content-header">
<nut-tag custom-color="#1a1a1a">{{ item.degree.degree_name }}</nut-tag>
<view>{{item.goods_name}}</view>
</view>
<!-- @click="navigateTo('/pages/control/goods/edit?id=' + item.goods_id)" -->
<view class="goods-item-content-body">
<view class="goods-item-content-body-desc">
{{item.content}}
</view>
</view>
<view class="goods-item-content-footer">
<view style="font-size: 24rpx;color: red;">
<text>¥{{item.goods_price}}</text>
</view>
<view style="font-size: 24rpx;">
状态:<text>{{item.status.text}}</text>
</view>
<view class="goods-item-content-footer-btn">
<nut-button size="small" type="primary"
v-if="item.status.value == 10 || item.status.value == 20"
@click="navigateTo('/pages/config/goodsEdit?id=' + item.goods_id)">
编辑商品
</nut-button>
<nut-button size="small" type="primary" v-if="item.status.value == 40 "
@click="navigateTo('/pages/config/goodsEdit?id=' + item.goods_id)">
售后(重新上架)
</nut-button>
</view>
</view>
</view>
</view>
</z-paging>
</view>
</template>
<script setup>
import {
ref,
reactive,
onMounted,
computed
} from 'vue'
import {
onLoad,
onShow,
} from '@dcloudio/uni-app'
// import {
// fetchFilterParmas
// } from '@/api/goods';
import {
fetchFilterParmas,
fetchSysGoodsList
} from '@/api/goods';
import {
navigateTo,
// switchTab,
// goToOtherMiniProgram
} from '@/utils/helper';
// 显示商品图片
const showGoodsImages = (goods) => {
console.log(goods);
uni.previewImage({
// current: index, // 指定当前显示的图片索引
urls: goods?.image.map(e => {
return e.file_path
}),
});
}
const getImg = (goods) => {
const url = goods?.image?.[0]?.file_path
return url ? url + '?imageView2/1/w/200/h/200' : ''
}
// zp
const paging = ref(null);
// 商品列表
const dataList = ref([]);
// 价格排序
const selectPriceSortRef = ref(null);
// 成色选择
const selectDegreeRef = ref(null);
// 机型选择
const selectProductRef = ref(null)
const state = reactive({
type_params: [], // 产品类型
drop_down_options: [], // 产品类型下的品牌列表
o_drop_down_options: [],
// 价格排序
price_sort_params: [{
text: '默认排序',
value: ''
},
{
text: '价格升序',
value: 'ascend'
},
{
text: '价格降序',
value: 'descend'
}
],
// 成色所有选项
degree_params: [],
price_sort: '',
price_sort_name: "默认排序",
degree_ids: [],
degree_name: "成色",
product_name: "机型",
type_id: 1, // 产品类型id 默认 1 手机
type_name: '手机',
brand_id: 0, // 品牌id // 默认 0 全部
brand_name: '全部',
product_ids: [0], // 机型ids 默认 0 全部
search_val: '', // 搜索
});
// 搜索
const onSearch = () => {
console.log("搜索:", state.search_val);
paging.value.reload();
}
// 清空搜索框
const onClear = () => {
console.log("搜索:", state.search_val);
paging.value.reload();
}
// 机型重置
const onResetProduct = () => {
console.log("重置产品");
state.type_id = 1
state.type_name = '手机'
state.brand_id = 0
state.brand_name = '全部'
state.product_ids = [0]
state.product_name = '机型'
}
// 机型确定
const onConfirmProduct = () => {
console.log("当前产品类型", {
"type_id": state.type_id,
"type_name": state.type_name,
"brand_id": state.brand_id,
"brand_name": state.brand_name,
"product_ids": state.product_ids,
});
selectProductRef.value?.toggle(false);
// 4. 刷新数据
paging.value.reload();
}
// 选择机型
const selectProduct = (product) => {
if (product.value === 0) {
state.product_ids = [0]
} else {
state.product_ids = state.product_ids.filter(e => e != 0)
// 判断是否存在
const index = state.product_ids.indexOf(product.value);
if (index > -1) {
state.product_ids.splice(index, 1); // 存在则删除
if (state.product_ids.length === 0) {
state.product_ids = [0]
}
} else {
state.product_ids.push(product.value); // 新增
}
}
console.log(product);
}
const productOptions = computed(() => {
return state?.o_drop_down_options[state.type_id]?.children[state.brand_id].children
})
// 选择品牌
const selectBrand = (brand) => {
console.log(brand);
// 选中的品牌id
state.brand_id = brand.value;
state.brand_name = brand.label
// 品牌下的产品ids
state.product_ids = [0];
state.product_name = brand.label
}
// 选择type
const selectType = (type) => {
console.log(type);
// 选中产品类型id
state.type_id = type.type_id;
state.type_name = type.name;
// 选中的品牌id
state.brand_id = 0;
state.brand_name = '全部';
// 品牌下的产品ids
state.product_ids = [0];
}
// 选择价格排序
const selectPriceSort = (item) => {
if (state.price_sort !== item.value) {
state.price_sort = item.value
state.price_sort_name = item.text
} else {
state.price_sort_name = '默认排序'
state.price_sort = ''
}
selectPriceSortRef.value?.toggle(false);
// 4. 刷新数据
paging.value.reload();
};
// 选择成色
const selectDegree = (item) => {
const index = state.degree_ids.indexOf(item.value);
if (index > -1) {
state.degree_ids.splice(index, 1);
} else {
state.degree_ids.push(item.value);
}
if (state.degree_ids.length > 0) {
state.degree_name = '已选' + state.degree_ids.length.toString() + '项'
} else {
state.degree_name = '成色'
}
}
// 重置选择成色
const onResetDegree = () => {
state.degree_ids = [];
state.degree_name = '成色'
selectDegreeRef.value?.toggle(false);
// 4. 刷新数据
paging.value.reload();
}
// 确认选择成色
const onConfirmDegree = () => {
if (state.degree_ids.length > 0) {
state.degree_name = '已选' + state.degree_ids.length.toString() + '项'
} else {
state.degree_name = '成色'
}
selectDegreeRef.value?.toggle(false);
// 4. 刷新数据
paging.value.reload();
}
// 获取列表
const queryList = (pageNo, pageSize) => {
const params = {
pageSize,
page: pageNo,
price_sort: state.price_sort,
degree_ids: state.degree_ids,
type_id: state.type_id,
brand_id: state.brand_id,
product_ids: state.product_ids,
search: state.search_val,
}
console.log(params);
fetchSysGoodsList(params).then(res => {
console.log('res=>', res.list);
paging.value.complete(res.list);
}).catch(res => {
paging.value.complete(false);
});
};
const init = () => {
console.log('init111');
// 加载默认筛选项内容
fetchFilterParmas().then(res => {
console.log(res);
// 处理成色
let degree_params = res.degree_list;
state.degree_params = degree_params.reduce((it, cit) => {
it.push({
text: cit.degree_name,
value: cit.degree_id
});
return it;
}, state.degree_params) || [];
// 产品类型
state.type_params = res.type_list
// 产品下品牌列表
state.drop_down_options = res.drop_down_options
state.o_drop_down_options = res.o_drop_down_options
})
}
onShow(() => {
console.log("onshow---");
console.log('paging.value', paging.value);
if (paging.value) {
// paging.value.pageNo = 1;
paging.value.refresh();
// paging.value.refreshToPage(1)
// paging.value.reload();
}
});
onMounted(() => {
init();
})
</script>
<style scoped lang="scss">
.page-content {
min-height: 100vh;
background-color: #f2f3f5;
--nut-menu-bar-box-shadow: none;
--nut-menu-item-content-padding: 20rpx;
--nut-menu-item-content-max-height: 900rpx;
// --nut-searchbar-input-padding:5px 0 5px 13px;
--nut-searchbar-input-height: 40px;
}
:deep(.titleClass) .nut-menu__title-text {
font-size: 30rpx;
font-weight: bold;
color: black;
}
.top-bar {
background: #fff;
// padding: 20rpx;
align-items: center;
text-align: center;
padding: 20rpx 60rpx;
// display: flex;
// justify-content: space-between;
// border-top: 1px solid #eee;
// position: sticky;
// bottom: 0;
// z-index: 999;
}
.goods-item {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 20rpx;
background-color: #ffffff;
// border-radius: 20rpx;
margin-bottom: 20rpx;
gap: 20rpx;
.goods-item-image {
width: 180rpx;
height: 180rpx;
.goods-item-image-img {
width: 100%;
height: 100%;
}
}
.goods-item-content {
// width: 100%;
display: flex;
flex: 1;
flex-direction: column;
justify-content: space-between;
/* 首尾贴边,中间均分 */
// gap: 15px;
.goods-item-content-header {
display: flex;
align-items: center;
padding: 6rpx 0;
gap: 20rpx;
}
.goods-item-content-body {
padding: 6rpx 0;
.goods-item-content-body-desc {
color: #7c7c7c;
font-size: 26rpx;
/* 关键属性 */
display: -webkit-box;
/* 使用弹性盒子布局 */
-webkit-box-orient: vertical;
/* 垂直方向排列 */
-webkit-line-clamp: 2;
/* 限制显示两行 */
overflow: hidden;
/* 超出部分隐藏 */
text-overflow: ellipsis;
/* 超出时显示省略号 */
}
}
.goods-item-content-stock {
display: flex;
justify-content: space-between;
.goods-item-content-stock-desc {
font-size: 26rpx;
color: #999999;
}
.goods-item-content-status-desc {
font-size: 26rpx;
color: red;
}
}
.goods-item-content-footer {
padding: 6rpx 0;
display: flex;
justify-content: space-between;
align-items: center;
// width: 100%;
// flex-direction: row;
.goods-item-content-footer-btn {
display: flex;
justify-content: space-between;
align-items: center;
gap: 10rpx;
.share-btn {
border-radius: 50rpx;
border: 2rpx solid red;
font-size: 26rpx;
align-items: center;
height: 54rpx;
color: red;
display: flex;
justify-content: center;
}
}
}
}
}
.filter-types {
display: flex;
justify-content: flex-start;
flex-direction: row;
align-items: center;
overflow: auto;
gap: 10rpx;
padding: 10rpx;
// position: fixed;
// top: 0;
height: 60rpx;
// z-index: 9999;
background-color: #fff;
border-bottom: 2rpx solid gainsboro;
border-top: 2rpx solid gainsboro;
.filter-type-inner {
align-items: center;
background-color: rgba(0, 0, 0, .05);
border-radius: 16rpx;
box-sizing: border-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
flex: 0 0 auto;
font-size: 28rpx;
gap: 15rpx;
padding: 10rpx 20rpx;
// image {
// height: 22px;
// width: 22px;
// }
}
.filter-type-inner.active {
background-color: rgba(250, 44, 25, .1);
color: var(--nutui-color-primary);
}
}
.tabs-container {
display: flex;
.tab-pane-inner {
height: 600rpx;
}
.tabs-inner {
overflow-y: scroll;
height: 600rpx;
width: 160rpx;
background-color: #F5F5F5;
.tab-inner {
display: flex;
height: 60rpx;
padding: 10rpx;
font-size: 28rpx;
display: flex;
align-items: center;
background: #F5F5F5;
text {
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: center;
}
}
.tab-inner-active {
// background: #FFF;
background-color: rgba(250, 44, 25, .1);
color: var(--nutui-color-primary);
}
}
}
.degree-inner {
display: flex;
flex: 1;
flex-wrap: wrap;
// gap: 20rpx;
gap: 10rpx;
// padding: 11px;
width: 100%;
margin-bottom: 60rpx;
}
.degree-item {
align-items: center;
background-color: rgba(0, 0, 0, .05);
border-radius: 10rpx;
box-sizing: border-box;
display: flex;
flex: 0 0 auto;
font-size: 26rpx;
gap: 10rpx;
justify-content: center;
min-height: 80rpx;
width: calc(50% - 10rpx);
}
.degree-item.active {
background-color: rgba(250, 44, 25, .1);
color: var(--nutui-color-primary);
}
.product-btns {
display: flex;
width: 100%;
padding: 20rpx 0;
// border-bottom: 2rpx solid gainsboro;
// border-top: 2rpx solid gainsboro;
.reset {
flex: 1;
}
.confirm {
flex: 2;
}
}
.degree-btns {
display: flex;
width: 100%;
.reset {
flex: 1;
/* 重置按钮占 1 份 */
}
.confirm {
flex: 2;
/* 确认按钮占 2 份 */
}
}
.main-nav-container {
display: flex;
justify-content: space-between;
background-color: #fff;
padding: 20rpx;
}
.nav-button {
display: flex;
align-items: center;
width: 45%;
height: 160rpx;
border-radius: 20rpx;
overflow: hidden;
padding: 0 10rpx;
}
.phone-button {
background: linear-gradient(135deg, #6a5ae0, #8d7bfb);
color: white;
}
.parts-button {
background: linear-gradient(135deg, #ff6b6b, #ee5253);
color: white;
}
.nav-button-bg {
position: absolute;
right: 0;
top: 0;
height: 100%;
width: 50%;
opacity: 0.2;
object-fit: cover;
}
.nav-button-icon {
width: 90rpx;
height: 90rpx;
margin-right: 20rpx;
// border-radius: 20rpx;
z-index: 2;
}
.nav-button-content {
z-index: 2;
display: flex;
flex-direction: column;
}
.nav-button-title {
font-size: 34rpx;
font-weight: bold;
margin-bottom: 8rpx;
}
.nav-button-desc {
font-size: 24rpx;
opacity: 0.85;
}
</style>

View File

@@ -1,618 +0,0 @@
<template>
<view class="page-content">
<view style=" padding: 10rpx;">
<view class="title">基础台费 </view>
<nut-form>
<!-- <nut-form-item>
<template v-slot:label>房间</template>
<template v-slot:default>
<view style="color: black;" @click="visibleRoomsPopup = true">
<text>{{form.room_name}}</text>
</view>
</template>
</nut-form-item> -->
<!-- 台费类型套餐支付状态 三者在同一行布局 -->
<view class="inline-form">
<!-- 台费类型选择 -->
<nut-form-item label-position="top">
<template v-slot:label>结算方式</template>
<template v-slot:default>
<view style="color: black;" @click="visibleFeeTypePopup = true">
<text>{{form.fee_type_name}}</text>
</view>
</template>
</nut-form-item>
<!-- 套餐选择 -->
<nut-form-item label-position="top" v-if="form.fee_type === 1 || form.fee_type === 2">
<template v-slot:label>选择团购</template>
<template v-slot:default>
<view style="color: black;" @click="visibleCombosPopup = true">
<text>{{form.fee_combo_name}}</text>
</view>
</template>
</nut-form-item>
<!-- 金额输入框 -->
<nut-form-item label-position="top" v-else>
<template v-slot:label>线下收款</template>
<template v-slot:default>
<nut-input v-model="form.fee_amount" placeholder="请输入金额" type="number" />
</template>
</nut-form-item>
<!-- 支付状态选择 -->
<nut-form-item label-position="top">
<template v-slot:label>支付状态</template>
<template v-slot:default>
<view style="color: black;" @click="openPayStatusPopup('fee')">
<text>{{form.fee_pay_status_txt}}</text>
</view>
</template>
</nut-form-item>
</view>
</nut-form>
<view class="title">超时收费 </view>
<nut-form>
<!-- 台费类型套餐支付状态 三者在同一行布局 -->
<view class="inline-form">
<!-- 台费类型选择 -->
<nut-form-item label-position="top">
<template v-slot:label>时长(小时)</template>
<template v-slot:default>
<nut-input v-model="form.often" placeholder="请输入小时" type="number" />
</template>
</nut-form-item>
<!-- 金额输入框 -->
<nut-form-item label-position="top">
<template v-slot:label>超时金额</template>
<template v-slot:default>
<nut-input v-model="form.over_amount" placeholder="请输入金额" type="number" />
</template>
</nut-form-item>
<!-- 支付状态选择 -->
<nut-form-item label-position="top">
<template v-slot:label>支付状态</template>
<template v-slot:default>
<view style="color: black;" @click="openPayStatusPopup('over')">
<text>{{form.over_pay_status_txt}}</text>
</view>
</template>
</nut-form-item>
</view>
</nut-form>
<view class="title">商品 </view>
<view class="top-bar">
<nut-button type="primary" plain size="small" @click="addGoods">新增商品</nut-button>
</view>
<nut-form>
<!-- 台费类型套餐支付状态 三者在同一行布局 -->
<view class="inline-goods-form" v-for="(item, index) in orderGoods" :key="index">
<view class="form-row">
<!-- 台费类型选择 -->
<nut-form-item label-position="top">
<template v-slot:label>商品</template>
<template v-slot:default>
<view style="color: black;" @click="visibleGoodsCascader = true;goodsIndex = index">
<text v-if="item.goods_type_name && item.goods_name">
{{ item.goods_type_name }} - {{ item.goods_name }}
</text>
<text v-else>请选择商品</text>
</view>
</template>
</nut-form-item>
<!-- 套餐选择 -->
<nut-form-item label-position="top">
<template v-slot:label>售价</template>
<template v-slot:default>
<view style="color: black;">
<text>{{item.goods_price}}</text>
</view>
</template>
</nut-form-item>
</view>
<view class="form-row">
<!-- 支付状态选择 -->
<nut-form-item label-position="top">
<template v-slot:label>支付状态</template>
<template v-slot:default>
<view style="color: black;" @click="openPayStatusPopup('goods',index)">
<text>{{item.goods_pay_status_txt}}</text>
</view>
</template>
</nut-form-item>
<!-- 套餐选择 -->
<nut-form-item label-position="top">
<template v-slot:label>操作</template>
<template v-slot:default>
<view>
<nut-button type="danger" size="mini" @click="removeGoods(index)">删除商品</nut-button>
</view>
</template>
</nut-form-item>
</view>
</view>
</nut-form>
<view class="title">订单优惠 </view>
<nut-form>
<nut-form-item>
<template v-slot:label>优惠金额</template>
<template v-slot:default>
<nut-input v-model="form.discount_amount" placeholder="请输入金额" type="number" />
</template>
</nut-form-item>
</nut-form>
<view style="align-items: center;text-align: center; padding: 20rpx 60rpx;">
<nut-button type="primary" block @click="submitForm">
保存订单
</nut-button>
</view>
</view>
<nut-cascader title="商品选择" v-model:visible="visibleGoodsCascader" v-model="cascaderGoodsValue"
@change="onGoodsChange" @pathChange="onGoodsPathChange" text-key="label" value-key="value"
children-key="children" :options="selectGoods" :title-ellipsis="false" @open="onOpenGoodsCascader"
@close="onCloseGoodsCascader"></nut-cascader>
<!-- v-model="popupPaymentStatusVal" -->
<nut-popup v-model:visible="visiblePaymentStatusPopup" position="bottom" safe-area-inset-bottom>
<nut-picker :columns="paymentStatuses" :field-names="{text:'label',value:'value'}" title="选择支付状态"
@confirm="onConfirmPaymentStatus" @cancel="visiblePaymentStatusPopup = false">
</nut-picker>
</nut-popup>
<nut-popup v-model:visible="visibleCombosPopup" position="bottom" safe-area-inset-bottom>
<nut-picker v-model="popupCombosVal" :columns="combos" :field-names="{text:'label',value:'value'}"
title="选择团购套餐" @confirm="onConfirmCombos" @cancel="visibleCombosPopup = false">
</nut-picker>
</nut-popup>
<!-- v-model="popupFeeTypeVal" -->
<nut-popup v-model:visible="visibleFeeTypePopup" position="bottom" safe-area-inset-bottom>
<nut-picker :columns="feeTypes" :field-names="{text:'label',value:'value'}" title="选择结算方式"
@confirm="onConfirmFeeType" @cancel="visibleFeeTypePopup = false">
</nut-picker>
</nut-popup>
<!-- <nut-popup v-model:visible="visibleRoomsPopup" position="bottom" safe-area-inset-bottom>
<nut-picker v-model="popupRoomsVal" :columns="rooms" :field-names="{text:'label',value:'value'}"
title="选择房间" @confirm="onConfirmRoom" @cancel="visibleRoomsPopup = false">
</nut-picker>
</nut-popup> -->
</view>
</template>
<script setup>
import {
computed,
onMounted,
reactive,
ref,
toValue
} from 'vue';
import {
fetchCombos,
fetchGoods,
} from '@/api/index';
// // 选择房间弹窗
// const visibleRoomsPopup = ref(false);
// // 选中的房间
// const popupRoomsVal = ref([])
// // 房间列表
// const rooms = [{
// value: 1,
// label: '房间 101'
// },
// {
// value: 2,
// label: '房间 102'
// },
// {
// value: 3,
// label: '房间 103'
// }
// ];
// // 选择房间
// const onConfirmRoom = (selectedValue) => {
// console.log(selectedValue);
// form.room_name = selectedValue.selectedOptions[0].label
// form.room_id = selectedValue.selectedOptions[0].value
// console.log(form);
// visibleRoomsPopup.value = false
// }
// 选择房间弹窗
const visibleFeeTypePopup = ref(false);
// 台费结算类型
// const popupFeeTypeVal = ref([])
// 台费类型选择列表
const feeTypes = [{
value: 1,
label: '美团'
},
{
value: 2,
label: '抖音'
},
{
value: 3,
label: '线下'
}
];
// 选择房间
const onConfirmFeeType = (selectedValue) => {
console.log(selectedValue);
form.fee_type_name = selectedValue.selectedOptions[0].label
form.fee_type = selectedValue.selectedOptions[0].value
console.log(form);
if (form.fee_type !== 3) {
getCombos();
}
visibleFeeTypePopup.value = false
}
const getCombos = () => {
console.log("获取套餐");
fetchCombos({
type: form.fee_type
}).then(res => {
console.log(res);
combos.value = res;
})
}
// 选择套餐弹窗
const visibleCombosPopup = ref(false);
// 选中的套餐
const popupCombosVal = ref([])
// 套餐列表
const combos = ref([]);
// 选择套餐
const onConfirmCombos = (selectedValue) => {
console.log(selectedValue);
form.fee_combo_name = selectedValue.selectedOptions[0].label
form.fee_combo_id = selectedValue.selectedOptions[0].value
console.log(form);
visibleCombosPopup.value = false
}
// 支付状态弹窗
const visiblePaymentStatusPopup = ref(false);
// 选中的支付状态
const popupPaymentStatusVal = ref([])
// 支付类型
const popupPaymentTypeVal = ref('')
// 支付状态
const paymentStatuses = [{
value: 1,
label: '已付'
},
{
value: 2,
label: '未付'
},
{
value: 3,
label: '赠送'
}
];
const openPayStatusPopup = (type, index = -1) => {
popupPaymentTypeVal.value = type
goodsPayIndex.value = index // 只有type = goods 生效
visiblePaymentStatusPopup.value = true
console.log(type);
}
const onConfirmPaymentStatus = (selectedValue) => {
if (popupPaymentTypeVal.value == 'fee') {
form.fee_pay_status_txt = selectedValue.selectedOptions[0].label
form.payment_status = selectedValue.selectedOptions[0].value
}
if (popupPaymentTypeVal.value == 'over') {
form.over_pay_status_txt = selectedValue.selectedOptions[0].label
form.over_pay_status = selectedValue.selectedOptions[0].value
}
if (popupPaymentTypeVal.value == 'goods' && goodsPayIndex.value >= 0) {
console.log("处理商品支付状态", goodsPayIndex.value);
orderGoods.value[goodsPayIndex.value].goods_pay_status_txt = selectedValue.selectedOptions[0].label
orderGoods.value[goodsPayIndex.value].goods_pay_status = selectedValue.selectedOptions[0].value
}
console.log(form);
visiblePaymentStatusPopup.value = false
popupPaymentTypeVal.value = ''
goodsPayIndex.value = -1
}
// 订单商品列表
const orderGoods = ref([
// {
// goods_type_name: null,
// goods_type_id: null,
// goods_name: null,
// goods_id: null,
// goods_price: null,
// goods_pay_status: 0,
// goods_pay_status_txt: "请选择",
// cascader_val: []
// },
])
// 当前操作的商品
const goodsPayIndex = ref(0)
// 当前操作的商品
const goodsIndex = ref(0)
// 添加规则
const addGoods = () => {
console.log(orderGoods.value);
orderGoods.value.push({
goods_type_name: null,
goods_type_id: null,
goods_name: null,
goods_id: null,
goods_price: null,
goods_pay_status: 0,
goods_pay_status_txt: "请选择",
cascader_val: []
})
}
// 删除商品
const removeGoods = (index) => {
orderGoods.value.splice(index, 1)
}
// 显示商品选择
const visibleGoodsCascader = ref(false)
// 商品选中
const cascaderGoodsValue = computed(() => {
let cascader_val = [];
if (goodsIndex.value >= 0) {
return orderGoods.value[goodsIndex.value]?.cascader_val ?? []
} else {
return cascader_val;
}
});
const onGoodsChange = (...args) => {
console.log("onGoodsChange", args);
}
// 选择商品
const onGoodsPathChange = (args) => {
console.log("onGoodsPathChange", args);
console.log("goodsIndex", goodsIndex.value);
console.log("orderGoods.value[goodsIndex.value]", orderGoods.value[goodsIndex.value]);
orderGoods.value[goodsIndex.value].goods_type_name = null
orderGoods.value[goodsIndex.value].goods_type_id = null
orderGoods.value[goodsIndex.value].goods_name = null
orderGoods.value[goodsIndex.value].goods_id = null
orderGoods.value[goodsIndex.value].goods_price = null
if (args.length >= 1 && args[0] !== null) {
orderGoods.value[goodsIndex.value].goods_type_name = args[0].text
orderGoods.value[goodsIndex.value].goods_type_id = args[0].value
}
if (args.length >= 2 && args[1] !== null) {
orderGoods.value[goodsIndex.value].goods_name = args[1].text
orderGoods.value[goodsIndex.value].goods_id = args[1].value
orderGoods.value[goodsIndex.value].goods_price = args[1].goods_price
}
console.log("orderGoods.value[goodsIndex.value]", orderGoods.value[goodsIndex.value]);
}
const onCloseGoodsCascader = () => {
console.log("onCloseGoodsCascader");
console.log("goodsIndex.value", goodsIndex.value);
if (orderGoods.value[goodsIndex.value].goods_type_id && orderGoods.value[goodsIndex.value].goods_id) {
orderGoods.value[goodsIndex.value].cascader_val = [
orderGoods.value[goodsIndex.value].goods_type_id,
orderGoods.value[goodsIndex.value].goods_id
]
}
goodsIndex.value = 0
console.log("goodsIndex.value", goodsIndex.value);
}
const onOpenGoodsCascader = () => {
console.log("onOpenGoodsCascader");
console.log("goodsIndex.value", goodsIndex.value);
}
const form = reactive({
// room_id: 0,
// room_name: '选择房间',
fee_type: 0,
fee_type_name: '选择方式',
fee_combo_id: 0, // 套餐费用ID
fee_combo_name: '请选择', // 套餐费用名称
fee_amount: null, // 线下支付费用
fee_pay_status: 0, // 费用支付状态
fee_pay_status_txt: '请选择', // 费用支付状态
over_often: null, // 超时小时
over_amount: null, // 超时金额
over_pay_status: 0, // 超时支付状态
over_pay_status_txt: "请选择", // 超时支付状态
discount_amount: null, // 优惠金额
})
const selectGoods = ref([])
onMounted(() => {
fetchGoods().then(res => {
selectGoods.value = res;
})
})
// 提交表单
const submitForm = () => {
// const formData = {
// room: room.value,
// feeType: feeType.value,
// selectedPackage: selectedPackage.value,
// amount: amount.value,
// paymentStatus: paymentStatus.value
// };
console.log('提交的订单数据:', orderGoods.value);
};
</script>
<style lang="scss" scoped>
.page-content {
min-height: 100vh;
background-color: #f2f3f5;
}
.title {
padding: 0 20rpx;
margin-top: 20rpx;
margin-bottom: 20rpx;
font-size: 28rpx;
// font-weight: 400;
color: #909ca4;
}
.inline-form {
display: flex;
justify-content: space-between;
gap: 10rpx;
/* 在元素之间添加间距 */
}
.top-bar {
background: #fff;
padding: 20rpx;
display: flex;
justify-content: space-between;
border-top: 1px solid #eee;
// position: sticky;
// bottom: 0;
// z-index: 999;
}
/* 每个商品项容器 */
.inline-goods-form {
// box-sizing: border-box;
}
/* 行容器 */
.form-row {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 20rpx;
margin-bottom: 20rpx;
}
// .inline-goods-form {
// display: flex;
// justify-content: space-between;
// gap: 10rpx;
// /* 在元素之间添加间距 */
// }
// .inline-goods-form {
// display: flex;
// flex-wrap: nowrap;
// /* 防止换行 */
// align-items: flex-start;
// gap: 10rpx;
// margin-bottom: 20rpx;
// padding: 20rpx;
// background-color: #f8f9fa;
// border-radius: 16rpx;
// box-sizing: border-box;
// overflow: hidden;
// /* 防止溢出 */
// }
// /* 关键为每个表单项设置适当的flex属性 */
// .inline-goods-form .nut-form-item {
// flex: 1; /* 平均分配空间 */
// min-width: 0; /* 重要:允许内容收缩 */
// max-width: 100%; /* 防止溢出 */
// word-break: break-word; /* 文本换行 */
// overflow: hidden; /* 隐藏溢出内容 */
// }
// /* 确保内部元素不会撑开 */
// .inline-goods-form .nut-form-item__body {
// width: 100%;
// overflow: hidden;
// }
// /* 调整按钮大小 */
// .inline-goods-form .nut-button {
// max-width: 100%;
// white-space: nowrap;
// overflow: hidden;
// text-overflow: ellipsis;
// }
// .inline-goods-form {
// display: flex;
// flex-wrap: wrap; /* 确保元素在不足的宽度时换行 */
// justify-content: space-between;
// gap: 10rpx; /* 设置每个表单项之间的间距 */
// width: 100%;
// // box-sizing: border-box;
// }
// .inline-goods-form-item-50 {
// flex: 0 0 50% !important; /* 第一个表单项占 50% */
// }
// .inline-goods-form-item-25 {
// flex: 0 0 25% !important; /* 其他两个表单项各占 25% */
// }
// .inline-item {
// flex: 1;
// display: flex;
// flex-direction: column;
// }
</style>

View File

@@ -1,379 +0,0 @@
<template>
<view class="content">
<nut-watermark v-if="detail.status?.value === 10" class="mark1" :z-index="1" content="此商品已下架"></nut-watermark>
<nut-watermark v-if="detail.status?.value === 30" class="mark1" :z-index="1" content="此商品已锁定"></nut-watermark>
<nut-watermark v-if="detail.status?.value === 40" class="mark1" :z-index="1" content="此商品已售出"></nut-watermark>
<!-- <nut-watermark v-if="detail.is_locked" class="mark1" :z-index="1" content="此商品被锁单"></nut-watermark> -->
<swiper class="swiper" circular indicator-dots autoplay>
<swiper-item @click="showGoodsImages(idx)" v-for="(item,idx) in detail.image" :key="idx">
<image :src="item.file_path" mode="aspectFill"></image>
</swiper-item>
</swiper>
<view class='goods_info'>
<nut-cell-group>
<view class="price">
<text class="unit"></text>
<text class="value">{{detail.goods_price}}</text>
</view>
</nut-cell-group>
<nut-cell-group>
<view class="name">
<view class="top">
<view class="tag">
<text>{{detail.degree?.degree_name}}</text>
</view>
<text class="title">{{detail.goods_name}}</text>
</view>
<view>
<text class="info">{{detail.content}}</text>
</view>
</view>
</nut-cell-group>
<view class="service">
<view class="info">
<text class="title">服务</text>
<text class="value">{{serviceTxt}}</text>
</view>
</view>
</view>
<view class="bottom-action">
<view class="bottom-action-icon">
<button plain open-type="contact" style="border:none;border-width: 0;" class="bottom-action-icon-item">
<nut-icon name='service'></nut-icon>
<text>客服</text>
</button>
<!-- <button plain style="border:none;border-width: 0;" class="bottom-action-icon-item"
@click="switchTab('/pages/cart/index')">
<nut-icon name='cart'></nut-icon>
<text>购物车</text>
</button> -->
</view>
<!-- detail.goods_status?.value === 10 && -->
<!-- @click="navigateTo('/pages/order/preview?ids=' + detail.goods_id+'&from=item')" -->
<view class="bottom-action-btn" v-if="detail.status?.value === 20">
<nut-button type="primary" v-if="!audit" @click="buyNow(detail.goods_id)">立即购买</nut-button>
</view>
<view class="bottom-action-btn" v-else>
<nut-button plain v-if="!audit">暂不支持购买</nut-button>
</view>
</view>
</view>
</template>
<script setup>
import {
reactive,
ref
} from 'vue';
import {
navigateTo,
switchTab,
goToLoginPage
} from '@/utils/helper';
import {
onShareAppMessage,
onShareTimeline,
onLoad
} from '@dcloudio/uni-app'
import {
fetchGoodsDetail,
} from '@/api/goods';
import {
fetchGetConfig,
} from '@/api/config';
// 审核模式 默认开启 true
const audit = ref(true);
const serviceTxt = ref('')
const id = ref(0)
const detail = reactive({})
onLoad(options => {
console.log('init');
// 获取配置
getConfig()
// 获取商品详情
id.value = options.id
fetchGoodsDetail(id.value).then(res => {
Object.assign(detail, res)
})
})
// 立即购买
const buyNow = (goodsId) => {
let token = uni.getStorageSync('token')
if (token) {
console.log("已经登陆");
uni.navigateTo({
url: `/pages/order/preview?ids=${goodsId}&from=item`
})
} else {
goToLoginPage(); // 未登陆
}
}
// 获取配置
const getConfig = () => {
fetchGetConfig().then(res => {
console.log('getConfig=====>', res)
audit.value = res.appConfig.is_audit == 1
serviceTxt.value = res.appConfig.service_txt
})
}
// 分享给朋友圈
onShareTimeline((res) => {
return {
title: detail.goods_name,
path: '/pages/mall/detail?id=' + detail.goods_id,
imageUrl: detail.image[0].file_path
};
})
// 分享
onShareAppMessage((res) => {
return {
title: detail.goods_name,
path: '/pages/mall/detail?id=' + detail.goods_id,
imageUrl: detail.image[0].file_path
}
})
// 显示图片
const showGoodsImages = (index) => {
uni.previewImage({
current: index, // 指定当前显示的图片索引
urls: detail.image.map(e => {
return e.file_path
}),
});
}
</script>
<style scoped lang="scss">
.bottom-action {
position: fixed;
bottom: 0;
left: 0;
height: 50px;
background: #fff;
width: calc(100% - 20px);
display: flex;
align-items: center;
justify-content: space-between;
margin: 0 auto;
padding: 5px 10px;
.bottom-action-icon {
align-items: center;
display: flex;
justify-content: center;
.bottom-action-icon-item {
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
text {
color: rgba(0, 0, 0, .5);
font-size: 11px;
}
}
}
.bottom-action-btn {
-ms-flex-align: center;
-ms-flex-pack: end;
-webkit-align-items: center;
align-items: center;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
gap: 5px;
-webkit-justify-content: flex-end;
justify-content: flex-end;
}
}
.content {
display: flex;
flex-direction: column;
min-height: calc(100vh - 50px); //100vh;
/* align-items: center; */
// justify-content: center;
background-color: #f2f3f5;
// height: calc(100% - 50px);
--nut-cell-group-title-color: #000;
--nut-collapse-item-padding: 10px 10px 10px 10px;
--nut-collapse-wrapper-content-padding: 10px 10px 10px 10px;
--nut-collapse-item-color: #000;
padding-bottom: 50px;
}
.report-inner {
display: flex;
flex-direction: column;
gap: 5px;
.report-item {
.report-item-name {
color: rgba(0, 0, 0, .9);
font-weight: 700;
}
.report-item-content {
display: flex;
flex-wrap: wrap;
.report-item-content-item {
padding-top: 2px;
padding-bottom: 2px;
width: 50%;
display: flex;
align-items: center;
}
}
}
}
.count-item {
display: flex;
justify-content: center;
align-items: center;
gap: 2px;
}
.swiper {
width: 100%;
height: 414px;
image {
width: 100%;
height: 100%;
}
}
.goods_info {
padding: 5px;
color: #000;
.price {
border-radius: 5px;
padding: 10px;
background: #fff;
.unit {
font-size: 12px;
}
.value {
font-size: 24px;
}
}
.name {
border-radius: 5px;
padding: 10px;
background: #fff;
display: flex;
gap: 5px;
flex-direction: column;
.top {
display: flex;
gap: 5px;
.tag {
background: #000;
padding: 1px 2px;
justify-content: center;
align-items: center;
display: flex;
border-radius: 2px;
text {
font-size: 10px;
color: #fff;
}
}
.title {
font-size: 16px;
}
}
.info {
color: rgba(0, 0, 0, .7);
font-size: 13px;
}
}
.service {
border-radius: 5px;
padding: 10px;
background: #fff;
display: flex;
align-items: center;
justify-content: space-between;
.info {
display: flex;
flex-direction: column;
justify-content: center;
gap: 5px;
.title {
font-size: 16px;
}
.value {
color: rgba(0, 0, 0, .7);
font-size: 13px;
}
}
.right_icon {
background-color: currentColor;
mask: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiPjxwYXRoIGZpbGw9IiMxQTFBMUEiIGQ9Ik0zNTMuODMgMTU4LjE3YTQyLjY3IDQyLjY3IDAgMSAxIDYwLjM0LTYwLjM0bDM4NCAzODRhNDIuNjcgNDIuNjcgMCAwIDEgMCA2MC4zNmwtMzg0IDM4NGE0Mi42NyA0Mi42NyAwIDEgMS02MC4zNC02MC4zNkw3MDcuNjcgNTEyeiIvPjwvc3ZnPg==') 0 0/100% 100% no-repeat;
width: 12px;
height: 12px;
}
}
.report {
border-radius: 5px;
padding: 1px;
background: #fff;
}
}
</style>

View File

@@ -1,579 +0,0 @@
<template>
<view class="content">
<nut-watermark v-if="detail.shelves_status?.value === 10" class="mark1" :z-index="1"
content="此商品已下架"></nut-watermark>
<nut-watermark v-if="detail.shelves_status?.value === 30" class="mark1" :z-index="1"
content="此商品已售出"></nut-watermark>
<nut-watermark v-if="detail.is_locked" class="mark1" :z-index="1" content="此商品被锁单"></nut-watermark>
<swiper class="swiper" circular indicator-dots autoplay>
<swiper-item @click="showGoodsImages(idx)" v-for="(item,idx) in detail.image" :key="idx">
<image :src="item.file_path" mode="aspectFill"></image>
</swiper-item>
</swiper>
<view class='goods_info'>
<nut-cell-group>
<view class="price">
<text class="unit"></text>
<text class="value">{{getPrice(detail)}}</text>
</view>
</nut-cell-group>
<nut-cell-group>
<view class="name">
<view class="top">
<view class="tag">
<text>{{detail.degree?.degree_name}}</text>
</view>
<text class="title">{{detail.goods_name}}</text>
</view>
<view>
<text class="info">{{detail.content}}</text>
</view>
</view>
</nut-cell-group>
<view class="service">
<view class="info">
<text class="title">服务</text>
<text class="value">{{detail.service_txt}}</text>
</view>
</view>
<nut-cell-group title="验机报告">
<nut-collapse v-model="activeNames" @change="onChange">
<nut-collapse-item :name="1" icon="rect-down">
<template v-slot:title>
瑕疵项
</template>
<template v-slot:value>
<view class="count-item">
<nut-icon name="tips" size="12"
custom-color='#ff3535'></nut-icon><text>{{detail.report_tags?.bad_count}}</text>
</view>
</template>
<view class="report-inner">
<view class="report-item" v-for="(item,idx) in detail?.report_tags?.bad" :key="idx">
<view class="report-item-name">{{item.name}}</view>
<view class="report-item-content">
<view class="report-item-content-item" v-for="(iitem,iidx) in item.value_list"
:key="iidx">
<nut-icon name="tips" size="12" custom-color="#ff3535"></nut-icon>
<text>{{iitem.name}}</text>
</view>
</view>
</view>
</view>
</nut-collapse-item>
<nut-collapse-item :name="2" icon="rect-down">
<template v-slot:title>
正常项
</template>
<template v-slot:value>
<view class="count-item">
<nut-icon name="success" size="12" custom-color="#5dcc30"></nut-icon>
<text>{{detail.report_tags?.ok_count}}</text>
</view>
</template>
<view class="report-inner">
<view class="report-item" v-for="(item,idx) in detail?.report_tags?.ok" :key="idx">
<view class="report-item-name">{{item.name}}</view>
<view class="report-item-content">
<view class="report-item-content-item" v-for="(iitem,iidx) in item.value_list"
:key="iidx">
<nut-icon name="success" size="12" custom-color="#5dcc30"></nut-icon>
<text>{{iitem.name}}</text>
</view>
</view>
</view>
</view>
</nut-collapse-item>
</nut-collapse>
</nut-cell-group>
</view>
<view class="bottom-action">
<view class="bottom-action-icon">
<button plain open-type="contact" style="border:none;border-width: 0;" class="bottom-action-icon-item">
<nut-icon name='service'></nut-icon>
<text>客服</text>
</button>
</view>
<!-- detail.goods_status?.value === 10 && -->
<view class="bottom-action-btn"
v-if="detail.shelves_status?.value === 20 && !goods_cart_ids.includes(detail.goods_id) ">
<!-- @click="navigateTo('/pages/order/housePreview?ids=' + detail.goods_id+'&from=item')" -->
<nut-button type="primary" v-if="!audit" @click="buyNow(detail.goods_id)">立即购买</nut-button>
</view>
<!-- detail.goods_status?.value === 10 && -->
<!-- <view class="bottom-action-btn"
v-else-if="detail.shelves_status?.value === 20 && goods_cart_ids.includes(detail.goods_id) && user_goods_cart_ids.includes(detail.goods_id)">
<nut-button plain>已在购物车</nut-button>
</view> -->
<view class="bottom-action-btn" v-else>
<nut-button plain v-if="!audit">已锁定</nut-button>
</view>
</view>
</view>
</template>
<script setup>
import {
reactive,
ref
} from 'vue';
import {
navigateTo,
switchTab,
goToLoginPage
} from '@/utils/helper';
import {
onShareAppMessage,
onShareTimeline,
onLoad
} from '@dcloudio/uni-app'
import {
houseFetchCartGoodsIds,
houseFetchGoodsDetail
} from '@/api/house_goods';
import {
// fetchOrderbuyNow,
houseFetchCheckGoods
} from '@/api/house_order';
import {
fetchGetConfig,
fetchGetPriceRules,
} from '@/api/config';
// 审核模式
const audit = ref(true);
// 是否开启整仓调价
const isWarehouse = ref(false)
// 单个商品规则列表
const singleRule = ref([])
// 价格区间规则列表
const rangeRule = ref([])
// 整仓规则
const warehouseRule = reactive({
val: 0,
val_type: 1,
})
// 获取全部调价规则
const GetPriceRules = () => {
fetchGetPriceRules().then(res => {
console.log('res', res);
// 区间调价
rangeRule.value = res?.range ?? [];
// 单机调价
singleRule.value = res?.single ?? [];
// 整仓调价
Object.assign(warehouseRule, res?.warehouse?.[0] ?? {
val: 0,
val_type: 1,
})
})
}
// 获取价格
const getPrice = (goods) => {
// 判断是否开启整仓调价
if (isWarehouse.value) {
console.log("开启整仓调价");
// 查找单机器加价规则
const list = singleRule.value || singleRule; // 兼容 ref 和 reactive
// 根据 product_id == goods_id 找对应规则
const rule = list.find(item => item.product_id === goods.goods_id);
if (rule) {
// 存在单机加价规则
const basePrice = Number(goods.goods_price);
const val = Number(rule.val);
let finalPrice = basePrice;
// val_type 处理
if (rule.val_type == 1) {
finalPrice = basePrice + val; // 固定加价
} else if (rule.val_type == 2) {
finalPrice = basePrice + (basePrice * val / 100); // 按百分比加
}
return finalPrice.toFixed(2); // 保留两位小数
} else {
// 不存在则使用整仓加价
const basePrice = Number(goods.goods_price);
const val = Number(warehouseRule.val);
let finalPrice = basePrice;
// val_type 处理
if (warehouseRule.val_type == 1) {
finalPrice = basePrice + val; // 固定加价
} else if (warehouseRule.val_type == 2) {
finalPrice = basePrice + (basePrice * val / 100); // 按百分比加
}
return finalPrice.toFixed(2); // 保留两位小数
}
} else {
console.log("未开启整仓调价");
// 查找单机器加价规则
const singleRuleList = singleRule.value || singleRule; // 兼容 ref 和 reactive
// 根据 product_id == goods_id 找对应规则
const oneRule = singleRuleList.find(item => item.product_id === goods.goods_id);
if (oneRule) {
// 存在单机加价规则
const basePrice = Number(goods.goods_price);
const val = Number(oneRule.val);
let finalPrice = basePrice;
// val_type 处理
if (oneRule.val_type == 1) {
finalPrice = basePrice + val; // 固定加价
} else if (oneRule.val_type == 2) {
finalPrice = basePrice + (basePrice * val / 100); // 按百分比加
}
return finalPrice.toFixed(2); // 保留两位小数
} else {
// 不存在则使用区间加价
const basePrice = Number(goods.goods_price)
// // 查找区间加价规则
const rangeRulelist = rangeRule.value || rangeRule; // 兼容 ref 和 reactive
const quRule = rangeRulelist.find(item => {
const min = Number(item.min_price)
const max = Number(item.max_price)
return basePrice >= min && basePrice < max
}) || null
if (quRule) {
// 存在区间加价
const val = Number(quRule.val);
let finalPrice = basePrice;
// val_type 处理
if (quRule.val_type == 1) {
finalPrice = basePrice + val; // 固定加价
} else if (quRule.val_type == 2) {
finalPrice = basePrice + (basePrice * val / 100); // 按百分比加
}
return finalPrice.toFixed(2); // 保留两位小数
} else {
// 不存在区间加价
return basePrice
}
}
}
}
const id = ref(0)
const detail = reactive({})
// 用户购物车商品列表
const user_goods_cart_ids = ref([]);
// 全部购物车商品列表
const goods_cart_ids = ref([]);
// 立即购买
const buyNow = (goodsId) => {
let token = uni.getStorageSync('token')
if (token) {
// 检测是否可以购买
houseFetchCheckGoods({
goods_id: goodsId,
}).then(res => {
console.log(res);
console.log("已经登陆");
uni.navigateTo({
url: `/pages/order/housePreview?ids=${goodsId}&from=item`
})
});
} else {
goToLoginPage(); // 未登陆
}
}
// 获取配置
const getConfig = () => {
fetchGetConfig().then(res => {
console.log('getConfig=====>', res)
audit.value = res.appConfig.is_audit == 1
isWarehouse.value = res.appConfig.is_warehouse == 1
})
}
onLoad(options => {
console.log('init');
// 获取配置
getConfig()
GetPriceRules()
// 获取商品详情
id.value = options.id
houseFetchGoodsDetail(id.value).then(res => {
Object.assign(detail, res)
})
// 获取购买记录
houseFetchCartGoodsIds().then(res => {
console.log(res);
user_goods_cart_ids.value = res.user_cart_goods_ids;
goods_cart_ids.value = res.cart_goods_ids;
})
})
// 分享给朋友圈
onShareTimeline((res) => {
return {
title: detail.goods_name,
path: '/pages/mall/houseDetail?id=' + detail.goods_id,
imageUrl: detail.image[0].file_path
};
})
// 分享
onShareAppMessage((res) => {
return {
title: detail.goods_name,
path: '/pages/mall/houseDetail?id=' + detail.goods_id,
imageUrl: detail.image[0].file_path
}
})
const activeNames = ref([1, 2]);
const onChange = (modelValue, currName, status) => {
// currName: 当前操作的 collapse-item 的 name
// status: true 打开 false 关闭
console.log(modelValue, currName, status);
}
// 显示图片
const showGoodsImages = (index) => {
uni.previewImage({
current: index, // 指定当前显示的图片索引
urls: detail.image.map(e => {
return e.file_path
}),
});
}
</script>
<style scoped lang="scss">
.bottom-action {
position: fixed;
bottom: 0;
left: 0;
height: 50px;
background: #fff;
width: calc(100% - 20px);
display: flex;
align-items: center;
justify-content: space-between;
margin: 0 auto;
padding: 5px 10px;
.bottom-action-icon {
align-items: center;
display: flex;
justify-content: center;
.bottom-action-icon-item {
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
text {
color: rgba(0, 0, 0, .5);
font-size: 11px;
}
}
}
.bottom-action-btn {
-ms-flex-align: center;
-ms-flex-pack: end;
-webkit-align-items: center;
align-items: center;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
gap: 5px;
-webkit-justify-content: flex-end;
justify-content: flex-end;
}
}
.content {
display: flex;
flex-direction: column;
/* align-items: center; */
// justify-content: center;
background-color: #f2f3f5;
height: calc(100% - 50px);
--nut-cell-group-title-color: #000;
--nut-collapse-item-padding: 10px 10px 10px 10px;
--nut-collapse-wrapper-content-padding: 10px 10px 10px 10px;
--nut-collapse-item-color: #000;
padding-bottom: 50px;
}
.report-inner {
display: flex;
flex-direction: column;
gap: 5px;
.report-item {
.report-item-name {
color: rgba(0, 0, 0, .9);
font-weight: 700;
}
.report-item-content {
display: flex;
flex-wrap: wrap;
.report-item-content-item {
padding-top: 2px;
padding-bottom: 2px;
width: 50%;
display: flex;
align-items: center;
}
}
}
}
.count-item {
display: flex;
justify-content: center;
align-items: center;
gap: 2px;
}
.swiper {
width: 100%;
height: 414px;
image {
width: 100%;
height: 100%;
}
}
.goods_info {
padding: 5px;
color: #000;
.price {
border-radius: 5px;
padding: 10px;
background: #fff;
.unit {
font-size: 12px;
}
.value {
font-size: 24px;
}
}
.name {
border-radius: 5px;
padding: 10px;
background: #fff;
display: flex;
gap: 5px;
flex-direction: column;
.top {
display: flex;
gap: 5px;
.tag {
background: #000;
padding: 1px 2px;
justify-content: center;
align-items: center;
display: flex;
border-radius: 2px;
text {
font-size: 10px;
color: #fff;
}
}
.title {
font-size: 16px;
}
}
.info {
color: rgba(0, 0, 0, .7);
font-size: 13px;
}
}
.service {
border-radius: 5px;
padding: 10px;
background: #fff;
display: flex;
align-items: center;
justify-content: space-between;
.info {
display: flex;
flex-direction: column;
justify-content: center;
gap: 5px;
.title {
font-size: 16px;
}
.value {
color: rgba(0, 0, 0, .7);
font-size: 13px;
}
}
.right_icon {
background-color: currentColor;
mask: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiPjxwYXRoIGZpbGw9IiMxQTFBMUEiIGQ9Ik0zNTMuODMgMTU4LjE3YTQyLjY3IDQyLjY3IDAgMSAxIDYwLjM0LTYwLjM0bDM4NCAzODRhNDIuNjcgNDIuNjcgMCAwIDEgMCA2MC4zNmwtMzg0IDM4NGE0Mi42NyA0Mi42NyAwIDEgMS02MC4zNC02MC4zNkw3MDcuNjcgNTEyeiIvPjwvc3ZnPg==') 0 0/100% 100% no-repeat;
width: 12px;
height: 12px;
}
}
.report {
border-radius: 5px;
padding: 1px;
background: #fff;
}
}
</style>

View File

@@ -38,10 +38,10 @@
</view>
</view>
<view class="price" v-if="order?.fee_type?.value == 0 || order?.fee_type?.value == 3">
{{order?.fee_amount}}
¥{{order?.fee_amount}}
</view>
<view class="price" v-else-if="order?.fee_type?.value == 1 || order?.fee_type?.value == 2 ">
{{order?.fee_combo_price}}
¥{{order?.fee_combo_price}}
</view>
<view class="goods-pay-status">
{{order?.fee_pay_status?.text}}
@@ -56,7 +56,7 @@
</view>
</view>
<view class="price">
{{order?.over_amount}}
¥{{order?.over_amount}}
</view>
<view class="goods-pay-status">
{{order?.over_pay_status?.text}}
@@ -70,7 +70,7 @@
</view>
</view>
<view class="price">
{{goods?.goods_price}}
¥{{goods?.goods_price}}
</view>
<view class="goods-pay-status">
{{goods?.goods_pay_status_txt}}
@@ -78,8 +78,16 @@
</view>
<view class="footer">
<view class="order-inner-price">
<view>优惠:<nut-price :price="order.discount_amount" size="normal" :need-symbol="true" /></view>
<view>总计:<nut-price :price="order.total_price" size="normal" :need-symbol="true" /></view>
<view style="display: flex;">优惠
<view style="color: #fa2c19;font-size: 26rpx;">
¥{{order?.discount_amount}}
</view>
</view>
<view style="display: flex;">总计
<view style="color: #fa2c19;font-size: 26rpx;">
¥{{order?.discount_amount}}
</view>
</view>
</view>
<view v-if="order.remarks" style="padding-left:20rpx;font-size: 26rpx;">备注</view>
<view v-if="order.remarks" class="remarks">