Commit f771c60967447ea311825b9023c02402e3c6ac2a

Authored by 史婷婷
2 parents dda9b7c5 97d06920

Merge remote-tracking branch 'origin/cjerp-1.0_20260122-sydd' into publish_cjerp

# Conflicts:
#	pages/change_list/add.vue
#	pages/change_list/modify.vue
#	pages/order_list/approve.vue
#	pages/order_list/modify.vue
#	pages/order_list/product.vue
Showing 47 changed files with 3544 additions and 731 deletions

Too many changes to show.

To preserve performance only 47 of 77 files are displayed.

1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <project version="4"> 2 <project version="4">
3 <component name="ChangeListManager"> 3 <component name="ChangeListManager">
4 - <list default="true" id="22e3db16-f3f9-44cc-b7ca-0b5f75df2820" name="Changes" comment="" /> 4 + <list default="true" id="22e3db16-f3f9-44cc-b7ca-0b5f75df2820" name="Changes" comment="">
  5 + <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
  6 + <change beforePath="$PROJECT_DIR$/pages-business/purchase/config.vue" beforeDir="false" />
  7 + <change beforePath="$PROJECT_DIR$/pages-business/purchase/order/index.vue" beforeDir="false" />
  8 + <change beforePath="$PROJECT_DIR$/pages-business/purchase/order/item/index.vue" beforeDir="false" />
  9 + <change beforePath="$PROJECT_DIR$/pages-business/purchase/order/pay-type/index.vue" beforeDir="false" />
  10 + <change beforePath="$PROJECT_DIR$/pages-business/retail/config.vue" beforeDir="false" />
  11 + <change beforePath="$PROJECT_DIR$/pages-business/sale/config.vue" beforeDir="false" />
  12 + <change beforePath="$PROJECT_DIR$/pages-business/take/config.vue" beforeDir="false" />
  13 + <change beforePath="$PROJECT_DIR$/pages-data/address/index.vue" beforeDir="false" />
  14 + <change beforePath="$PROJECT_DIR$/pages-data/brand/index.vue" beforeDir="false" />
  15 + <change beforePath="$PROJECT_DIR$/pages-data/category/index.vue" beforeDir="false" />
  16 + <change beforePath="$PROJECT_DIR$/pages-data/customer/index.vue" beforeDir="false" />
  17 + <change beforePath="$PROJECT_DIR$/pages-data/logistics/index.vue" beforeDir="false" />
  18 + <change beforePath="$PROJECT_DIR$/pages-data/member/index.vue" beforeDir="false" />
  19 + <change beforePath="$PROJECT_DIR$/pages-data/pay-type/index.vue" beforeDir="false" />
  20 + <change beforePath="$PROJECT_DIR$/pages-data/product/index.vue" beforeDir="false" />
  21 + <change beforePath="$PROJECT_DIR$/pages-data/property/index.vue" beforeDir="false" />
  22 + <change beforePath="$PROJECT_DIR$/pages-data/property/item/index.vue" beforeDir="false" />
  23 + <change beforePath="$PROJECT_DIR$/pages-data/shop/index.vue" beforeDir="false" />
  24 + <change beforePath="$PROJECT_DIR$/pages-data/store-center/index.vue" beforeDir="false" />
  25 + <change beforePath="$PROJECT_DIR$/pages-data/supplier/index.vue" beforeDir="false" />
  26 + <change beforePath="$PROJECT_DIR$/pages.json" beforeDir="false" afterPath="$PROJECT_DIR$/pages.json" afterDir="false" />
  27 + <change beforePath="$PROJECT_DIR$/pages/business/index.vue" beforeDir="false" />
  28 + <change beforePath="$PROJECT_DIR$/pages/common/textview/index.vue" beforeDir="false" />
  29 + <change beforePath="$PROJECT_DIR$/pages/common/webview/index.vue" beforeDir="false" />
  30 + <change beforePath="$PROJECT_DIR$/pages/data/index.vue" beforeDir="false" />
  31 + <change beforePath="$PROJECT_DIR$/pages/mine/help/index.vue" beforeDir="false" />
  32 + <change beforePath="$PROJECT_DIR$/pages/mine/index2.vue" beforeDir="false" />
  33 + </list>
5 <option name="SHOW_DIALOG" value="false" /> 34 <option name="SHOW_DIALOG" value="false" />
6 <option name="HIGHLIGHT_CONFLICTS" value="true" /> 35 <option name="HIGHLIGHT_CONFLICTS" value="true" />
7 <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> 36 <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@@ -50,7 +79,7 @@ @@ -50,7 +79,7 @@
50 <component name="Git.Settings"> 79 <component name="Git.Settings">
51 <option name="RECENT_BRANCH_BY_REPOSITORY"> 80 <option name="RECENT_BRANCH_BY_REPOSITORY">
52 <map> 81 <map>
53 - <entry key="$PROJECT_DIR$" value="publish_cjerp" /> 82 + <entry key="$PROJECT_DIR$" value="test_cjerp" />
54 </map> 83 </map>
55 </option> 84 </option>
56 <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> 85 <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@@ -63,17 +92,18 @@ @@ -63,17 +92,18 @@
63 <option name="hideEmptyMiddlePackages" value="true" /> 92 <option name="hideEmptyMiddlePackages" value="true" />
64 <option name="showLibraryContents" value="true" /> 93 <option name="showLibraryContents" value="true" />
65 </component> 94 </component>
66 - <component name="PropertiesComponent">{  
67 - &quot;keyToString&quot;: {  
68 - &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,  
69 - &quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,  
70 - &quot;git-widget-placeholder&quot;: &quot;main&quot;,  
71 - &quot;kotlin-language-version-configured&quot;: &quot;true&quot;,  
72 - &quot;last_opened_file_path&quot;: &quot;/Users/zhuyl/Documents/qgutech/erp-mobile&quot;,  
73 - &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,  
74 - &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot; 95 + <component name="PropertiesComponent"><![CDATA[{
  96 + "keyToString": {
  97 + "Git.Branch.Popup.ShowAllRemotes": "true",
  98 + "RunOnceActivity.ShowReadmeOnStart": "true",
  99 + "RunOnceActivity.git.unshallow": "true",
  100 + "git-widget-placeholder": "main",
  101 + "kotlin-language-version-configured": "true",
  102 + "last_opened_file_path": "/Users/zhuyl/Documents/qgutech/erp-mobile",
  103 + "nodejs_package_manager_path": "npm",
  104 + "vue.rearranger.settings.migration": "true"
75 } 105 }
76 -}</component> 106 +}]]></component>
77 <component name="RunManager"> 107 <component name="RunManager">
78 <configuration default="true" type="Applet" factoryName="Applet"> 108 <configuration default="true" type="Applet" factoryName="Applet">
79 <option name="WIDTH" value="400" /> 109 <option name="WIDTH" value="400" />
@@ -175,7 +205,7 @@ @@ -175,7 +205,7 @@
175 <entry key="branch"> 205 <entry key="branch">
176 <value> 206 <value>
177 <list> 207 <list>
178 - <option value="cjerp-1.0_20251220" /> 208 + <option value="origin/cjerp-1.0_20260116" />
179 </list> 209 </list>
180 </value> 210 </value>
181 </entry> 211 </entry>
  1 +import request from '@/utils/request'
  2 +import { ContentTypeEnum } from '@/utils/httpEnum';
  3 +
  4 +const baseUrl = '/confirmationSlip';
  5 +// 查询列表
  6 +export function queryApi(params) {
  7 + return request({
  8 + url: baseUrl + `/query`,
  9 + method: 'get',
  10 + params
  11 + })
  12 +}
  13 +
  14 +// 根据ID查询详情数据
  15 +export function getDetailApi(id) {
  16 + return request({
  17 + url: baseUrl,
  18 + method: 'get',
  19 + params: { id }
  20 + })
  21 +}
  22 +
  23 +
  24 +// 修改保存
  25 +export function updateApi(params) {
  26 + return request({
  27 + url: baseUrl,
  28 + method: 'put',
  29 + data: params,
  30 + contentType: ContentTypeEnum.JSON
  31 + })
  32 +}
  1 +import request from '@/utils/request'
  2 +
  3 +const baseUrl = '/sample/feedback';
  4 +// 查询列表
  5 +export function queryApi(params) {
  6 + return request({
  7 + url: baseUrl + `/query`,
  8 + method: 'get',
  9 + params
  10 + })
  11 +}
  12 +
  13 +// 根据ID查询详情数据
  14 +export function getDetailApi(id) {
  15 + return request({
  16 + url: baseUrl,
  17 + method: 'get',
  18 + params: { id }
  19 + })
  20 +}
  1 +import request from '@/utils/request'
  2 +import { ContentTypeEnum } from '@/utils/httpEnum';
  3 +
  4 +const baseUrl = '/sample/tracking';
  5 +// 查询列表
  6 +export function queryApi(params) {
  7 + return request({
  8 + url: baseUrl + `/query`,
  9 + method: 'get',
  10 + params
  11 + })
  12 +}
  13 +
  14 +// 根据ID查询详情数据
  15 +export function getDetailApi(id) {
  16 + return request({
  17 + url: baseUrl,
  18 + method: 'get',
  19 + params: { id }
  20 + })
  21 +}
  22 +
  23 +
  24 +// 修改保存
  25 +export function updateApi(params) {
  26 + return request({
  27 + url: baseUrl,
  28 + method: 'put',
  29 + data: params,
  30 + contentType: ContentTypeEnum.JSON
  31 + })
  32 +}
@@ -207,7 +207,7 @@ export default { @@ -207,7 +207,7 @@ export default {
207 } 207 }
208 208
209 .label { 209 .label {
210 - max-width: 280rpx; 210 + max-width: 400rpx;
211 margin-right: 20rpx; 211 margin-right: 20rpx;
212 color: rgba(0, 0, 0, 0.6); 212 color: rgba(0, 0, 0, 0.6);
213 font-size: 28rpx; 213 font-size: 28rpx;
@@ -222,7 +222,7 @@ export default { @@ -222,7 +222,7 @@ export default {
222 } 222 }
223 223
224 .label1 { 224 .label1 {
225 - max-width: 280rpx; 225 + max-width: 400rpx;
226 margin-right: 20rpx; 226 margin-right: 20rpx;
227 color: rgba(0, 0, 0, 0.6); 227 color: rgba(0, 0, 0, 0.6);
228 font-size: 32rpx; 228 font-size: 32rpx;
@@ -190,6 +190,7 @@ @@ -190,6 +190,7 @@
190 <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount) 190 <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount)
191 }}</text></view> 191 }}</text></view>
192 <view class="row"><text class="label">发货日期</text><text class="value">{{ item.deliveryDate }}</text></view> 192 <view class="row"><text class="label">发货日期</text><text class="value">{{ item.deliveryDate }}</text></view>
  193 + <view class="row"><text class="label">是否为试样订单</text><text class="value">{{ item.sampleOrder ? '是' : '否' }}</text></view>
