完成京东购物新增

This commit is contained in:
tangxinyue 2026-04-08 18:32:10 +08:00
parent a2dc82ab4b
commit 8c3298af2a
8 changed files with 1015 additions and 326 deletions

View File

@ -7,7 +7,7 @@ export default {
},
onLaunch: function (options) {
console.log=()=>{}
// console.log=()=>{}
// === wgt ===
console.log('=== App Launch 开始 ===')
console.log('启动参数:', JSON.stringify(options))

View File

@ -8,12 +8,15 @@
<!-- 输入层 -->
<template v-if="type !== 'textarea'">
<input class="auto-input" :type="type" :value="modelValue" :placeholder="placeholder" :placeholder-style="placeholderStyle"
:style="[inputStyle, { width: inputWidth }]" @input="onInput" :maxlength="maxlength" />
:style="[inputStyle, { width: finalInputWidth }]" @input="onInput" :maxlength="maxlength" :focus="isFocus" @blur="onBlur" />
</template>
<template v-else>
<textarea class="auto-textarea" :value="modelValue" :placeholder="placeholder" :placeholder-style="placeholderStyle"
:style="[inputStyle]" @input="onInput" :maxlength="maxlength" auto-height />
:style="[inputStyle]" @input="onInput" :maxlength="maxlength" auto-height :focus="isFocus" @blur="onBlur" />
</template>
<!-- 编辑图标 -->
<image v-if="showEdit" class="edit-icon" src="/static/image/common/edit.png" @click="handleFocusIcon"></image>
</view>
</template>
@ -60,12 +63,28 @@ const props = defineProps({
extraWidth: {
type: Number,
default: 10 //
},
showEdit: {
type: Boolean,
default: false
}
});
const emit = defineEmits(['update:modelValue', 'change']);
const instance = getCurrentInstance();
const inputWidth = ref(props.minWidth);
//
const finalInputWidth = computed(() => {
// textarea 使
if (props.type === 'textarea') return '100%';
// class
const classStr = instance.proxy.$attrs.class || '';
if (classStr.includes('flex-1') || classStr.includes('w100')) {
return '100%';
}
return inputWidth.value;
});
const isFocus = ref(false);
const inputStyle = computed(() => ({
fontSize: props.fontSize,
@ -74,11 +93,29 @@ const inputStyle = computed(() => ({
fontFamily: 'inherit'
}));
/**
* 点击图标触发聚焦
*/
const handleFocusIcon = () => {
isFocus.value = false;
nextTick(() => {
isFocus.value = true;
});
};
/**
* 失去焦点处理
*/
const onBlur = () => {
isFocus.value = false;
};
/**
* 核心逻辑测量隐藏文本的物理宽度
*/
const updateWidth = () => {
if (props.type === 'textarea') return;
//
nextTick(() => {
const query = uni.createSelectorQuery().in(instance.proxy);
query.select('.measure-text').boundingClientRect(data => {
@ -114,11 +151,23 @@ onMounted(() => {
<style lang="less" scoped>
.auto-width-input-container {
position: relative;
display: inline-block;
display: inline-flex; //
align-items: center;
vertical-align: middle;
max-width: 100%;
flex-wrap: nowrap;
// flex-1 width: 100% flex
&.flex-1, &.w100 {
display: flex !important;
width: 100% !important;
}
&.is-textarea {
display: flex !important;
width: 100%;
align-items: flex-start;
flex-direction: row !important;
}
.measure-text {
@ -131,18 +180,34 @@ onMounted(() => {
min-width: v-bind('props.minWidth');
padding: 0;
margin: 0;
text-align: inherit; //
height: 1.4em; //
text-align: inherit;
height: 1.4em;
line-height: 1.4em;
flex-shrink: 0;
// input
& {
flex: 1;
}
}
.auto-textarea {
width: 100%;
flex: 1 !important;
width: 0 !important;
min-width: 0;
min-height: 1.4em;
padding: 0;
margin: 0;
line-height: 1.4em;
display: block;
}
.edit-icon {
width: 28rpx;
height: 28rpx;
margin-left: 8rpx;
flex-shrink: 0;
margin-top: 4rpx;
}
}
</style>

View File

@ -14,7 +14,7 @@
<view v-if="item.status === '等待付款'" class="status-warning">
<image style="width: 116rpx;height: 30rpx;" src="/static/image/shopping/jingdong/dengdaifukuan.png">
</image>
<text class="status-desc" v-if="item.statusDesc">{{ item.statusDesc }}</text>
<text class="status-desc" v-if="item.statusDesc">{{ formatStatusDesc(item.statusDesc) }}</text>
</view>
<text v-else class="status-text"
:class="{ red: item.statusColor === 'red' || item.status === '正在出库' || item.status === '商家备餐中' || item.status === '骑手到店取餐中' || item.status === '骑手已到店' }">{{
@ -87,8 +87,7 @@
<view class="product-price-box">
<view class="price-wrap wx-font-regular">
<text class="price-symbol"></text>
<text class="price-num">{{ item.price || (item.products && item.products[0] &&
item.products[0].price) }}</text>
<text class="price-num">{{ safeFormatPrice(item) }}</text>
</view>
<text class="product-count"
v-if="item.count || (item.products && item.products[0] && item.products[0].count)">{{
@ -162,6 +161,21 @@ const onLongPress = (e) => {
emit('longpress', { event: e, item: props.item });
};
const formatStatusDesc = (desc) => {
if (!desc || !desc.includes(' : ')) return desc;
const parts = desc.split(' : ');
if (parts.length >= 2) {
return `${parts[0]}${parts[1]}`;
}
return desc;
};
const safeFormatPrice = (item) => {
const val = item.price || (item.products && item.products[0] && item.products[0].price);
const num = Number(val);
return isNaN(num) ? '0.00' : num.toFixed(2);
};
const getButtons = (shopType, status, item) => {
const buttons = [];
if (status == '等待付款') {

View File

@ -27,7 +27,7 @@ export function createApp() {
const systemInfo = uni.getStorageSync('systemInfo') || {}
app.config.globalProperties.$system = systemInfo.platform == 'ios' ? 'iOS' : 'Android'
app.config.globalProperties.$systemInfo = systemInfo
uni.setStorageSync('version', '1.0.4.sp2')
uni.setStorageSync('version', '1.0.4.sp3')
app.config.globalProperties.$version = uni.getStorageSync('version')
app.use(globalMethods);
return {

View File

@ -275,16 +275,16 @@ const otherList = [{
name: "通话",
path: "/pages/common/call-and-message-entry/call-and-message-entry?type=call"
},
// {
// icon: "/static/image/index/qita/gouwu.png",
// name: "购物",
// path: "/pages/shopping/index"
// },
{
icon: "/static/image/index/qita/ranking.png",
name: "从夯倒拉排名",
path: "/pages/other/ranking/ranking"
},
{
icon: "/static/image/index/qita/gouwu.png",
name: "购物",
path: "/pages/shopping/index"
},
]
const data = reactive({

File diff suppressed because it is too large Load Diff

View File

@ -1,32 +1,33 @@
{
"shoppingClassfiy": {
"dengdaifukuan": {
"id": 8562245551,
"id": "",
"shopType": "self",
"shopName": "安野屋 (AARYE) 京联名哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈好梦",
"shopName": "",
"status": "等待付款",
"statusDesc": "18 : 25 : 46",
"consignee": "肖战",
"phone": "152633221112",
"fullAddress": "上海市浦东新区世纪大道123号",
"totalPrice": "69.00",
"carriage": "0.00",
"statusDesc": "",
"consignee": "",
"phone": "",
"fullAddress": "",
"totalPrice": "",
"carriage": "",
"products": [
{
"image": "",
"name": "哈哈哈哈哈",
"title": "安野屋AARYE红红火火恍恍惚惚哈哈哈哈哈好",
"desc": "联名哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈好梦",
"service": "无理由退货政策",
"price": "69.00",
"count": "1"
"name": "",
"title": "",
"desc": "",
"service": "",
"price": "",
"count": ""
}
],
"orderInfo": [
{
"label": "订单编号",
"key": "orderNumber",
"value": "8562245551"
"value": "",
"type": "number"
},
{
"label": "交易快照",
@ -46,7 +47,8 @@
{
"label": "下单时间",
"key": "orderTime",
"value": "2022-01-01 12:00:00"
"value": "",
"type": "time"
}
],
"sendType": [
@ -58,42 +60,48 @@
{
"label": "期望配送时间",
"key": "expectedDeliveryTime",
"value": "大王 122555662221555"
"value": " ",
"type": "timeRange"
},
{
"label": "收货方式",
"key": "shippingMethod",
"value": "送货上门"
"value": ""
}
],
"promoType": "text",
"promoHighlight": "白条支付券0.5元优惠券"
},
"zhengzaichuku": {
"id": 5504455,
"shopType": "none",
"shopName": "甜小南旗舰店",
"id": "",
"shopType": "self",
"shopName": "",
"status": "正在出库",
"trackingTitle": "仓库处理中",
"trackingDesc": "预计 3月12日24:00 前发货3月15日 24:00 前送达",
"trackingTime": "2026-03-10 15:14:30",
"trackingDesc": "",
"trackingDesc2": "",
"trackingTime": "",
"consignee": "",
"phone": "",
"fullAddress": "",
"totalPrice": "",
"carriage": "",
"products": [
{
"image": "/static/image/shopping/jingdong/product1.png",
"title": "安野哈哈哈哈哈哈哈哈哈哈哈哈好好",
"desc": "联名哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈好梦",
"tags": [
"无理由退货政策"
],
"price": "69.00",
"count": 1
"image": "",
"title": "",
"desc": "",
"service": "",
"price": "",
"count": ""
}
],
"orderInfo": [
{
"label": "订单编号",
"key": "orderNumber",
"value": "8562245551"
"value": "",
"type": "number"
},
{
"label": "交易快照",
@ -108,12 +116,13 @@
{
"label": "支付时间",
"key": "paymentTime",
"value": "2022-01-01 12:00:00"
"value": "",
"type": "time"
},
{
"label": "下单时间",
"key": "orderTime",
"value": "2022-01-01 12:00:00"
"value": ""
}
],
"sendType": [
@ -125,17 +134,18 @@
{
"label": "收货信息",
"key": "userInfo",
"value": "大王 122555662221555"
"value": ""
},
{
"label": "收货地址",
"key": "address",
"value": "哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈"
"value": ""
},
{
"label": "期望配送时间",
"key": "expectedDeliveryTime",
"value": "大王 122555662221555"
"value": "",
"type": "timeRange"
},
{
"label": "收货方式",
@ -147,31 +157,32 @@
"promoText": "告别凑单, 享免运优惠"
},
"yiqianshou": {
"id": 585552,
"id": "",
"shopType": "self",
"shopName": "甜小南旗舰店",
"shopName": "",
"status": "完成",
"statusColor": "gray",
"trackingTitle": "已签收",
"courier": "",
"trackingDesc": "您的订单已签收,可对快递员的服务进行评价或打赏哦~",
"trackingTime": "2026-03-10 15: 14: 30",
"trackingDesc2": "",
"trackingTime": "",
"products": [
{
"image": "/static/image/shopping/jingdong/product1.png",
"title": "安野哈哈哈哈哈哈哈哈哈哈哈哈好好",
"desc": "联名哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈好梦",
"tags": [
"无理由退货政策"
],
"price": "69.00",
"count": 1
"image": "",
"title": "",
"desc": "",
"service": "",
"price": "",
"count": ""
}
],
"orderInfo": [
{
"label": "订单编号",
"key": "orderNumber",
"value": "8562245551"
"value": "",
"type": "number"
},
{
"label": "交易快照",
@ -186,12 +197,12 @@
{
"label": "支付时间",
"key": "paymentTime",
"value": "2022-01-01 12:00:00"
"value": ""
},
{
"label": "下单时间",
"key": "orderTime",
"value": "2022-01-01 12:00:00"
"value": ""
}
],
"sendType": [
@ -203,7 +214,8 @@
{
"label": "期望配送时间",
"key": "expectedDeliveryTime",
"value": "大王 122555662221555"
"value": "",
"type": "timeRange"
},
{
"label": "收货方式",
@ -216,28 +228,27 @@
"hasMore": true
},
"wancheng": {
"id": 4545451,
"id": "",
"shopType": "jd",
"shopName": "甜小南旗舰店",
"shopName": "",
"status": "完成",
"statusColor": "gray",
"products": [
{
"image": "/static/image/shopping/jingdong/product1.png",
"title": "安野哈哈哈哈哈哈哈哈哈哈哈哈好好",
"desc": "联名哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈好梦",
"tags": [
"无理由退货政策"
],
"price": "69.00",
"count": 1
"image": "",
"title": "",
"desc": "",
"service": "",
"price": "",
"count": ""
}
],
"orderInfo": [
{
"label": "订单编号",
"key": "orderNumber",
"value": "8562245551"
"value": "",
"type": "number"
},
{
"label": "交易快照",
@ -252,12 +263,13 @@
{
"label": "支付时间",
"key": "paymentTime",
"value": "2022-01-01 12:00:00"
"value": "",
"type": "time"
},
{
"label": "下单时间",
"key": "orderTime",
"value": "2022-01-01 12:00:00"
"value": ""
}
],
"sendType": [
@ -269,39 +281,38 @@
{
"label": "收货信息",
"key": "userInfo",
"value": "大王 122555662221555"
"value": ""
},
{
"label": "收货地址",
"key": "address",
"value": "哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈"
"value": ""
}
],
"hasMore": true
},
"yiquxiao": {
"id": 1236524,
"id": "",
"shopType": "self",
"shopName": "甜小南旗舰店",
"shopName": "",
"status": "已取消",
"statusColor": "gray",
"products": [
{
"image": "/static/image/shopping/jingdong/product1.png",
"title": "安野哈哈哈哈哈哈哈哈哈哈哈哈好好",
"desc": "联名哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈好梦",
"tags": [
"无理由退货政策"
],
"price": "1669.00",
"count": 1
"image": "",
"title": "",
"desc": "",
"service": "",
"price": "",
"count": ""
}
],
"orderInfo": [
{
"label": "订单编号",
"key": "orderNumber",
"value": "8562245551"
"value": "",
"type": "number"
},
{
"label": "交易快照",
@ -321,7 +332,7 @@
{
"label": "下单时间",
"key": "orderTime",
"value": "2022-01-01 12:00:00"
"value": ""
}
],
"sendType": [
@ -333,7 +344,8 @@
{
"label": "期望配送时间",
"key": "expectedDeliveryTime",
"value": "大王 122555662221555"
"value": "",
"type": "timeRange"
},
{
"label": "收货方式",

View File

@ -78,6 +78,7 @@
<script setup>
import { ref, computed, onMounted, getCurrentInstance } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import ShoppingCard from '@/components/shopping/jingdong/shopping-card.vue';
import { util } from '@/utils/common.js';
@ -87,12 +88,20 @@ const actionMenuState = ref({ x: 0, y: 0, item: null });
//
const buttonGroup = [
{
name: "新增购物",
name: "新增购物订单",
click: () => {
uni.navigateTo({
url: '/pages/shopping/jingdong/add-order/add-order'
});
}
}, {
name: "新增秒送订单",
click: () => {
uni.showToast({
title: '开发中,敬请期待',
icon: 'none'
});
}
},
]
/**
@ -138,7 +147,7 @@ const editOrder = () => {
if (!item) return;
showActionMenu.value = false;
uni.navigateTo({
url: '/pages/shopping/jingdong/add-order/add-order?id=' + item.id + '&type=' + item.shopType
url: '/pages/shopping/jingdong/add-order/add-order?id=' + item.id + '&type=' + item.shopType + '&isEdit=true'
});
};
@ -163,12 +172,29 @@ const handleCardClick = (item) => {
*/
const handleDeleteOrder = () => {
const itemToDel = actionMenuState.value.item;
// 1.
const productImage = itemToDel?.products?.[0]?.image;
if (productImage && (productImage.includes('_doc/') || productImage.includes('_downloads/') || productImage.includes('store_'))) {
uni.removeSavedFile({
filePath: productImage,
success: () => console.log('图片文件删除成功:', productImage),
fail: (err) => console.error('图片文件删除失败:', err)
});
}
// 2.
const realIndex = mockOrderList.value.findIndex(item => item === itemToDel);
if (realIndex > -1) {
mockOrderList.value.splice(realIndex, 1);
//
uni.setStorageSync('jingdongShopping', mockOrderList.value);
}
showActionMenu.value = false;
uni.showToast({ title: '已删除', icon: 'none' });
uni.showToast({
title: '已删除',
icon: 'none'
});
};
const contentPaddingTop = ref('0px');
@ -196,6 +222,13 @@ onMounted(() => {
}, 100);
});
onShow(() => {
const cachedData = uni.getStorageSync('jingdongShopping');
if (cachedData && Array.isArray(cachedData)) {
mockOrderList.value = cachedData;
}
});
const currentTab = ref(0);
const tabList = ref([
{ name: '全部' },