完成京东购物新增

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) { onLaunch: function (options) {
console.log=()=>{} // console.log=()=>{}
// === wgt === // === wgt ===
console.log('=== App Launch 开始 ===') console.log('=== App Launch 开始 ===')
console.log('启动参数:', JSON.stringify(options)) console.log('启动参数:', JSON.stringify(options))

View File

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

View File

@ -14,7 +14,7 @@
<view v-if="item.status === '等待付款'" class="status-warning"> <view v-if="item.status === '等待付款'" class="status-warning">
<image style="width: 116rpx;height: 30rpx;" src="/static/image/shopping/jingdong/dengdaifukuan.png"> <image style="width: 116rpx;height: 30rpx;" src="/static/image/shopping/jingdong/dengdaifukuan.png">
</image> </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> </view>
<text v-else class="status-text" <text v-else class="status-text"
:class="{ red: item.statusColor === 'red' || item.status === '正在出库' || item.status === '商家备餐中' || item.status === '骑手到店取餐中' || item.status === '骑手已到店' }">{{ :class="{ red: item.statusColor === 'red' || item.status === '正在出库' || item.status === '商家备餐中' || item.status === '骑手到店取餐中' || item.status === '骑手已到店' }">{{
@ -87,8 +87,7 @@
<view class="product-price-box"> <view class="product-price-box">
<view class="price-wrap wx-font-regular"> <view class="price-wrap wx-font-regular">
<text class="price-symbol"></text> <text class="price-symbol"></text>
<text class="price-num">{{ item.price || (item.products && item.products[0] && <text class="price-num">{{ safeFormatPrice(item) }}</text>
item.products[0].price) }}</text>
</view> </view>
<text class="product-count" <text class="product-count"
v-if="item.count || (item.products && item.products[0] && item.products[0].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 }); 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 getButtons = (shopType, status, item) => {
const buttons = []; const buttons = [];
if (status == '等待付款') { if (status == '等待付款') {

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -78,6 +78,7 @@
<script setup> <script setup>
import { ref, computed, onMounted, getCurrentInstance } from 'vue'; import { ref, computed, onMounted, getCurrentInstance } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import ShoppingCard from '@/components/shopping/jingdong/shopping-card.vue'; import ShoppingCard from '@/components/shopping/jingdong/shopping-card.vue';
import { util } from '@/utils/common.js'; import { util } from '@/utils/common.js';
@ -87,12 +88,20 @@ const actionMenuState = ref({ x: 0, y: 0, item: null });
// //
const buttonGroup = [ const buttonGroup = [
{ {
name: "新增购物", name: "新增购物订单",
click: () => { click: () => {
uni.navigateTo({ uni.navigateTo({
url: '/pages/shopping/jingdong/add-order/add-order' url: '/pages/shopping/jingdong/add-order/add-order'
}); });
} }
}, {
name: "新增秒送订单",
click: () => {
uni.showToast({
title: '开发中,敬请期待',
icon: 'none'
});
}
}, },
] ]
/** /**
@ -138,7 +147,7 @@ const editOrder = () => {
if (!item) return; if (!item) return;
showActionMenu.value = false; showActionMenu.value = false;
uni.navigateTo({ 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 handleDeleteOrder = () => {
const itemToDel = actionMenuState.value.item; 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); const realIndex = mockOrderList.value.findIndex(item => item === itemToDel);
if (realIndex > -1) { if (realIndex > -1) {
mockOrderList.value.splice(realIndex, 1); mockOrderList.value.splice(realIndex, 1);
//
uni.setStorageSync('jingdongShopping', mockOrderList.value);
} }
showActionMenu.value = false; showActionMenu.value = false;
uni.showToast({ title: '已删除', icon: 'none' }); uni.showToast({
title: '已删除',
icon: 'none'
});
}; };
const contentPaddingTop = ref('0px'); const contentPaddingTop = ref('0px');
@ -196,6 +222,13 @@ onMounted(() => {
}, 100); }, 100);
}); });
onShow(() => {
const cachedData = uni.getStorageSync('jingdongShopping');
if (cachedData && Array.isArray(cachedData)) {
mockOrderList.value = cachedData;
}
});
const currentTab = ref(0); const currentTab = ref(0);
const tabList = ref([ const tabList = ref([
{ name: '全部' }, { name: '全部' },