193 </view> 194 </view>
194 </view> 195 </view>
195 <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" /> 196 <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" />
@@ -207,7 +207,7 @@ export default { @@ -207,7 +207,7 @@ export default {
207 } 207 }
208 208
209 .label { 209 .label {
210 - max-width: 280rpx; 210 + max-width: 400rpx;
211 margin-right: 20rpx; 211 margin-right: 20rpx;
212 color: rgba(0, 0, 0, 0.6); 212 color: rgba(0, 0, 0, 0.6);
213 font-size: 28rpx; 213 font-size: 28rpx;
@@ -222,7 +222,7 @@ export default { @@ -222,7 +222,7 @@ export default {
222 } 222 }
223 223
224 .label1 { 224 .label1 {
225 - max-width: 280rpx; 225 + max-width: 400rpx;
226 margin-right: 20rpx; 226 margin-right: 20rpx;
227 color: rgba(0, 0, 0, 0.6); 227 color: rgba(0, 0, 0, 0.6);
228 font-size: 32rpx; 228 font-size: 32rpx;
@@ -28,7 +28,7 @@ export default { @@ -28,7 +28,7 @@ export default {
28 title: { type: String, default: '请选择' }, 28 title: { type: String, default: '请选择' },
29 // 统一约定:options 为 [{ label: string, value: string|number }] 29 // 统一约定:options 为 [{ label: string, value: string|number }]
30 options: { type: Array, default: () => [] }, 30 options: { type: Array, default: () => [] },
31 - value: { type: [String, Number], default: '' } 31 + value: { type: [String, Number, Boolean], default: '' }
32 }, 32 },
33 data() { 33 data() {
34 return { 34 return {
1 -<template>  
2 -  
3 - <uni-section title="配置项" type="line">  
4 - <view class="form-view">  
5 - <!-- 基础用法,不包含校验规则 -->  
6 -  
7 - </view>  
8 - </uni-section>  
9 -  
10 -</template>  
11 -  
12 -<script>  
13 -  
14 -</script>  
15 -  
16 -<style>  
17 - .top-view{  
18 - padding: 20px;  
19 - }  
20 - .form-view {  
21 - margin-top: 20px;  
22 - padding-left: 5px;  
23 - padding-right: 5px;  
24 - /* display: flex;  
25 - align-items: center; */  
26 - padding-bottom: 20px;  
27 - }  
28 -  
29 - .button-view {  
30 - display: flex;  
31 - align-items: center;  
32 - margin-bottom: 20px;  
33 - }  
34 -  
35 -</style>  
1 -<template>  
2 -  
3 - <uni-section title="配置项" type="line">  
4 - <view class="form-view">  
5 - <!-- 基础用法,不包含校验规则 -->  
6 - <view>零售出库单上的会员是否必填</view>  
7 - <uni-forms-item label="" required>  
8 - <uni-data-checkbox v-model="configFormData.retailOutSheetRequireMember" :localdata="isRequired" />  
9 - </uni-forms-item>  
10 - <view>零售出库单是否需要发货</view>  
11 - <uni-forms-item label="" required>  
12 -  
13 - <uni-data-checkbox v-model="configFormData.retailOutSheetRequireLogistics" :localdata="isRequired" />  
14 - </uni-forms-item>  
15 - <view>零售退货单上的会员是否必填</view>  
16 - <uni-forms-item label="" required>  
17 -  
18 - <uni-data-checkbox v-model="configFormData.retailReturnRequireMember" :localdata="isRequired" />  
19 - </uni-forms-item>  
20 - <view>零售退货单是否关联零售出库单</view>  
21 - <uni-forms-item label="" required>  
22 -  
23 - <uni-data-checkbox v-model="configFormData.retailReturnRequireOutStock" :localdata="isRequired" />  
24 - </uni-forms-item>  
25 - <view>零售退货单是否多次关联零售出库单</view>  
26 - <uni-forms-item label="" required>  
27 -  
28 - <uni-data-checkbox v-model="configFormData.retailReturnMultipleRelateOutStock" :localdata="isRequired" />  
29 - </uni-forms-item>  
30 -  
31 - </uni-forms>  
32 - <view class="button-view">  
33 - <button class="btn-view-button" @click="submit" type="primary" size="mini">保存</button>  
34 - <button class="btn-view-button" @click="cancel" type="primary" size="mini">取消</button>  
35 - </view>  
36 - </view>  
37 - </uni-section>  
38 -  
39 -</template>  
40 -  
41 -<script>  
42 -  
43 -</script>  
44 -  
45 -<style>  
46 - .top-view{  
47 - padding: 20px;  
48 - }  
49 - .form-view {  
50 - margin-top: 20px;  
51 - padding-left: 5px;  
52 - padding-right: 5px;  
53 - /* display: flex;  
54 - align-items: center; */  
55 - padding-bottom: 20px;  
56 - }  
57 -  
58 - .button-view {  
59 - display: flex;  
60 - align-items: center;  
61 - margin-bottom: 20px;  
62 - }  
63 -  
64 -</style>  
1 -<template>  
2 -  
3 - <uni-section title="配置项" type="line">  
4 - <view class="form-view">  
5 -  
6 - </view>  
7 - </uni-section>  
8 -  
9 -</template>  
10 -  
11 -<script>  
12 -  
13 -</script>  
14 -  
15 -<style>  
16 - .top-view{  
17 - padding: 20px;  
18 - }  
19 - .form-view {  
20 - margin-top: 20px;  
21 - padding-left: 5px;  
22 - padding-right: 5px;  
23 - /* display: flex;  
24 - align-items: center; */  
25 - padding-bottom: 20px;  
26 - }  
27 -  
28 - .button-view {  
29 - display: flex;  
30 - align-items: center;  
31 - margin-bottom: 20px;  
32 - }  
33 -  
34 -</style>  
1 -<template>  
2 -  
3 - <uni-section title="配置项" type="line">  
4 - <view class="form-view">  
5 -  
6 - </view>  
7 - </uni-section>  
8 -  
9 -</template>  
10 -  
11 -<script>  
12 -  
13 -</script>  
14 -  
15 -<style>  
16 - .top-view{  
17 - padding: 20px;  
18 - }  
19 - .form-view {  
20 - margin-top: 20px;  
21 - padding-left: 5px;  
22 - padding-right: 5px;  
23 - /* display: flex;  
24 - align-items: center; */  
25 - padding-bottom: 20px;  
26 - }  
27 -  
28 - .button-view {  
29 - display: flex;  
30 - align-items: center;  
31 - margin-bottom: 20px;  
32 - }  
33 -  
34 -</style>  
@@ -28,12 +28,6 @@ @@ -28,12 +28,6 @@
28 } 28 }
29 }, 29 },
30 { 30 {
31 - "path": "pages/mine/index2",  
32 - "style": {  
33 - "navigationBarTitleText": "我的2"  
34 - }  
35 - },  
36 - {  
37 "path": "pages/mine/info/index", 31 "path": "pages/mine/info/index",
38 "style": { 32 "style": {
39 "navigationBarTitleText": "个人信息" 33 "navigationBarTitleText": "个人信息"
@@ -784,126 +778,70 @@ @@ -784,126 +778,70 @@
784 "navigationBarBackgroundColor": "#ffffff", 778 "navigationBarBackgroundColor": "#ffffff",
785 "navigationBarTextStyle": "black" 779 "navigationBarTextStyle": "black"
786 } 780 }
787 - }  
788 - ],  
789 - "subPackages": [  
790 - {  
791 - "root": "pages-business",  
792 - "pages": [  
793 - {  
794 - "path": "purchase/config",  
795 - "style": {  
796 - "navigationBarTitleText": "采购设置"  
797 - }  
798 - },  
799 - {  
800 - "path": "purchase/order/index",  
801 - "style": {  
802 - "navigationBarTitleText": "采购订单"  
803 - }  
804 - },  
805 - {  
806 - "path": "retail/config",  
807 - "style": {  
808 - "navigationBarTitleText": "零售设置"  
809 - }  
810 - },  
811 - {  
812 - "path": "sale/config",  
813 - "style": {  
814 - "navigationBarTitleText": "销售设置"  
815 - }  
816 - },  
817 - {  
818 - "path": "take/config",  
819 - "style": {  
820 - "navigationBarTitleText": "盘点设置"  
821 - }  
822 - }  
823 - ]  
824 - },  
825 - {  
826 - "root": "pages-data",  
827 - "pages": [  
828 - {  
829 - "path": "address/index",  
830 - "style": {  
831 - "navigationBarTitleText": "地址管理"  
832 - }  
833 - },  
834 - {  
835 - "path": "brand/index",  
836 - "style": {  
837 - "navigationBarTitleText": "品牌管理"  
838 - }  
839 - },  
840 - {  
841 - "path": "category/index",  
842 - "style": {  
843 - "navigationBarTitleText": "分类管理"  
844 - }  
845 - },  
846 - {  
847 - "path": "customer/index",  
848 - "style": {  
849 - "navigationBarTitleText": "客户管理"  
850 - }  
851 - },  
852 - {  
853 - "path": "logistics/index",  
854 - "style": {  
855 - "navigationBarTitleText": "物流管理"  
856 - }  
857 - },  
858 - {  
859 - "path": "member/index",  
860 - "style": {  
861 - "navigationBarTitleText": "会员管理"  
862 - }  
863 - },  
864 - {  
865 - "path": "pay-type/index",  
866 - "style": {  
867 - "navigationBarTitleText": "支付方式"  
868 - }  
869 - },  
870 - {  
871 - "path": "product/index",  
872 - "style": {  
873 - "navigationBarTitleText": "产品管理"  
874 - }  
875 - },  
876 - {  
877 - "path": "property/index",  
878 - "style": {  
879 - "navigationBarTitleText": "商品属性"  
880 - }  
881 - },  
882 - {  
883 - "path": "property/item/index",  
884 - "style": {  
885 - "navigationBarTitleText": "属性项"  
886 - }  
887 - },  
888 - {  
889 - "path": "shop/index",  
890 - "style": {  
891 - "navigationBarTitleText": "店铺管理"  
892 - }  
893 - },  
894 - {  
895 - "path": "store-center/index",  
896 - "style": {  
897 - "navigationBarTitleText": "门店管理"  
898 - }  
899 - },  
900 - {  
901 - "path": "supplier/index",  
902 - "style": {  
903 - "navigationBarTitleText": "供应商管理"  
904 - }  
905 - }  
906 - ] 781 + },
  782 + {
  783 + "path": "pages/confirmation_form/index",
  784 + "style": {
  785 + "navigationBarTitleText": "产品试样确认单",
  786 + "navigationBarBackgroundColor": "#ffffff",
  787 + "navigationBarTextStyle": "black"
  788 + }
  789 + },
  790 + {
  791 + "path": "pages/confirmation_form/detail",
  792 + "style": {
  793 + "navigationBarTitleText": "产品试样确认单详情",
  794 + "navigationBarBackgroundColor": "#ffffff",
  795 + "navigationBarTextStyle": "black"
  796 + }
  797 + },
  798 + {
  799 + "path": "pages/confirmation_form/modify",
  800 + "style": {
  801 + "navigationBarTitleText": "编辑产品试样确认单",
  802 + "navigationBarBackgroundColor": "#ffffff",
  803 + "navigationBarTextStyle": "black"
  804 + }
  805 + },
  806 + {
  807 + "path": "pages/follow_up_form/index",
  808 + "style": {
  809 + "navigationBarTitleText": "产品试样结果跟踪单",
  810 + "navigationBarBackgroundColor": "#ffffff",
  811 + "navigationBarTextStyle": "black"
  812 + }
  813 + },
  814 + {
  815 + "path": "pages/follow_up_form/detail",
  816 + "style": {
  817 + "navigationBarTitleText": "产品试样结果跟踪单详情",
  818 + "navigationBarBackgroundColor": "#ffffff",
  819 + "navigationBarTextStyle": "black"
  820 + }
  821 + },
  822 + {
  823 + "path": "pages/follow_up_form/modify",
  824 + "style": {
  825 + "navigationBarTitleText": "编辑产品试样结果跟踪单",
  826 + "navigationBarBackgroundColor": "#ffffff",
  827 + "navigationBarTextStyle": "black"
  828 + }
  829 + },
  830 + {
  831 + "path": "pages/feedback_form/index",
  832 + "style": {
  833 + "navigationBarTitleText": "产品试样结果反馈单",
  834 + "navigationBarBackgroundColor": "#ffffff",
  835 + "navigationBarTextStyle": "black"
  836 + }
  837 + },
  838 + {
  839 + "path": "pages/feedback_form/detail",
  840 + "style": {
  841 + "navigationBarTitleText": "产品试样结果反馈单详情",
  842 + "navigationBarBackgroundColor": "#ffffff",
  843 + "navigationBarTextStyle": "black"
  844 + }
907 } 845 }
908 ], 846 ],
909 "tabBar": { 847 "tabBar": {
1 -<template>  
2 - <view class="work-container">  
3 - <!-- 轮播图 -->  
4 - <uni-swiper-dot class="uni-swiper-dot-box" :info="data" :current="current" field="content">  
5 - <swiper class="swiper-box" :current="swiperDotIndex" @change="changeSwiper">  
6 - <swiper-item v-for="(item, index) in data" :key="index">  
7 - <view class="swiper-item" @click="clickBannerItem(item)">  
8 - <image :src="item.image" mode="aspectFill" :draggable="false" />  
9 - </view>  
10 - </swiper-item>  
11 - </swiper>  
12 - </uni-swiper-dot>  
13 -  
14 - <!-- 宫格组件 -->  
15 - <uni-section title="采购管理" type="line">  
16 - <HR style="border:1 dashed #eeeeff" width="100%" color='#eeeeff' SIZE='1' />  
17 -  
18 - <view class="grid-body">  
19 - <uni-grid :column="4" :showBorder="false" @change="changeGrid">  
20 -  
21 - <uni-grid-item :index=1>  
22 - <view class="grid-item-box">  
23 - <!-- <uni-icons color="#007AFF" type="gift" size="30"></uni-icons> -->  
24 - <view class="cuIcon-settings text-pink icon"></view>  
25 - <text class="text">参数配置</text>  
26 - </view>  
27 - </uni-grid-item>  
28 - <uni-grid-item :index=2>  
29 - <view class="grid-item-box">  
30 - <!-- <uni-icons color="#007AFF" type="list" size="30"></uni-icons> -->  
31 - <view class="cuIcon-sort text-pink icon"></view>  
32 - <text class="text">采购订单</text>  
33 - </view>  
34 - </uni-grid-item>  
35 - <uni-grid-item :index=3>  
36 - <view class="grid-item-box">  
37 - <!-- <uni-icons color="#007AFF" type="color" size="30"></uni-icons> -->  
38 - <view class="cuIcon-newshot text-pink icon"></view>  
39 - <text class="text">采购入库</text>  
40 - </view>  
41 - </uni-grid-item>  
42 - <uni-grid-item :index=4>  
43 - <view class="grid-item-box">  
44 - <!-- <uni-icons color="#007AFF" type="flag" size="30"></uni-icons> -->  
45 - <view class="cuIcon-exit text-pink icon"></view>  
46 - <text class="text">采购退货</text>  
47 - </view>  
48 - </uni-grid-item>  
49 - </uni-grid>  
50 - </view>  
51 - </uni-section>  
52 - <uni-section title="销售管理" type="line">  
53 - <HR style="border:1 dashed #eeeeff" width="100%" color='#eeeeff' SIZE='1' />  
54 - <view class="grid-body">  
55 - <uni-grid :column="4" :showBorder="false" @change="changeGrid">  
56 - <uni-grid-item :index=5>  
57 - <view class="grid-item-box">  
58 - <!-- <uni-icons color="#007AFF" type="person-filled" size="30"></uni-icons> -->  
59 -  
60 - <view class="cuIcon-settings text-yellow icon"></view>  
61 - <text class="text">参数配置</text>  
62 - </view>  
63 - </uni-grid-item>  
64 - <uni-grid-item :index=6>  
65 - <view class="grid-item-box">  
66 - <!-- <uni-icons color="#007AFF" type="staff-filled" size="30"></uni-icons> -->  
67 - <view class="cuIcon-sort text-yellow icon"></view>  
68 - <text class="text">销售订单</text>  
69 - </view>  
70 - </uni-grid-item>  
71 - <uni-grid-item :index=7>  
72 - <view class="grid-item-box">  
73 - <!-- <uni-icons color="#007AFF" type="auth" size="30"></uni-icons> -->  
74 - <view class="cuIcon-text text-yellow icon"></view>  
75 - <text class="text">销售出库</text>  
76 - </view>  
77 - </uni-grid-item>  
78 - <uni-grid-item :index=8>  
79 - <view class="grid-item-box">  
80 - <!-- <uni-icons color="#007AFF" type="home" size="30"></uni-icons> -->  
81 - <view class="cuIcon-exit text-yellow icon"></view>  
82 - <text class="text">销售退货</text>  
83 - </view>  
84 - </uni-grid-item>  
85 -  
86 - </uni-grid>  
87 - </view>  
88 - </uni-section>  
89 - <uni-section title="零售管理" type="line">  
90 - <HR style="border:1 dashed #eeeeff" width="100%" color='#eeeeff' SIZE='1' />  
91 - <view class="grid-body">  
92 - <uni-grid :column="4" :showBorder="false" @change="changeGrid">  
93 - <uni-grid-item :index=9>  
94 - <view class="grid-item-box">  
95 - <!-- <uni-icons color="#007AFF" type="shop" size="30"></uni-icons> -->  
96 - <view class="cuIcon-settings text-green icon"></view>  
97 - <text class="text">参数配置</text>  
98 - </view>  
99 - </uni-grid-item>  
100 - <uni-grid-item :index=10>  
101 - <view class="grid-item-box">  
102 - <!-- <uni-icons color="#007AFF" type="wallet" size="30"></uni-icons> -->  
103 - <view class="cuIcon-text text-green icon"></view>  
104 - <text class="text">零售出库</text>  
105 - </view>  
106 - </uni-grid-item>  
107 - <uni-grid-item :index=11>  
108 - <view class="grid-item-box">  
109 - <!-- <uni-icons color="#007AFF" type="map-pin-ellipse" size="30"></uni-icons> -->  
110 - <view class="cuIcon-exit text-green icon"></view>  
111 - <text class="text">零售退货</text>  
112 - </view>  
113 - </uni-grid-item>  
114 - </uni-grid>  
115 - </view>  
116 - </uni-section>  
117 - <uni-section title="库存管理" type="line">  
118 - <HR style="border:1 dashed #eeeeff" width="100%" color='#eeeeff' SIZE='1' />  
119 - <view class="grid-body">  
120 - <uni-grid :column="4" :showBorder="false" @change="changeGrid">  
121 - <uni-grid-item :index=12>  
122 - <view class="grid-item-box">  
123 - <!-- <uni-icons color="#007AFF" type="link" size="30"></uni-icons> -->  
124 - <view class="cuIcon-punch text-brown icon"></view>  
125 - <text class="text">商品库存</text>  
126 - </view>  
127 - </uni-grid-item>  
128 - <uni-grid-item :index=13>  
129 - <view class="grid-item-box">  
130 - <!-- <uni-icons type="wallet-filled" size="30"></uni-icons> -->  
131 - <view class="cuIcon-form text-brown icon"></view>  
132 - <text class="text">变动记录</text>  
133 - </view>  
134 - </uni-grid-item>  
135 - <uni-grid-item :index=14>  
136 - <view class="grid-item-box">  
137 - <!-- <uni-icons type="wallet-filled" size="30"></uni-icons> -->  
138 - <view class="cuIcon-edit text-brown icon"></view>  
139 - <text class="text">数量调整</text>  
140 - </view>  
141 - </uni-grid-item>  
142 - <uni-grid-item :index=15>  
143 - <view class="grid-item-box">  
144 - <view class="cuIcon-recharge text-brown icon"></view>  
145 - <text class="text">成本调整</text>  
146 - </view>  
147 - </uni-grid-item>  
148 - <uni-grid-item :index=16>  
149 - <view class="grid-item-box">  
150 - <view class="cuIcon-info text-brown icon"></view>  
151 - <text class="text">调整原因</text>  
152 - </view>  
153 - </uni-grid-item>  
154 - <uni-grid-item :index=17>  
155 - <view class="grid-item-box">  
156 - <view class="cuIcon-camerarotate text-brown icon"></view>  
157 - <text class="text">仓库调拨</text>  
158 - </view>  
159 - </uni-grid-item>  
160 - </uni-grid>  
161 - </view>  
162 - </uni-section>  
163 - <uni-section title="盘点管理" type="line">  
164 - <HR style="border:1 dashed #eeeeff" width="100%" color='#eeeeff' SIZE='1' />  
165 - <view class="grid-body">  
166 - <uni-grid :column="4" :showBorder="false" @change="changeGrid">  
167 - <uni-grid-item :index=18>  
168 - <view class="grid-item-box">  
169 - <!-- <uni-icons color="#007AFF" type="link" size="30"></uni-icons> -->  
170 - <view class="cuIcon-settings text-blue icon"></view>  
171 - <text class="text">参数配置</text>  
172 - </view>  
173 - </uni-grid-item>  
174 - <uni-grid-item :index=19>  
175 - <view class="grid-item-box">  
176 - <!-- <uni-icons type="wallet-filled" size="30"></uni-icons> -->  
177 - <view class="cuIcon-roundcheck text-blue icon"></view>  
178 - <text class="text">预盘点单</text>  
179 - </view>  
180 - </uni-grid-item>  
181 - <uni-grid-item :index=20>  
182 - <view class="grid-item-box">  
183 - <!-- <uni-icons type="wallet-filled" size="30"></uni-icons> -->  
184 - <view class="cuIcon-post text-blue icon"></view>  
185 - <text class="text">盘点任务</text>  
186 - </view>  
187 - </uni-grid-item>  
188 - <uni-grid-item :index=21>  
189 - <view class="grid-item-box">  
190 - <!-- <uni-icons type="wallet-filled" size="30"></uni-icons> -->  
191 - <view class="cuIcon-same text-blue icon"></view>  
192 - <text class="text">盘点单管理</text>  
193 - </view>  
194 - </uni-grid-item>  
195 -  
196 - </uni-grid>  
197 - </view>  
198 - </uni-section>  
199 - <view>  
200 - <uni-popup ref="alertDialog" type="dialog">  
201 - <uni-popup-dialog type="info" cancelText="关闭" confirmText="确定" title="专业版源代码" content="专业版源代码">  
202 - <view><image src="../../static/images/wx.jpg" style="width: 250px;height: 250px;"></image></view>  
203 - </uni-popup-dialog>  
204 - </uni-popup>  
205 - </view>  
206 - </view>  
207 -</template>  
208 -  
209 -<script>  
210 - export default {  
211 - data() {  
212 - return {  
213 - current: 0,  
214 - swiperDotIndex: 0,  
215 - data: [{  
216 - image: 'http://xy.wecando21cn.com/static/images/banner/banner01.jpg'  
217 - },  
218 - {  
219 - image: 'http://xy.wecando21cn.com/static/images/banner/banner02.jpg'  
220 - },  
221 - {  
222 - image: 'http://xy.wecando21cn.com/static/images/banner/banner03.jpg'  
223 - }  
224 - ],  
225 - }  
226 - },  
227 - methods: {  
228 - clickBannerItem(item) {  
229 - console.info(item)  
230 - },  
231 - changeSwiper(e) {  
232 - this.current = e.detail.current  
233 - },  
234 - changeGrid(e) {  
235 - this.$refs.alertDialog.open('center');  
236 - }  
237 - }  
238 - }  
239 -</script>  
240 -  
241 -<style lang="scss">  
242 - /* #ifndef APP-NVUE */  
243 - page {  
244 - display: flex;  
245 - flex-direction: column;  
246 - box-sizing: border-box;  
247 - background-color: #fff;  
248 - min-height: 100%;  
249 - height: auto;  
250 - }  
251 -  
252 - view {  
253 - font-size: 14px;  
254 - line-height: inherit;  
255 - }  
256 -  
257 - .uni-icons {  
258 - color: #007AFF;  
259 - }  
260 -  
261 - /* #endif */  
262 -  
263 - .text {  
264 - text-align: center;  
265 - font-size: 26rpx;  
266 - margin-top: 10rpx;  
267 - }  
268 -  
269 - .grid-item-box {  
270 - flex: 1;  
271 - /* #ifndef APP-NVUE */  
272 - display: flex;  
273 - /* #endif */  
274 - flex-direction: column;  
275 - align-items: center;  
276 - justify-content: center;  
277 - padding: 15px 0;  
278 - }  
279 -  
280 - .uni-margin-wrap {  
281 - width: 690rpx;  
282 - width: 100%;  
283 - ;  
284 - }  
285 -  
286 - .swiper {  
287 - height: 300rpx;  
288 - }  
289 -  
290 - .swiper-box {  
291 - height: 150px;  
292 - }  
293 -  
294 - .swiper-item {  
295 - /* #ifndef APP-NVUE */  
296 - display: flex;  
297 - /* #endif */  
298 - flex-direction: column;  
299 - justify-content: center;  
300 - align-items: center;  
301 - color: #fff;  
302 - height: 300rpx;  
303 - line-height: 300rpx;  
304 - }  
305 -  
306 - @media screen and (min-width: 500px) {  
307 - .uni-swiper-dot-box {  
308 - width: 400px;  
309 - /* #ifndef APP-NVUE */  
310 - margin: 0 auto;  
311 - /* #endif */  
312 - margin-top: 8px;  
313 - }  
314 -  
315 - .image {  
316 - width: 100%;  
317 - }  
318 - }  
319 -  
320 - .icon {  
321 - font-size: 28px;  
322 - }  
323 -  
324 - .text {  
325 - display: block;  
326 - font-size: 13px;  
327 - margin: 8px 0px;  
328 - }  
329 -</style>  
@@ -53,9 +53,9 @@ @@ -53,9 +53,9 @@
53 <uni-easyinput v-model="form.priceListNo" placeholder="请输入价格表编号" :inputBorder="false" /> 53 <uni-easyinput v-model="form.priceListNo" placeholder="请输入价格表编号" :inputBorder="false" />
54 </template> 54 </template>
55 </uni-list-item> 55 </uni-list-item>
56 - <uni-list-item title="开票情况"> 56 + <uni-list-item title="开票要求">
57 <template v-slot:footer> 57 <template v-slot:footer>
58 - <uni-easyinput v-model="form.invoicingStatus" placeholder="请输入开票情况" :inputBorder="false" /> 58 + <uni-easyinput v-model="form.invoicingStatus" placeholder="请输入开票要求" :inputBorder="false" />
59 </template> 59 </template>
60 </uni-list-item> 60 </uni-list-item>
61 <uni-list-item class="amount-item"> 61 <uni-list-item class="amount-item">
@@ -216,7 +216,7 @@ export default { @@ -216,7 +216,7 @@ export default {
216 const m = res.data || {} 216 const m = res.data || {}
217 const next = { ...this.form, ...m } 217 const next = { ...this.form, ...m }
218 next.id = m.id || m.code || id 218 next.id = m.id || m.code || id
219 - next.purchaseOrderLineList = Array.isArray(m.purchaseOrderLineList) ? m.purchaseOrderLineList.map(x => ({ 219 + next.purchaseOrderLineList = Array.isArray(m.purchaseOrderLineList) ? m.purchaseOrderLineList.map(x => ({
220 ...x, 220 ...x,
221 assessmentExceedsAgreement: Number(x.assessmentExceedsAgreement || 0).toFixed(2) || 0.00, 221 assessmentExceedsAgreement: Number(x.assessmentExceedsAgreement || 0).toFixed(2) || 0.00,
222 })) : [] 222 })) : []
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 27
28 <view class="section"> 28 <view class="section">
29 <view class="row"><text class="label">价格表编号</text><text class="value">{{ form.priceListNo }}</text></view> 29 <view class="row"><text class="label">价格表编号</text><text class="value">{{ form.priceListNo }}</text></view>
30 - <view class="row"><text class="label">开票情况</text><text class="value">{{ form.invoicingStatus }}</text></view> 30 + <view class="row"><text class="label">开票要求</text><text class="value">{{ form.invoicingStatus }}</text></view>
31 <view class="row"><text class="label">运费</text><text class="value">{{ form.shippingCost }}</text></view> 31 <view class="row"><text class="label">运费</text><text class="value">{{ form.shippingCost }}</text></view>
32 <view class="row"><text class="label">执行标准</text><text class="value">{{ getDicName('APPLICABLE_STANDARD', 32 <view class="row"><text class="label">执行标准</text><text class="value">{{ getDicName('APPLICABLE_STANDARD',
33 form.executionStandard, dicOptions.APPLICABLE_STANDARD) }}</text></view> 33 form.executionStandard, dicOptions.APPLICABLE_STANDARD) }}</text></view>
@@ -52,9 +52,9 @@ @@ -52,9 +52,9 @@
52 <uni-easyinput v-model="form.priceListNo" placeholder="请输入价格表编号" :inputBorder="false" /> 52 <uni-easyinput v-model="form.priceListNo" placeholder="请输入价格表编号" :inputBorder="false" />
53 </template> 53 </template>
54 </uni-list-item> 54 </uni-list-item>
55 - <uni-list-item title="开票情况"> 55 + <uni-list-item title="开票要求">
56 <template v-slot:footer> 56 <template v-slot:footer>
57 - <uni-easyinput v-model="form.invoicingStatus" placeholder="请输入开票情况" :inputBorder="false" /> 57 + <uni-easyinput v-model="form.invoicingStatus" placeholder="请输入开票要求" :inputBorder="false" />
58 </template> 58 </template>
59 </uni-list-item> 59 </uni-list-item>
60 <uni-list-item class="amount-item"> 60 <uni-list-item class="amount-item">
@@ -212,7 +212,7 @@ export default { @@ -212,7 +212,7 @@ export default {
212 const next = { ...this.form, ...m } 212 const next = { ...this.form, ...m }
213 next.id = m.id || m.code || id; 213 next.id = m.id || m.code || id;
214 next.purchaseOrderId = m.orderId || ''; 214 next.purchaseOrderId = m.orderId || '';
215 - next.purchaseOrderLineList = Array.isArray(m.afterChangeSpecList) ? m.afterChangeSpecList.map(x => ({ 215 + next.purchaseOrderLineList = Array.isArray(m.afterChangeSpecList) ? m.afterChangeSpecList.map(x => ({
216 ...x, 216 ...x,
217 assessmentExceedsAgreement: Number(x.assessmentExceedsAgreement || 0).toFixed(2) || 0.00, 217 assessmentExceedsAgreement: Number(x.assessmentExceedsAgreement || 0).toFixed(2) || 0.00,
218 })) : [] 218 })) : []
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 27
28 <view class="section"> 28 <view class="section">
29 <view class="row"><text class="label">价格表编号</text><text class="value">{{ form.priceListNo }}</text></view> 29 <view class="row"><text class="label">价格表编号</text><text class="value">{{ form.priceListNo }}</text></view>
30 - <view class="row"><text class="label">开票情况</text><text class="value">{{ form.invoicingStatus }}</text></view> 30 + <view class="row"><text class="label">开票要求</text><text class="value">{{ form.invoicingStatus }}</text></view>
31 <view class="row"><text class="label">运费</text><text class="value">{{ form.shippingCost }}</text></view> 31 <view class="row"><text class="label">运费</text><text class="value">{{ form.shippingCost }}</text></view>
32 <view class="row"><text class="label">执行标准</text><text class="value">{{ getDicName('APPLICABLE_STANDARD', 32 <view class="row"><text class="label">执行标准</text><text class="value">{{ getDicName('APPLICABLE_STANDARD',
33 form.executionStandard, dicOptions.APPLICABLE_STANDARD) }}</text></view> 33 form.executionStandard, dicOptions.APPLICABLE_STANDARD) }}</text></view>
  1 +<template>
  2 + <view class="page">
  3 + <scroll-view class="scroll" scroll-y>
  4 + <view class="detail-page">
  5 + <view v-if="isEditAll">
  6 + <view class="section">
  7 + <uni-list-item title="订货单位" class="no-border-top">
  8 + <template v-slot:footer>
  9 + <view class="readonly-text">{{ form.orderingUnitName }}</view>
  10 + </template>
  11 + </uni-list-item>
  12 + <uni-list-item class="select-item" :class="form.sampleTypeName ? 'is-filled' : 'is-empty'"
  13 + clickable @click="openSheet('sampleType')" :rightText="form.sampleTypeName || '请选择'"
  14 + showArrow>
  15 + <template v-slot:body>
  16 + <view class="item-title"><text>试样种类</text></view>
  17 + </template>
  18 + </uni-list-item>
  19 + <uni-list-item class="select-item" :class="form.customerTypeName ? 'is-filled' : 'is-empty'"
  20 + clickable @click="openSheet('customerType')" :rightText="form.customerTypeName || '请选择'"
  21 + showArrow>
  22 + <template v-slot:body>
  23 + <view class="item-title"><text>客户类型</text></view>
  24 + </template>
  25 + </uni-list-item>
  26 + <uni-list-item title="生产厂">
  27 + <template v-slot:footer>
  28 + <view class="readonly-text">{{ form.workshopName }}</view>
  29 + </template>
  30 + </uni-list-item>
  31 + <uni-list-item title="所属品种">
  32 + <template v-slot:footer>
  33 + <view class="readonly-text">{{ form.belongingBreed }}</view>
  34 + </template>
  35 + </uni-list-item>
  36 + <uni-list-item title="原供货同行">
  37 + <template v-slot:footer>
  38 + <uni-easyinput v-model="form.originalSupplierPeer" placeholder="请输入原供货同行"
  39 + :inputBorder="false" />
  40 + </template>
  41 + </uni-list-item>
  42 + </view>
  43 +
  44 + <!-- 产品 -->
  45 + <view class="section2">
  46 + <!-- mode="add" 允许编辑 -->
  47 + <Product mode="add" :list="initPurchaseOrderLineList" @change="purchaseOrderLineListChange"
  48 + :provideSamplesOptions="provideSamplesOptions"
  49 + :clearParametersOptions="clearParametersOptions" />
  50 + </view>
  51 +
  52 + <view class="section3">
  53 + <view class="view-total">
  54 + <view class="head">合计</view>
  55 + <view class="row">
  56 + <view class="row2">
  57 + <text class="label">数量</text><text class="value">{{ form.totalQuantity }}</text>
  58 + </view>
  59 + </view>
  60 + </view>
  61 + </view>
  62 +
  63 + <view class="section2">
  64 +
  65 + <uni-list-item class="select-item"
  66 + :class="form.sampleQuantityRegulationName ? 'is-filled' : 'is-empty'" clickable
  67 + @click="openSheet('sampleQuantityRegulation')"
  68 + :rightText="form.sampleQuantityRegulationName || '请选择'" showArrow>
  69 + <template v-slot:body>
  70 + <view class="item-title"><text>本次试样数量是否超规定</text></view>
  71 + </template>
  72 + </uni-list-item>
  73 +
  74 + <uni-list-item class="select-item"
  75 + :class="form.specificationQuantityRegulationName ? 'is-filled' : 'is-empty'" clickable
  76 + @click="openSheet('specificationQuantityRegulation')"
  77 + :rightText="form.specificationQuantityRegulationName || '请选择'" showArrow>
  78 + <template v-slot:body>
  79 + <view class="item-title"><text>试样规格个数是否超规定</text></view>
  80 + </template>
  81 + </uni-list-item>
  82 +
  83 + <uni-list-item title="试样次数">
  84 + <template v-slot:footer>
  85 + <uni-easyinput type="textarea" v-model="form.sampleFrequency" placeholder="请输入试样次数"
  86 + :inputBorder="false" />
  87 + </template>
  88 + </uni-list-item>
  89 +
  90 + <uni-list-item title="前期不合格描述">
  91 + <template v-slot:footer>
  92 + <uni-easyinput type="textarea" v-model="form.earlyNonconformityDescription"
  93 + placeholder="请输入前期不合格描述" :inputBorder="false" />
  94 + </template>
  95 + </uni-list-item>
  96 +
  97 + </view>
  98 + </view>
  99 + <view v-else class="detail-section">
  100 + <view class="section">
  101 + <text class="row company">{{ form.orderingUnitName }}</text>
  102 + <view :class="['status', `status_${form.status}`]" />
  103 + <view class="row"><text class="label">试样种类</text><text class="value">{{ form.sampleTypeName
  104 + }}</text></view>
  105 + <view class="row"><text class="label">客户类型</text><text class="value">{{ form.customerTypeName
  106 + }}</text></view>
  107 + <view class="row"><text class="label">分厂</text><text class="value">{{ form.workshopName
  108 + }}</text></view>
  109 + <view class="row"><text class="label">所属品种</text><text class="value">{{ form.belongingBreed
  110 + }}</text></view>
  111 + <view class="row"><text class="label">原供货同行</text><text class="value">{{
  112 + form.originalSupplierPeer }}</text>
  113 + </view>
  114 + </view>
  115 +
  116 + <!-- 产品 -->
  117 + <view class="section2">
  118 + <Product mode="view" :list="form.productSampleConfirmationSlipDetailList" />
  119 + </view>
  120 +
  121 + <view class="section3">
  122 + <view class="view-total">
  123 + <view class="head">合计</view>
  124 + <view class="row">
  125 + <view class="row2">
  126 + <text class="label">数量</text><text class="value">{{ form.totalQuantity }}</text>
  127 + </view>
  128 + </view>
  129 + </view>
  130 + </view>
  131 +
  132 + <view class="section">
  133 + <view class="row"><text class="label">数量</text><text class="value">{{ form.totalQuantity
  134 + }}</text></view>
  135 + <view class="row"><text class="label">本次试样数量是否超规定</text><text class="value">{{
  136 + form.sampleQuantityRegulation ?
  137 + '是' : '否' }}</text></view>
  138 + <view class="row"><text class="label">试样规格个数是否超规定</text><text class="value">{{
  139 + form.specificationQuantityRegulation ? '是' : '否' }}</text></view>
  140 + <view class="row"><text class="label">试样次数</text><text class="value">{{ form.sampleFrequency
  141 + }}</text></view>
  142 + <uni-list-item class="row-2" :class="form.earlyNonconformityDescription ? 'is-filled' : 'is-empty'" v-if="isEditEarlyNonconformityDescription" title="前期不合格描述">
  143 + <template v-slot:footer>
  144 + <uni-easyinput type="textarea" v-model="form.earlyNonconformityDescription"
  145 + placeholder="请输入前期不合格描述" :inputBorder="false" />
  146 + </template>
  147 + </uni-list-item>
  148 + <view v-else class="row"><text class="label">前期不合格描述</text><text class="value">{{
  149 + form.earlyNonconformityDescription
  150 + }}</text></view>
  151 + </view>
  152 + </view>
  153 +
  154 +
  155 + </view>
  156 + </scroll-view>
  157 + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options"
  158 + v-model="sheet.value" @confirm="onSheetConfirm" />
  159 + </view>
  160 +</template>
  161 +
  162 +<script>
  163 +import { getDetailApi } from '@/api/confirmation_form.js'
  164 +import Product from './product.vue'
  165 +import {
  166 + getDicByCodes
  167 +} from '@/utils/dic'
  168 +import SingleSelectSheet from '@/components/single-select/index.vue'
  169 +// 办事处内勤:可编辑 (编辑时的所有字段)
  170 +// 办事处主管:只能编辑 :前期不合格描述
  171 +// 其他人 :只能查看
  172 +export default {
  173 + name: 'ConfirmationFormApprove',
  174 + components: { Product, SingleSelectSheet },
  175 + props: { id: { type: [String, Number], default: '' } },
  176 + data() {
  177 + return {
  178 + form: {},
  179 + initPurchaseOrderLineList: [],
  180 + roleCodes: [],
  181 + canEditSupplementary: false,
  182 + isEditAll: false,
  183 + isEditEarlyNonconformityDescription: false,
  184 + sheet: { visible: false, title: '请选择', options: [], value: '', field: '' },
  185 + dicOptions: {
  186 + ENTERPRISE_TYPE: [], // 客户类型
  187 + SAMPLE_TYPE: [], // 试样种类
  188 + CLEAR_PARAMETERS: [], // 是否提供明确参数
  189 + PROVIDE_SAMPLES: [], // 是否提供样品
  190 + },
  191 + enterpriseTypeLocal: [], // 客户类型
  192 + sampleTypeLocal: [], // 试样种类
  193 + provideSamplesOptions: [], // 是否提供样品
  194 + clearParametersOptions: [], // 是否提供明确参数
  195 + }
  196 + },
  197 + computed: {
  198 + },
  199 + watch: {
  200 + id: {
  201 + immediate: true,
  202 + handler(val) {
  203 + const v = (val !== undefined && val !== null) ? String(val) : ''
  204 + if (v) {
  205 + this.loadDetail(v);
  206 + this.loadAllDicData()
  207 + this.getRoleInfo();
  208 + }
  209 + }
  210 + }
  211 + },
  212 + onLoad(query) {
  213 +
  214 + },
  215 + methods: {
  216 + getRoleInfo() {
  217 + this.roleCodes = this.$store.getters.roleCodes || [];
  218 + console.log('roleCodes', this.roleCodes)
  219 + // 办事处内勤:可编辑 (编辑时的所有字段) bscnq
  220 + this.isEditAll = this.roleCodes.includes('bscnq');
  221 + // 办事处主管:只能编辑 :前期不合格描述 bsczg
  222 + this.isEditEarlyNonconformityDescription = this.roleCodes.includes('bsczg');
  223 + },
  224 + async loadDetail(id) {
  225 + try {
  226 + const res = await getDetailApi(id)
  227 + const m = res.data || {}
  228 + const next = { ...this.form, ...m }
  229 + // 确保ID存在
  230 + next.id = m.id || id
  231 + next.sampleQuantityRegulationName = m.sampleQuantityRegulation === true ? '是' : '否'
  232 + next.specificationQuantityRegulationName = m.specificationQuantityRegulation === true ? '是' : '否'
  233 + // 映射列表
  234 + // 注意:详情返回的是 productSampleConfirmationSlipDetailList,需要赋值给 initPurchaseOrderLineList 以便 Product 组件初始化
  235 + // 且需要处理字段兼容性,确保 Product 组件能正确显示和编辑
  236 + const lines = Array.isArray(m.productSampleConfirmationSlipDetailList) ? m.productSampleConfirmationSlipDetailList.map(x => ({
  237 + ...x,
  238 + // 确保 Product 组件需要的字段存在
  239 + // Product组件使用: quantity(需发), shippedQuantity(实发), supplementaryQuantity(需求补货), salesPrice(单价)
  240 + // 详情接口返回的字段应该已经包含了这些,如果有差异需要在此处转换
  241 + // 注意:add.vue中 onRelateConfirm 做了映射,这里是回显,通常直接使用即可
  242 + })) : []
  243 +
  244 + this.form = next;
  245 + this.initPurchaseOrderLineList = lines;
  246 + } catch (e) {
  247 + this.form = {}
  248 + }
  249 + },
  250 + loadAllDicData() {
  251 + const dicCodes = ['ENTERPRISE_TYPE', 'SAMPLE_TYPE', 'CLEAR_PARAMETERS', 'PROVIDE_SAMPLES']
  252 + return getDicByCodes(dicCodes).then(results => {
  253 + this.dicOptions.ENTERPRISE_TYPE = results.ENTERPRISE_TYPE.data || []
  254 + this.dicOptions.SAMPLE_TYPE = results.SAMPLE_TYPE.data || []
  255 + this.dicOptions.CLEAR_PARAMETERS = results.CLEAR_PARAMETERS.data || []
  256 + this.dicOptions.PROVIDE_SAMPLES = results.PROVIDE_SAMPLES.data || []
  257 +
  258 + this.enterpriseTypeLocal = (this.dicOptions.ENTERPRISE_TYPE || []).map(it => ({
  259 + value: it.code,
  260 + label: it.name
  261 + }))
  262 + this.sampleTypeLocal = (this.dicOptions.SAMPLE_TYPE || []).map(it => ({
  263 + value: it.code,
  264 + label: it.name
  265 + }))
  266 + this.provideSamplesOptions = (this.dicOptions.PROVIDE_SAMPLES || []).map(it => ({
  267 + value: it.code,
  268 + label: it.name
  269 + }))
  270 + this.clearParametersOptions = (this.dicOptions.CLEAR_PARAMETERS || []).map(it => ({
  271 + value: it.code,
  272 + label: it.name
  273 + }))
  274 + }).catch(() => {
  275 + this.dicOptions = {
  276 + ENTERPRISE_TYPE: [], // 客户类型
  277 + SAMPLE_TYPE: [], // 试样种类
  278 + CLEAR_PARAMETERS: [], // 是否提供明确参数
  279 + PROVIDE_SAMPLES: [], // 是否提供样品
  280 + }
  281 + this.enterpriseTypeLocal = []
  282 + this.sampleTypeLocal = []
  283 + this.provideSamplesOptions = []
  284 + this.clearParametersOptions = []
  285 + })
  286 + },
  287 + calculateSummary(list) {
  288 + const summary = (list || []).reduce((acc, it) => {
  289 + const qty = Number(it.supplementaryQuantity) || 0
  290 + const shipped = Number(it.shippedQuantity) || 0
  291 + const orderQty = Number(it.quantity) || 0
  292 + acc.totalSupplementaryQuantity += qty
  293 + acc.totalShippedQuantity += shipped
  294 + acc.totalQuantity += orderQty
  295 + return acc
  296 + }, { totalQuantity: 0, totalShippedQuantity: 0, totalSupplementaryQuantity: 0 })
  297 +
  298 + const fixedTotalQuantity = Number(summary.totalQuantity.toFixed(2))
  299 + const fixedTotalShippedQuantity = Number(summary.totalShippedQuantity.toFixed(2))
  300 + const fixedTotalSupplementaryQuantity = Number(summary.totalSupplementaryQuantity.toFixed(2))
  301 + this.form.totalQuantity = fixedTotalQuantity
  302 + this.form.totalShippedQuantity = fixedTotalShippedQuantity
  303 + this.form.totalSupplementaryQuantity = fixedTotalSupplementaryQuantity
  304 + },
  305 + purchaseOrderLineListChange(data) {
  306 + const list = Array.isArray(data) ? data : []
  307 + this.form.productSampleConfirmationSlipDetailList = list
  308 + },
  309 + getFormValues() {
  310 + delete this.form.status;
  311 + const m = this.form || {}
  312 + return JSON.parse(JSON.stringify(m))
  313 + },
  314 + // 审批-通过:校验表单
  315 + checkForm() {
  316 + return true
  317 + },
  318 + openSheet(field) {
  319 + let options = []
  320 + let title = ''
  321 + let value = ''
  322 +
  323 + if (field === 'sampleType') {
  324 + title = '试样种类'
  325 + options = this.sampleTypeLocal
  326 + value = this.form.sampleType
  327 + } else if (field === 'customerType') {
  328 + title = '客户类型'
  329 + options = this.enterpriseTypeLocal
  330 + value = this.form.customerType
  331 + } else if (field === 'sampleQuantityRegulation') {
  332 + title = '本次试样数量是否超规定'
  333 + options = [{ value: true, label: '是' }, { value: false, label: '否' }]
  334 + value = this.form.sampleQuantityRegulation
  335 + } else if (field === 'specificationQuantityRegulation') {
  336 + title = '试样规格个数是否超规定'
  337 + options = [{ value: true, label: '是' }, { value: false, label: '否' }]
  338 + value = this.form.specificationQuantityRegulation
  339 + }
  340 +
  341 + const match = options.find(o => String(o.value) === String(value))
  342 + this.sheet = { ...this.sheet, visible: true, title, options, field, value: match ? match.value : '' }
  343 + },
  344 + onSheetConfirm({ value, label }) {
  345 + const field = this.sheet.field
  346 + this.form[field] = value
  347 + this.form[field + 'Name'] = label
  348 + this.sheet.visible = false
  349 + },
  350 + }
  351 +}
  352 +</script>
  353 +
  354 +<style lang="scss" scoped>
  355 +.page {
  356 + display: flex;
  357 + flex-direction: column;
  358 + height: 100vh;
  359 +}
  360 +
  361 +.scroll {
  362 + flex: 1;
  363 + background: #f3f3f3;
  364 +}
  365 +
  366 +.detail-page {
  367 + padding-bottom: 150rpx;
  368 +}
  369 +
  370 +.section {
  371 + padding: 32rpx;
  372 + background: #fff;
  373 + margin-bottom: 20rpx;
  374 + position: relative;
  375 +
  376 +}
  377 +
  378 +.row {
  379 + display: flex;
  380 + margin-bottom: 28rpx;
  381 +
  382 + &:last-child {
  383 + margin-bottom: 0;
  384 + }
  385 +
  386 + &.company {
  387 + font-size: 36rpx;
  388 + font-weight: 600;
  389 + color: rgba(0, 0, 0, 0.9);
  390 + padding-top: 10rpx;
  391 + margin-bottom: 32rpx;
  392 + line-height: 50rpx;
  393 + }
  394 +
  395 + .label {
  396 + width: 240rpx;
  397 + line-height: 32rpx;
  398 + font-size: 28rpx;
  399 + color: rgba(0, 0, 0, 0.6);
  400 + }
  401 +
  402 + .value {
  403 + flex: 1;
  404 + line-height: 32rpx;
  405 + font-size: 28rpx;
  406 + color: rgba(0, 0, 0, 0.9);
  407 + text-align: right;
  408 + word-break: break-all;
  409 + }
  410 +}
  411 +
  412 +.row-2 {
  413 + display: flex;
  414 + margin-bottom: 28rpx;
  415 +
  416 + &:last-child {
  417 + margin-bottom: 0;
  418 + }
  419 +
  420 + &.company {
  421 + font-size: 36rpx;
  422 + font-weight: 600;
  423 + color: rgba(0, 0, 0, 0.9);
  424 + padding-top: 10rpx;
  425 + margin-bottom: 32rpx;
  426 + line-height: 50rpx;
  427 + }
  428 +
  429 + .label {
  430 + width: 240rpx;
  431 + line-height: 32rpx;
  432 + font-size: 28rpx;
  433 + color: rgba(0, 0, 0, 0.6);
  434 + }
  435 +
  436 + .value {
  437 + flex: 1;
  438 + line-height: 32rpx;
  439 + font-size: 28rpx;
  440 + color: rgba(0, 0, 0, 0.9);
  441 + text-align: right;
  442 + word-break: break-all;
  443 + }
  444 +}
  445 +
  446 +
  447 +.title-header {
  448 + background-color: #fff;
  449 + display: flex;
  450 + align-items: center;
  451 + padding: 32rpx 32rpx 22rpx;
  452 + border-bottom: 1rpx dashed #f0f0f0;
  453 +
  454 + &_icon {
  455 + width: 32rpx;
  456 + height: 28rpx;
  457 + margin-right: 16rpx;
  458 + }
  459 +
  460 + span {
  461 + color: rgba(0, 0, 0, 0.9);
  462 + font-size: 32rpx;
  463 + line-height: 44rpx;
  464 + font-weight: 600;
  465 + }
  466 +}
  467 +
  468 +.section3 {
  469 + padding: 0 32rpx;
  470 + background-color: #fff;
  471 + margin-bottom: 20rpx;
  472 +}
  473 +
  474 +.view-total {
  475 + padding: 20rpx 0;
  476 +
  477 + .head {
  478 + font-size: 32rpx;
  479 + font-weight: 600;
  480 + line-height: 50rpx;
  481 + color: rgba(0, 0, 0, 0.9);
  482 + padding-bottom: 16rpx;
  483 + margin-bottom: 24rpx;
  484 + border-bottom: 1px dashed #E7E7E7;
  485 + }
  486 +
  487 + .row {
  488 + display: flex;
  489 + margin-bottom: 24rpx;
  490 + line-height: 32rpx;
  491 +
  492 + .row2 {
  493 + width: 50%;
  494 + }
  495 +
  496 + .label {
  497 + width: 180rpx;
  498 + margin-right: 14rpx;
  499 + color: rgba(0, 0, 0, 0.6);
  500 + font-size: 28rpx;
  501 + }
  502 +
  503 + .value {
  504 + flex: 1;
  505 + color: rgba(0, 0, 0, 0.9);
  506 + font-size: 28rpx;
  507 + white-space: pre-wrap;
  508 + word-break: break-all;
  509 + }
  510 + }
  511 +}
  512 +
  513 +::v-deep .no-border-top {
  514 + .uni-list--border::after {
  515 + background-color: transparent;
  516 + }
  517 +}
  518 +
  519 +.detail-section {
  520 +
  521 + .section {
  522 + padding: 32rpx;
  523 + background: #fff;
  524 + margin-bottom: 20rpx;
  525 + position: relative;
  526 +
  527 +
  528 + }
  529 +
  530 + .row {
  531 + display: flex;
  532 + margin-bottom: 28rpx;
  533 +
  534 + &:last-child {
  535 + margin-bottom: 0;
  536 + }
  537 +
  538 + &.company {
  539 + font-size: 36rpx;
  540 + font-weight: 600;
  541 + color: rgba(0, 0, 0, 0.9);
  542 + padding-top: 10rpx;
  543 + margin-bottom: 32rpx;
  544 + line-height: 50rpx;
  545 + }
  546 +
  547 + .label {
  548 + max-width: 400rpx;
  549 + margin-right: 20rpx;
  550 + line-height: 32rpx;
  551 + font-size: 28rpx;
  552 + color: rgba(0, 0, 0, 0.6);
  553 + }
  554 +
  555 + .value {
  556 + flex: 1;
  557 + line-height: 32rpx;
  558 + font-size: 28rpx;
  559 + color: rgba(0, 0, 0, 0.9);
  560 + text-align: right;
  561 + word-break: break-all;
  562 + }
  563 + }
  564 +
  565 + .title-header {
  566 + background-color: #fff;
  567 + display: flex;
  568 + align-items: center;
  569 + padding: 32rpx 32rpx 22rpx;
  570 + border-bottom: 1rpx dashed #f0f0f0;
  571 +
  572 + &_icon {
  573 + width: 32rpx;
  574 + height: 28rpx;
  575 + margin-right: 16rpx;
  576 + }
  577 +
  578 + span {
  579 + color: rgba(0, 0, 0, 0.9);
  580 + font-size: 32rpx;
  581 + line-height: 44rpx;
  582 + font-weight: 600;
  583 + }
  584 + }
  585 +
  586 + .section2 {
  587 + background: #f1f1f1;
  588 + }
  589 +
  590 +
  591 + .section3 {
  592 + padding: 0 32rpx;
  593 + background-color: #fff;
  594 + margin: 20rpx 0;
  595 + }
  596 +
  597 + .view-total {
  598 + padding-bottom: 20rpx;
  599 +
  600 + .head {
  601 + font-size: 32rpx;
  602 + font-weight: 600;
  603 + line-height: 50rpx;
  604 + color: rgba(0, 0, 0, 0.9);
  605 + padding-bottom: 16rpx;
  606 + margin-bottom: 24rpx;
  607 + border-bottom: 1px dashed #E7E7E7;
  608 + }
  609 +
  610 + .row {
  611 + display: flex;
  612 + margin-bottom: 24rpx;
  613 + line-height: 32rpx;
  614 +
  615 + .row2 {
  616 + width: 50%;
  617 + }
  618 +
  619 + .label {
  620 + width: 180rpx;
  621 + margin-right: 14rpx;
  622 + color: rgba(0, 0, 0, 0.6);
  623 + font-size: 28rpx;
  624 + }
  625 +
  626 + .value {
  627 + flex: 1;
  628 + color: rgba(0, 0, 0, 0.9);
  629 + font-size: 28rpx;
  630 + white-space: pre-wrap;
  631 + word-break: break-all;
  632 + }
  633 + }
  634 + }
  635 +}
  636 +::v-deep .row-2 {
  637 + .uni-list-item__container {
  638 + padding-left: 0;
  639 + padding-right: 0;
  640 + }
  641 +}
  642 +</style>
  1 +<template>
  2 + <view class="page">
  3 + <scroll-view class="scroll" scroll-y>
  4 + <view class="detail-page">
  5 + <view class="section">
  6 + <text class="row company">{{ form.orderingUnitName }}</text>
  7 + <view :class="['status', `status_${form.status}`]" />
  8 + <view class="row"><text class="label">试样种类</text><text class="value">{{ form.sampleTypeName }}</text></view>
  9 + <view class="row"><text class="label">客户类型</text><text class="value">{{ form.customerTypeName }}</text></view>
  10 + <view class="row"><text class="label">生产厂</text><text class="value">{{ form.workshopName }}</text></view>
  11 + <view class="row"><text class="label">所属品种</text><text class="value">{{ form.belongingBreed }}</text></view>
  12 + <view class="row"><text class="label">原供货同行</text><text class="value">{{ form.originalSupplierPeer }}</text>
  13 + </view>
  14 + </view>
  15 +
  16 + <!-- 产品 -->
  17 + <view class="section2">
  18 + <Product mode="view" :list="form.productSampleConfirmationSlipDetailList" />
  19 + </view>
  20 +
  21 + <view class="section3">
  22 + <view class="view-total">
  23 + <view class="head">合计</view>
  24 + <view class="row">
  25 + <view class="row2">
  26 + <text class="label">数量</text><text class="value">{{ form.totalQuantity }}</text>
  27 + </view>
  28 + </view>
  29 + </view>
  30 + </view>
  31 +
  32 + <view class="section">
  33 + <view class="row"><text class="label">数量</text><text class="value">{{ form.totalQuantity }}</text></view>
  34 + <view class="row"><text class="label">本次试样数量是否超规定</text><text class="value">{{ form.sampleQuantityRegulation ?
  35 + '是' : '否' }}</text></view>
  36 + <view class="row"><text class="label">试样规格个数是否超规定</text><text class="value">{{
  37 + form.specificationQuantityRegulation ? '是' : '否' }}</text></view>
  38 + <view class="row"><text class="label">试样次数</text><text class="value">{{ form.sampleFrequency }}</text></view>
  39 + <view class="row"><text class="label">前期不合格描述</text><text class="value">{{ form.earlyNonconformityDescription
  40 + }}</text></view>
  41 + </view>
  42 + </view>
  43 + </scroll-view>
  44 + <detail-buttons :buttons="displayButtons" @click="handleButtonClick" />
  45 + </view>
  46 +</template>
  47 +
  48 +<script>
  49 +import { getDetailApi } from '@/api/confirmation_form.js'
  50 +import Product from './product.vue'
  51 +import DetailButtons from '@/components/detail-buttons/index.vue'
  52 +
  53 +export default {
  54 + name: 'ConfirmationFormDetail',
  55 + components: { Product, DetailButtons },
  56 + data() {
  57 + return {
  58 + form: {},
  59 + buttons: [
  60 + { text: '编辑', visible: true, variant: 'outline', event: 'edit' },
  61 + { text: '审核详情', visible: true, variant: 'outline', event: 'auditDetail' },
  62 + { text: '审核', visible: true, variant: 'primary', event: 'audit' },
  63 + ]
  64 + }
  65 + },
  66 + computed: {
  67 + statusFlags() {
  68 + const m = this.form || {}
  69 + const e = String(m.status || '')
  70 + // showAudit 这个字段就是后端自己判断的 制单人所在区域 所有人 权限
  71 + return {
  72 + canEdit: !e && m.showAudit || false,
  73 + canAudit: e === 'AUDIT' && m.showExamine || false,
  74 + canAuditDetail: !!e || false,
  75 + }
  76 + },
  77 + displayButtons() {
  78 + const f = this.statusFlags
  79 + return [
  80 + { ...this.buttons[0], visible: f.canEdit }, // 不需要额外的角色权限
  81 + { ...this.buttons[1], visible: f.canAuditDetail && this.$auth.hasPermi('sample-order:confirmation-form:review') },
  82 + { ...this.buttons[2], visible: f.canAudit && this.$auth.hasPermi('sample-order:confirmation-form:approve') },
  83 + ]
  84 + }
  85 + },
  86 + onLoad(query) {
  87 + const id = (query && (query.id || query.code)) || ''
  88 + if (id) this.loadDetail(id)
  89 + },
  90 + methods: {
  91 + async loadDetail(id) {
  92 + try {
  93 + const res = await getDetailApi(id)
  94 + this.form = res.data || {}
  95 + } catch (e) {
  96 + this.form = {}
  97 + }
  98 + },
  99 + handleButtonClick(btn) {
  100 + if (!btn || btn.disabled) return
  101 + const map = {
  102 + edit: () => this.onEdit(),
  103 + auditDetail: () => this.onAuditDetail(),
  104 + audit: () => this.onAudit(),
  105 + }
  106 + const fn = map[btn.event]
  107 + if (typeof fn === 'function') fn()
  108 + },
  109 + onEdit() {
  110 + const id = this.form.id || this.form.code
  111 + if (id) uni.navigateTo({ url: `/pages/confirmation_form/modify?id=${id}` })
  112 + },
  113 + onAuditDetail() {
  114 + uni.setStorageSync('sourceBusinessId', this.form.id)
  115 + uni.navigateTo({ url: '/pages/flow/audit_detail' })
  116 + },
  117 + onAudit() {
  118 + uni.setStorageSync('sourceBusinessId', this.form.id)
  119 + uni.navigateTo({ url: '/pages/flow/audit' })
  120 + },
  121 +
  122 + }
  123 +}
  124 +</script>
  125 +
  126 +<style lang="scss" scoped>
  127 +.page {
  128 + display: flex;
  129 + flex-direction: column;
  130 + height: 100vh;
  131 +}
  132 +
  133 +.scroll {
  134 + flex: 1;
  135 + background: #f3f3f3;
  136 +}
  137 +
  138 +.detail-page {
  139 + padding-bottom: 150rpx;
  140 +}
  141 +
  142 +.section {
  143 + padding: 32rpx;
  144 + background: #fff;
  145 + margin-bottom: 20rpx;
  146 + position: relative;
  147 +
  148 + .status {
  149 + position: absolute;
  150 + top: 16rpx;
  151 + right: 52rpx;
  152 + width: 180rpx;
  153 + height: 146rpx;
  154 + background-repeat: no-repeat;
  155 + background-size: 100% 100%;
  156 + background-position: center;
  157 +
  158 + &_AUDIT {
  159 + background-image: url('~@/static/images/dev_manage/status_1.png');
  160 + }
  161 +
  162 + &_PASS {
  163 + background-image: url('~@/static/images/dev_manage/status_2.png');
  164 + }
  165 +
  166 + &_REFUSE {
  167 + background-image: url('~@/static/images/dev_manage/status_3.png');
  168 + }
  169 +
  170 + &_CANCEL {
  171 + background-image: url('~@/static/images/dev_manage/status_4.png');
  172 + }
  173 +
  174 + }
  175 +}
  176 +
  177 +.row {
  178 + display: flex;
  179 + margin-bottom: 28rpx;
  180 +
  181 + &:last-child {
  182 + margin-bottom: 0;
  183 + }
  184 +
  185 + &.company {
  186 + font-size: 36rpx;
  187 + font-weight: 600;
  188 + color: rgba(0, 0, 0, 0.9);
  189 + padding-top: 10rpx;
  190 + margin-bottom: 32rpx;
  191 + line-height: 50rpx;
  192 + }
  193 +
  194 + .label {
  195 + max-width: 400rpx;
  196 + margin-right: 20rpx;
  197 + line-height: 32rpx;
  198 + font-size: 28rpx;
  199 + color: rgba(0, 0, 0, 0.6);
  200 + }
  201 +
  202 + .value {
  203 + flex: 1;
  204 + line-height: 32rpx;
  205 + font-size: 28rpx;
  206 + color: rgba(0, 0, 0, 0.9);
  207 + text-align: right;
  208 + word-break: break-all;
  209 + }
  210 +}
  211 +
  212 +.title-header {
  213 + background-color: #fff;
  214 + display: flex;
  215 + align-items: center;
  216 + padding: 32rpx 32rpx 22rpx;
  217 + border-bottom: 1rpx dashed #f0f0f0;
  218 +
  219 + &_icon {
  220 + width: 32rpx;
  221 + height: 28rpx;
  222 + margin-right: 16rpx;
  223 + }
  224 +
  225 + span {
  226 + color: rgba(0, 0, 0, 0.9);
  227 + font-size: 32rpx;
  228 + line-height: 44rpx;
  229 + font-weight: 600;
  230 + }
  231 +}
  232 +
  233 +.section2 {
  234 + background: #f1f1f1;
  235 +}
  236 +
  237 +
  238 +.section3 {
  239 + padding: 0 32rpx;
  240 + background-color: #fff;
  241 + margin: 20rpx 0;
  242 +}
  243 +
  244 +.view-total {
  245 + padding-bottom: 20rpx;
  246 +
  247 + .head {
  248 + font-size: 32rpx;
  249 + font-weight: 600;
  250 + line-height: 50rpx;
  251 + color: rgba(0, 0, 0, 0.9);
  252 + padding-bottom: 16rpx;
  253 + margin-bottom: 24rpx;
  254 + border-bottom: 1px dashed #E7E7E7;
  255 + }
  256 +
  257 + .row {
  258 + display: flex;
  259 + margin-bottom: 24rpx;
  260 + line-height: 32rpx;
  261 +
  262 + .row2 {
  263 + width: 50%;
  264 + }
  265 +
  266 + .label {
  267 + width: 180rpx;
  268 + margin-right: 14rpx;
  269 + color: rgba(0, 0, 0, 0.6);
  270 + font-size: 28rpx;
  271 + }
  272 +
  273 + .value {
  274 + flex: 1;
  275 + color: rgba(0, 0, 0, 0.9);
  276 + font-size: 28rpx;
  277 + white-space: pre-wrap;
  278 + word-break: break-all;
  279 + }
  280 + }
  281 +}
  282 +</style>
  1 +<template>
  2 + <view class="page">
  3 + <view class="dev-list-fixed">
  4 + <view class="search-row">
  5 + <uni-search-bar v-model="searchKeyword" radius="6" placeholder="请输入订货单位" clearButton="auto"
  6 + cancelButton="none" bgColor="#F3F3F3" textColor="rgba(0,0,0,0.4)" @confirm="search"
  7 + @input="onSearchInput" />
  8 + <view class="tool-icons">
  9 + <image class="tool-icon" src="/static/images/dev_manage/filter_icon.png" @click="openFilter" />
  10 + </view>
  11 + </view>
  12 + </view>
  13 +
  14 +
  15 + <!-- 列表卡片组件 -->
  16 + <view class="list-box">
  17 + <card-list ref="cardRef" :fetch-fn="fetchList" :query="query" :extra="extraParams" row-key="id"
  18 + :enable-refresh="true" :enable-load-more="true" @loaded="onCardLoaded" @error="onCardError">
  19 + <template v-slot="{ item, selected }">
  20 + <view class="card" @click.stop="onCardClick(item)">
  21 + <view class="card-header">
  22 + <text class="title omit2">{{ item.orderingUnitName }}</text>
  23 + <text :class="['status', `status_${item.status}`]">{{ filterStatus(item.status) }}</text>
  24 + </view>
  25 + <view class="info-row">
  26 + <text>试样种类</text><text>{{ item.sampleTypeName || '-' }}</text>
  27 + </view>
  28 + <view class="info-row">
  29 + <text>生产厂</text><text>{{ item.workshopName || '-' }}</text>
  30 + </view>
  31 + <view class="info-row">
  32 + <text>客户类型</text><text>{{ item.customerTypeName || '-' }}</text>
  33 + </view>
  34 + </view>
  35 + </template>
  36 + </card-list>
  37 + </view>
  38 +
  39 +
  40 +
  41 + <!-- 筛选弹框 -->
  42 + <filter-modal :visible.sync="filterVisible" :value.sync="filterForm" title="筛选" @reset="onFilterReset"
  43 + @confirm="onFilterConfirm">
  44 + <template v-slot="{ model }">
  45 + <view class="filter-form">
  46 + <view class="form-item">
  47 + <view class="label">生产厂</view>
  48 + <uni-data-checkbox mode="tag" :multiple="false" :value-field="'value'" :text-field="'text'"
  49 + v-model="model.workshopId" @change="onWorkshopChange" :localdata="workshopOptions" />
  50 + </view>
  51 + <view class="form-item">
  52 + <view class="label">审核状态</view>
  53 + <uni-data-checkbox mode="tag" :multiple="false" :value-field="'value'" :text-field="'text'"
  54 + v-model="model.status" @change="onStatusChange" :localdata="statusLocal" />
  55 + </view>
  56 + <view class="form-item">
  57 + <view class="label">试样种类</view>
  58 + <uni-data-checkbox mode="tag" :multiple="false" :value-field="'value'" :text-field="'text'"
  59 + v-model="model.sampleType" @change="onSampleTypeChange" :localdata="sampleTypeLocal" />
  60 + </view>
  61 + <view class="form-item">
  62 + <view class="label">客户类型</view>
  63 + <uni-data-checkbox mode="tag" :multiple="false" :value-field="'value'" :text-field="'text'"
  64 + v-model="model.customerType" @change="onEnterpriseTypeChange" :localdata="enterpriseTypeLocal" />
  65 + </view>
  66 + </view>
  67 + </template>
  68 + </filter-modal>
  69 + </view>
  70 +</template>
  71 +
  72 +<script>
  73 +import CardList from '@/components/card/index.vue'
  74 +import FilterModal from '@/components/filter/index.vue'
  75 +import { workshopQueryApi } from '@/api/devManage.js'
  76 +import SingleSelectSheet from '@/components/single-select/index.vue'
  77 +import {
  78 + queryApi
  79 +} from '@/api/confirmation_form.js'
  80 +import {
  81 + getDicByCodes
  82 +} from '@/utils/dic'
  83 +
  84 +export default {
  85 + components: {
  86 + CardList,
  87 + FilterModal,
  88 + SingleSelectSheet
  89 + },
  90 + data() {
  91 + return {
  92 + searchKeyword: '',
  93 + searchKeywordDebounced: '',
  94 + tabs: [],
  95 + // 给到 card 的筛选值
  96 + query: {
  97 + status: '',
  98 + workshopId: '',
  99 + sampleType: '',
  100 + customerType: '',
  101 + },
  102 + extraParams: {},
  103 +
  104 + // 批量选择
  105 + rowKey: 'id',
  106 + currentItems: [],
  107 +
  108 + // 筛选弹框
  109 + filterVisible: false,
  110 + filterForm: {
  111 + status: '',
  112 + workshopId: '',
  113 + sampleType: '',
  114 + customerType: '',
  115 + },
  116 + dicOptions: {
  117 + AUDIT_STATUS: [], // 审核
  118 + ENTERPRISE_TYPE: [], // 客户类型
  119 + SAMPLE_TYPE: [], // 试样种类
  120 + },
  121 + statusLocal: [],
  122 + enterpriseTypeLocal: [], // 客户类型
  123 + sampleTypeLocal: [], // 试样种类
  124 + workshopOptions: [],
  125 + }
  126 + },
  127 + computed: {
  128 + extraCombined() {
  129 + return {
  130 + orderingUnitName: this.searchKeywordDebounced || undefined
  131 + }
  132 + }
  133 + },
  134 + watch: {
  135 + extraCombined: {
  136 + deep: true,
  137 + handler(v) {
  138 + this.extraParams = v
  139 + },
  140 + immediate: true
  141 + },
  142 +
  143 + },
  144 + created() {
  145 + this.loadAllDicData()
  146 + this.loadWorkshopOptions()
  147 + },
  148 + onLoad() { },
  149 + // 页面触底兜底:当页面自身滚动到底部时,转调卡片组件加载更多
  150 + onReachBottom() {
  151 + if (this.$refs && this.$refs.cardRef && this.$refs.cardRef.onLoadMore) {
  152 + this.$refs.cardRef.onLoadMore()
  153 + }
  154 + },
  155 + beforeDestroy() {
  156 + if (this.searchDebounceTimer) {
  157 + clearTimeout(this.searchDebounceTimer)
  158 + this.searchDebounceTimer = null
  159 + }
  160 + },
  161 + methods: {
  162 + async loadWorkshopOptions() {
  163 + try {
  164 + const res = await workshopQueryApi({ pageIndex: 1, pageSize: 9999 })
  165 + const list = (res && res.data && res.data.datas) || []
  166 + this.workshopOptions = list.map(it => ({ text: it.name || it.workshopName || '', value: it.id || it.workshopId || '' }))
  167 + } catch (e) {
  168 + this.workshopOptions = []
  169 + }
  170 + },
  171 + onCardLoaded({
  172 + items
  173 + }) {
  174 + this.currentItems = items
  175 + },
  176 + onCardError() {
  177 + uni.showToast({
  178 + title: '列表加载失败',
  179 + icon: 'none'
  180 + })
  181 + },
  182 + // 输入实时搜索:1200ms 防抖,仅在停止输入超过阈值后刷新
  183 + onSearchInput(val) {
  184 + if (this.searchDebounceTimer) clearTimeout(this.searchDebounceTimer)
  185 + this.searchDebounceTimer = setTimeout(() => {
  186 + this.searchKeywordDebounced = this.searchKeyword
  187 + this.searchDebounceTimer = null
  188 + }, 1200)
  189 + },
  190 + // uni-search-bar 确认搜索:更新关键字并触发 CardList 刷新
  191 + search(e) {
  192 + const val = e && e.value != null ? e.value : this.searchKeyword
  193 + this.searchKeyword = val
  194 + this.searchKeywordDebounced = val
  195 + },
  196 + onAdd() {
  197 + uni.navigateTo({
  198 + url: '/pages/confirmation_form/add'
  199 + })
  200 + },
  201 + openFilter() {
  202 + this.filterVisible = true
  203 + },
  204 + onFilterReset(payload) {
  205 + this.filterForm = payload
  206 + },
  207 + onFilterConfirm(payload) {
  208 + if ((payload.status === '' || payload.status == null) && this.filterForm.status !== '') {
  209 + payload.status = this.filterForm.status
  210 + }
  211 + this.query = {
  212 + ...payload
  213 + }
  214 + },
  215 + onStatusChange(e) {
  216 + const raw = e && e.detail && e.detail.value !== undefined ?
  217 + e.detail.value :
  218 + (e && e.value !== undefined ? e.value : '')
  219 + this.filterForm.status = raw
  220 + },
  221 +
  222 + onSampleTypeChange(e) {
  223 + const raw = e && e.detail && e.detail.value !== undefined ?
  224 + e.detail.value :
  225 + (e && e.value !== undefined ? e.value : '')
  226 + this.filterForm.sampleType = raw
  227 + },
  228 +
  229 + onEnterpriseTypeChange(e) {
  230 + const raw = e && e.detail && e.detail.value !== undefined ?
  231 + e.detail.value :
  232 + (e && e.value !== undefined ? e.value : '')
  233 + this.filterForm.customerType = raw
  234 + },
  235 +
  236 + // 列表接口(真实请求)
  237 + fetchList({
  238 + pageIndex,
  239 + pageSize,
  240 + query,
  241 + extra
  242 + }) {
  243 + const params = {
  244 + pageIndex,
  245 + pageSize,
  246 + ...extra,
  247 + ...query
  248 + }
  249 + if (this.searchKeywordDebounced) {
  250 + params.orderingUnitName = this.searchKeywordDebounced
  251 + }
  252 + return queryApi(params)
  253 + .then(res => {
  254 + const _data = res.data || {};
  255 + const records = _data.datas || [];
  256 + const totalCount = _data.totalCount || 0;
  257 + const hasNext = _data.hasNext || false
  258 + return {
  259 + records,
  260 + totalCount,
  261 + hasNext
  262 + }
  263 + })
  264 + .catch(err => {
  265 + console.error('fetchList error', err)
  266 + this.onCardError()
  267 + return {
  268 + records: [],
  269 + totalCount: 0,
  270 + hasNext: false
  271 + }
  272 + })
  273 + },
  274 + loadAllDicData() {
  275 + const dicCodes = ['AUDIT_STATUS', 'ENTERPRISE_TYPE', 'SAMPLE_TYPE']
  276 + return getDicByCodes(dicCodes).then(results => {
  277 + this.dicOptions.AUDIT_STATUS = results.AUDIT_STATUS.data || []
  278 + this.dicOptions.ENTERPRISE_TYPE = results.ENTERPRISE_TYPE.data || []
  279 + this.dicOptions.SAMPLE_TYPE = results.SAMPLE_TYPE.data || []
  280 + this.statusLocal = (this.dicOptions.AUDIT_STATUS || []).map(it => ({
  281 + value: it.code,
  282 + text: it.name
  283 + }))
  284 + this.enterpriseTypeLocal = (this.dicOptions.ENTERPRISE_TYPE || []).map(it => ({
  285 + value: it.code,
  286 + text: it.name
  287 + }))
  288 + this.sampleTypeLocal = (this.dicOptions.SAMPLE_TYPE || []).map(it => ({
  289 + value: it.code,
  290 + text: it.name
  291 + }))
  292 + }).catch(() => {
  293 + this.dicOptions = {
  294 + AUDIT_STATUS: [],
  295 + ENTERPRISE_TYPE: [], // 客户类型
  296 + SAMPLE_TYPE: [], // 试样种类
  297 + }
  298 + this.statusLocal = []
  299 + this.enterpriseTypeLocal = []
  300 + this.sampleTypeLocal = []
  301 + })
  302 + },
  303 + onCardClick(item) {
  304 + const id = (item && (item.id || item.code)) || ''
  305 + if (!id) return
  306 + const query = '?id=' + encodeURIComponent(id)
  307 + uni.navigateTo({
  308 + url: '/pages/confirmation_form/detail' + query
  309 + })
  310 + },
  311 + onWorkshopChange(e) {
  312 + const raw = e && e.detail && e.detail.value !== undefined ? e.detail.value : (e && e.value !== undefined ? e.value : '')
  313 + this.filterForm.workshopId = raw
  314 + const match = (this.workshopOptions || []).find(o => String(o.value) === String(raw))
  315 + this.filterForm.workshopIdName = match ? (match.text || '') : ''
  316 + },
  317 + filterStatus(status) {
  318 + const _item = this.statusLocal.filter(item => item.value === status)[0] || {};
  319 + return _item.text || '';
  320 + },
  321 + }
  322 +}
  323 +</script>
  324 +
  325 +<style lang="scss" scoped>
  326 +.page {
  327 + display: flex;
  328 + flex-direction: column;
  329 + height: 100vh;
  330 +}
  331 +
  332 +.dev-list-fixed {
  333 + position: fixed;
  334 + top: 96rpx;
  335 + left: 0;
  336 + right: 0;
  337 + z-index: 2;
  338 + background: #fff;
  339 +
  340 + .search-row {
  341 + display: flex;
  342 + align-items: center;
  343 + padding: 16rpx 32rpx;
  344 +
  345 + .uni-searchbar {
  346 + padding: 0;
  347 + flex: 1;
  348 + }
  349 +
  350 + .tool-icons {
  351 + display: flex;
  352 +
  353 + .tool-icon {
  354 + width: 48rpx;
  355 + height: 48rpx;
  356 + display: block;
  357 + margin-left: 32rpx;
  358 + }
  359 + }
  360 + }
  361 +
  362 +}
  363 +
  364 +/* 仅当前页覆盖 uni-search-bar 盒子高度 */
  365 +::v-deep .uni-searchbar__box {
  366 + height: 80rpx !important;
  367 + justify-content: start;
  368 +
  369 + .uni-searchbar__box-search-input {
  370 + font-size: 32rpx !important;
  371 + }
  372 +}
  373 +
  374 +.list-box {
  375 + flex: 1;
  376 + padding-top: 140rpx;
  377 +
  378 + &.pad-batch {
  379 + padding-bottom: 144rpx;
  380 + }
  381 +
  382 + .card {
  383 + position: relative;
  384 + }
  385 +
  386 + .card-header {
  387 + margin-bottom: 28rpx;
  388 + position: relative;
  389 +
  390 + .title {
  391 + font-size: 36rpx;
  392 + font-weight: 600;
  393 + line-height: 50rpx;
  394 + color: rgba(0, 0, 0, 0.9);
  395 + width: 578rpx;
  396 + }
  397 +
  398 + .status {
  399 + font-weight: 600;
  400 + position: absolute;
  401 + top: -32rpx;
  402 + right: -12rpx;
  403 + height: 48rpx;
  404 + line-height: 48rpx;
  405 + color: #fff;
  406 + font-size: 24rpx;
  407 + padding: 0 14rpx;
  408 + border-radius: 6rpx;
  409 +
  410 + // 审核中
  411 + &.status_AUDIT {
  412 + background: $theme-primary;
  413 + }
  414 +
  415 + // 审核通过
  416 + &.status_PASS {
  417 + background: #2BA471;
  418 + }
  419 +
  420 + // 已驳回
  421 + &.status_REFUSE {
  422 + background: #d54941;
  423 + }
  424 +
  425 + // 已取消
  426 + &.status_CANCEL {
  427 + background: #e7e7e7;
  428 + color: rgba(0, 0, 0, 0.6);
  429 + }
  430 +
  431 + }
  432 +
  433 + }
  434 +
  435 + .info-row {
  436 + display: flex;
  437 + align-items: center;
  438 + color: rgba(0, 0, 0, 0.6);
  439 + font-size: 28rpx;
  440 + margin-bottom: 24rpx;
  441 +
  442 + &:last-child {
  443 + margin-bottom: 0;
  444 + }
  445 +
  446 + text {
  447 + width: 60%;
  448 + line-height: 32rpx;
  449 +
  450 + &:last-child {
  451 + color: rgba(0, 0, 0, 0.9);
  452 + width: 40%;
  453 + }
  454 +
  455 + &.category {
  456 + display: inline-block;
  457 + padding: 4rpx 12rpx;
  458 + border-radius: 6rpx;
  459 + font-size: 24rpx;
  460 + width: auto;
  461 +
  462 + &.category_A {
  463 + background: #FFF0ED;
  464 + color: #D54941;
  465 + }
  466 +
  467 + &.category_B {
  468 + background: #FFF1E9;
  469 + color: #E37318;
  470 + }
  471 +
  472 + &.category_C {
  473 + background: #F2F3FF;
  474 + color: $theme-primary;
  475 + }
  476 +
  477 + &.category_D {
  478 + background: #E3F9E9;
  479 + color: #2BA471;
  480 + }
  481 + }
  482 + }
  483 +
  484 + }
  485 +}
  486 +
  487 +.filter-form {
  488 + .form-item {
  489 + margin-bottom: 24rpx;
  490 + }
  491 +
  492 + .label {
  493 + margin-bottom: 20rpx;
  494 + color: rgba(0, 0, 0, 0.9);
  495 + height: 44rpx;
  496 + line-height: 44rpx;
  497 + font-size: 30rpx;
  498 + }
  499 +
  500 + .uni-easyinput {
  501 + border: 1rpx solid #f3f3f3;
  502 + }
  503 +
  504 +}
  505 +
  506 +/* 深度覆盖 uni-data-checkbox(mode=tag)内部的 tag 展示与间距 */
  507 +::v-deep .filter-form .uni-data-checklist .checklist-group {
  508 + .checklist-box {
  509 + &.is--tag {
  510 + width: 212rpx;
  511 + margin-top: 0;
  512 + margin-bottom: 24rpx;
  513 + margin-right: 24rpx;
  514 + height: 80rpx;
  515 + padding: 0 20rpx;
  516 + border-radius: 12rpx;
  517 + background-color: #f3f3f3;
  518 + border-color: #f3f3f3;
  519 +
  520 + &:nth-child(3n) {
  521 + margin-right: 0;
  522 + }
  523 +
  524 + .checklist-content {
  525 + display: flex;
  526 + justify-content: center;
  527 + }
  528 +
  529 + .checklist-text {
  530 + color: rgba(0, 0, 0, 0.9);
  531 + font-size: 28rpx;
  532 + text-align: center;
  533 + }
  534 + }
  535 +
  536 + &.is-checked {
  537 + background-color: $theme-primary-plain-bg !important;
  538 + border-color: $theme-primary-plain-bg !important;
  539 +
  540 + .checklist-text {
  541 + color: $theme-primary !important;
  542 + }
  543 + }
  544 + }
  545 +
  546 +}
  547 +</style>
  1 +<template>
  2 + <view class="page">
  3 + <scroll-view class="scroll" scroll-y>
  4 + <uni-list>
  5 + <view class="section">
  6 + <uni-list-item title="订货单位">
  7 + <template v-slot:footer>
  8 + <view class="readonly-text">{{ form.orderingUnitName }}</view>
  9 + </template>
  10 + </uni-list-item>
  11 + <uni-list-item class="select-item" :class="form.sampleTypeName ? 'is-filled' : 'is-empty'" clickable
  12 + @click="openSheet('sampleType')" :rightText="form.sampleTypeName || '请选择'" showArrow>
  13 + <template v-slot:body>
  14 + <view class="item-title"><text>试样种类</text></view>
  15 + </template>
  16 + </uni-list-item>
  17 + <uni-list-item class="select-item" :class="form.customerTypeName ? 'is-filled' : 'is-empty'" clickable
  18 + @click="openSheet('customerType')" :rightText="form.customerTypeName || '请选择'" showArrow>
  19 + <template v-slot:body>
  20 + <view class="item-title"><text>客户类型</text></view>
  21 + </template>
  22 + </uni-list-item>
  23 + <uni-list-item title="生产厂">
  24 + <template v-slot:footer>
  25 + <view class="readonly-text">{{ form.workshopName }}</view>
  26 + </template>
  27 + </uni-list-item>
  28 + <uni-list-item title="所属品种">
  29 + <template v-slot:footer>
  30 + <view class="readonly-text">{{ form.belongingBreed }}</view>
  31 + </template>
  32 + </uni-list-item>
  33 + <uni-list-item title="原供货同行">
  34 + <template v-slot:footer>
  35 + <uni-easyinput v-model="form.originalSupplierPeer" placeholder="请输入原供货同行" :inputBorder="false" />
  36 + </template>
  37 + </uni-list-item>
  38 + </view>
  39 +
  40 + <!-- 产品 -->
  41 + <view class="section2">
  42 + <!-- mode="add" 允许编辑 -->
  43 + <Product mode="add" :list="initPurchaseOrderLineList" @change="purchaseOrderLineListChange"
  44 + :provideSamplesOptions="provideSamplesOptions" :clearParametersOptions="clearParametersOptions" />
  45 + </view>
  46 +
  47 + <view class="section">
  48 +
  49 + <uni-list-item class="select-item" :class="form.sampleQuantityRegulationName ? 'is-filled' : 'is-empty'" clickable
  50 + @click="openSheet('sampleQuantityRegulation')" :rightText="form.sampleQuantityRegulationName || '请选择'" showArrow>
  51 + <template v-slot:body>
  52 + <view class="item-title"><text>本次试样数量是否超规定</text></view>
  53 + </template>
  54 + </uni-list-item>
  55 +
  56 + <uni-list-item class="select-item" :class="form.specificationQuantityRegulationName ? 'is-filled' : 'is-empty'" clickable
  57 + @click="openSheet('specificationQuantityRegulation')" :rightText="form.specificationQuantityRegulationName || '请选择'" showArrow>
  58 + <template v-slot:body>
  59 + <view class="item-title"><text>试样规格个数是否超规定</text></view>
  60 + </template>
  61 + </uni-list-item>
  62 +
  63 + <uni-list-item title="试样次数">
  64 + <template v-slot:footer>
  65 + <uni-easyinput type="textarea" v-model="form.sampleFrequency" placeholder="请输入试样次数" :inputBorder="false" />
  66 + </template>
  67 + </uni-list-item>
  68 +
  69 + <uni-list-item title="前期不合格描述">
  70 + <template v-slot:footer>
  71 + <uni-easyinput type="textarea" v-model="form.earlyNonconformityDescription" placeholder="请输入前期不合格描述" :inputBorder="false" />
  72 + </template>
  73 + </uni-list-item>
  74 +
  75 + </view>
  76 +
  77 + <view class="footer">
  78 + <view class="view-total">
  79 + <view class="head">合计</view>
  80 + <view class="row">
  81 + <view class="row2">
  82 + <text class="label">数量</text><text class="value">{{ form.totalQuantity }}</text>
  83 + </view>
  84 + </view>
  85 + </view>
  86 + <button class="btn submit" type="primary" @click="onSubmit">保存</button>
  87 + </view>
  88 + </uni-list>
  89 + </scroll-view>
  90 + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value"
  91 + @confirm="onSheetConfirm" />
  92 + </view>
  93 +</template>
  94 +
  95 +<script>
  96 +import { updateApi, getDetailApi } from '@/api/confirmation_form.js'
  97 +import Product from './product.vue'
  98 +import SingleSelectSheet from '@/components/single-select/index.vue'
  99 +import {
  100 + getDicByCodes
  101 +} from '@/utils/dic'
  102 +
  103 +export default {
  104 + name: 'ConfirmationFormModify',
  105 + components: { Product, SingleSelectSheet },
  106 + data() {
  107 + return {
  108 + form: {
  109 + purchaseOrderId: '',
  110 + id: '',
  111 + // 订单基础信息
  112 + purchaseOrderName: '',
  113 + customerName: '',
  114 + customerId: '',
  115 + workshopName: '',
  116 + workshopId: '',
  117 + originPlanShipDate: '',
  118 + deptName: '',
  119 + deptId: '',
  120 + totalQuantity: '',
  121 + totalShippedQuantity: '',
  122 + totalSupplementaryQuantity: '',
  123 + code: '',
  124 + // 默认当前日期 格式为 yyyy-MM-dd
  125 + orderDate: new Date().toISOString().substring(0, 10),
  126 +
  127 + },
  128 + initPurchaseOrderLineList: [],
  129 + maxDeliveryDate: new Date().toISOString().substring(0, 10),
  130 + sheet: { visible: false, title: '请选择', options: [], value: '', field: '' },
  131 + dicOptions: {
  132 + ENTERPRISE_TYPE: [], // 客户类型
  133 + SAMPLE_TYPE: [], // 试样种类
  134 + CLEAR_PARAMETERS: [], // 是否提供明确参数
  135 + PROVIDE_SAMPLES: [], // 是否提供样品
  136 + },
  137 + enterpriseTypeLocal: [], // 客户类型
  138 + sampleTypeLocal: [], // 试样种类
  139 + provideSamplesOptions: [], // 是否提供样品
  140 + clearParametersOptions: [], // 是否提供明确参数
  141 + }
  142 + },
  143 + onLoad(query) {
  144 + const id = (query && (query.id || query.code)) || ''
  145 + if (id) {
  146 + this.loadDetail(id)
  147 + this.loadAllDicData()
  148 + }
  149 + },
  150 + methods: {
  151 + async loadDetail(id) {
  152 + try {
  153 + const res = await getDetailApi(id)
  154 + const m = res.data || {}
  155 + const next = { ...this.form, ...m }
  156 + // 确保ID存在
  157 + next.id = m.id || id
  158 + next.sampleQuantityRegulationName = m.sampleQuantityRegulation === true ? '是' : '否'
  159 + next.specificationQuantityRegulationName = m.specificationQuantityRegulation === true ? '是' : '否'
  160 + // 映射列表
  161 + // 注意:详情返回的是 productSampleConfirmationSlipDetailList,需要赋值给 initPurchaseOrderLineList 以便 Product 组件初始化
  162 + // 且需要处理字段兼容性,确保 Product 组件能正确显示和编辑
  163 + const lines = Array.isArray(m.productSampleConfirmationSlipDetailList) ? m.productSampleConfirmationSlipDetailList.map(x => ({
  164 + ...x,
  165 + // 确保 Product 组件需要的字段存在
  166 + // Product组件使用: quantity(需发), shippedQuantity(实发), supplementaryQuantity(需求补货), salesPrice(单价)
  167 + // 详情接口返回的字段应该已经包含了这些,如果有差异需要在此处转换
  168 + // 注意:add.vue中 onRelateConfirm 做了映射,这里是回显,通常直接使用即可
  169 + })) : []
  170 +
  171 + this.form = next;
  172 + this.initPurchaseOrderLineList = lines;
  173 + } catch (e) {
  174 + uni.showToast({ title: '加载失败', icon: 'none' })
  175 + }
  176 + },
  177 + loadAllDicData() {
  178 + const dicCodes = ['ENTERPRISE_TYPE', 'SAMPLE_TYPE', 'CLEAR_PARAMETERS', 'PROVIDE_SAMPLES']
  179 + return getDicByCodes(dicCodes).then(results => {
  180 + this.dicOptions.ENTERPRISE_TYPE = results.ENTERPRISE_TYPE.data || []
  181 + this.dicOptions.SAMPLE_TYPE = results.SAMPLE_TYPE.data || []
  182 + this.dicOptions.CLEAR_PARAMETERS = results.CLEAR_PARAMETERS.data || []
  183 + this.dicOptions.PROVIDE_SAMPLES = results.PROVIDE_SAMPLES.data || []
  184 +
  185 + this.enterpriseTypeLocal = (this.dicOptions.ENTERPRISE_TYPE || []).map(it => ({
  186 + value: it.code,
  187 + label: it.name
  188 + }))
  189 + this.sampleTypeLocal = (this.dicOptions.SAMPLE_TYPE || []).map(it => ({
  190 + value: it.code,
  191 + label: it.name
  192 + }))
  193 + this.provideSamplesOptions = (this.dicOptions.PROVIDE_SAMPLES || []).map(it => ({
  194 + value: it.code,
  195 + label: it.name
  196 + }))
  197 + this.clearParametersOptions = (this.dicOptions.CLEAR_PARAMETERS || []).map(it => ({
  198 + value: it.code,
  199 + label: it.name
  200 + }))
  201 + }).catch(() => {
  202 + this.dicOptions = {
  203 + ENTERPRISE_TYPE: [], // 客户类型
  204 + SAMPLE_TYPE: [], // 试样种类
  205 + CLEAR_PARAMETERS: [], // 是否提供明确参数
  206 + PROVIDE_SAMPLES: [], // 是否提供样品
  207 + }
  208 + this.enterpriseTypeLocal = []
  209 + this.sampleTypeLocal = []
  210 + this.provideSamplesOptions = []
  211 + this.clearParametersOptions = []
  212 + })
  213 + },
  214 + validateRequired() {
  215 + // const checks = [
  216 + // { key: 'purchaseOrderName', label: '订单编号' }
  217 + // ]
  218 + // for (const it of checks) {
  219 + // const val = this.form[it.key]
  220 + // if (val === undefined || val === null || String(val).trim() === '') {
  221 + // uni.showToast({ title: `请先选择${it.label}`, icon: 'none' })
  222 + // return false
  223 + // }
  224 + // }
  225 + return true
  226 + },
  227 + validateLineListRequired() {
  228 + const list = Array.isArray(this.form.purchaseOrderLineList) ? this.form.purchaseOrderLineList : []
  229 + if (list.length === 0) {
  230 + uni.showToast({ title: '请先添加产品', icon: 'none' })
  231 + return false
  232 + }
  233 + const fields = [
  234 + { key: 'brand', label: '牌号' },
  235 + { key: 'quantity', label: '需发' },
  236 + { key: 'supplementaryQuantity', label: '需求补货' },
  237 + ]
  238 + for (let i = 0; i < list.length; i++) {
  239 + const it = list[i] || {}
  240 + for (const f of fields) {
  241 + const v = it && it[f.key]
  242 + if (v === undefined || v === null || String(v).trim() === '') {
  243 + uni.showToast({ title: `产品第${i + 1}条:${f.label}不能为空!`, icon: 'none' })
  244 + return false
  245 + }
  246 + }
  247 + const has = (v) => v !== undefined && v !== null && String(v).trim() !== ''
  248 + if (has(it.thicknessTolPos) && has(it.thicknessTolNeg)) {
  249 + const pos = Number(it.thicknessTolPos)
  250 + const neg = Number(it.thicknessTolNeg)
  251 + if (!(pos > neg)) {
  252 + uni.showToast({ title: `产品第${i + 1}条:厚度公差上限需大于下限`, icon: 'none' })
  253 + return false
  254 + }
  255 + }
  256 + if (has(it.widthTolPos) && has(it.widthTolNeg)) {
  257 + const pos = Number(it.widthTolPos)
  258 + const neg = Number(it.widthTolNeg)
  259 + if (!(pos > neg)) {
  260 + uni.showToast({ title: `产品第${i + 1}条:宽度公差上限需大于下限`, icon: 'none' })
  261 + return false
  262 + }
  263 + }
  264 + if (has(it.lengthTolPos) && has(it.lengthTolNeg)) {
  265 + const pos = Number(it.lengthTolPos)
  266 + const neg = Number(it.lengthTolNeg)
  267 + if (!(pos > neg)) {
  268 + uni.showToast({ title: `产品第${i + 1}条:长度公差上限需大于下限`, icon: 'none' })
  269 + return false
  270 + }
  271 + }
  272 + }
  273 + return true
  274 + },
  275 + async onSubmit() {
  276 + if (!this.validateRequired()) return
  277 + const payload = { ...this.form }
  278 + delete payload.status
  279 + console.log('onSubmit__payload', payload)
  280 +
  281 + try {
  282 + await updateApi(payload)
  283 + uni.showToast({ title: '保存成功', icon: 'success' })
  284 + setTimeout(() => { uni.redirectTo({ url: '/pages/confirmation_form/index' }) }, 300)
  285 + } catch (e) {
  286 + uni.showToast({ title: (e && e.msg) || '保存失败', icon: 'none' })
  287 + }
  288 + },
  289 + calculateSummary(list) {
  290 + const summary = (list || []).reduce((acc, it) => {
  291 + const qty = Number(it.supplementaryQuantity) || 0
  292 + const shipped = Number(it.shippedQuantity) || 0
  293 + const orderQty = Number(it.quantity) || 0
  294 + acc.totalSupplementaryQuantity += qty
  295 + acc.totalShippedQuantity += shipped
  296 + acc.totalQuantity += orderQty
  297 + return acc
  298 + }, { totalQuantity: 0, totalShippedQuantity: 0, totalSupplementaryQuantity: 0 })
  299 +
  300 + const fixedTotalQuantity = Number(summary.totalQuantity.toFixed(2))
  301 + const fixedTotalShippedQuantity = Number(summary.totalShippedQuantity.toFixed(2))
  302 + const fixedTotalSupplementaryQuantity = Number(summary.totalSupplementaryQuantity.toFixed(2))
  303 + this.form.totalQuantity = fixedTotalQuantity
  304 + this.form.totalShippedQuantity = fixedTotalShippedQuantity
  305 + this.form.totalSupplementaryQuantity = fixedTotalSupplementaryQuantity
  306 + },
  307 + purchaseOrderLineListChange(data) {
  308 + const list = Array.isArray(data) ? data : []
  309 + this.form.productSampleConfirmationSlipDetailList = list
  310 + },
  311 + openSheet(field) {
  312 + let options = []
  313 + let title = ''
  314 + let value = ''
  315 +
  316 + if (field === 'sampleType') {
  317 + title = '试样种类'
  318 + options = this.sampleTypeLocal
  319 + value = this.form.sampleType
  320 + } else if (field === 'customerType') {
  321 + title = '客户类型'
  322 + options = this.enterpriseTypeLocal
  323 + value = this.form.customerType
  324 + } else if (field === 'sampleQuantityRegulation') {
  325 + title = '本次试样数量是否超规定'
  326 + options = [{ value: true, label: '是' }, { value: false, label: '否' }]
  327 + value = this.form.sampleQuantityRegulation
  328 + } else if (field === 'specificationQuantityRegulation') {
  329 + title = '试样规格个数是否超规定'
  330 + options = [{ value: true, label: '是' }, { value: false, label: '否' }]
  331 + value = this.form.specificationQuantityRegulation
  332 + }
  333 +
  334 + const match = options.find(o => String(o.value) === String(value))
  335 + this.sheet = { ...this.sheet, visible: true, title, options, field, value: match ? match.value : '' }
  336 + },
  337 + onSheetConfirm({ value, label }) {
  338 + const field = this.sheet.field
  339 + this.form[field] = value
  340 + this.form[field + 'Name'] = label
  341 + this.sheet.visible = false
  342 + },
  343 + }
  344 +}
  345 +</script>
  346 +
  347 +<style lang="scss" scoped>
  348 +.page {
  349 + display: flex;
  350 + flex-direction: column;
  351 + height: 100%;
  352 +}
  353 +
  354 +.scroll {
  355 + flex: 1;
  356 + padding: 6rpx 0 400rpx;
  357 +}
  358 +
  359 +
  360 +
  361 +.title-header {
  362 + background-color: #fff;
  363 + display: flex;
  364 + align-items: center;
  365 + padding: 32rpx 32rpx 22rpx;
  366 +
  367 + .title-header_icon {
  368 + width: 32rpx;
  369 + height: 28rpx;
  370 + margin-right: 16rpx;
  371 + }
  372 +
  373 + span {
  374 + color: rgba(0, 0, 0, 0.9);
  375 + font-size: 32rpx;
  376 + line-height: 44rpx;
  377 + font-weight: 600;
  378 + }
  379 +}
  380 +
  381 +
  382 +.section {
  383 + background: #fff;
  384 + margin-bottom: 20rpx;
  385 +}
  386 +
  387 +.section2 {
  388 + background: #f1f1f1;
  389 +}
  390 +
  391 +::v-deep .uni-list {
  392 + background: transparent;
  393 +
  394 + &-item {
  395 + &__extra-text {
  396 + font-size: 32rpx;
  397 + }
  398 +
  399 + &__content-title {
  400 + font-size: 32rpx;
  401 + color: rgba(0, 0, 0, 0.9);
  402 + }
  403 +
  404 + &__container {
  405 + padding: 32rpx;
  406 + // align-items: center;
  407 +
  408 + .uni-easyinput {
  409 +
  410 + .is-disabled {
  411 + background-color: transparent !important;
  412 + }
  413 +
  414 + &__placeholder-class {
  415 + font-size: 32rpx;
  416 + color: rgba(0, 0, 0, 0.4);
  417 + }
  418 +
  419 + &__content {
  420 + border: none;
  421 +
  422 + &-input {
  423 + padding-left: 0 !important;
  424 + height: 48rpx;
  425 + line-height: 48rpx;
  426 + font-size: 32rpx;
  427 + }
  428 +
  429 + .content-clear-icon {
  430 + font-size: 44rpx !important;
  431 + }
  432 + }
  433 + }
  434 +
  435 + .amount-row {
  436 + flex: 1;
  437 + display: flex;
  438 + align-items: center;
  439 +
  440 + .uni-easyinput {
  441 + flex: 1;
  442 + }
  443 +
  444 + .unit {
  445 + margin-left: 16rpx;
  446 + color: rgba(0, 0, 0, 0.9);
  447 + }
  448 + }
  449 +
  450 + .item-title,
  451 + .uni-list-item__content {
  452 + flex: none;
  453 + min-height: 48rpx;
  454 + line-height: 48rpx;
  455 + font-size: 32rpx;
  456 + position: relative;
  457 + width: 210rpx;
  458 + margin-right: 32rpx;
  459 + color: rgba(0, 0, 0, 0.9);
  460 + padding-right: 0;
  461 +
  462 +
  463 + .required {
  464 + color: red;
  465 + position: absolute;
  466 + top: 50%;
  467 + transform: translateY(-50%);
  468 + left: -16rpx;
  469 + }
  470 + }
  471 +
  472 + }
  473 +
  474 + &.select-item {
  475 + &.is-empty {
  476 + .uni-list-item__extra-text {
  477 + color: rgba(0, 0, 0, 0.4) !important;
  478 + }
  479 + }
  480 +
  481 + &.is-filled {
  482 + .uni-list-item__extra-text {
  483 + color: rgba(0, 0, 0, 0.9) !important;
  484 + }
  485 + }
  486 +
  487 + .serial-number-row {
  488 + display: flex;
  489 + align-items: center;
  490 + }
  491 +
  492 + }
  493 +
  494 + &.mgb10 {
  495 + margin-bottom: 20rpx;
  496 + }
  497 +
  498 + }
  499 +
  500 + .title-header {
  501 + background-color: #fff;
  502 + display: flex;
  503 + align-items: center;
  504 + padding: 32rpx 32rpx 22rpx;
  505 +
  506 + &_icon {
  507 + width: 32rpx;
  508 + height: 28rpx;
  509 + margin-right: 16rpx;
  510 + }
  511 +
  512 + span {
  513 + color: rgba(0, 0, 0, 0.9);
  514 + font-size: 32rpx;
  515 + line-height: 44rpx;
  516 + font-weight: 600;
  517 + }
  518 + }
  519 +}
  520 +
  521 +/* 只读 easyinput 根据内容自适应高度 */
  522 +::v-deep .uni-list-item__container {
  523 + align-items: flex-start;
  524 +}
  525 +
  526 +/* 只读文本样式 */
  527 +.readonly-text {
  528 + color: rgba(0, 0, 0, 0.9);
  529 + font-size: 32rpx;
  530 + line-height: 48rpx;
  531 + text-align: right;
  532 + white-space: pre-wrap;
  533 + word-break: break-all;
  534 +}
  535 +
  536 +
  537 +.footer {
  538 + position: fixed;
  539 + left: 0;
  540 + right: 0;
  541 + bottom: 0;
  542 + padding: 0 32rpx 32rpx;
  543 + padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
  544 + background: #fff;
  545 + box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
  546 + z-index: 10;
  547 +
  548 + .btn {
  549 + height: 80rpx;
  550 + line-height: 80rpx;
  551 + border-radius: 12rpx;
  552 + font-size: 32rpx;
  553 + }
  554 +
  555 + .submit {
  556 + background: $theme-primary;
  557 + color: #fff;
  558 + }
  559 +
  560 + .view-total {
  561 + padding: 20rpx 0;
  562 +
  563 + .head {
  564 + font-size: 32rpx;
  565 + font-weight: 600;
  566 + line-height: 50rpx;
  567 + color: rgba(0, 0, 0, 0.9);
  568 + padding-bottom: 16rpx;
  569 + margin-bottom: 24rpx;
  570 + border-bottom: 1px dashed #E7E7E7;
  571 + }
  572 +
  573 + .row {
  574 + display: flex;
  575 + margin-bottom: 24rpx;
  576 + line-height: 32rpx;
  577 +
  578 + .row2 {
  579 + width: 50%;
  580 + }
  581 +
  582 + .label {
  583 + width: 180rpx;
  584 + margin-right: 14rpx;
  585 + color: rgba(0, 0, 0, 0.6);
  586 + font-size: 32rpx;
  587 + }
  588 +
  589 + .value {
  590 + flex: 1;
  591 + color: rgba(0, 0, 0, 0.9);
  592 + font-size: 32rpx;
  593 + white-space: pre-wrap;
  594 + word-break: break-all;
  595 + font-weight: 600;
  596 + }
  597 + }
  598 + }
  599 +}
  600 +</style>
  1 +<template>
  2 + <view class="product">
  3 +
  4 + <!-- 新增&详情-产品 -->
  5 + <view class="header bp">
  6 + <image class="opCollapse" src="/static/images/title.png" />
  7 + <text class="title">{{ title || '产品' }}</text>
  8 + <view class="ops">
  9 + <!-- <image v-if="mode === 'add'" class="opAdd" @click="onAdd" src="/static/images/plus.png" /> -->
  10 + <view v-if="mode === 'view'" class="op1" @click="toggleViewCollapse">
  11 + <image class="opAdd" :src="collapsedView ? '/static/images/down.png' : '/static/images/up.png'" />
  12 + <text class="op">{{ collapsedView ? '展开' : '收起' }} </text>
  13 + </view>
  14 +
  15 + </view>
  16 + </view>
  17 +
  18 + <view v-if="mode === 'add'" class="section">
  19 + <view v-for="(item, idx) in items" :key="'a-' + idx" class="block">
  20 + <view class="row"><text class="label">牌号</text><text class="value">{{ item.brand }}</text></view>
  21 + <!-- 厚(公差) * 宽(公差) * 长(公差) -->
  22 + <view class="row row-spec"><text class="label">规格(mm)</text>
  23 + <view class="value value-spec">
  24 + <view v-if="item.thickness" class="value-spec_val">{{ item.thickness }}</view>
  25 + <view v-if="item.thickness" class="value-spec_box">
  26 + <view v-if="item.thicknessTolPos" class="value-spec_box_1">{{ item.thicknessTolPos > 0 ? '+' + item.thicknessTolPos : item.thicknessTolPos }}
  27 + </view>
  28 + <view v-if="item.thicknessTolNeg" class="value-spec_box_2">{{ item.thicknessTolNeg > 0 ? '+' + item.thicknessTolNeg : item.thicknessTolNeg }}
  29 + </view>
  30 + </view>
  31 + <view v-if="item.width" class="value-spec_val p12">*</view>
  32 + <view v-if="item.width" class="value-spec_val">{{ item.width }}</view>
  33 + <view v-if="item.width" class="value-spec_box">
  34 + <view v-if="item.widthTolPos" class="value-spec_box_1">{{ item.widthTolPos > 0 ? '+' +
  35 + item.widthTolPos : item.widthTolPos }}</view>
  36 + <view v-if="item.widthTolNeg" class="value-spec_box_2">{{ item.widthTolNeg > 0 ? '+' +
  37 + item.widthTolNeg : item.widthTolNeg }}</view>
  38 + </view>
  39 + <view v-if="item.length" class="value-spec_val p12">*</view>
  40 + <view v-if="item.length" class="value-spec_val">{{ item.length }}</view>
  41 + <view v-if="item.length" class="value-spec_box">
  42 + <view v-if="item.lengthTolPos" class="value-spec_box_1">{{ item.lengthTolPos > 0 ? '+' +
  43 + item.lengthTolPos : item.lengthTolPos }}</view>
  44 + <view v-if="item.lengthTolNeg" class="value-spec_box_2">{{ item.lengthTolNeg > 0 ? '+' +
  45 + item.lengthTolNeg : item.lengthTolNeg }}</view>
  46 + </view>
  47 + </view>
  48 + </view>
  49 + <view class="row"><text class="label">状态</text><text class="value">{{ item.status }}</text></view>
  50 + <view v-show="!item.collapsed">
  51 +
  52 + <view class="row" :class="{ 'noneStyle': !item.showSalesPrice }"><text
  53 + class="label">数量kg</text><text class="value">{{ item.quantity }}</text>
  54 + </view>
  55 +
  56 + <uni-list class="edit-list">
  57 + <uni-list-item class="select-item"
  58 + :class="item.provideSamplesName ? 'is-filled' : 'is-empty'" clickable
  59 + @click="openProductSheet(idx, 'provideSamples')"
  60 + :rightText="item.provideSamplesName || '请选择是否提供样品'" showArrow>
  61 + <template v-slot:body>
  62 + <view class="item-title"><text>是否提供样品</text></view>
  63 + </template>
  64 + </uni-list-item>
  65 + <uni-list-item class="select-item"
  66 + :class="item.clearParametersName ? 'is-filled' : 'is-empty'" clickable
  67 + @click="openProductSheet(idx, 'clearParameters')"
  68 + :rightText="item.clearParametersName || '请选择是否提供明确参数'" showArrow>
  69 + <template v-slot:body>
  70 + <view class="item-title"><text>是否提供明确参数</text></view>
  71 + </template>
  72 + </uni-list-item>
  73 + </uni-list>
  74 + </view>
  75 +
  76 + <view class="block-ops">
  77 + <div class="toggle" @click="toggleItem(idx)">
  78 + <image :src="item.collapsed ? '/static/images/up.png' : '/static/images/down.png'"
  79 + class="icon" />
  80 + {{ item.collapsed ? '展开' : '收起' }}
  81 + </div>
  82 + </view>
  83 + </view>
  84 + </view>
  85 +
  86 + <view v-else-if="mode === 'view'" class="view-list" v-show="!collapsedView">
  87 + <view v-for="(item, idx) in items" :key="'v-' + idx" class="card">
  88 + <view class="row"><text class="label">牌号</text><text class="value">{{ item.brand }}</text></view>
  89 + <!-- 厚(公差) * 宽(公差) * 长(公差) -->
  90 + <view class="row row-spec"><text class="label">规格(mm)</text>
  91 + <view class="value value-spec">
  92 + <view v-if="item.thickness" class="value-spec_val">{{ item.thickness }}</view>
  93 + <view v-if="item.thickness" class="value-spec_box">
  94 + <view v-if="item.thicknessTolPos" class="value-spec_box_1">{{ item.thicknessTolPos > 0 ? '+'
  95 + +
  96 + item.thicknessTolPos : item.thicknessTolPos }}
  97 + </view>
  98 + <view v-if="item.thicknessTolNeg" class="value-spec_box_2">{{ item.thicknessTolNeg > 0 ? '+'
  99 + +
  100 + item.thicknessTolNeg : item.thicknessTolNeg }}
  101 + </view>
  102 + </view>
  103 + <view v-if="item.width" class="value-spec_val p12">*</view>
  104 + <view v-if="item.width" class="value-spec_val">{{ item.width }}</view>
  105 + <view v-if="item.width" class="value-spec_box">
  106 + <view v-if="item.widthTolPos" class="value-spec_box_1">{{ item.widthTolPos > 0 ? '+' +
  107 + item.widthTolPos : item.widthTolPos }}
  108 + </view>
  109 + <view v-if="item.widthTolNeg" class="value-spec_box_2">{{ item.widthTolNeg > 0 ? '+' +
  110 + item.widthTolNeg : item.widthTolNeg }}
  111 + </view>
  112 + </view>
  113 + <view v-if="item.length" class="value-spec_val p12">*</view>
  114 + <view v-if="item.length" class="value-spec_val">{{ item.length }}</view>
  115 + <view v-if="item.length" class="value-spec_box">
  116 + <view v-if="item.lengthTolPos" class="value-spec_box_1">{{ item.lengthTolPos > 0 ? '+' +
  117 + item.lengthTolPos : item.lengthTolPos }}
  118 + </view>
  119 + <view v-if="item.lengthTolNeg" class="value-spec_box_2">{{ item.lengthTolNeg > 0 ? '+' +
  120 + item.lengthTolNeg : item.lengthTolNeg }}
  121 + </view>
  122 + </view>
  123 + </view>
  124 + </view>
  125 + <view class="row"><text class="label">状态</text><text class="value">{{ item.status }}</text></view>
  126 + <view class="row"><text class="label">数量(kg)</text><text class="value">{{ item.quantity }}</text>
  127 + </view>
  128 + <view class="row"><text class="label">是否提供样品</text><text class="value">{{ item.provideSamplesName
  129 + }}</text>
  130 + </view>
  131 + <view class="row"><text class="label">是否提供明确参数</text><text class="value">{{ item.clearParametersName
  132 + }}</text>
  133 + </view>
  134 + </view>
  135 + </view>
  136 +
  137 + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" />
  138 + </view>
  139 +</template>
  140 +<script>
  141 +import { uuid } from '@/utils/uuid.js'
  142 +import SingleSelectSheet from '@/components/single-select/index.vue'
  143 +export default {
  144 + name: 'Product',
  145 + props: {
  146 + title: { type: String, default: '' },
  147 + mode: { type: String, default: 'add' },
  148 + list: { type: Array, default: () => [] },
  149 + max: { type: Number, default: 8 },
  150 + provideSamplesOptions: { type: Array, default: () => [] },
  151 + clearParametersOptions: { type: Array, default: () => [] },
  152 + },
  153 + components: { SingleSelectSheet },
  154 + data() {
  155 + return {
  156 + items: [],
  157 + collapsedView: false,
  158 + roleCodes: [],
  159 + sheet: { visible: false, title: '请选择产品', options: [], value: '', idx: -1, mode: '' }
  160 + }
  161 + },
  162 + computed: {
  163 + minDeliveryDate() {
  164 + const s = this.orderDate
  165 + if (!s) return ''
  166 + const parts = String(s).split('-')
  167 + const y = Number(parts[0])
  168 + const m = Number(parts[1])
  169 + const d = Number(parts[2])
  170 + if (!y || !m || !d) return ''
  171 + const dt = new Date(y, m - 1, d)
  172 + dt.setDate(dt.getDate() + 1)
  173 + const yy = dt.getFullYear()
  174 + const mm = String(dt.getMonth() + 1).padStart(2, '0')
  175 + const dd = String(dt.getDate()).padStart(2, '0')
  176 + return `${yy}/${mm}/${dd}`
  177 + },
  178 + // roleCodes() {
  179 + // const g = this.$store && this.$store.getters
  180 + // return (g && g.roleCodes) || [];
  181 + // },
  182 + },
  183 + watch: {
  184 + items: {
  185 + handler() { this.emitChange() },
  186 + deep: true
  187 + },
  188 + list: {
  189 + handler(v) {
  190 + const arr = Array.isArray(v) ? v : []
  191 + this.items = arr.map(x => {
  192 + const it = { ...this.defaultItem(), ...x, collapsed: true }
  193 + return it
  194 + })
  195 + },
  196 + deep: true
  197 + },
  198 + },
  199 + created() {
  200 + const init = Array.isArray(this.list) && this.list.length > 0 ? this.list.map(v => ({ ...this.defaultItem(), ...v, collapsed: false })) : [{ ...this.defaultItem(), collapsed: false }]
  201 + this.items = init;
  202 + },
  203 + methods: {
  204 + defaultItem() {
  205 + return {
  206 + purchaseOrderId: uuid(),
  207 + collapsed: false,
  208 + id: '',
  209 + // 厚度公差
  210 + thicknessTolPos: '',
  211 + thicknessTolNeg: '',
  212 + // 宽度公差
  213 + widthTolPos: '',
  214 + widthTolNeg: '',
  215 + // 长度公差
  216 + lengthTolPos: '',
  217 + lengthTolNeg: '',
  218 + // 其他字段
  219 + industry: '',
  220 + quality: '',
  221 + brand: '',
  222 + thickness: '',
  223 + width: '',
  224 + length: '',
  225 + status: '',
  226 + quantity: '',
  227 + shippedQuantity: '',
  228 + supplementaryQuantity: '',
  229 + confirmedDeliveryDate: '',
  230 + remarks: '',
  231 + }
  232 + },
  233 +
  234 + onAdd() {
  235 + const obj = this.defaultItem()
  236 + obj.collapsed = true
  237 + this.items.push(obj)
  238 + this.emitChange()
  239 + },
  240 + onRemove(id) {
  241 + if (!id) return
  242 + uni.showModal({
  243 + title: '系统提示',
  244 + content: '是否确定删除选中的产品?',
  245 + confirmText: '确定',
  246 + cancelText: '取消',
  247 + success: (res) => {
  248 + if (res && res.confirm) {
  249 + const i = this.items.findIndex(it => String(it.purchaseOrderId) === String(id))
  250 + if (i >= 0) {
  251 + this.items.splice(i, 1)
  252 + this.emitChange()
  253 + }
  254 + }
  255 + }
  256 + })
  257 + },
  258 + toggleItem(idx) {
  259 + const it = this.items[idx]
  260 + if (!it) return
  261 + it.collapsed = !it.collapsed
  262 + this.$set(this.items, idx, it)
  263 + },
  264 + emitChange() {
  265 + const out = this.items.map(it => ({ ...it }))
  266 + this.$emit('input', out)
  267 + this.$emit('update:value', out)
  268 + this.$emit('change', out)
  269 + },
  270 + onNonNegativeNumberInput(val, item, idx, field) {
  271 + let v = String(val != null ? val : (item && item[field]) || '')
  272 + v = v.replace(/[^0-9.]/g, '')
  273 + v = v.replace(/(\..*)\./g, '$1')
  274 + if (v.startsWith('.')) v = '0' + v
  275 + if (v === '') { item[field] = ''; if (typeof idx === 'number') this.$set(this.items, idx, { ...item }); return }
  276 + const num = Number(v)
  277 + if (isNaN(num) || num < 0) {
  278 + item[field] = '0'
  279 + } else {
  280 + item[field] = v
  281 + }
  282 + if (typeof idx === 'number') this.$set(this.items, idx, { ...item })
  283 + },
  284 + onNonNegativeNumberBlur(item, idx, field) {
  285 + const v = String((item && item[field]) || '')
  286 + const num = Number(v)
  287 + if (isNaN(num) || num < 0) item[field] = '0'
  288 + if (typeof idx === 'number') this.$set(this.items, idx, { ...item })
  289 + },
  290 + onRealNumberInput(val, item, idx, field) {
  291 + let s = String(val != null ? val : (item && item[field]) || '')
  292 + const neg = s.trim().startsWith('-')
  293 + s = s.replace(/[^0-9.\-]/g, '')
  294 + s = s.replace(/(?!^)-/g, '')
  295 + s = s.replace(/(\..*)\./g, '$1')
  296 + if (s.startsWith('.')) s = '0' + s
  297 + if (s.startsWith('-.')) s = '-0.' + s.slice(2)
  298 + if (neg && !s.startsWith('-')) s = '-' + s.replace(/-/g, '')
  299 + item[field] = s
  300 + if (typeof idx === 'number') this.$set(this.items, idx, { ...item })
  301 + },
  302 + onRealNumberBlur(item, idx, field) {
  303 + const s = String((item && item[field]) || '')
  304 + if (s === '') { if (typeof idx === 'number') this.$set(this.items, idx, { ...item }); return }
  305 + const n = Number(s)
  306 + if (isNaN(n)) item[field] = ''
  307 + if (typeof idx === 'number') this.$set(this.items, idx, { ...item })
  308 + },
  309 + // 限制输入为2位小数
  310 + onTwoDecimalInput(val, item, idx, field) {
  311 + let v = String(val != null ? val : (item && item[field]) || '')
  312 + v = v.replace(/[^0-9.]/g, '')
  313 + v = v.replace(/(\..*)\./g, '$1')
  314 +
  315 + // Restrict to 2 decimal places
  316 + const decimalIndex = v.indexOf('.')
  317 + if (decimalIndex !== -1 && v.length > decimalIndex + 3) {
  318 + v = v.substring(0, decimalIndex + 3)
  319 + }
  320 +
  321 + if (v.startsWith('.')) v = '0' + v
  322 +
  323 + // If the value was modified (truncated or cleaned)
  324 + if (String(val) !== v) {
  325 + // Hack: Temporarily set the dirty value to trigger Vue update mechanism
  326 + // This ensures that when we set the clean value back, Vue detects a change
  327 + item[field] = val
  328 + if (typeof idx === 'number') this.$set(this.items, idx, { ...item })
  329 +
  330 + // Then revert to the clean value asynchronously
  331 + setTimeout(() => {
  332 + item[field] = v
  333 + if (typeof idx === 'number') this.$set(this.items, idx, { ...item })
  334 + }, 0)
  335 + } else {
  336 + item[field] = v
  337 + if (typeof idx === 'number') this.$set(this.items, idx, { ...item })
  338 + }
  339 + },
  340 + onTwoDecimalBlur(item, idx, field) {
  341 + let v = String((item && item[field]) || '')
  342 + const num = Number(v)
  343 + if (isNaN(num) || num < 0) {
  344 + item[field] = '0'
  345 + } else {
  346 + if (v.endsWith('.')) {
  347 + item[field] = v.slice(0, -1)
  348 + }
  349 + }
  350 + if (typeof idx === 'number') this.$set(this.items, idx, { ...item })
  351 + },
  352 + toggleViewCollapse() {
  353 + this.collapsedView = !this.collapsedView
  354 + },
  355 + onDeliveryChange(e, item, idx) {
  356 + const getStr = (x) => {
  357 + if (x && x.detail && x.detail.value !== undefined) return x.detail.value
  358 + if (typeof x === 'string') return x
  359 + return item && item.deliveryDate ? item.deliveryDate : ''
  360 + }
  361 + const val = getStr(e)
  362 + if (!val || !this.orderDate) return
  363 + const parse = (s) => {
  364 + const p = String(s).replace(/\//g, '-').split('-')
  365 + const y = Number(p[0])
  366 + const m = Number(p[1])
  367 + const d = Number(p[2])
  368 + return new Date(y, m - 1, d)
  369 + }
  370 + const sel = parse(val)
  371 + const ord = parse(this.orderDate)
  372 + if (!(sel > ord)) {
  373 + item.deliveryDate = ''
  374 + this.$set(this.items, idx, { ...item })
  375 + uni.showToast({ title: '发货日期必须大于订货日期', icon: 'none' })
  376 + }
  377 + },
  378 + openProductSheet(idx, mode = 'provideSamples') {
  379 + let opts = []
  380 + let title = ''
  381 + let value = ''
  382 + const item = this.items[idx]
  383 +
  384 + if (mode === 'provideSamples') {
  385 + opts = this.provideSamplesOptions
  386 + value = item.provideSamples
  387 + title = '选择是否提供样品'
  388 + } else if (mode === 'clearParameters') {
  389 + opts = this.clearParametersOptions;
  390 + value = item.clearParameters
  391 + title = '是否提供明确参数'
  392 + }
  393 + console.log('____', { ...this.sheet, visible: true, title, options: opts, idx, value, mode })
  394 + this.sheet = { ...this.sheet, visible: true, title, options: opts, idx, value, mode }
  395 + },
  396 + onProductConfirm({ value, label }) {
  397 + const idx = this.sheet.idx
  398 + const _mode = this.sheet.mode;
  399 + const it = this.items[idx]
  400 + if (!it) { this.sheet.visible = false; return }
  401 + it[_mode] = value
  402 + it[_mode + 'Name'] = label || ''
  403 + this.$set(this.items, idx, it)
  404 + this.sheet.visible = false
  405 + this.emitChange()
  406 + },
  407 + }
  408 +}
  409 +</script>
  410 +<style lang="scss" scoped>
  411 +.header {
  412 + background-color: #fff;
  413 + display: flex;
  414 + align-items: center;
  415 + padding: 24rpx 32rpx;
  416 +
  417 + &.bp {
  418 + border-bottom: 1px solid #f0f0f0;
  419 + }
  420 +}
  421 +
  422 +.dot {
  423 + width: 16rpx;
  424 + height: 16rpx;
  425 + background: #3D48A3;
  426 + border-radius: 50%;
  427 + margin-right: 12rpx;
  428 +}
  429 +
  430 +.title {
  431 + font-size: 32rpx;
  432 + color: rgba(0, 0, 0, 0.9);
  433 + font-weight: 600;
  434 +}
  435 +
  436 +.ops {
  437 + margin-left: auto;
  438 +}
  439 +
  440 +.op {
  441 + color: $theme-primary;
  442 + font-size: 28rpx;
  443 + margin-left: 8rpx;
  444 +}
  445 +
  446 +.op1 {
  447 + display: flex;
  448 + align-items: center;
  449 +}
  450 +
  451 +.opAdd {
  452 + color: rgba(0, 0, 0, 0.6);
  453 + width: 40rpx;
  454 + height: 40rpx;
  455 +}
  456 +
  457 +.opCollapse {
  458 + color: rgba(0, 0, 0, 0.6);
  459 + width: 32rpx;
  460 + height: 28rpx;
  461 + margin-right: 16rpx;
  462 +}
  463 +
  464 +::v-deep .uni-list {
  465 + background: transparent;
  466 +
  467 + .uni-list--border-top {
  468 + background-color: transparent !important;
  469 + }
  470 +
  471 + &-item {
  472 + &__extra-text {
  473 + font-size: 32rpx;
  474 + }
  475 +
  476 + &__content-title {
  477 + font-size: 32rpx;
  478 + color: rgba(0, 0, 0, 0.9);
  479 + }
  480 +
  481 + &__container {
  482 + padding: 32rpx;
  483 +
  484 + .uni-easyinput {
  485 +
  486 + .is-disabled {
  487 + background-color: transparent !important;
  488 + }
  489 +
  490 + &__placeholder-class {
  491 + font-size: 32rpx;
  492 + color: rgba(0, 0, 0, 0.4);
  493 + }
  494 +
  495 + &__content {
  496 + border: none;
  497 +
  498 + &-input {
  499 + padding-left: 0 !important;
  500 + height: 48rpx;
  501 + line-height: 48rpx;
  502 + font-size: 32rpx;
  503 + }
  504 +
  505 + .content-clear-icon {
  506 + font-size: 44rpx !important;
  507 + }
  508 + }
  509 + }
  510 +
  511 + .amount-row {
  512 + flex: 1;
  513 + display: flex;
  514 + align-items: center;
  515 +
  516 + .uni-easyinput {
  517 + flex: 1;
  518 + }
  519 +
  520 + .unit {
  521 + margin-left: 16rpx;
  522 + color: rgba(0, 0, 0, 0.9);
  523 + }
  524 + }
  525 +
  526 + .item-title,
  527 + .uni-list-item__content {
  528 + flex: none;
  529 + min-height: 48rpx;
  530 + line-height: 48rpx;
  531 + font-size: 32rpx;
  532 + position: relative;
  533 + width: 210rpx;
  534 + margin-right: 32rpx;
  535 + color: rgba(0, 0, 0, 0.9);
  536 + padding-right: 0;
  537 +
  538 +
  539 + .required {
  540 + color: red;
  541 + position: absolute;
  542 + top: 50%;
  543 + transform: translateY(-50%);
  544 + left: -16rpx;
  545 + }
  546 + }
  547 +
  548 + }
  549 +
  550 + &.select-item {
  551 + &.is-empty {
  552 + .uni-list-item__extra-text {
  553 + color: rgba(0, 0, 0, 0.4) !important;
  554 + }
  555 + }
  556 +
  557 + &.is-filled {
  558 + .uni-list-item__extra-text {
  559 + color: rgba(0, 0, 0, 0.9) !important;
  560 + }
  561 + }
  562 +
  563 + .serial-number-row {
  564 + display: flex;
  565 + align-items: center;
  566 + }
  567 +
  568 + }
  569 +
  570 + &.mgb10 {
  571 + margin-bottom: 20rpx;
  572 + }
  573 +
  574 + }
  575 +
  576 + .title-header {
  577 + background-color: #fff;
  578 + display: flex;
  579 + align-items: center;
  580 + padding: 32rpx 32rpx 22rpx;
  581 +
  582 + &_icon {
  583 + width: 32rpx;
  584 + height: 28rpx;
  585 + margin-right: 16rpx;
  586 + }
  587 +
  588 + span {
  589 + color: rgba(0, 0, 0, 0.9);
  590 + font-size: 32rpx;
  591 + line-height: 44rpx;
  592 + font-weight: 600;
  593 + }
  594 + }
  595 +}
  596 +
  597 +/* 只读 easyinput 根据内容自适应高度 */
  598 +::v-deep .uni-list-item__container {
  599 + align-items: flex-start;
  600 +}
  601 +
  602 +.block-ops {
  603 + display: flex;
  604 + padding: 20rpx 32rpx 20rpx;
  605 + justify-content: space-around;
  606 +}
  607 +
  608 +.del {
  609 + color: #D54941;
  610 + font-size: 28rpx;
  611 + display: flex;
  612 + align-items: center;
  613 +
  614 + image {
  615 + width: 40rpx;
  616 + height: 40rpx;
  617 + }
  618 +}
  619 +
  620 +.toggle {
  621 + color: $theme-primary;
  622 + font-size: 28rpx;
  623 + display: flex;
  624 + align-items: center;
  625 +
  626 + image {
  627 + width: 40rpx;
  628 + height: 40rpx;
  629 + }
  630 +}
  631 +
  632 +.section {
  633 + background: #f1f1f1;
  634 + margin-bottom: 20rpx;
  635 +
  636 + .block {
  637 + background: #ffffff;
  638 + // padding: 32rpx 0;
  639 + margin-bottom: 20rpx;
  640 +
  641 + &:last-child {
  642 + margin-bottom: 0;
  643 + }
  644 + }
  645 +
  646 + .row {
  647 + display: flex;
  648 + // margin-bottom: 24rpx;
  649 + line-height: 32rpx;
  650 + padding: 32rpx;
  651 + border-bottom: 1rpx solid #f2f2f2 !important;
  652 +
  653 +
  654 + &.noneStyle {
  655 + border-bottom: 0;
  656 + border-bottom: none;
  657 + }
  658 +
  659 + &.row-spec {
  660 + align-items: center;
  661 + }
  662 + }
  663 +
  664 + .row:last-child {
  665 + margin-bottom: 0;
  666 + }
  667 +
  668 + .label {
  669 + width: 210rpx;
  670 + margin-right: 32rpx;
  671 + color: rgba(0, 0, 0, 0.9);
  672 + font-size: 32rpx;
  673 + line-height: 48rpx;
  674 + }
  675 +
  676 + .value {
  677 + flex: 1;
  678 + color: rgba(0, 0, 0, 0.9);
  679 + font-size: 32rpx;
  680 + white-space: pre-wrap;
  681 + word-break: break-all;
  682 + line-height: 48rpx;
  683 + }
  684 +
  685 + .value-spec {
  686 + height: 48rpx;
  687 + display: flex;
  688 + align-items: center;
  689 + color: #000000;
  690 +
  691 + &_box {
  692 + position: relative;
  693 + width: 60rpx;
  694 + height: 48rpx;
  695 +
  696 + &_1 {
  697 + font-size: 16rpx;
  698 + position: absolute;
  699 + top: -10rpx;
  700 + left: 0;
  701 + }
  702 +
  703 + &_2 {
  704 + font-size: 16rpx;
  705 + position: absolute;
  706 + bottom: -10rpx;
  707 + left: 0;
  708 + }
  709 + }
  710 +
  711 + &_val {
  712 + font-size: 28rpx;
  713 +
  714 + &.p12 {
  715 + padding-right: 12rpx;
  716 + }
  717 + }
  718 + }
  719 +
  720 + .view-total {
  721 + padding-top: 20rpx;
  722 +
  723 + .head {
  724 + font-size: 32rpx;
  725 + font-weight: 600;
  726 + line-height: 50rpx;
  727 + color: rgba(0, 0, 0, 0.9);
  728 + padding-bottom: 16rpx;
  729 + margin-bottom: 24rpx;
  730 + border-bottom: 1px dashed #E7E7E7;
  731 + }
  732 +
  733 + .row {
  734 + display: flex;
  735 + margin-bottom: 24rpx;
  736 + line-height: 32rpx;
  737 +
  738 + .label {
  739 + width: 180rpx;
  740 + margin-right: 14rpx;
  741 + color: rgba(0, 0, 0, 0.6);
  742 + font-size: 28rpx;
  743 + }
  744 +
  745 + .value {
  746 + flex: 1;
  747 + color: rgba(0, 0, 0, 0.9);
  748 + font-size: 28rpx;
  749 + white-space: pre-wrap;
  750 + word-break: break-all;
  751 + }
  752 + }
  753 + }
  754 +}
  755 +
  756 +
  757 +.view-list {
  758 + padding: 26rpx 32rpx;
  759 + background: #ffffff;
  760 +
  761 + .card {
  762 + background: #f3f3f3;
  763 + border-radius: 16rpx;
  764 + padding: 32rpx 44rpx;
  765 + margin-bottom: 20rpx;
  766 +
  767 + &:last-child {
  768 + margin-bottom: 0;
  769 + }
  770 + }
  771 +
  772 + .row {
  773 + display: flex;
  774 + margin-bottom: 24rpx;
  775 + line-height: 32rpx;
  776 +
  777 + &.row-spec {
  778 + height: 60rpx;
  779 + align-items: center;
  780 + }
  781 + }
  782 +
  783 + .row:last-child {
  784 + margin-bottom: 0;
  785 + }
  786 +
  787 + .label {
  788 + width: 200rpx;
  789 + margin-right: 14rpx;
  790 + color: rgba(0, 0, 0, 0.6);
  791 + font-size: 28rpx;
  792 + }
  793 +
  794 + .value {
  795 + flex: 1;
  796 + color: rgba(0, 0, 0, 0.9);
  797 + font-size: 28rpx;
  798 + white-space: pre-wrap;
  799 + word-break: break-all;
  800 + }
  801 +
  802 + .value-spec {
  803 + height: 60rpx;
  804 + display: flex;
  805 + align-items: center;
  806 + color: #000000;
  807 +
  808 + &_box {
  809 + position: relative;
  810 + width: 60rpx;
  811 + height: 60rpx;
  812 +
  813 + &_1 {
  814 + font-size: 16rpx;
  815 + position: absolute;
  816 + top: 0;
  817 + left: 0;
  818 + }
  819 +
  820 + &_2 {
  821 + font-size: 16rpx;
  822 + position: absolute;
  823 + bottom: 0;
  824 + left: 0;
  825 + }
  826 + }
  827 +
  828 + &_val {
  829 + font-size: 28rpx;
  830 +
  831 + &.p12 {
  832 + padding-right: 12rpx;
  833 + }
  834 + }
  835 + }
  836 +
  837 + .view-total {
  838 + padding-top: 20rpx;
  839 +
  840 + .head {
  841 + font-size: 32rpx;
  842 + font-weight: 600;
  843 + line-height: 50rpx;
  844 + color: rgba(0, 0, 0, 0.9);
  845 + padding-bottom: 16rpx;
  846 + margin-bottom: 24rpx;
  847 + border-bottom: 1px dashed #E7E7E7;
  848 + }
  849 +
  850 + .row {
  851 + display: flex;
  852 + margin-bottom: 24rpx;
  853 + line-height: 32rpx;
  854 +
  855 + .label {
  856 + width: 180rpx;
  857 + margin-right: 14rpx;
  858 + color: rgba(0, 0, 0, 0.6);
  859 + font-size: 28rpx;
  860 + }
  861 +
  862 + .value {
  863 + flex: 1;
  864 + color: rgba(0, 0, 0, 0.9);
  865 + font-size: 28rpx;
  866 + white-space: pre-wrap;
  867 + word-break: break-all;
  868 + }
  869 + }
  870 + }
  871 +}
  872 +</style>
  1 +<template>
  2 + <view class="page">
  3 + <scroll-view class="scroll" scroll-y>
  4 + <view class="detail-page">
  5 + <view class="section">
  6 + <text class="row company">{{ form.orderingUnitName }}</text>
  7 + <view :class="['status', `status_${form.status}`]" />
  8 + <view class="row"><text class="label">试样种类</text><text class="value">{{ form.sampleTypeName }}</text></view>
  9 + <view class="row"><text class="label">客户类型</text><text class="value">{{ form.customerTypeName }}</text></view>
  10 + <view class="row"><text class="label">生产厂</text><text class="value">{{ form.workshopName }}</text></view>
  11 + <view class="row"><text class="label">所属品种</text><text class="value">{{ form.belongingBreed }}</text></view>
  12 + <view class="row"><text class="label">原供货同行</text><text class="value">{{ form.originalSupplierPeer }}</text>
  13 + </view>
  14 + </view>
  15 +
  16 + <!-- 产品 -->
  17 + <view class="section2">
  18 + <Product mode="view" :list="form.productSampleConfirmationSlipDetailList" />
  19 + </view>
  20 +
  21 + <view class="section">
  22 + <view class="row"><text class="label">数量</text><text class="value">{{ form.totalQuantity }}</text></view>
  23 + <view class="row"><text class="label">本次试样数量是否超规定</text><text class="value">{{ form.sampleQuantityRegulation ?
  24 + '是' : '否' }}</text></view>
  25 + <view class="row"><text class="label">试样规格个数是否超规定</text><text class="value">{{
  26 + form.specificationQuantityRegulation ? '是' : '否' }}</text></view>
  27 + <view class="row"><text class="label">试样次数</text><text class="value">{{ form.sampleFrequency }}</text></view>
  28 + <view class="row"><text class="label">前期不合格描述</text><text class="value">{{ form.earlyNonconformityDescription
  29 + }}</text></view>
  30 + </view>
  31 + </view>
  32 + </scroll-view>
  33 + </view>
  34 +</template>
  35 +
  36 +<script>
  37 +import { getDetailApi } from '@/api/confirmation_form.js'
  38 +import Product from './product.vue'
  39 +
  40 +export default {
  41 + name: 'ConfirmationFormViewer',
  42 + components: { Product },
  43 + props: { id: { type: [String, Number], default: '' } },
  44 + data() {
  45 + return {
  46 + form: {},
  47 + }
  48 + },
  49 + computed: {
  50 + },
  51 + watch: {
  52 + id: {
  53 + immediate: true,
  54 + handler(val) {
  55 + const v = (val !== undefined && val !== null) ? String(val) : ''
  56 + if (v) this.loadDetail(v)
  57 + }
  58 + }
  59 + },
  60 + onLoad(query) {
  61 + },
  62 + methods: {
  63 + async loadDetail(id) {
  64 + try {
  65 + const res = await getDetailApi(id)
  66 + this.form = res.data || {}
  67 + } catch (e) {
  68 + this.form = {}
  69 + }
  70 + },
  71 + }
  72 +}
  73 +</script>
  74 +
  75 +<style lang="scss" scoped>
  76 +.page {
  77 + display: flex;
  78 + flex-direction: column;
  79 + height: 100vh;
  80 +}
  81 +
  82 +.scroll {
  83 + flex: 1;
  84 + background: #f3f3f3;
  85 +}
  86 +
  87 +.detail-page {
  88 + padding-bottom: 20rpx;
  89 +}
  90 +
  91 +.section {
  92 + padding: 32rpx;
  93 + background: #fff;
  94 + margin-bottom: 20rpx;
  95 + position: relative;
  96 +
  97 +}
  98 +
  99 +.row {
  100 + display: flex;
  101 + margin-bottom: 28rpx;
  102 +
  103 + &:last-child {
  104 + margin-bottom: 0;
  105 + }
  106 +
  107 + &.company {
  108 + font-size: 36rpx;
  109 + font-weight: 600;
  110 + color: rgba(0, 0, 0, 0.9);
  111 + padding-top: 10rpx;
  112 + margin-bottom: 32rpx;
  113 + line-height: 50rpx;
  114 + }
  115 +
  116 + .label {
  117 + max-width: 400rpx;
  118 + margin-right: 20rpx;
  119 + line-height: 32rpx;
  120 + font-size: 28rpx;
  121 + color: rgba(0, 0, 0, 0.6);
  122 + }
  123 +
  124 + .value {
  125 + flex: 1;
  126 + line-height: 32rpx;
  127 + font-size: 28rpx;
  128 + color: rgba(0, 0, 0, 0.9);
  129 + text-align: right;
  130 + word-break: break-all;
  131 + }
  132 +}
  133 +
  134 +.title-header {
  135 + background-color: #fff;
  136 + display: flex;
  137 + align-items: center;
  138 + padding: 32rpx 32rpx 22rpx;
  139 + border-bottom: 1rpx dashed #f0f0f0;
  140 +
  141 + &_icon {
  142 + width: 32rpx;
  143 + height: 28rpx;
  144 + margin-right: 16rpx;
  145 + }
  146 +
  147 + span {
  148 + color: rgba(0, 0, 0, 0.9);
  149 + font-size: 32rpx;
  150 + line-height: 44rpx;
  151 + font-weight: 600;
  152 + }
  153 +}
  154 +</style>
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 <view v-if="mode === 'add'" class="add-list"> 16 <view v-if="mode === 'add'" class="add-list">
17 <view v-for="(item, idx) in items" :key="idx" class="block"> 17 <view v-for="(item, idx) in items" :key="idx" class="block">
18 <uni-list v-show="item.collapsed"> 18 <uni-list v-show="item.collapsed">
19 - <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx)" :rightText="item.productName || '请选择产品名称'" showArrow> 19 + <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.productName || '请选择产品名称'" showArrow>
20 <template v-slot:body> 20 <template v-slot:body>
21 <view class="item-title"><text>产品名称</text></view> 21 <view class="item-title"><text>产品名称</text></view>
22 </template> 22 </template>
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 </uni-list-item> 33 </uni-list-item>
34 </uni-list> 34 </uni-list>
35 <uni-list v-show="!item.collapsed"> 35 <uni-list v-show="!item.collapsed">
36 - <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx)" :rightText="item.productName || '请选择产品名称'" showArrow> 36 + <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.productName || '请选择产品名称'" showArrow>
37 <template v-slot:body> 37 <template v-slot:body>
38 <view class="item-title"><text>产品名称</text></view> 38 <view class="item-title"><text>产品名称</text></view>
39 </template> 39 </template>
@@ -137,6 +137,12 @@ @@ -137,6 +137,12 @@
137 <uni-datetime-picker :start="minDeliveryDate" type="date" v-model="item.deliveryDate" @change="onDateChange(idx, $event)" /> 137 <uni-datetime-picker :start="minDeliveryDate" type="date" v-model="item.deliveryDate" @change="onDateChange(idx, $event)" />
138 </template> 138 </template>
139 </uni-list-item> 139 </uni-list-item>
  140 + <uni-list-item class="select-item" :class="typeof item.sampleOrder === 'boolean' ? 'is-filled' : 'is-empty'" clickable
  141 + @click="openProductSheet(idx, 'sampleOrder')" :rightText="typeof item.sampleOrder === 'boolean' ? (item.sampleOrder ? '是' : '否') : '请选择'" showArrow>
  142 + <template v-slot:body>
  143 + <view class="item-title"><text>是否为试样订单</text></view>
  144 + </template>
  145 + </uni-list-item>
140 </uni-list> 146 </uni-list>
141 <view class="block-ops"> 147 <view class="block-ops">
142 <div class="del" @click="onRemove(idx)"> 148 <div class="del" @click="onRemove(idx)">
@@ -195,6 +201,7 @@ @@ -195,6 +201,7 @@
195 <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount) 201 <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount)
196 }}</text></view> 202 }}</text></view>
197 <view class="row"><text class="label">发货日期</text><text class="value">{{ item.deliveryDate }}</text></view> 203 <view class="row"><text class="label">发货日期</text><text class="value">{{ item.deliveryDate }}</text></view>
  204 + <view class="row"><text class="label">是否为试样订单</text><text class="value">{{ item.sampleOrder ? '是' : '否' }}</text></view>
198 </view> 205 </view>
199 </view> 206 </view>
200 <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" /> 207 <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" />
@@ -217,7 +224,7 @@ export default { @@ -217,7 +224,7 @@ export default {
217 return { 224 return {
218 items: [], 225 items: [],
219 collapsedView: false, 226 collapsedView: false,
220 - sheet: { visible: false, title: '请选择产品', options: [], value: '', idx: -1 } 227 + sheet: { visible: false, title: '请选择产品', options: [], value: '', idx: -1, mode: 'product' }
221 } 228 }
222 }, 229 },
223 computed: { 230 computed: {
@@ -251,20 +258,20 @@ export default { @@ -251,20 +258,20 @@ export default {
251 handler(v) { 258 handler(v) {
252 // const arr = Array.isArray(v) ? v : [] 259 // const arr = Array.isArray(v) ? v : []
253 // this.items = arr.map(x => ({ ...this.defaultItem(), ...x, collapsed: true })) 260 // this.items = arr.map(x => ({ ...this.defaultItem(), ...x, collapsed: true }))
254 - this.items = v.map(x => ({ ...this.defaultItem(), ...x, collapsed: true })) 261 + this.items = v.map(x => ({ ...this.defaultItem(), ...x, sampleOrder: !!x.sampleOrder, collapsed: true }))
255 console.log('v', v) 262 console.log('v', v)
256 }, 263 },
257 deep: true 264 deep: true
258 } 265 }
259 }, 266 },
260 created() { 267 created() {
261 - const init = Array.isArray(this.list) && this.list.length > 0 ? this.list.map(v => ({ ...this.defaultItem(), ...v, collapsed: true })) : [{ ...this.defaultItem(), collapsed: false }] 268 + const init = Array.isArray(this.list) && this.list.length > 0 ? this.list.map(v => ({ ...this.defaultItem(), ...v, sampleOrder: !!v.sampleOrder, collapsed: true })) : [{ ...this.defaultItem(), collapsed: false }]
262 this.items = init 269 this.items = init
263 this.recalculateAll() 270 this.recalculateAll()
264 }, 271 },
265 methods: { 272 methods: {
266 defaultItem() { 273 defaultItem() {
267 - return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '',processingFee: undefined, status: '', quantity: '', unitPrice: '', totalAmount: 0, deliveryDate: '' } 274 + return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', status: '', quantity: '', unitPrice: '', processingFee: undefined, totalAmount: 0, deliveryDate: '', sampleOrder: false }
268 }, 275 },
269 onNonNegativeInput(idx, field) { 276 onNonNegativeInput(idx, field) {
270 const it = this.items[idx] 277 const it = this.items[idx]
@@ -373,18 +380,38 @@ export default { @@ -373,18 +380,38 @@ export default {
373 const l = [item.length, item.lengthTolPos, item.lengthTolNeg].filter(Boolean).join('/') 380 const l = [item.length, item.lengthTolPos, item.lengthTolNeg].filter(Boolean).join('/')
374 return [t, w, l].filter(Boolean).join(' × ') 381 return [t, w, l].filter(Boolean).join(' × ')
375 }, 382 },
376 - openProductSheet(idx) {  
377 - const opts = this.selectOptions  
378 - const current = this.items[idx] && this.items[idx].productId  
379 - const match = opts.find(o => o.value === current)  
380 - this.sheet = { ...this.sheet, visible: true, title: '请选择产品', options: opts, idx, value: match ? match.value : '' } 383 + openProductSheet(idx, mode = 'product') {
  384 + let opts = []
  385 + let title = ''
  386 + let value = ''
  387 + const item = this.items[idx]
  388 +
  389 + if (mode === 'product') {
  390 + opts = this.selectOptions
  391 + const current = item && item.productId
  392 + const match = opts.find(o => o.value === current)
  393 + value = match ? match.value : ''
  394 + title = '请选择产品'
  395 + } else if (mode === 'sampleOrder') {
  396 + opts = [{ label: '是', value: true }, { label: '否', value: false }]
  397 + value = item.sampleOrder
  398 + title = '是否为试样订单'
  399 + }
  400 +
  401 + this.sheet = { ...this.sheet, visible: true, title, options: opts, idx, value, mode }
381 }, 402 },
382 onProductConfirm({ value, label }) { 403 onProductConfirm({ value, label }) {
383 - const idx = this.sheet.idx 404 + const { idx, mode } = this.sheet
384 const it = this.items[idx] 405 const it = this.items[idx]
385 if (!it) { this.sheet.visible = false; return } 406 if (!it) { this.sheet.visible = false; return }
386 - it.productId = value  
387 - it.productName = label || '' 407 +
  408 + if (mode === 'product') {
  409 + it.productId = value
  410 + it.productName = label || ''
  411 + } else if (mode === 'sampleOrder') {
  412 + it.sampleOrder = value
  413 + }
  414 +
388 this.$set(this.items, idx, it) 415 this.$set(this.items, idx, it)
389 this.sheet.visible = false 416 this.sheet.visible = false
390 this.emitChange() 417 this.emitChange()
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 <view v-if="mode === 'add'" class="add-list"> 16 <view v-if="mode === 'add'" class="add-list">
17 <view v-for="(item, idx) in items" :key="idx" class="block"> 17 <view v-for="(item, idx) in items" :key="idx" class="block">
18 <uni-list v-show="item.collapsed"> 18 <uni-list v-show="item.collapsed">
19 - <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx)" :rightText="item.productName || '请选择产品名称'" showArrow> 19 + <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.productName || '请选择产品名称'" showArrow>
20 <template v-slot:body> 20 <template v-slot:body>
21 <view class="item-title"><text>产品名称</text></view> 21 <view class="item-title"><text>产品名称</text></view>
22 </template> 22 </template>
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 </uni-list-item> 33 </uni-list-item>
34 </uni-list> 34 </uni-list>
35 <uni-list v-show="!item.collapsed"> 35 <uni-list v-show="!item.collapsed">
36 - <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx)" :rightText="item.productName || '请选择产品名称'" showArrow> 36 + <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.productName || '请选择产品名称'" showArrow>
37 <template v-slot:body> 37 <template v-slot:body>
38 <view class="item-title"><text>产品名称</text></view> 38 <view class="item-title"><text>产品名称</text></view>
39 </template> 39 </template>
@@ -139,6 +139,12 @@ @@ -139,6 +139,12 @@
139 <uni-datetime-picker :start="minDeliveryDate" type="date" v-model="item.deliveryDate" @change="onDateChange(idx, $event)" /> 139 <uni-datetime-picker :start="minDeliveryDate" type="date" v-model="item.deliveryDate" @change="onDateChange(idx, $event)" />
140 </template> 140 </template>
141 </uni-list-item> 141 </uni-list-item>
  142 + <uni-list-item class="select-item" :class="typeof item.sampleOrder === 'boolean' ? 'is-filled' : 'is-empty'" clickable
  143 + @click="openProductSheet(idx, 'sampleOrder')" :rightText="typeof item.sampleOrder === 'boolean' ? (item.sampleOrder ? '是' : '否') : '请选择'" showArrow>
  144 + <template v-slot:body>
  145 + <view class="item-title"><text>是否为试样订单</text></view>
  146 + </template>
  147 + </uni-list-item>
142 </uni-list> 148 </uni-list>
143 <view class="block-ops"> 149 <view class="block-ops">
144 <div class="del" @click="onRemove(idx)"> 150 <div class="del" @click="onRemove(idx)">
@@ -197,6 +203,7 @@ @@ -197,6 +203,7 @@
197 <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount) 203 <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount)
198 }}</text></view> 204 }}</text></view>
199 <view class="row"><text class="label">发货日期</text><text class="value">{{ item.deliveryDate }}</text></view> 205 <view class="row"><text class="label">发货日期</text><text class="value">{{ item.deliveryDate }}</text></view>
  206 + <view class="row"><text class="label">是否为试样订单</text><text class="value">{{ item.sampleOrder ? '是' : '否' }}</text></view>
