pageFour.vue 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270
  1. <template>
  2. <view class="page-container">
  3. <!-- 入库信息卡片 -->
  4. <view class="card_wrap">
  5. <u--form labelPosition="top" :model="warehouseInfo" ref="form" class="address-section">
  6. <view class="address-header">
  7. <u-icon name="car-fill" size="36rpx" color="#108cff" class="location-icon"></u-icon>
  8. <text class="address-title">入库信息</text>
  9. </view>
  10. <!-- 编码和快递单号同一行 -->
  11. <u-row class="info-row" justify="space-between">
  12. <u-col span="4.5">
  13. <u-form-item label="编码" prop="codeStorage">
  14. <u--input v-model="warehouseInfo.codeStorage" placeholder="请输入编码" class="info-input" />
  15. </u-form-item>
  16. </u-col>
  17. <u-col span="4.5">
  18. <u-form-item label="快递单号" prop="expressOrderNo">
  19. <u--input v-model="warehouseInfo.expressOrderNo" placeholder="请输入快递单号" class="info-input" />
  20. </u-form-item>
  21. </u-col>
  22. <u-col span="2">
  23. <u-form-item label="物流图片" prop="uploadedImage">
  24. <view class="image-uploader" @click="selectImage">
  25. <u-icon v-if="!warehouseInfo.uploadedImage" name="camera-fill" size="48rpx"
  26. color="#909399" class="camera-icon"></u-icon>
  27. <image v-else :src="warehouseInfo.uploadedImage" mode="aspectFill"
  28. class="image-preview">
  29. </image>
  30. </view>
  31. </u-form-item>
  32. </u-col>
  33. </u-row>
  34. <!-- 单独一行的收单物品 -->
  35. <u-row class="info-row" justify="space-between">
  36. <u-col span="5.8">
  37. <u-form-item label="收单物品" prop="item">
  38. <u--input v-model="warehouseInfo.item" placeholder="请输入收单物品" class="info-input" />
  39. </u-form-item>
  40. </u-col>
  41. <!-- 收单类型 -->
  42. <u-col span="5.8">
  43. <u-form-item label="收单类型" prop="customerServiceNameLabel" @tap="selectCustomerServiceName">
  44. <view class="click-wrapper">
  45. <u--input v-model="warehouseInfo.customerServiceNameLabel" placeholder="点击选择收单类型"
  46. class="info-input" disabled />
  47. </view>
  48. </u-form-item>
  49. <!-- 收单类型选择 -->
  50. <u-picker :show="showCustomerServicePicker" :columns="customerServiceColumns" confirm
  51. keyName="label" @confirm="handleConfirmCustomerService"
  52. @cancel="showCustomerServicePicker = false"></u-picker>
  53. </u-col>
  54. </u-row>
  55. <u-row class="info-row" justify="space-between">
  56. <!-- 收单类别 -->
  57. <u-col span="5.8">
  58. <u-form-item label="类别" prop="category" @tap="selectCategory">
  59. <view class="click-wrapper">
  60. <u--input v-model="warehouseInfo.categoryLabel" placeholder="点击选择类别" class="info-input"
  61. disabled />
  62. </view>
  63. </u-form-item>
  64. <!-- 收单类型选择 -->
  65. <u-picker :show="showCategoryPicker" :columns="categoryColumns" confirm keyName="label"
  66. @confirm="handleConfirmCategory" @cancel="showCategoryPicker = false"></u-picker>
  67. </u-col>
  68. <!-- 是否需要查码 -->
  69. <u-col span="5.8">
  70. <u-form-item label="是否需要查码" prop="needCheckCode" @tap="selectNeedCheckCode">
  71. <view class="click-wrapper">
  72. <u--input v-model="warehouseInfo.needCheckCodeLabel" placeholder="点击选择是否需要查码"
  73. class="info-input" disabled />
  74. </view>
  75. </u-form-item>
  76. <!-- 是否需要查码选择 -->
  77. <u-picker :show="showNeedCheckCodePicker" :columns="needCheckCodeColumns" confirm
  78. keyName="label" @confirm="handleConfirmNeedCheckCode"
  79. @cancel="showNeedCheckCodePicker = false"></u-picker>
  80. </u-col>
  81. </u-row>
  82. <!-- 查码费和表款同一行 -->
  83. <u-row class="info-row" justify="space-between">
  84. <u-col span="5.8">
  85. <u-form-item label="表款">
  86. <u--input v-model="warehouseInfo.watchPrice" placeholder="请输入表款" class="info-input"
  87. type="number" />
  88. </u-form-item>
  89. </u-col>
  90. <u-col span="5.8">
  91. <u-form-item label="查码费">
  92. <u--input v-model="warehouseInfo.checkCodeFee" placeholder="请输入查码费" class="info-input"
  93. type="number" :disabled="warehouseInfo.needCheckCode == '2'" />
  94. </u-form-item>
  95. </u-col>
  96. </u-row>
  97. <u-row class="info-row" justify="space-between">
  98. <u-col span="5.8">
  99. <u-form-item label="好处费">
  100. <u--input v-model="warehouseInfo.benefitFee" placeholder="请输入好处费" class="info-input"
  101. type="number" />
  102. </u-form-item>
  103. </u-col>
  104. <u-col span="5.8">
  105. <u-form-item label="运费">
  106. <u--input v-model="warehouseInfo.freight" placeholder="请输入运费" class="info-input"
  107. type="number" />
  108. </u-form-item>
  109. </u-col>
  110. </u-row>
  111. <!-- 维修金额和毛业绩同一行 -->
  112. <u-row class="info-row" justify="space-between">
  113. <u-col span="5.8">
  114. <u-form-item label="维修金额">
  115. <u--input v-model="warehouseInfo.repairAmount" placeholder="请输入维修金额" class="info-input"
  116. type="number" />
  117. </u-form-item>
  118. </u-col>
  119. <u-col span="5.8">
  120. <u-form-item label="分单比例(0~100)">
  121. <u--input v-model="warehouseInfo.splitRatio" placeholder="请输入分单比例(0~100)" class="info-input"
  122. type="number" />
  123. </u-form-item>
  124. </u-col>
  125. </u-row>
  126. <!-- 业绩 -->
  127. <u-row class="info-row" justify="space-between">
  128. <u-col span="3.8">
  129. <u-form-item label="成本合计">
  130. <u--input :disabled="true" :value="computedTotalCost" placeholder="成本合计自动计算"
  131. class="info-input" type="number" />
  132. </u-form-item>
  133. </u-col>
  134. <u-col span="3.8">
  135. <u-form-item label="业绩">
  136. <u--input :disabled="true" :value="computedPerformance" placeholder="业绩自动计算"
  137. class="info-input" type="number" />
  138. </u-form-item>
  139. </u-col>
  140. <u-col span="3.8">
  141. <u-form-item label="毛业绩">
  142. <u--input :disabled="true" :value="computedGrossPerformance" placeholder="毛业绩自动计算"
  143. class="info-input" type="number" />
  144. </u-form-item>
  145. </u-col>
  146. </u-row>
  147. <!-- 收单备注 -->
  148. <u-row class="info-row">
  149. <u-col span="12">
  150. <u-form-item label="收单备注">
  151. <u--textarea v-model="warehouseInfo.remarks" placeholder="请输入收单备注" class="info-input"
  152. confirmType="done" rows="4" />
  153. </u-form-item>
  154. </u-col>
  155. </u-row>
  156. </u--form>
  157. </view>
  158. <!-- 新添加的卡片 -->
  159. <view class="card_wrap">
  160. <view class="address-section">
  161. <view class="address-header">
  162. <u-icon name="list" size="36rpx" color="#108cff" class="location-icon"></u-icon>
  163. <text class="address-title">分成信息</text>
  164. <u-button type="primary" plain shape="circle" size="mini" class="add-button" @click="addSplit">
  165. <u-icon name="plus" size="24rpx" color="#108cff"></u-icon>
  166. <text>添加</text>
  167. </u-button>
  168. </view>
  169. <!-- 分成信息表格 -->
  170. <view class="split-table">
  171. <u-row class="split-table-header">
  172. <u-col span="4">
  173. <text class="header-text">关联</text>
  174. </u-col>
  175. <u-col span="2">
  176. <text class="header-text">分成人</text>
  177. </u-col>
  178. <u-col span="2">
  179. <text class="header-text">比例</text>
  180. </u-col>
  181. <u-col span="1">
  182. <text class="header-text">类型</text>
  183. </u-col>
  184. <u-col span="1">
  185. <text class="header-text">公司</text>
  186. </u-col>
  187. <u-col span="2" class="action-column">
  188. <text class="header-text">操作</text>
  189. </u-col>
  190. </u-row>
  191. <u-row v-for="(item, index) in profitSharingList" :key="item.uuid" class="split-table-row">
  192. <u-col span="4">
  193. <view class="table-cell">
  194. <!-- <select v-model="item.deptId" class="custom-select">
  195. <option v-for="option in associationOptions" :key="option.id" :value="option.id">
  196. {{ option.label }}
  197. </option>
  198. </select> -->
  199. <u-button @click='handleSelectOrg(item)' :text="item.orgName" plain></u-button>
  200. </view>
  201. </u-col>
  202. <u-col span="2">
  203. <view class="table-cell">
  204. <!-- <select v-model="item.userId" class="custom-select">
  205. <option value="">无</option>
  206. <option v-for="person in item.personOptions" :key="person.id" :value="person.id">
  207. {{ person.label }}
  208. </option>
  209. </select> -->
  210. <u-button @click="handleSelectPerson(item)" :text="item.userName" plain></u-button>
  211. </view>
  212. </u-col>
  213. <u-col span="2">
  214. <view class="table-cell">
  215. <u--input v-model="item.commissionRate" type="number" class="percentage-input"
  216. @input="handlePercentageInput(item)" min="0" max="100" precision="0" />
  217. </view>
  218. </u-col>
  219. <u-col span="1">
  220. <view class="table-cell">
  221. <view :class="['account-type', item.accountType == '1' ? 'frontend' : 'backend']"
  222. @click="toggleAccountType(item)" style="cursor: pointer;">
  223. {{ item.accountType == '1' ? '前' : '后' }}
  224. </view>
  225. </view>
  226. </u-col>
  227. <u-col span="1">
  228. <view class="table-cell">
  229. <view class="radio-wrapper" @click="toggleBelongToCompany(item)">
  230. <view :class="['radio-circle', item.isCompanyPerformance == '1' ? 'active' : '']">
  231. <u-icon v-if="item.isCompanyPerformance == '1'" name="checkmark" size="20rpx"
  232. color="#fff"></u-icon>
  233. </view>
  234. </view>
  235. </view>
  236. </u-col>
  237. <u-col span="2" class="action-column">
  238. <view class="table-cell">
  239. <u-button type="error" plain shape="circle" size="mini"
  240. @click="deleteRow(item.id, item.uuid)" class='delectBtn'>
  241. <u-icon name="trash" size="20rpx" color="#ff6b6b"></u-icon>
  242. </u-button>
  243. </view>
  244. </u-col>
  245. </u-row>
  246. </view>
  247. </view>
  248. </view>
  249. <!-- 确认入库按钮 -->
  250. <div class="confirm-button-container">
  251. <u-button class='next-btn' type="success" @click="confirmWarehouseEntry" style="border-radius: 11px;">
  252. <u-icon name="checkmark-circle-fill" size="28rpx" color="#fff"></u-icon>
  253. <text style="margin-left: 8rpx;">确认入库</text>
  254. </u-button>
  255. </div>
  256. <!-- 组织选择 -->
  257. <u-picker :show="showOrgPicker" title="请选择组织" :columns="columnsOrgList" keyName="label"
  258. @confirm="handleOrgConfirmOrg" @cancel=' showOrgPicker = false'></u-picker>
  259. <!-- 人员选择 -->
  260. <u-picker :show="showPersonPicker" title="请选择分成人" :columns="columnsPersonList" keyName="label"
  261. @confirm="handleConfirmPerson" @cancel='handleCancelPerson'></u-picker>
  262. <u-toast ref="uToast"></u-toast>
  263. </view>
  264. </template>
  265. <script>
  266. export default {
  267. props: {
  268. orderDetail: {
  269. type: Object,
  270. default: () => { },
  271. },
  272. currentReceipt: {
  273. type: Object,
  274. default: () => { },
  275. },
  276. },
  277. watch: {
  278. currentReceipt: {
  279. handler(newVal) {
  280. if (newVal) {
  281. console.log('这里是page4', newVal)
  282. // "searchValue": null,
  283. // "createBy": "12234",
  284. // "createTime": "2025-12-25 13:39:25",
  285. // "updateBy": "12234",
  286. // "updateTime": "2025-12-27 09:33:05",
  287. // "remark": null,
  288. // "params": {},
  289. // "id": "4347",
  290. // "sendFormId": "5464",
  291. // "clueId": "1973381744953516033",
  292. // "item": "测试发单-VV", //收单物品
  293. // "brand": "LV",
  294. // "needCheckCode": 1,
  295. // "code": "111",
  296. // "paymentAmount": 99.00,
  297. // "phone": "18692257000",
  298. // "tableFee": 999999.00,
  299. // "benefitFee": 666.00, //好处费
  300. // "freight": 666666.00, //运费
  301. // "checkCodeFee": 666.00, //查码费
  302. // "totalCost": null,
  303. // "sellingPrice": 125000.00,
  304. // "performance": null,
  305. // "receiptRemark": null,
  306. // "repairAmount": 666.00, //维修金额
  307. // "grossPerformance": 666.00, //毛业绩
  308. // "expressOrderNo": "666", //快递单号
  309. // "fileIds": "",
  310. // "model": "lvvvv",
  311. // "splitRatio": null,
  312. // "customerServiceName": "1",
  313. // "deptId": "373",
  314. // "category": "2",
  315. // "delFlag": null,
  316. // "idCard": "444",
  317. // "paymentMethod": null,
  318. // "bankCardNumber": "333",
  319. // "bankName": "222",
  320. // "customName": "111"
  321. const data = newVal
  322. this.warehouseInfo = {
  323. codeStorage: data.code,//编码
  324. expressOrderNo: data.expressOrderNo || '',//快递单号
  325. uploadedImage: data.receiptRemark?.split(';')[1] || '',//物流图片 截取备注第二部分
  326. item: data.item || '',//收单物品
  327. checkCodeFee: data.checkCodeFee || '',//查码费
  328. watchPrice: data.tableFee || '',//表款
  329. benefitFee: data.benefitFee || '',//好处费
  330. freight: data.freight || '',//运费
  331. repairAmount: data.repairAmount || '',//维修金额
  332. grossPerformance: data.grossPerformance || '',//毛业绩
  333. performance: data.performance || '',//业绩
  334. remarks: data.receiptRemark?.split(';')[0] || '',//收单备注 截取备注第一部分
  335. splitRatio: data.splitRatio || '',//分单比例
  336. customerServiceName: data.customerServiceName || '',//收单类型,1收单类,2维修类,3销售类
  337. customerServiceNameLabel: this.customerServiceColumns[0].filter(item => item.value == data.customerServiceName)[0].label || '',//收单类型,1收单类,2维修类,3销售类
  338. category: data.category || '',//类别
  339. categoryLabel: this.categoryColumns[0].filter(item => item.value == data.category)[0].label || '',//类别
  340. needCheckCode: data.needCheckCode || '',//是否需要查码
  341. needCheckCodeLabel: this.needCheckCodeColumns[0].filter(item => item.value == data.needCheckCode)[0].label || '',//是否需要查码
  342. }
  343. this.getShareList()
  344. }
  345. },
  346. }
  347. },
  348. computed: {
  349. computedTotalCost() {
  350. //成本 合计 = 运费 + 好处费+ 查码费 + 表款(支付总额)+ 维修费。
  351. const freight = this.warehouseInfo.freight || 0
  352. const benefitFee = this.warehouseInfo.benefitFee || 0
  353. const checkCodeFee = this.warehouseInfo.checkCodeFee || 0
  354. const watchPrice = this.warehouseInfo.watchPrice || 0
  355. const repairAmount = this.warehouseInfo.repairAmount || 0
  356. return Number(freight) + Number(benefitFee) + Number(checkCodeFee) + Number(watchPrice) + Number(repairAmount)
  357. },
  358. computedPerformance() {
  359. //业绩 //sellingPrice - (totalCost// 成本合计 = 运费1 + 好处费1 + 查码费1 + 表款(支付总额)1+ 维修费1。)
  360. const sellingPrice = this.currentReceipt.sellingPrice || 0
  361. const totalCost = Number(this.warehouseInfo.watchPrice) + Number(this.warehouseInfo.freight) + Number(this.warehouseInfo.benefitFee) + Number(this.warehouseInfo.checkCodeFee) + Number(this.warehouseInfo.repairAmount)
  362. return sellingPrice - totalCost
  363. },
  364. computedGrossPerformance() {
  365. // 毛业绩 //毛利 performance*splitRatio,分单比例
  366. const performance = Number(this.computedPerformance) || 0
  367. //保留小数点后两位
  368. const p = performance * (Number(this.warehouseInfo.splitRatio) / 100 || 0)
  369. return p.toFixed(2)
  370. },
  371. },
  372. data() {
  373. return {
  374. // 入库信息相关的数据
  375. warehouseInfo: {
  376. codeStorage: '',//编码
  377. expressOrderNo: '',//快递单号
  378. uploadedImage: '',//物流图片
  379. item: '',//收单物品
  380. checkCodeFee: '',//查码费
  381. watchPrice: '',//表款
  382. benefitFee: '',//好处费
  383. freight: '',//运费
  384. repairAmount: '',//维修金额
  385. grossPerformance: '',//毛业绩
  386. performance: '',//业绩
  387. splitRatio: '',//分单比例
  388. remarks: '',//收单备注
  389. customerServiceNameLabel: '',//收单类型,1收单类,2维修类,3销售类
  390. customerServiceName: '',//收单类型,1收单类,2维修类,3销售类
  391. },
  392. // 分成信息相关的数据
  393. profitSharingList: [
  394. ],
  395. // 关联选项列表
  396. // associationOptions: [],
  397. // 分成人选项列表
  398. // personOptions: [],
  399. // 表单验证规则
  400. showOrgPicker: false,
  401. showPersonPicker: false,
  402. columnsOrgList: [],
  403. //传入的分成人名单
  404. columnsPersonList: [],
  405. showCustomerServicePicker: false,//显示选择收单类型的弹窗
  406. customerServiceColumns: [[
  407. { label: '收单类', value: '1' },
  408. { label: '维修类', value: '2' },
  409. { label: '销售类', value: '3' }
  410. ]],
  411. showCategoryPicker: false,//显示选择类别弹窗
  412. categoryColumns: [[
  413. { label: '腕表', value: '1' },
  414. { label: '包包', value: '2' },
  415. { label: '首饰', value: '4' },
  416. { label: '其他', value: '3' }
  417. ]],
  418. showNeedCheckCodePicker: false,//显示选择是否需要查码弹窗
  419. needCheckCodeColumns: [[
  420. { label: '是', value: '1' },
  421. { label: '否', value: '2' }
  422. ]],
  423. currentEditItem: '',
  424. };
  425. },
  426. mounted() {
  427. // 获取分成人名单
  428. this.$nextTick(() => {
  429. this.getCommissionUserList();
  430. })
  431. },
  432. methods: {
  433. // 选择物流图片
  434. selectImage() {
  435. uni.chooseImage({
  436. count: 1,
  437. sizeType: ['compressed'],
  438. sourceType: ['album', 'camera'],
  439. success: async (res) => {
  440. const tempFilePath = res.tempFilePaths[0];
  441. //把选择的图片上传给服务器,然后获取返回路径
  442. const rep = await uni.$u.api.uploadFile(tempFilePath)
  443. if (rep.code == 200) {
  444. console.log('上传成功=====>', rep.data.url)
  445. this.warehouseInfo.uploadedImage = rep.data.url
  446. }
  447. }
  448. });
  449. },
  450. // 添加分成行
  451. addSplit() {
  452. // 添加新行
  453. this.profitSharingList.push({
  454. deptId: '',
  455. accountType: '1',
  456. userId: '',
  457. commissionRate: 0,
  458. isCompanyPerformance: '2',
  459. orgName: '',
  460. userName: '',
  461. id: '',
  462. uuid: Math.random()//唯一标识,仅vfor使用
  463. });
  464. //重新计算全部行的分成比例
  465. this.calculateTotalPercentage();
  466. },
  467. // 重新计算全部行的分成比例
  468. calculateTotalPercentage() {
  469. //获取选择前端的行的数量
  470. const frontItems = this.profitSharingList.filter(item => item.accountType == '1');
  471. const backItems = this.profitSharingList.filter(item => item.accountType == '2');
  472. const totalFrontItems = frontItems.length;
  473. const totalBackItems = backItems.length;
  474. console.log('选择前端的行的数量====>', totalFrontItems)
  475. console.log('选择后端的行的数量====>', totalBackItems)
  476. //把profitSharingList中的前端行的分成比例按照 100/数量 重新计算
  477. this.profitSharingList.map(item => {
  478. if (item.accountType == '1') {
  479. item.commissionRate = (100 / totalFrontItems).toFixed()
  480. }
  481. if (item.accountType == '2') {
  482. item.commissionRate = (100 / totalBackItems).toFixed()
  483. }
  484. })
  485. },
  486. // 切换账户类型
  487. toggleAccountType(item) {
  488. item.accountType = item.accountType == '1' ? '2' : '1';
  489. // 重新计算分成比例
  490. this.calculateTotalPercentage();
  491. },
  492. // 处理百分比输入
  493. handlePercentageInput(item) {
  494. // 确保输入是数字
  495. let value = Number(item.percentage);
  496. // 验证输入值是否在有效范围内(0-100)
  497. if (isNaN(value)) {
  498. item.percentage = 0;
  499. } else if (value < 0) {
  500. item.percentage = 0;
  501. } else if (value > 100) {
  502. item.percentage = 100;
  503. } else {
  504. // 确保是整数
  505. item.percentage = Math.floor(value);
  506. }
  507. },
  508. // 切换归属公司状态
  509. toggleBelongToCompany(item) {
  510. item.isCompanyPerformance = item.isCompanyPerformance == '1' ? '2' : '1';
  511. },
  512. // 确认入库方法
  513. async confirmWarehouseEntry() {
  514. console.log('确认入库', this.orderDetail.id)
  515. uni.showModal({
  516. title: '确认入库',
  517. content: `是否确认入库改订单:${this.orderDetail.item}?`,
  518. success: async (res) => {
  519. if (res.confirm) {
  520. //修改状态
  521. await uni.$u.api.oderForm({
  522. status: "3",
  523. id: this.orderDetail.id,
  524. });
  525. await uni.$u.api.updateReceiptForm({
  526. id: this.currentReceipt.id,
  527. code: this.warehouseInfo.codeStorage || '',//编码
  528. expressOrderNo: this.warehouseInfo.expressOrderNo || '',//快递单号
  529. item: this.warehouseInfo.item || '',//收单物品
  530. checkCodeFee: this.warehouseInfo.checkCodeFee || '',//查码费
  531. tableFee: this.warehouseInfo.watchPrice || '',//表款
  532. benefitFee: this.warehouseInfo.benefitFee || '',//好处费
  533. freight: this.warehouseInfo.freight || '',//运费
  534. repairAmount: this.warehouseInfo.repairAmount || '',//维修金额
  535. grossPerformance: this.computedGrossPerformance || '',//毛业绩
  536. performance: this.computedPerformance || '',//毛业绩
  537. splitRatio: this.warehouseInfo.splitRatio || '',//分单比例
  538. receiptRemark: this.warehouseInfo.remarks + ';' + this.warehouseInfo.uploadedImage || '',//收单备注
  539. customerServiceName: this.warehouseInfo.customerServiceName || '',//收单类型,1收单类,2维修类,3销售类
  540. category: this.warehouseInfo.category || '',//类别
  541. needCheckCode: this.warehouseInfo.needCheckCode || '',//是否需要查码
  542. totalCost: this.computedTotalCost || '',//成本合计
  543. });
  544. //废弃
  545. //上传物流表单数据
  546. // this.$emit('confirmInterStore', {
  547. // warehouseInfo: this.warehouseInfo,
  548. // })
  549. //保存入库信息
  550. //废弃
  551. //上传分成数据
  552. await this.addShare()
  553. this.$refs.uToast.show({
  554. type: "success",
  555. message: "入库成功",
  556. iconUrl: "https://uviewui.com/demo/toast/success.png",
  557. complete() {
  558. // uni.navigateTo({
  559. // url: '/pages/pagereceivecenter/pagereceivecenter',
  560. // })
  561. //退回上一页
  562. uni.navigateBack({
  563. delta: 1,
  564. animationType: 'pop-out'
  565. })
  566. },
  567. });
  568. } else if (res.cancel) {
  569. // 用户点击了取消,不执行任何操作
  570. uni.$u.toast('已取消入库');
  571. }
  572. }
  573. })
  574. },
  575. // 获取分成人名单
  576. async getCommissionUserList() {
  577. const commissionUserList = await uni.$u.api.getCustomerManagerAllList()
  578. console.log('分成人名单', commissionUserList.data[0].children)
  579. // this.associationOptions = commissionUserList.data[0].children
  580. this.columnsOrgList = [commissionUserList.data[0].children]
  581. },
  582. //初始化分成比例
  583. async getShareList() {
  584. console.log('当前收单信息', this.currentReceipt.id)
  585. const { rows, total } = await uni.$u.api.selectCommissionList({
  586. pageSize: 9999,
  587. pageNum: 1,
  588. }, { sendFormId: this.currentReceipt.sendFormId, });
  589. console.log('分成比例表格数据', rows)
  590. const newRows = rows.filter(item => item.receiptFormId == this.currentReceipt.id)
  591. newRows.map(item => {
  592. item.uuid = Math.random()//唯一标识
  593. })
  594. this.profitSharingList = newRows
  595. },
  596. //上传分成
  597. addShare() {
  598. this.profitSharingList.forEach(async item => {
  599. const data = {
  600. id: item.id || '',
  601. accountType: item.accountType == '1' ? 1 : 2,
  602. clueId: this.currentReceipt.clueId,
  603. commissionRate: item.commissionRate,
  604. isCompanyPerformance: item.isCompanyPerformance == '1' ? 1 : 2,
  605. sendFormId: this.currentReceipt.sendFormId,
  606. userId: item.userId,
  607. userName: item.userName,
  608. receiptFormId: this.currentReceipt.id,//关联的收单id
  609. }
  610. if (item.id) {
  611. //更新
  612. await uni.$u.api.clueCommissionUpdate(data);
  613. } else {
  614. //新增
  615. await uni.$u.api.clueCommissionAdd(data);
  616. }
  617. });
  618. },
  619. //删除分成
  620. async deleteRow(id, uuid) {
  621. console.log(id, 'id', uuid, 'uuid')
  622. // 确认删除
  623. uni.showModal({
  624. title: '确认删除',
  625. content: '是否确认删除当前行分成比例?',
  626. success: async (res) => {
  627. if (res.confirm) {
  628. //如果没有id说明是新增的,直接删除数组中的项
  629. if (!id) {
  630. this.profitSharingList = this.profitSharingList.filter(item => item.uuid != uuid)
  631. uni.$u.toast('删除成功')
  632. this.calculateTotalPercentage();
  633. return
  634. }
  635. try {
  636. await uni.$u.api.deleteClueCommissionForm(id)
  637. uni.$u.toast('删除成功')
  638. this.getShareList()
  639. } catch (error) {
  640. uni.$u.toast('删除失败,请稍后重试')
  641. }
  642. //重新计算全部行的分成比例
  643. this.calculateTotalPercentage();
  644. } else {
  645. uni.$u.toast('已取消删除')
  646. }
  647. }
  648. })
  649. },
  650. //打开选择框
  651. handleSelectOrg(item) {
  652. console.log(item.uuid, '当前选择的行的uuid')
  653. this.currentEditItem = item.uuid
  654. console.log(this.currentEditItem, '当前选择的行')
  655. // this.showOrgPicker = true
  656. this.showPersonPicker = true
  657. //把当前的组织赋值给当前的组件
  658. this.columnsPersonList = this.columnsOrgList//获取到的分成人名单
  659. },
  660. //选择当前的分成人
  661. handleSelectPerson(item) {
  662. console.log(item, '当前选择的行')
  663. this.currentEditItem = item.uuid
  664. //获取当前选择组织的分成人名单
  665. // 获取当前行的关联id
  666. const deptId = item.deptId
  667. //递归查找当前选择的组织
  668. const org = this.findOrg(this.columnsOrgList[0], deptId)
  669. // const org = this.columnsOrgList[0].find(org => org.id == deptId)
  670. console.log(org, '当前选择的组织')
  671. if (org) {
  672. this.columnsPersonList = [org.children]
  673. }
  674. // 把当前选择组织的分成人名单赋值给当前行的分成人选项列表
  675. this.showPersonPicker = true
  676. },
  677. //递归查找当前选择的组织
  678. findOrg(orgList, deptId) {
  679. for (const org of orgList) {
  680. if (org.id == deptId) {
  681. return org
  682. }
  683. if (org.children && org.children.length > 0) {
  684. const found = this.findOrg(org.children, deptId)
  685. if (found) {
  686. return found
  687. }
  688. }
  689. }
  690. return null
  691. },
  692. //确认选择组织
  693. handleOrgConfirmOrg({ columnIndex, value, values },) {
  694. console.log(value, '选择的组织')
  695. //把值赋值给当前行
  696. this.profitSharingList.forEach(item => {
  697. if (item.uuid == this.currentEditItem) {
  698. item.orgName = value[0].label
  699. item.deptId = value[0].id
  700. // item.personOptions = value[0].children
  701. //将当前的行的分成人清空
  702. item.userId = ''
  703. item.userName = ''
  704. }
  705. })
  706. this.showOrgPicker = false
  707. },
  708. //确认选择人
  709. handleConfirmPerson({ columnIndex, value, values },) {
  710. console.log(value[0], '选择的人')
  711. console.log(value[0].isUser, '是否是用户')
  712. //把值赋值给当前行
  713. if (value[0].isUser) {
  714. //当前选择是用户
  715. this.profitSharingList.forEach(item => {
  716. if (item.uuid == this.currentEditItem) {
  717. item.userName = value[0].label
  718. item.userId = value[0].id
  719. }
  720. })
  721. this.columnsPersonList = []
  722. this.showPersonPicker = false
  723. } else {
  724. //当前选择是组织
  725. // 把组织的label赋值给当前的行的关联
  726. this.profitSharingList.forEach(item => {
  727. if (item.uuid == this.currentEditItem) {
  728. item.orgName = value[0].label
  729. item.deptId = value[0].id
  730. }
  731. })
  732. const childrens = value[0].children
  733. console.log('当前分公司的内部分成人', childrens)
  734. this.columnsPersonList = [childrens]
  735. }
  736. },
  737. // 取消选择人
  738. handleCancelPerson() {
  739. this.columnsPersonList = []
  740. this.showPersonPicker = false
  741. },
  742. //点击选择收单类型
  743. selectCustomerServiceName() {
  744. console.log('点击了选择收单类型')
  745. //打开选择收单类型的弹窗
  746. this.showCustomerServicePicker = true
  747. },
  748. handleConfirmCustomerService({ value }) {
  749. //选择了收单类型
  750. console.log(value[0].label, '选择的收单类型')
  751. console.log(value[0].value, '选择的收单类型')
  752. //把值赋值给当前行
  753. this.warehouseInfo.customerServiceNameLabel = value[0].label
  754. this.warehouseInfo.customerServiceName = value[0].value
  755. //关闭弹窗
  756. this.showCustomerServicePicker = false
  757. },
  758. //点击选择类别
  759. selectCategory() {
  760. console.log('点击了选择类别')
  761. //打开选择类别弹窗
  762. this.showCategoryPicker = true
  763. },
  764. handleConfirmCategory({ value }) {
  765. //选择了类别
  766. console.log(value[0].label, '选择的类别')
  767. console.log(value[0].value, '选择的类别')
  768. //把值赋值给当前行
  769. this.warehouseInfo.categoryLabel = value[0].label
  770. this.warehouseInfo.category = value[0].value
  771. //关闭弹窗
  772. this.showCategoryPicker = false
  773. },
  774. //点击选择是否需要查码
  775. selectNeedCheckCode() {
  776. console.log('点击了选择是否需要查码')
  777. //打开选择是否需要查码弹窗
  778. this.showNeedCheckCodePicker = true
  779. },
  780. handleConfirmNeedCheckCode({ value }) {
  781. //选择了是否需要查码
  782. console.log(value[0].label, '选择的是否需要查码')
  783. console.log(value[0].value, '选择的是否需要查码')
  784. //把值赋值给当前行
  785. this.warehouseInfo.needCheckCodeLabel = value[0].label
  786. this.warehouseInfo.needCheckCode = value[0].value
  787. //关闭弹窗
  788. this.showNeedCheckCodePicker = false
  789. },
  790. }
  791. };
  792. </script>
  793. <style lang="scss" scoped>
  794. // 导入公共样式
  795. @import './common.scss';
  796. // 主样式
  797. .page-container {
  798. box-sizing: border-box;
  799. padding: 0;
  800. background-color: map-get($colors, bg);
  801. font-family: map-get($font, family);
  802. -webkit-font-smoothing: map-get($font, smoothing);
  803. font-smoothing: map-get($font, smoothing);
  804. }
  805. .address-section {
  806. padding: map-get($sizes, padding-sm) map-get($sizes, padding);
  807. .u-col {
  808. padding: 0;
  809. box-sizing: border-box;
  810. }
  811. .u-col:first-child {
  812. padding-right: 15rpx;
  813. }
  814. .u-col:last-child {
  815. padding-left: 15rpx;
  816. }
  817. }
  818. // 表单行样式
  819. .info-row {
  820. margin-bottom: 20rpx;
  821. box-sizing: border-box;
  822. padding: 0;
  823. }
  824. // 表单标签样式
  825. .info-label {
  826. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  827. margin-bottom: 8rpx;
  828. display: block;
  829. }
  830. // 输入框样式
  831. .info-input {
  832. height: 65rpx;
  833. border-radius: 8rpx;
  834. border: 1rpx solid #e5e7eb;
  835. padding: 20rpx 16rpx;
  836. width: 100%;
  837. box-sizing: border-box;
  838. @include font-styles($size: small, $weight: regular, $color: secondary);
  839. // textarea特殊样式
  840. &[type="textarea"] {
  841. min-height: 160rpx;
  842. resize: vertical;
  843. padding-top: 20rpx;
  844. padding-bottom: 20rpx;
  845. }
  846. }
  847. // 防止表单label换行
  848. ::v-deep .u-form-item__body__left__content__label {
  849. white-space: nowrap;
  850. }
  851. ::v-deep .u-form-item__body {
  852. padding: 0;
  853. }
  854. // 图片上传样式
  855. .image-uploader {
  856. width: 100%;
  857. height: 65rpx;
  858. border: 2rpx dashed #409eff;
  859. border-radius: 8rpx;
  860. display: flex;
  861. align-items: center;
  862. justify-content: center;
  863. cursor: pointer;
  864. background-color: #ecf5ff;
  865. box-sizing: border-box;
  866. overflow: hidden;
  867. transition: all 0.3s ease;
  868. &:hover {
  869. border-color: #66b1ff;
  870. background-color: #f0f9ff;
  871. transform: scale(1.02);
  872. }
  873. }
  874. .camera-icon {
  875. margin: 0;
  876. font-size: 32rpx;
  877. color: #409eff;
  878. transition: all 0.3s ease;
  879. }
  880. .image-uploader:hover .camera-icon {
  881. color: #66b1ff;
  882. transform: scale(1.1);
  883. }
  884. .image-preview {
  885. width: 100%;
  886. height: 100%;
  887. object-fit: cover;
  888. border-radius: 10rpx;
  889. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  890. transition: all 0.3s ease;
  891. }
  892. .image-uploader:hover .image-preview {
  893. transform: scale(1.02);
  894. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.15);
  895. }
  896. .hidden-input {
  897. display: none;
  898. }
  899. // 分成信息卡片样式
  900. .address-header {
  901. display: flex;
  902. align-items: center;
  903. justify-content: space-between;
  904. margin-bottom: 20rpx;
  905. .address-title {
  906. @include font-styles($size: small, $weight: medium, $color: primary);
  907. margin-left: 10rpx;
  908. }
  909. }
  910. .split-content {
  911. padding: 10rpx 0;
  912. }
  913. .split-item {
  914. display: flex;
  915. justify-content: space-between;
  916. align-items: center;
  917. padding: 15rpx 0;
  918. border-bottom: 1rpx solid map-get($colors, border);
  919. &:last-child {
  920. border-bottom: none;
  921. }
  922. }
  923. .split-label {
  924. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  925. }
  926. .split-value {
  927. @include font-styles($size: small, $weight: regular, $color: secondary);
  928. }
  929. .add-button {
  930. padding: 0;
  931. width: 50rpx;
  932. height: 50rpx;
  933. display: flex;
  934. align-items: center;
  935. justify-content: center;
  936. }
  937. /* 分成信息表格样式 */
  938. .split-table {
  939. width: 100%;
  940. margin-top: 20rpx;
  941. background-color: #fff;
  942. border-radius: 8rpx;
  943. overflow: hidden;
  944. }
  945. .split-table-header {
  946. background-color: #f5f7fa;
  947. padding: 15rpx 0;
  948. border-bottom: 1rpx solid #e4e7ed;
  949. }
  950. .split-table-row {
  951. padding: 15rpx 0;
  952. border-bottom: 1rpx solid #e4e7ed;
  953. align-items: center;
  954. &:last-child {
  955. border-bottom: none;
  956. }
  957. }
  958. .header-text {
  959. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  960. text-align: center;
  961. display: block;
  962. }
  963. .table-cell {
  964. display: flex;
  965. align-items: center;
  966. justify-content: center;
  967. padding: 0 10rpx;
  968. box-sizing: border-box;
  969. }
  970. .action-column {
  971. display: flex;
  972. align-items: center;
  973. justify-content: center;
  974. }
  975. /* 自定义下拉框样式 - 隐藏原生箭头 */
  976. .custom-select {
  977. width: 100%;
  978. height: 50rpx;
  979. border-radius: 0;
  980. border: 1rpx solid #e5e7eb;
  981. text-align: center;
  982. /* 增加右侧内边距,为自定义箭头留出空间 */
  983. @include font-styles($size: tiny, $weight: regular, $color: secondary);
  984. background-color: #fff;
  985. /* 确保隐藏所有浏览器的原生箭头 */
  986. appearance: none !important;
  987. -webkit-appearance: none !important;
  988. -moz-appearance: none !important;
  989. -o-appearance: none !important;
  990. cursor: pointer;
  991. /* 使用自定义SVG箭头 */
  992. background-repeat: no-repeat;
  993. background-position: right 8rpx center;
  994. background-size: 12rpx 12rpx;
  995. box-sizing: border-box;
  996. position: relative;
  997. /* 防止箭头在焦点状态下显示 */
  998. &:focus {
  999. outline: none;
  1000. border-color: #409eff;
  1001. box-shadow: 0 0 0 2rpx rgba(64, 158, 255, 0.2);
  1002. }
  1003. /* 针对IE/Edge浏览器的特殊处理 */
  1004. &::-ms-expand {
  1005. display: none !important;
  1006. }
  1007. /* 针对某些旧版浏览器的额外处理 */
  1008. &::-webkit-select-arrow {
  1009. display: none !important;
  1010. }
  1011. /* 添加伪元素覆盖可能残留的箭头 */
  1012. &::after {
  1013. content: '';
  1014. position: absolute;
  1015. right: 8rpx;
  1016. top: 50%;
  1017. transform: translateY(-50%);
  1018. width: 12rpx;
  1019. height: 12rpx;
  1020. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23909399' d='M6 8l-4-4h8z'/%3E%3C/svg%3E");
  1021. background-repeat: no-repeat;
  1022. background-size: 100% 100%;
  1023. pointer-events: none;
  1024. z-index: 1;
  1025. }
  1026. }
  1027. /* 百分比输入框样式 */
  1028. .percentage-input {
  1029. text-align: center;
  1030. background-color: #f9f9f9;
  1031. color: #606266;
  1032. text-align: center;
  1033. padding: 0rpx !important;
  1034. }
  1035. /* 账户类型标签样式 */
  1036. .account-type {
  1037. padding: 4rpx 16rpx;
  1038. border-radius: 12rpx;
  1039. font-size: 24rpx;
  1040. font-weight: 500;
  1041. color: #fff;
  1042. text-align: center;
  1043. }
  1044. .account-type.frontend {
  1045. background-color: #409eff;
  1046. }
  1047. .account-type.backend {
  1048. background-color: #909399;
  1049. }
  1050. /* 调整表格布局,使其更紧凑 */
  1051. .split-table {
  1052. width: 100%;
  1053. margin-top: 10rpx;
  1054. }
  1055. .split-table-header,
  1056. .split-table-row {
  1057. padding: 10rpx 0;
  1058. }
  1059. .table-cell {
  1060. padding: 0 5rpx;
  1061. }
  1062. /* 归属公司单选框样式 */
  1063. .radio-wrapper {
  1064. cursor: pointer;
  1065. display: flex;
  1066. align-items: center;
  1067. justify-content: center;
  1068. }
  1069. .radio-circle {
  1070. width: 32rpx;
  1071. height: 32rpx;
  1072. border-radius: 50%;
  1073. border: 2rpx solid #dcdfe6;
  1074. display: flex;
  1075. align-items: center;
  1076. justify-content: center;
  1077. transition: all 0.3s ease;
  1078. }
  1079. .radio-circle.active {
  1080. border-color: #67c23a;
  1081. background-color: #67c23a;
  1082. }
  1083. /* 确认入库按钮样式 */
  1084. .confirm-button-container {
  1085. display: flex;
  1086. justify-content: center;
  1087. align-items: center;
  1088. padding: 40rpx 0;
  1089. margin-top: 20rpx;
  1090. }
  1091. /* 响应式布局调整 */
  1092. @media screen and (max-width: 750rpx) {
  1093. .split-table {
  1094. overflow-x: auto;
  1095. }
  1096. .custom-select {
  1097. width: 100%;
  1098. }
  1099. .account-type {
  1100. padding: 2rpx 10rpx;
  1101. font-size: 22rpx;
  1102. }
  1103. }
  1104. @media screen and (min-width: 751rpx) {
  1105. .table-cell {
  1106. padding: 0 10rpx;
  1107. }
  1108. }
  1109. .u-button {
  1110. height: 60rpx;
  1111. }
  1112. .delectBtn {
  1113. height: 40rpx;
  1114. .u-button {
  1115. width: 40rpx;
  1116. }
  1117. }
  1118. .delectBtn ::v-deep .u-button--mini {
  1119. min-width: 20rpx !important;
  1120. }
  1121. .next-btn {
  1122. position: fixed;
  1123. bottom: 10rpx;
  1124. left: 2.5%;
  1125. width: 95%;
  1126. height: 80rpx;
  1127. line-height: 80rpx;
  1128. text-align: center;
  1129. @include font-styles($size: medium, $weight: bold, $color: #fff);
  1130. border-radius: 0rpx 0rpx 20rpx 20rpx;
  1131. }
  1132. </style>