|
|
@@ -128,10 +128,17 @@
|
|
|
<text class="popup-title">选择产品型号</text>
|
|
|
<text class="confirm-text" @click="confirmTypeSelect">确定</text>
|
|
|
</view>
|
|
|
- <scroll-view scroll-y class="item-list">
|
|
|
+ <view class="search-bar">
|
|
|
+ <view class="search-input-wrap">
|
|
|
+ <text class="search-icon">🔍</text>
|
|
|
+ <input class="search-input" type="text" v-model="typeSearchKey" placeholder="输入名称检索"
|
|
|
+ @input="onTypeSearch" />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <scroll-view scroll-y class="item-list" @scrolltolower="loadMoreType">
|
|
|
<view class="option-item" v-for="(item, index) in typeList" :key="index"
|
|
|
:class="{ active: tempSelectedIndex === index }" @click="selectTypeItem(index)">
|
|
|
- <text>{{ item }}</text>
|
|
|
+ <text>{{ item.num }} - {{ item.name }}</text>
|
|
|
<icon type="success_no_circle" size="16" color="#C1001C" v-if="tempSelectedIndex === index">
|
|
|
</icon>
|
|
|
</view>
|
|
|
@@ -147,10 +154,17 @@
|
|
|
<text class="popup-title">选择表面处理</text>
|
|
|
<text class="confirm-text" @click="confirmSurfaceSelect">确定</text>
|
|
|
</view>
|
|
|
- <scroll-view scroll-y class="item-list">
|
|
|
+ <view class="search-bar">
|
|
|
+ <view class="search-input-wrap">
|
|
|
+ <text class="search-icon">🔍</text>
|
|
|
+ <input class="search-input" type="text" v-model="surfaceSearchKey" placeholder="输入名称检索"
|
|
|
+ @input="onSurfaceSearch" />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <scroll-view scroll-y class="item-list" @scrolltolower="loadMoreSurface">
|
|
|
<view class="option-item" v-for="(item, index) in surfaceList" :key="index"
|
|
|
:class="{ active: tempSurfaceIndex === index }" @click="selectSurfaceItem(index)">
|
|
|
- <text>{{ item }}</text>
|
|
|
+ <text>{{ item.num }} - {{ item.name }}</text>
|
|
|
<icon type="success_no_circle" size="16" color="#C1001C" v-if="tempSurfaceIndex === index">
|
|
|
</icon>
|
|
|
</view>
|
|
|
@@ -166,10 +180,17 @@
|
|
|
<text class="popup-title">选择包装方式</text>
|
|
|
<text class="confirm-text" @click="confirmPackageSelect">确定</text>
|
|
|
</view>
|
|
|
- <scroll-view scroll-y class="item-list">
|
|
|
+ <view class="search-bar">
|
|
|
+ <view class="search-input-wrap">
|
|
|
+ <text class="search-icon">🔍</text>
|
|
|
+ <input class="search-input" type="text" v-model="packageSearchKey" placeholder="输入名称检索"
|
|
|
+ @input="onPackageSearch" />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <scroll-view scroll-y class="item-list" @scrolltolower="loadMorePackage">
|
|
|
<view class="option-item" v-for="(item, index) in packageList" :key="index"
|
|
|
:class="{ active: tempPackageIndex === index }" @click="selectPackageItem(index)">
|
|
|
- <text>{{ item }}</text>
|
|
|
+ <text>{{ item.num }} - {{ item.name }}</text>
|
|
|
<icon type="success_no_circle" size="16" color="#C1001C" v-if="tempPackageIndex === index">
|
|
|
</icon>
|
|
|
</view>
|
|
|
@@ -182,6 +203,10 @@
|
|
|
|
|
|
<script>
|
|
|
import ErpNavBar from '@/components/erp-nav-bar.vue';
|
|
|
+import { listPageColor } from '@/api/erp/color.js';
|
|
|
+import { listPagePack } from '@/api/erp/pack.js';
|
|
|
+import { listPageModel } from '@/api/erp/model.js';
|
|
|
+import { addOrderDetail } from '@/api/erp/orderDetail.js';
|
|
|
export default {
|
|
|
components: { ErpNavBar },
|
|
|
data() {
|
|
|
@@ -189,40 +214,212 @@ export default {
|
|
|
itemIndex: -1,
|
|
|
showTypePicker: false, showSurfacePicker: false, showPackagePicker: false,
|
|
|
tempSelectedIndex: -1, tempSurfaceIndex: -1, tempPackageIndex: -1,
|
|
|
- typeList: ['TY0018', 'TY0019', 'TY0020', 'TY0021', 'TY0022', 'TY0023', 'TY0024', 'TY0025', 'TY0026', 'TY0027', 'TY0028'],
|
|
|
- surfaceList: ['PL坯料', '阳极氧化', '电泳涂漆', '粉末喷涂', '氟碳喷涂', '木纹转印'],
|
|
|
- packageList: ['不贴膜+3点捆扎', '贴膜+纸箱', '气泡膜包装', '简易编织袋', '木托架包装'],
|
|
|
+ typeList: [],
|
|
|
+ surfaceList: [],
|
|
|
+ packageList: [],
|
|
|
+ // 搜索关键词
|
|
|
+ typeSearchKey: '', surfaceSearchKey: '', packageSearchKey: '',
|
|
|
+ // 防抖定时器
|
|
|
+ typeSearchTimer: null, surfaceSearchTimer: null, packageSearchTimer: null,
|
|
|
+ // 分页参数
|
|
|
+ typePageNum: 1, typePageSize: 20, typeHasMore: true, typeLoading: false,
|
|
|
+ surfacePageNum: 1, surfacePageSize: 20, surfaceHasMore: true, surfaceLoading: false,
|
|
|
+ packagePageNum: 1, packagePageSize: 20, packageHasMore: true, packageLoading: false,
|
|
|
formData: {
|
|
|
- type: '', name: '', material: '',
|
|
|
- surfaceName: '', packageMethod: '', length: '',
|
|
|
+ type: '', modelId: '', name: '', material: '',
|
|
|
+ surfaceName: '', surfaceId: '', packageMethod: '', packageId: '', length: '',
|
|
|
wallThickness: '', count: ''
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- onLoad(options) {
|
|
|
+ async onLoad(options) {
|
|
|
if (options.data) {
|
|
|
try {
|
|
|
const item = JSON.parse(decodeURIComponent(options.data));
|
|
|
- this.formData = item;
|
|
|
+ this.formData.type = item.modelNum || '';
|
|
|
+ this.formData.modelId = item.modelId || '';
|
|
|
+ this.formData.name = item.modelName || '';
|
|
|
+ this.formData.material = item.material || '';
|
|
|
+ this.formData.surfaceName = item.surfaceName || '';
|
|
|
+ this.formData.surfaceId = item.surfaceId || '';
|
|
|
+ this.formData.packageMethod = item.packName || '';
|
|
|
+ this.formData.packageId = item.packId || '';
|
|
|
+ this.formData.length = item.length || '';
|
|
|
+ this.formData.wallThickness = item.wallThickness || '';
|
|
|
+ this.formData.count = item.count || '';
|
|
|
this.itemIndex = parseInt(options.index || -1);
|
|
|
} catch (e) {
|
|
|
console.error('Data parse error', e);
|
|
|
}
|
|
|
}
|
|
|
+ await Promise.all([
|
|
|
+ this.loadModels(),
|
|
|
+ this.loadSurfaceKinds(),
|
|
|
+ this.loadPackageMethods()
|
|
|
+ ]);
|
|
|
},
|
|
|
methods: {
|
|
|
- openTypePicker() { if (this.formData.type) this.tempSelectedIndex = this.typeList.indexOf(this.formData.type); this.showTypePicker = true; },
|
|
|
- closeTypePicker() { this.showTypePicker = false; },
|
|
|
+ async loadModels(pageNum = 1, keyword = '') {
|
|
|
+ if (this.typeLoading) return;
|
|
|
+ this.typeLoading = true;
|
|
|
+ try {
|
|
|
+ const res = await listPageModel({ pageNum, pageSize: this.typePageSize, name: keyword });
|
|
|
+ const rows = res.rows || [];
|
|
|
+ const total = res.total || 0;
|
|
|
+ if (pageNum === 1) {
|
|
|
+ this.typeList = rows;
|
|
|
+ } else {
|
|
|
+ this.typeList = [...this.typeList, ...rows];
|
|
|
+ }
|
|
|
+ this.typeHasMore = this.typeList.length < total;
|
|
|
+ } catch (e) {
|
|
|
+ console.error('加载型号失败', e);
|
|
|
+ } finally {
|
|
|
+ this.typeLoading = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async loadSurfaceKinds(pageNum = 1, keyword = '') {
|
|
|
+ if (this.surfaceLoading) return;
|
|
|
+ this.surfaceLoading = true;
|
|
|
+ try {
|
|
|
+ const res = await listPageColor({ pageNum, pageSize: this.surfacePageSize, name: keyword });
|
|
|
+ let rows = (res.rows || []).filter(item => item.name);
|
|
|
+ const total = res.total || 0;
|
|
|
+ if (pageNum === 1) {
|
|
|
+ this.surfaceList = rows;
|
|
|
+ } else {
|
|
|
+ this.surfaceList = [...this.surfaceList, ...rows];
|
|
|
+ }
|
|
|
+ this.surfaceHasMore = this.surfaceList.length < total;
|
|
|
+ } catch (e) {
|
|
|
+ console.error('加载表面处理失败', e);
|
|
|
+ } finally {
|
|
|
+ this.surfaceLoading = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async loadPackageMethods(pageNum = 1, keyword = '') {
|
|
|
+ if (this.packageLoading) return;
|
|
|
+ this.packageLoading = true;
|
|
|
+ try {
|
|
|
+ const res = await listPagePack({ pageNum, pageSize: this.packagePageSize, name: keyword });
|
|
|
+ const rows = res.rows || [];
|
|
|
+ const total = res.total || 0;
|
|
|
+ if (pageNum === 1) {
|
|
|
+ this.packageList = rows;
|
|
|
+ } else {
|
|
|
+ this.packageList = [...this.packageList, ...rows];
|
|
|
+ }
|
|
|
+ this.packageHasMore = this.packageList.length < total;
|
|
|
+ } catch (e) {
|
|
|
+ console.error('加载包装方式失败', e);
|
|
|
+ } finally {
|
|
|
+ this.packageLoading = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ loadMoreType() {
|
|
|
+ if (this.typeHasMore && !this.typeLoading) {
|
|
|
+ this.typePageNum++;
|
|
|
+ this.loadModels(this.typePageNum, this.typeSearchKey);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ loadMoreSurface() {
|
|
|
+ if (this.surfaceHasMore && !this.surfaceLoading) {
|
|
|
+ this.surfacePageNum++;
|
|
|
+ this.loadSurfaceKinds(this.surfacePageNum, this.surfaceSearchKey);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ loadMorePackage() {
|
|
|
+ if (this.packageHasMore && !this.packageLoading) {
|
|
|
+ this.packagePageNum++;
|
|
|
+ this.loadPackageMethods(this.packagePageNum, this.packageSearchKey);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onTypeSearch() {
|
|
|
+ if (this.typeSearchTimer) clearTimeout(this.typeSearchTimer);
|
|
|
+ this.typeSearchTimer = setTimeout(() => {
|
|
|
+ this.typePageNum = 1;
|
|
|
+ this.loadModels(1, this.typeSearchKey);
|
|
|
+ }, 300);
|
|
|
+ },
|
|
|
+ onSurfaceSearch() {
|
|
|
+ if (this.surfaceSearchTimer) clearTimeout(this.surfaceSearchTimer);
|
|
|
+ this.surfaceSearchTimer = setTimeout(() => {
|
|
|
+ this.surfacePageNum = 1;
|
|
|
+ this.loadSurfaceKinds(1, this.surfaceSearchKey);
|
|
|
+ }, 300);
|
|
|
+ },
|
|
|
+ onPackageSearch() {
|
|
|
+ if (this.packageSearchTimer) clearTimeout(this.packageSearchTimer);
|
|
|
+ this.packageSearchTimer = setTimeout(() => {
|
|
|
+ this.packagePageNum = 1;
|
|
|
+ this.loadPackageMethods(1, this.packageSearchKey);
|
|
|
+ }, 300);
|
|
|
+ },
|
|
|
+ openTypePicker() {
|
|
|
+ if (this.formData.type) {
|
|
|
+ this.tempSelectedIndex = this.typeList.findIndex(item => item.num === this.formData.type);
|
|
|
+ } else {
|
|
|
+ this.tempSelectedIndex = -1;
|
|
|
+ }
|
|
|
+ this.showTypePicker = true;
|
|
|
+ },
|
|
|
+ closeTypePicker() {
|
|
|
+ this.showTypePicker = false;
|
|
|
+ this.typeSearchKey = '';
|
|
|
+ this.typePageNum = 1;
|
|
|
+ },
|
|
|
selectTypeItem(index) { this.tempSelectedIndex = index; },
|
|
|
- confirmTypeSelect() { if (this.tempSelectedIndex === -1) return; const val = this.typeList[this.tempSelectedIndex]; this.formData.type = val; this.formData.name = '工业铝材'; this.formData.material = (this.tempSelectedIndex % 2 === 0) ? '6063-T5' : '6061-T6'; this.closeTypePicker(); },
|
|
|
- openSurfacePicker() { if (this.formData.surfaceName) this.tempSurfaceIndex = this.surfaceList.indexOf(this.formData.surfaceName); this.showSurfacePicker = true; },
|
|
|
- closeSurfacePicker() { this.showSurfacePicker = false; },
|
|
|
+ confirmTypeSelect() {
|
|
|
+ if (this.tempSelectedIndex === -1) return;
|
|
|
+ const item = this.typeList[this.tempSelectedIndex];
|
|
|
+ this.formData.type = item.num;
|
|
|
+ this.formData.modelId = item.rowId;
|
|
|
+ this.formData.name = item.name;
|
|
|
+ this.formData.material = '6063-T5';
|
|
|
+ this.closeTypePicker();
|
|
|
+ },
|
|
|
+ openSurfacePicker() {
|
|
|
+ if (this.formData.surfaceName) {
|
|
|
+ this.tempSurfaceIndex = this.surfaceList.findIndex(item => item.name === this.formData.surfaceName);
|
|
|
+ } else {
|
|
|
+ this.tempSurfaceIndex = -1;
|
|
|
+ }
|
|
|
+ this.showSurfacePicker = true;
|
|
|
+ },
|
|
|
+ closeSurfacePicker() {
|
|
|
+ this.showSurfacePicker = false;
|
|
|
+ this.surfaceSearchKey = '';
|
|
|
+ this.surfacePageNum = 1;
|
|
|
+ },
|
|
|
selectSurfaceItem(index) { this.tempSurfaceIndex = index; },
|
|
|
- confirmSurfaceSelect() { if (this.tempSurfaceIndex === -1) return; this.formData.surfaceName = this.surfaceList[this.tempSurfaceIndex]; this.closeSurfacePicker(); },
|
|
|
- openPackagePicker() { if (this.formData.packageMethod) this.tempPackageIndex = this.packageList.indexOf(this.formData.packageMethod); this.showPackagePicker = true; },
|
|
|
- closePackagePicker() { this.showPackagePicker = false; },
|
|
|
+ confirmSurfaceSelect() {
|
|
|
+ if (this.tempSurfaceIndex === -1) return;
|
|
|
+ const item = this.surfaceList[this.tempSurfaceIndex];
|
|
|
+ this.formData.surfaceName = item.name;
|
|
|
+ this.formData.surfaceId = item.rowId;
|
|
|
+ this.closeSurfacePicker();
|
|
|
+ },
|
|
|
+ openPackagePicker() {
|
|
|
+ if (this.formData.packageMethod) {
|
|
|
+ this.tempPackageIndex = this.packageList.findIndex(item => item.name === this.formData.packageMethod);
|
|
|
+ } else {
|
|
|
+ this.tempPackageIndex = -1;
|
|
|
+ }
|
|
|
+ this.showPackagePicker = true;
|
|
|
+ },
|
|
|
+ closePackagePicker() {
|
|
|
+ this.showPackagePicker = false;
|
|
|
+ this.packageSearchKey = '';
|
|
|
+ this.packagePageNum = 1;
|
|
|
+ },
|
|
|
selectPackageItem(index) { this.tempPackageIndex = index; },
|
|
|
- confirmPackageSelect() { if (this.tempPackageIndex === -1) return; this.formData.packageMethod = this.packageList[this.tempPackageIndex]; this.closePackagePicker(); },
|
|
|
+ confirmPackageSelect() {
|
|
|
+ if (this.tempPackageIndex === -1) return;
|
|
|
+ const item = this.packageList[this.tempPackageIndex];
|
|
|
+ this.formData.packageMethod = item.name;
|
|
|
+ this.formData.packageId = item.rowId;
|
|
|
+ this.closePackagePicker();
|
|
|
+ },
|
|
|
saveEdit() {
|
|
|
const fields = [
|
|
|
{ key: 'type', label: '型号' },
|
|
|
@@ -238,7 +435,6 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
uni.$emit('update_order_item', {
|
|
|
index: this.itemIndex,
|
|
|
data: JSON.parse(JSON.stringify(this.formData))
|
|
|
@@ -505,6 +701,32 @@ export default {
|
|
|
padding: 0 40rpx;
|
|
|
}
|
|
|
|
|
|
+/* 搜索栏样式 */
|
|
|
+.search-bar {
|
|
|
+ padding: 16rpx 40rpx;
|
|
|
+ border-bottom: 1rpx solid #f0f0f0;
|
|
|
+}
|
|
|
+
|
|
|
+.search-input-wrap {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ background: #f5f6f8;
|
|
|
+ border-radius: 32rpx;
|
|
|
+ padding: 12rpx 24rpx;
|
|
|
+}
|
|
|
+
|
|
|
+.search-icon {
|
|
|
+ font-size: 28rpx;
|
|
|
+ margin-right: 12rpx;
|
|
|
+}
|
|
|
+
|
|
|
+.search-input {
|
|
|
+ flex: 1;
|
|
|
+ font-size: 26rpx;
|
|
|
+ color: #333;
|
|
|
+ height: 56rpx;
|
|
|
+}
|
|
|
+
|
|
|
.option-item {
|
|
|
height: 110rpx;
|
|
|
display: flex;
|