200 </view> 207 </view>
201 </view> 208 </view>
202 <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" /> 209 <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" />
@@ -219,7 +226,7 @@ export default { @@ -219,7 +226,7 @@ export default {
219 return { 226 return {
220 items: [], 227 items: [],
221 collapsedView: false, 228 collapsedView: false,
222 - sheet: { visible: false, title: '请选择产品', options: [], value: '', idx: -1 } 229 + sheet: { visible: false, title: '请选择产品', options: [], value: '', idx: -1, mode: 'product' }
223 } 230 }
224 }, 231 },
225 watch: { 232 watch: {
@@ -231,14 +238,14 @@ export default { @@ -231,14 +238,14 @@ export default {
231 handler(v) { 238 handler(v) {
232 // const arr = Array.isArray(v) ? v : [] 239 // const arr = Array.isArray(v) ? v : []
233 // this.items = arr.map(x => ({ ...this.defaultItem(), ...x, collapsed: true })) 240 // this.items = arr.map(x => ({ ...this.defaultItem(), ...x, collapsed: true }))
234 - this.items = v.map(x => ({ ...this.defaultItem(), ...x, collapsed: true })) 241 + this.items = v.map(x => ({ ...this.defaultItem(), ...x, sampleOrder: !!x.sampleOrder, collapsed: true }))
235 console.log('v', v) 242 console.log('v', v)
236 }, 243 },
237 deep: true 244 deep: true
238 } 245 }
239 }, 246 },
240 created() { 247 created() {
241 - const init = Array.isArray(this.list) && this.list.length > 0 ? this.list.map(v => ({ ...this.defaultItem(), ...v, collapsed: true })) : [{ ...this.defaultItem(), collapsed: false }] 248 + const init = Array.isArray(this.list) && this.list.length > 0 ? this.list.map(v => ({ ...this.defaultItem(), ...v, sampleOrder: !!v.sampleOrder, collapsed: true })) : [{ ...this.defaultItem(), collapsed: false }]
242 this.items = init 249 this.items = init
243 this.recalculateAll() 250 this.recalculateAll()
244 }, 251 },
@@ -266,7 +273,7 @@ export default { @@ -266,7 +273,7 @@ export default {
266 }, 273 },
267 methods: { 274 methods: {
268 defaultItem() { 275 defaultItem() {
269 - return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', status: '', quantity: '', unitPrice: '', processingFee: undefined, totalAmount: 0, deliveryDate: '' } 276 + return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', status: '', quantity: '', unitPrice: '', processingFee: undefined, totalAmount: 0, deliveryDate: '', sampleOrder: false }
270 }, 277 },
271 onNonNegativeInput(idx, field) { 278 onNonNegativeInput(idx, field) {
272 const it = this.items[idx] 279 const it = this.items[idx]
@@ -343,18 +350,38 @@ export default { @@ -343,18 +350,38 @@ export default {
343 const l = [item.length, item.lengthTolPos, item.lengthTolNeg].filter(Boolean).join('/') 350 const l = [item.length, item.lengthTolPos, item.lengthTolNeg].filter(Boolean).join('/')
344 return [t, w, l].filter(Boolean).join(' × ') 351 return [t, w, l].filter(Boolean).join(' × ')
345 }, 352 },
346 - openProductSheet(idx) {  
347 - const opts = Array.isArray(this.selectOptions) ? this.selectOptions : []  
348 - const current = this.items[idx] && this.items[idx].productId  
349 - const match = (opts || []).find(o => String(o.value) === String(current))  
350 - this.sheet = { ...this.sheet, visible: true, title: '请选择产品', options: opts, idx, value: match ? match.value : '' } 353 + openProductSheet(idx, mode = 'product') {
  354 + let opts = []
  355 + let title = ''
  356 + let value = ''
  357 + const item = this.items[idx]
  358 +
  359 + if (mode === 'product') {
  360 + opts = Array.isArray(this.selectOptions) ? this.selectOptions : []
  361 + const current = item && item.productId
  362 + const match = (opts || []).find(o => String(o.value) === String(current))
  363 + value = match ? match.value : ''
  364 + title = '请选择产品'
  365 + } else if (mode === 'sampleOrder') {
  366 + opts = [{ label: '是', value: true }, { label: '否', value: false }]
  367 + value = item.sampleOrder
  368 + title = '是否为试样订单'
  369 + }
  370 +
  371 + this.sheet = { ...this.sheet, visible: true, title, options: opts, idx, value, mode }
351 }, 372 },
352 onProductConfirm({ value, label }) { 373 onProductConfirm({ value, label }) {
353 - const idx = this.sheet.idx 374 + const { idx, mode } = this.sheet
354 const it = this.items[idx] 375 const it = this.items[idx]
355 if (!it) { this.sheet.visible = false; return } 376 if (!it) { this.sheet.visible = false; return }
356 - it.productId = value  
357 - it.productName = label || '' 377 +
  378 + if (mode === 'product') {
  379 + it.productId = value
  380 + it.productName = label || ''
  381 + } else if (mode === 'sampleOrder') {
  382 + it.sampleOrder = value
  383 + }
  384 +
358 this.$set(this.items, idx, it) 385 this.$set(this.items, idx, it)
359 this.sheet.visible = false 386 this.sheet.visible = false
360 this.emitChange() 387 this.emitChange()
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 <view v-if="mode === 'add'" class="add-list"> 16 <view v-if="mode === 'add'" class="add-list">
17 <view v-for="(item, idx) in items" :key="idx" class="block"> 17 <view v-for="(item, idx) in items" :key="idx" class="block">
18 <uni-list v-show="item.collapsed"> 18 <uni-list v-show="item.collapsed">
19 - <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx)" :rightText="item.productName || '请选择产品名称'" showArrow> 19 + <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.productName || '请选择产品名称'" showArrow>
20 <template v-slot:body> 20 <template v-slot:body>
21 <view class="item-title"><text>产品名称</text></view> 21 <view class="item-title"><text>产品名称</text></view>
22 </template> 22 </template>
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 </uni-list-item> 33 </uni-list-item>
34 </uni-list> 34 </uni-list>
35 <uni-list v-show="!item.collapsed"> 35 <uni-list v-show="!item.collapsed">
36 - <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx)" :rightText="item.productName || '请选择产品名称'" showArrow> 36 + <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.productName || '请选择产品名称'" showArrow>
37 <template v-slot:body> 37 <template v-slot:body>
38 <view class="item-title"><text>产品名称</text></view> 38 <view class="item-title"><text>产品名称</text></view>
39 </template> 39 </template>
@@ -137,6 +137,12 @@ @@ -137,6 +137,12 @@
137 <uni-datetime-picker :start="minDeliveryDate" type="date" v-model="item.deliveryDate" @change="onDateChange(idx, $event)" /> 137 <uni-datetime-picker :start="minDeliveryDate" type="date" v-model="item.deliveryDate" @change="onDateChange(idx, $event)" />
138 </template> 138 </template>
139 </uni-list-item> 139 </uni-list-item>
  140 + <uni-list-item class="select-item" :class="typeof item.sampleOrder === 'boolean' ? 'is-filled' : 'is-empty'" clickable
  141 + @click="openProductSheet(idx, 'sampleOrder')" :rightText="typeof item.sampleOrder === 'boolean' ? (item.sampleOrder ? '是' : '否') : '请选择'" showArrow>
  142 + <template v-slot:body>
  143 + <view class="item-title"><text>是否为试样订单</text></view>
  144 + </template>
  145 + </uni-list-item>
140 </uni-list> 146 </uni-list>
141 <view class="block-ops"> 147 <view class="block-ops">
142 <div class="del" @click="onRemove(idx)"> 148 <div class="del" @click="onRemove(idx)">
@@ -191,6 +197,7 @@ @@ -191,6 +197,7 @@
191 <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount) 197 <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount)
192 }}</text></view> 198 }}</text></view>
193 <view class="row"><text class="label">发货日期</text><text class="value">{{ item.deliveryDate }}</text></view> 199 <view class="row"><text class="label">发货日期</text><text class="value">{{ item.deliveryDate }}</text></view>
  200 + <view class="row"><text class="label">是否为试样订单</text><text class="value">{{ item.sampleOrder ? '是' : '否' }}</text></view>
194 </view> 201 </view>
195 </view> 202 </view>
196 <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" /> 203 <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" />
@@ -213,7 +220,7 @@ export default { @@ -213,7 +220,7 @@ export default {
213 return { 220 return {
214 items: [], 221 items: [],
215 collapsedView: false, 222 collapsedView: false,
216 - sheet: { visible: false, title: '请选择产品', options: [], value: '', idx: -1 } 223 + sheet: { visible: false, title: '请选择产品', options: [], value: '', idx: -1, mode: 'product' }
217 } 224 }
218 }, 225 },
219 computed: { 226 computed: {
@@ -247,20 +254,20 @@ export default { @@ -247,20 +254,20 @@ export default {
247 handler(v) { 254 handler(v) {
248 // const arr = Array.isArray(v) ? v : [] 255 // const arr = Array.isArray(v) ? v : []
249 // this.items = arr.map(x => ({ ...this.defaultItem(), ...x, collapsed: true })) 256 // this.items = arr.map(x => ({ ...this.defaultItem(), ...x, collapsed: true }))
250 - this.items = v.map(x => ({ ...this.defaultItem(), ...x, collapsed: true })) 257 + this.items = v.map(x => ({ ...this.defaultItem(), ...x, sampleOrder: !!x.sampleOrder, collapsed: true }))
251 console.log('v', v) 258 console.log('v', v)
252 }, 259 },
253 deep: true 260 deep: true
254 } 261 }
255 }, 262 },
256 created() { 263 created() {
257 - const init = Array.isArray(this.list) && this.list.length > 0 ? this.list.map(v => ({ ...this.defaultItem(), ...v, collapsed: true })) : [{ ...this.defaultItem(), collapsed: false }] 264 + const init = Array.isArray(this.list) && this.list.length > 0 ? this.list.map(v => ({ ...this.defaultItem(), ...v, sampleOrder: !!v.sampleOrder, collapsed: true })) : [{ ...this.defaultItem(), collapsed: false }]
258 this.items = init 265 this.items = init
259 this.recalculateAll() 266 this.recalculateAll()
260 }, 267 },
261 methods: { 268 methods: {
262 defaultItem() { 269 defaultItem() {
263 - return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', status: '', quantity: '', unitPrice: '', totalAmount: 0, deliveryDate: '' } 270 + return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', status: '', quantity: '', unitPrice: '', totalAmount: 0, deliveryDate: '', sampleOrder: false }
264 }, 271 },
265 onNonNegativeInput(idx, field) { 272 onNonNegativeInput(idx, field) {
266 const it = this.items[idx] 273 const it = this.items[idx]
@@ -380,18 +387,38 @@ export default { @@ -380,18 +387,38 @@ export default {
380 const l = [item.length, item.lengthTolPos, item.lengthTolNeg].filter(Boolean).join('/') 387 const l = [item.length, item.lengthTolPos, item.lengthTolNeg].filter(Boolean).join('/')
381 return [t, w, l].filter(Boolean).join(' × ') 388 return [t, w, l].filter(Boolean).join(' × ')
382 }, 389 },
383 - openProductSheet(idx) {  
384 - const opts = this.selectOptions  
385 - const current = this.items[idx] && this.items[idx].productId  
386 - const match = opts.find(o => o.value === current)  
387 - this.sheet = { ...this.sheet, visible: true, title: '请选择产品', options: opts, idx, value: match ? match.value : '' } 390 + openProductSheet(idx, mode = 'product') {
  391 + let opts = []
  392 + let title = ''
  393 + let value = ''
  394 + const item = this.items[idx]
  395 +
  396 + if (mode === 'product') {
  397 + opts = this.selectOptions
  398 + const current = item && item.productId
  399 + const match = opts.find(o => o.value === current)
  400 + value = match ? match.value : ''
  401 + title = '请选择产品'
  402 + } else if (mode === 'sampleOrder') {
  403 + opts = [{ label: '是', value: true }, { label: '否', value: false }]
  404 + value = item.sampleOrder
  405 + title = '是否为试样订单'
  406 + }
  407 +
  408 + this.sheet = { ...this.sheet, visible: true, title, options: opts, idx, value, mode }
388 }, 409 },
389 onProductConfirm({ value, label }) { 410 onProductConfirm({ value, label }) {
390 - const idx = this.sheet.idx 411 + const { idx, mode } = this.sheet
391 const it = this.items[idx] 412 const it = this.items[idx]
392 if (!it) { this.sheet.visible = false; return } 413 if (!it) { this.sheet.visible = false; return }
393 - it.productId = value  
394 - it.productName = label || '' 414 +
  415 + if (mode === 'product') {
  416 + it.productId = value
  417 + it.productName = label || ''
  418 + } else if (mode === 'sampleOrder') {
  419 + it.sampleOrder = value
  420 + }
  421 +
395 this.$set(this.items, idx, it) 422 this.$set(this.items, idx, it)
396 this.sheet.visible = false 423 this.sheet.visible = false
397 this.emitChange() 424 this.emitChange()
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 <view v-if="mode === 'add'" class="add-list"> 16 <view v-if="mode === 'add'" class="add-list">
17 <view v-for="(item, idx) in items" :key="idx" class="block"> 17 <view v-for="(item, idx) in items" :key="idx" class="block">
18 <uni-list v-show="item.collapsed"> 18 <uni-list v-show="item.collapsed">
19 - <uni-list-item class="select-item" :class="item.rawProductName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx)" :rightText="item.rawProductName || '请选择原材料名称'" showArrow> 19 + <uni-list-item class="select-item" :class="item.rawProductName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.rawProductName || '请选择原材料名称'" showArrow>
20 <template v-slot:body> 20 <template v-slot:body>
21 <view class="item-title"><text>原材料名称</text></view> 21 <view class="item-title"><text>原材料名称</text></view>
22 </template> 22 </template>
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 </uni-list-item> 33 </uni-list-item>
34 </uni-list> 34 </uni-list>
35 <uni-list v-show="!item.collapsed"> 35 <uni-list v-show="!item.collapsed">
36 - <uni-list-item class="select-item" :class="item.rawProductName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx)" :rightText="item.rawProductName || '请选择原材料名称'" showArrow> 36 + <uni-list-item class="select-item" :class="item.rawProductName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.rawProductName || '请选择原材料名称'" showArrow>
37 <template v-slot:body> 37 <template v-slot:body>
38 <view class="item-title"><text>原材料名称</text></view> 38 <view class="item-title"><text>原材料名称</text></view>
39 </template> 39 </template>
@@ -159,6 +159,12 @@ @@ -159,6 +159,12 @@
159 <uni-datetime-picker :start="minDeliveryDate" type="date" v-model="item.deliveryDate" @change="onDateChange(idx, $event)" /> 159 <uni-datetime-picker :start="minDeliveryDate" type="date" v-model="item.deliveryDate" @change="onDateChange(idx, $event)" />
160 </template> 160 </template>
161 </uni-list-item> 161 </uni-list-item>
  162 + <uni-list-item class="select-item" :class="typeof item.sampleOrder === 'boolean' ? 'is-filled' : 'is-empty'" clickable
  163 + @click="openProductSheet(idx, 'sampleOrder')" :rightText="typeof item.sampleOrder === 'boolean' ? (item.sampleOrder ? '是' : '否') : '请选择'" showArrow>
  164 + <template v-slot:body>
  165 + <view class="item-title"><text>是否为试样订单</text></view>
  166 + </template>
  167 + </uni-list-item>
162 </uni-list> 168 </uni-list>
163 <view class="block-ops"> 169 <view class="block-ops">
164 <div class="del" @click="onRemove(idx)"> 170 <div class="del" @click="onRemove(idx)">
@@ -218,6 +224,7 @@ @@ -218,6 +224,7 @@
218 <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount) 224 <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount)
219 }}</text></view> 225 }}</text></view>
220 <view class="row"><text class="label">发货日期</text><text class="value">{{ item.deliveryDate }}</text></view> 226 <view class="row"><text class="label">发货日期</text><text class="value">{{ item.deliveryDate }}</text></view>
  227 + <view class="row"><text class="label">是否为试样订单</text><text class="value">{{ item.sampleOrder ? '是' : '否' }}</text></view>
221 </view> 228 </view>
222 </view> 229 </view>
223 <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" /> 230 <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" />
@@ -289,22 +296,22 @@ export default { @@ -289,22 +296,22 @@ export default {
289 }, 296 },
290 list: { 297 list: {
291 handler(v) { 298 handler(v) {
292 - this.items = v.map(x => ({ ...this.defaultItem(), ...x, collapsed: true })) 299 + this.items = v.map(x => ({ ...this.defaultItem(), ...x, sampleOrder: !!x.sampleOrder, collapsed: true }))
293 console.log('v', v) 300 console.log('v', v)
294 }, 301 },
295 deep: true 302 deep: true
296 } 303 }
297 }, 304 },
298 created() { 305 created() {
299 - const init = Array.isArray(this.list) && this.list.length > 0 ? this.list.map(v => ({ ...this.defaultItem(), ...v, collapsed: true })) : [{ ...this.defaultItem(), collapsed: false }] 306 + const init = Array.isArray(this.list) && this.list.length > 0 ? this.list.map(v => ({ ...this.defaultItem(), ...v, sampleOrder: !!v.sampleOrder, collapsed: true })) : [{ ...this.defaultItem(), collapsed: false }]
300 this.items = init 307 this.items = init
301 console.log('init', init) 308 console.log('init', init)
302 this.recalculateAll() 309 this.recalculateAll()
303 }, 310 },
304 methods: { 311 methods: {
305 - defaultItem() {  
306 - return { productId:'', productName:'', productGrade:'', productStatus:'', rawProductId: '', rawProductName: '', rawProductGrade: '', industry: '',materialProductRatioRemarks:'', supplyTime: '存料加工', materialProductRatio: '', materialProductRatioName: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', productQuantity: '', unitPrice: '', amountExcludingTax: 0, totalAmount: 0, deliveryDate: '' }  
307 - }, 312 + defaultItem() {
  313 + return { rawProductId: '', rawProductName: '', rawProductGradeId: '', rawProductGradeName: '', industry: '', quality: '', supplyTime: '', materialProductRatio: '', materialProductRatioName: '', materialProductRatioRemarks: '', productName: '', productId: '', productGrade: '', productStatus: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', productQuantity: '', unitPrice: '', amountExcludingTax: 0, totalAmount: 0, deliveryDate: '', sampleOrder: false }
  314 + },
308 onNumberInput(idx, field) { 315 onNumberInput(idx, field) {
309 const it = this.items[idx] 316 const it = this.items[idx]
310 if (!it) return 317 if (!it) return
@@ -414,11 +421,25 @@ export default { @@ -414,11 +421,25 @@ export default {
414 const l = [item.length, item.lengthTolPos, item.lengthTolNeg].filter(Boolean).join('/') 421 const l = [item.length, item.lengthTolPos, item.lengthTolNeg].filter(Boolean).join('/')
415 return [t, w, l].filter(Boolean).join(' × ') 422 return [t, w, l].filter(Boolean).join(' × ')
416 }, 423 },
417 - openProductSheet(idx) {  
418 - const opts = this.rawProductOptions  
419 - const current = this.items[idx] && this.items[idx].rawProductId  
420 - const match = opts.find(o => String(o.value) === String(current))  
421 - this.sheet = { ...this.sheet, visible: true, title: '请选择原材料名称', options: opts, idx, value: match ? match.value : '', mode: 'product' } 424 + openProductSheet(idx, mode = 'product') {
  425 + let opts = []
  426 + let title = ''
  427 + let value = ''
  428 + const item = this.items[idx]
  429 +
  430 + if (mode === 'product') {
  431 + opts = this.rawProductOptions
  432 + const current = item && item.rawProductId
  433 + const match = opts.find(o => String(o.value) === String(current))
  434 + value = match ? match.value : ''
  435 + title = '请选择原材料名称'
  436 + } else if (mode === 'sampleOrder') {
  437 + opts = [{ label: '是', value: true }, { label: '否', value: false }]
  438 + value = item.sampleOrder
  439 + title = '是否为试样订单'
  440 + }
  441 +
  442 + this.sheet = { ...this.sheet, visible: true, title, options: opts, idx, value, mode }
422 }, 443 },
423 openProductGradeSheet(idx) { 444 openProductGradeSheet(idx) {
424 const it = this.items[idx] 445 const it = this.items[idx]
@@ -466,6 +487,8 @@ export default { @@ -466,6 +487,8 @@ export default {
466 } else if (this.sheet.mode === 'target') { 487 } else if (this.sheet.mode === 'target') {
467 it.productId = value 488 it.productId = value
468 it.productName = label || '' 489 it.productName = label || ''
  490 + } else if (this.sheet.mode === 'sampleOrder') {
  491 + it.sampleOrder = value
469 } 492 }
470 this.$set(this.items, idx, it) 493 this.$set(this.items, idx, it)
471 this.sheet.visible = false 494 this.sheet.visible = false
@@ -478,7 +478,8 @@ export default { @@ -478,7 +478,8 @@ export default {
478 } 478 }
479 479
480 .label { 480 .label {
481 - width: 310rpx; 481 + max-width: 400rpx;
  482 + margin-right: 20rpx;
482 color: rgba(0, 0, 0, 0.6); 483 color: rgba(0, 0, 0, 0.6);
483 font-size: 28rpx; 484 font-size: 28rpx;
484 } 485 }
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 <view v-if="mode === 'add'" class="add-list"> 16 <view v-if="mode === 'add'" class="add-list">
17 <view v-for="(item, idx) in items" :key="idx" class="block"> 17 <view v-for="(item, idx) in items" :key="idx" class="block">
18 <uni-list v-show="item.collapsed"> 18 <uni-list v-show="item.collapsed">
19 - <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx)" :rightText="item.productName || '请选择产品名称'" showArrow> 19 + <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.productName || '请选择产品名称'" showArrow>
20 <template v-slot:body> 20 <template v-slot:body>
21 <view class="item-title"><text>产品名称</text></view> 21 <view class="item-title"><text>产品名称</text></view>
22 </template> 22 </template>
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 </uni-list-item> 33 </uni-list-item>
34 </uni-list> 34 </uni-list>
35 <uni-list v-show="!item.collapsed"> 35 <uni-list v-show="!item.collapsed">
36 - <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx)" :rightText="item.productName || '请选择产品名称'" showArrow> 36 + <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.productName || '请选择产品名称'" showArrow>
37 <template v-slot:body> 37 <template v-slot:body>
38 <view class="item-title"><text>产品名称</text></view> 38 <view class="item-title"><text>产品名称</text></view>
39 </template> 39 </template>
@@ -132,6 +132,12 @@ @@ -132,6 +132,12 @@
132 <uni-datetime-picker :start="minDeliveryDate" type="date" v-model="item.deliveryDate" @change="onDateChange(idx, $event)" /> 132 <uni-datetime-picker :start="minDeliveryDate" type="date" v-model="item.deliveryDate" @change="onDateChange(idx, $event)" />
133 </template> 133 </template>
134 </uni-list-item> 134 </uni-list-item>
  135 + <uni-list-item class="select-item" :class="typeof item.sampleOrder === 'boolean' ? 'is-filled' : 'is-empty'" clickable
  136 + @click="openProductSheet(idx, 'sampleOrder')" :rightText="typeof item.sampleOrder === 'boolean' ? (item.sampleOrder ? '是' : '否') : '请选择'" showArrow>
  137 + <template v-slot:body>
  138 + <view class="item-title"><text>是否为试样订单</text></view>
  139 + </template>
  140 + </uni-list-item>
135 </uni-list> 141 </uni-list>
136 <view class="block-ops"> 142 <view class="block-ops">
137 <div class="del" @click="onRemove(idx)"> 143 <div class="del" @click="onRemove(idx)">
@@ -190,6 +196,7 @@ @@ -190,6 +196,7 @@
190 <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount) 196 <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount)
191 }}</text></view> 197 }}</text></view>
192 <view class="row"><text class="label">发货日期</text><text class="value">{{ item.deliveryDate }}</text></view> 198 <view class="row"><text class="label">发货日期</text><text class="value">{{ item.deliveryDate }}</text></view>
  199 + <view class="row"><text class="label">是否为试样订单</text><text class="value">{{ item.sampleOrder ? '是' : '否' }}</text></view>
193 </view> 200 </view>
194 </view> 201 </view>
195 <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" /> 202 <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" />
@@ -212,7 +219,7 @@ export default { @@ -212,7 +219,7 @@ export default {
212 return { 219 return {
213 items: [], 220 items: [],
214 collapsedView: false, 221 collapsedView: false,
215 - sheet: { visible: false, title: '请选择产品', options: [], value: '', idx: -1 } 222 + sheet: { visible: false, title: '请选择产品', options: [], value: '', idx: -1, mode: 'product' }
216 } 223 }
217 }, 224 },
218 computed: { 225 computed: {
@@ -247,19 +254,19 @@ export default { @@ -247,19 +254,19 @@ export default {
247 if (!v || !v.length) return 254 if (!v || !v.length) return
248 // Only update if significantly different to avoid loop/reset 255 // Only update if significantly different to avoid loop/reset
249 // For now, assuming external update wants to reset 256 // For now, assuming external update wants to reset
250 - this.items = v.map(x => ({ ...this.defaultItem(), ...x, collapsed: true })) 257 + this.items = v.map(x => ({ ...this.defaultItem(), ...x, sampleOrder: !!x.sampleOrder, collapsed: true }))
251 }, 258 },
252 deep: true 259 deep: true
253 } 260 }
254 }, 261 },
255 created() { 262 created() {
256 - const init = Array.isArray(this.list) && this.list.length > 0 ? this.list.map(v => ({ ...this.defaultItem(), ...v, collapsed: true })) : [{ ...this.defaultItem(), collapsed: false }] 263 + const init = Array.isArray(this.list) && this.list.length > 0 ? this.list.map(v => ({ ...this.defaultItem(), ...v, sampleOrder: !!v.sampleOrder, collapsed: true })) : [{ ...this.defaultItem(), collapsed: false }]
257 this.items = init 264 this.items = init
258 this.recalculateAll() 265 this.recalculateAll()
259 }, 266 },
260 methods: { 267 methods: {
261 defaultItem() { 268 defaultItem() {
262 - return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', status: '', quantity: '', unitPrice: '', amountExcludingTax: 0, totalAmount: 0, deliveryDate: '' } 269 + return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', status: '', quantity: '', unitPrice: '', amountExcludingTax: 0, totalAmount: 0, deliveryDate: '', sampleOrder: false }
263 }, 270 },
264 onNumberInput(idx, field) { 271 onNumberInput(idx, field) {
265 const it = this.items[idx] 272 const it = this.items[idx]
@@ -367,18 +374,38 @@ export default { @@ -367,18 +374,38 @@ export default {
367 const l = [item.length, item.lengthTolPos, item.lengthTolNeg].filter(Boolean).join('/') 374 const l = [item.length, item.lengthTolPos, item.lengthTolNeg].filter(Boolean).join('/')
368 return [t, w, l].filter(Boolean).join(' × ') 375 return [t, w, l].filter(Boolean).join(' × ')
369 }, 376 },
370 - openProductSheet(idx) {  
371 - const opts = this.selectOptions  
372 - const current = this.items[idx] && this.items[idx].productId  
373 - const match = opts.find(o => o.value === current)  
374 - this.sheet = { ...this.sheet, visible: true, title: '请选择产品', options: opts, idx, value: match ? match.value : '' } 377 + openProductSheet(idx, mode = 'product') {
  378 + let opts = []
  379 + let title = ''
  380 + let value = ''
  381 + const item = this.items[idx]
  382 +
  383 + if (mode === 'product') {
  384 + opts = this.selectOptions
  385 + const current = item && item.productId
  386 + const match = opts.find(o => o.value === current)
  387 + value = match ? match.value : ''
  388 + title = '请选择产品'
  389 + } else if (mode === 'sampleOrder') {
  390 + opts = [{ label: '是', value: true }, { label: '否', value: false }]
  391 + value = item.sampleOrder
  392 + title = '是否为试样订单'
  393 + }
  394 +
  395 + this.sheet = { ...this.sheet, visible: true, title, options: opts, idx, value, mode }
375 }, 396 },
376 onProductConfirm({ value, label }) { 397 onProductConfirm({ value, label }) {
377 - const idx = this.sheet.idx 398 + const { idx, mode } = this.sheet
378 const it = this.items[idx] 399 const it = this.items[idx]
379 if (!it) { this.sheet.visible = false; return } 400 if (!it) { this.sheet.visible = false; return }
380 - it.productId = value  
381 - it.productName = label || '' 401 +
  402 + if (mode === 'product') {
  403 + it.productId = value
  404 + it.productName = label || ''
  405 + } else if (mode === 'sampleOrder') {
  406 + it.sampleOrder = value
  407 + }
  408 +
382 this.$set(this.items, idx, it) 409 this.$set(this.items, idx, it)
383 this.sheet.visible = false 410 this.sheet.visible = false
384 this.emitChange() 411 this.emitChange()
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 <view v-if="mode === 'add'" class="add-list"> 16 <view v-if="mode === 'add'" class="add-list">
17 <view v-for="(item, idx) in items" :key="idx" class="block"> 17 <view v-for="(item, idx) in items" :key="idx" class="block">
18 <uni-list v-show="item.collapsed"> 18 <uni-list v-show="item.collapsed">
19 - <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx)" :rightText="item.productName || '请选择产品名称'" showArrow> 19 + <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.productName || '请选择产品名称'" showArrow>
20 <template v-slot:body> 20 <template v-slot:body>
21 <view class="item-title"><text>产品名称</text></view> 21 <view class="item-title"><text>产品名称</text></view>
22 </template> 22 </template>
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 </uni-list-item> 33 </uni-list-item>
34 </uni-list> 34 </uni-list>
35 <uni-list v-show="!item.collapsed"> 35 <uni-list v-show="!item.collapsed">
36 - <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx)" :rightText="item.productName || '请选择产品名称'" showArrow> 36 + <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.productName || '请选择产品名称'" showArrow>
37 <template v-slot:body> 37 <template v-slot:body>
38 <view class="item-title"><text>产品名称</text></view> 38 <view class="item-title"><text>产品名称</text></view>
39 </template> 39 </template>
@@ -132,6 +132,12 @@ @@ -132,6 +132,12 @@
132 <uni-datetime-picker :start="minDeliveryDate" type="date" v-model="item.deliveryDate" @change="onDateChange(idx, $event)" /> 132 <uni-datetime-picker :start="minDeliveryDate" type="date" v-model="item.deliveryDate" @change="onDateChange(idx, $event)" />
133 </template> 133 </template>
134 </uni-list-item> 134 </uni-list-item>
  135 + <uni-list-item class="select-item" :class="typeof item.sampleOrder === 'boolean' ? 'is-filled' : 'is-empty'" clickable
  136 + @click="openProductSheet(idx, 'sampleOrder')" :rightText="typeof item.sampleOrder === 'boolean' ? (item.sampleOrder ? '是' : '否') : '请选择'" showArrow>
  137 + <template v-slot:body>
  138 + <view class="item-title"><text>是否为试样订单</text></view>
  139 + </template>
  140 + </uni-list-item>
135 </uni-list> 141 </uni-list>
136 <view class="block-ops"> 142 <view class="block-ops">
137 <div class="del" @click="onRemove(idx)"> 143 <div class="del" @click="onRemove(idx)">
@@ -190,6 +196,7 @@ @@ -190,6 +196,7 @@
190 <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount) 196 <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount)
191 }}</text></view> 197 }}</text></view>
192 <view class="row"><text class="label">发货日期</text><text class="value">{{ item.deliveryDate }}</text></view> 198 <view class="row"><text class="label">发货日期</text><text class="value">{{ item.deliveryDate }}</text></view>
  199 + <view class="row"><text class="label">是否为试样订单</text><text class="value">{{ item.sampleOrder ? '是' : '否' }}</text></view>
193 </view> 200 </view>
194 </view> 201 </view>
195 <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" /> 202 <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" />
@@ -212,7 +219,7 @@ export default { @@ -212,7 +219,7 @@ export default {
212 return { 219 return {
213 items: [], 220 items: [],
214 collapsedView: false, 221 collapsedView: false,
215 - sheet: { visible: false, title: '请选择产品', options: [], value: '', idx: -1 } 222 + sheet: { visible: false, title: '请选择产品', options: [], value: '', idx: -1, mode: 'product' }
216 } 223 }
217 }, 224 },
218 computed: { 225 computed: {
@@ -247,14 +254,14 @@ export default { @@ -247,14 +254,14 @@ export default {
247 handler(v) { 254 handler(v) {
248 // const arr = Array.isArray(v) ? v : [] 255 // const arr = Array.isArray(v) ? v : []
249 // this.items = arr.map(x => ({ ...this.defaultItem(), ...x, collapsed: true })) 256 // this.items = arr.map(x => ({ ...this.defaultItem(), ...x, collapsed: true }))
250 - this.items = v.map(x => ({ ...this.defaultItem(), ...x, collapsed: true })) 257 + this.items = v.map(x => ({ ...this.defaultItem(), ...x, sampleOrder: !!x.sampleOrder, collapsed: true }))
251 console.log('v', v) 258 console.log('v', v)
252 }, 259 },
253 deep: true 260 deep: true
254 } 261 }
255 }, 262 },
256 created() { 263 created() {
257 - const init = Array.isArray(this.list) && this.list.length > 0 ? this.list.map(v => ({ ...this.defaultItem(), ...v, collapsed: true })) : [{ ...this.defaultItem(), collapsed: false }] 264 + const init = Array.isArray(this.list) && this.list.length > 0 ? this.list.map(v => ({ ...this.defaultItem(), ...v, sampleOrder: !!v.sampleOrder, collapsed: true })) : [{ ...this.defaultItem(), collapsed: false }]
258 this.items = init 265 this.items = init
259 this.recalculateAll() 266 this.recalculateAll()
260 }, 267 },
@@ -364,7 +371,7 @@ export default { @@ -364,7 +371,7 @@ export default {
364 return true 371 return true
365 }, 372 },
366 defaultItem() { 373 defaultItem() {
367 - return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', status: '', quantity: '', unitPrice: '', amountExcludingTax: 0, totalAmount: 0, deliveryDate: '' } 374 + return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', status: '', quantity: '', unitPrice: '', amountExcludingTax: 0, totalAmount: 0, deliveryDate: '', sampleOrder: false }
368 }, 375 },
369 onNonNegativeInput(idx, field) { 376 onNonNegativeInput(idx, field) {
370 const it = this.items[idx] 377 const it = this.items[idx]
@@ -417,18 +424,38 @@ export default { @@ -417,18 +424,38 @@ export default {
417 const l = [item.length, item.lengthTolPos, item.lengthTolNeg].filter(Boolean).join('/') 424 const l = [item.length, item.lengthTolPos, item.lengthTolNeg].filter(Boolean).join('/')
418 return [t, w, l].filter(Boolean).join(' × ') 425 return [t, w, l].filter(Boolean).join(' × ')
419 }, 426 },
420 - openProductSheet(idx) {  
421 - const opts = this.selectOptions  
422 - const current = this.items[idx] && this.items[idx].productId  
423 - const match = opts.find(o => o.value === current)  
424 - this.sheet = { ...this.sheet, visible: true, title: '请选择产品', options: opts, idx, value: match ? match.value : '' } 427 + openProductSheet(idx, mode = 'product') {
  428 + let opts = []
  429 + let title = ''
  430 + let value = ''
  431 + const item = this.items[idx]
  432 +
  433 + if (mode === 'product') {
  434 + opts = this.selectOptions
  435 + const current = item && item.productId
  436 + const match = opts.find(o => o.value === current)
  437 + value = match ? match.value : ''
  438 + title = '请选择产品'
  439 + } else if (mode === 'sampleOrder') {
  440 + opts = [{ label: '是', value: true }, { label: '否', value: false }]
  441 + value = item.sampleOrder
  442 + title = '是否为试样订单'
  443 + }
  444 +
  445 + this.sheet = { ...this.sheet, visible: true, title, options: opts, idx, value, mode }
425 }, 446 },
426 onProductConfirm({ value, label }) { 447 onProductConfirm({ value, label }) {
427 - const idx = this.sheet.idx 448 + const { idx, mode } = this.sheet
428 const it = this.items[idx] 449 const it = this.items[idx]
429 if (!it) { this.sheet.visible = false; return } 450 if (!it) { this.sheet.visible = false; return }
430 - it.productId = value  
431 - it.productName = label || '' 451 +
  452 + if (mode === 'product') {
  453 + it.productId = value
  454 + it.productName = label || ''
  455 + } else if (mode === 'sampleOrder') {
  456 + it.sampleOrder = value
  457 + }
  458 +
432 this.$set(this.items, idx, it) 459 this.$set(this.items, idx, it)
433 this.sheet.visible = false 460 this.sheet.visible = false
434 this.emitChange() 461 this.emitChange()