pageFour.vue 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268
  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. // this.showOrgPicker = true
  655. this.showPersonPicker = true
  656. //把当前的组织赋值给当前的组件
  657. this.columnsPersonList = this.columnsOrgList//获取到的分成人名单
  658. },
  659. //选择当前的分成人
  660. handleSelectPerson(item) {
  661. console.log(item, '当前选择的行')
  662. this.currentEditItem = item.uuid
  663. //获取当前选择组织的分成人名单
  664. // 获取当前行的关联id
  665. const deptId = item.deptId
  666. //递归查找当前选择的组织
  667. const org = this.findOrg(this.columnsOrgList[0], deptId)
  668. // const org = this.columnsOrgList[0].find(org => org.id == deptId)
  669. console.log(org, '当前选择的组织')
  670. if (org) {
  671. this.columnsPersonList = [org.children]
  672. }
  673. // 把当前选择组织的分成人名单赋值给当前行的分成人选项列表
  674. this.showPersonPicker = true
  675. },
  676. //递归查找当前选择的组织
  677. findOrg(orgList, deptId) {
  678. for (const org of orgList) {
  679. if (org.id == deptId) {
  680. return org
  681. }
  682. if (org.children && org.children.length > 0) {
  683. const found = this.findOrg(org.children, deptId)
  684. if (found) {
  685. return found
  686. }
  687. }
  688. }
  689. return null
  690. },
  691. //确认选择组织
  692. handleOrgConfirmOrg({ columnIndex, value, values },) {
  693. console.log(value, '选择的组织')
  694. //把值赋值给当前行
  695. this.profitSharingList.forEach(item => {
  696. if (item.uuid == this.currentEditItem) {
  697. item.orgName = value[0].label
  698. item.deptId = value[0].id
  699. // item.personOptions = value[0].children
  700. //将当前的行的分成人清空
  701. item.userId = ''
  702. item.userName = ''
  703. }
  704. })
  705. this.showOrgPicker = false
  706. },
  707. //确认选择人
  708. handleConfirmPerson({ columnIndex, value, values },) {
  709. console.log(value[0], '选择的人')
  710. console.log(value[0].isUser, '是否是用户')
  711. //把值赋值给当前行
  712. if (value[0].isUser) {
  713. //当前选择是用户
  714. this.profitSharingList.forEach(item => {
  715. if (item.uuid == this.currentEditItem) {
  716. item.userName = value[0].label
  717. item.userId = value[0].id
  718. }
  719. })
  720. this.columnsPersonList = []
  721. this.showPersonPicker = false
  722. } else {
  723. //当前选择是组织
  724. // 把组织的label赋值给当前的行的关联
  725. this.profitSharingList.forEach(item => {
  726. if (item.uuid == this.currentEditItem) {
  727. item.orgName = value[0].label
  728. item.deptId = value[0].id
  729. }
  730. })
  731. const childrens = value[0].children
  732. console.log('当前分公司的内部分成人', childrens)
  733. this.columnsPersonList = [childrens]
  734. }
  735. },
  736. // 取消选择人
  737. handleCancelPerson() {
  738. this.columnsPersonList = []
  739. this.showPersonPicker = false
  740. },
  741. //点击选择收单类型
  742. selectCustomerServiceName() {
  743. console.log('点击了选择收单类型')
  744. //打开选择收单类型的弹窗
  745. this.showCustomerServicePicker = true
  746. },
  747. handleConfirmCustomerService({ value }) {
  748. //选择了收单类型
  749. console.log(value[0].label, '选择的收单类型')
  750. console.log(value[0].value, '选择的收单类型')
  751. //把值赋值给当前行
  752. this.warehouseInfo.customerServiceNameLabel = value[0].label
  753. this.warehouseInfo.customerServiceName = value[0].value
  754. //关闭弹窗
  755. this.showCustomerServicePicker = false
  756. },
  757. //点击选择类别
  758. selectCategory() {
  759. console.log('点击了选择类别')
  760. //打开选择类别弹窗
  761. this.showCategoryPicker = true
  762. },
  763. handleConfirmCategory({ value }) {
  764. //选择了类别
  765. console.log(value[0].label, '选择的类别')
  766. console.log(value[0].value, '选择的类别')
  767. //把值赋值给当前行
  768. this.warehouseInfo.categoryLabel = value[0].label
  769. this.warehouseInfo.category = value[0].value
  770. //关闭弹窗
  771. this.showCategoryPicker = false
  772. },
  773. //点击选择是否需要查码
  774. selectNeedCheckCode() {
  775. console.log('点击了选择是否需要查码')
  776. //打开选择是否需要查码弹窗
  777. this.showNeedCheckCodePicker = true
  778. },
  779. handleConfirmNeedCheckCode({ value }) {
  780. //选择了是否需要查码
  781. console.log(value[0].label, '选择的是否需要查码')
  782. console.log(value[0].value, '选择的是否需要查码')
  783. //把值赋值给当前行
  784. this.warehouseInfo.needCheckCodeLabel = value[0].label
  785. this.warehouseInfo.needCheckCode = value[0].value
  786. //关闭弹窗
  787. this.showNeedCheckCodePicker = false
  788. },
  789. }
  790. };
  791. </script>
  792. <style lang="scss" scoped>
  793. // 导入公共样式
  794. @import './common.scss';
  795. // 主样式
  796. .page-container {
  797. box-sizing: border-box;
  798. padding: 0;
  799. background-color: map-get($colors, bg);
  800. font-family: map-get($font, family);
  801. -webkit-font-smoothing: map-get($font, smoothing);
  802. font-smoothing: map-get($font, smoothing);
  803. }
  804. .address-section {
  805. padding: map-get($sizes, padding-sm) map-get($sizes, padding);
  806. .u-col {
  807. padding: 0;
  808. box-sizing: border-box;
  809. }
  810. .u-col:first-child {
  811. padding-right: 15rpx;
  812. }
  813. .u-col:last-child {
  814. padding-left: 15rpx;
  815. }
  816. }
  817. // 表单行样式
  818. .info-row {
  819. margin-bottom: 20rpx;
  820. box-sizing: border-box;
  821. padding: 0;
  822. }
  823. // 表单标签样式
  824. .info-label {
  825. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  826. margin-bottom: 8rpx;
  827. display: block;
  828. }
  829. // 输入框样式
  830. .info-input {
  831. height: 65rpx;
  832. border-radius: 8rpx;
  833. border: 1rpx solid #e5e7eb;
  834. padding: 20rpx 16rpx;
  835. width: 100%;
  836. box-sizing: border-box;
  837. @include font-styles($size: small, $weight: regular, $color: secondary);
  838. // textarea特殊样式
  839. &[type="textarea"] {
  840. min-height: 160rpx;
  841. resize: vertical;
  842. padding-top: 20rpx;
  843. padding-bottom: 20rpx;
  844. }
  845. }
  846. // 防止表单label换行
  847. ::v-deep .u-form-item__body__left__content__label {
  848. white-space: nowrap;
  849. }
  850. ::v-deep .u-form-item__body {
  851. padding: 0;
  852. }
  853. // 图片上传样式
  854. .image-uploader {
  855. width: 100%;
  856. height: 65rpx;
  857. border: 2rpx dashed #409eff;
  858. border-radius: 8rpx;
  859. display: flex;
  860. align-items: center;
  861. justify-content: center;
  862. cursor: pointer;
  863. background-color: #ecf5ff;
  864. box-sizing: border-box;
  865. overflow: hidden;
  866. transition: all 0.3s ease;
  867. &:hover {
  868. border-color: #66b1ff;
  869. background-color: #f0f9ff;
  870. transform: scale(1.02);
  871. }
  872. }
  873. .camera-icon {
  874. margin: 0;
  875. font-size: 32rpx;
  876. color: #409eff;
  877. transition: all 0.3s ease;
  878. }
  879. .image-uploader:hover .camera-icon {
  880. color: #66b1ff;
  881. transform: scale(1.1);
  882. }
  883. .image-preview {
  884. width: 100%;
  885. height: 100%;
  886. object-fit: cover;
  887. border-radius: 10rpx;
  888. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  889. transition: all 0.3s ease;
  890. }
  891. .image-uploader:hover .image-preview {
  892. transform: scale(1.02);
  893. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.15);
  894. }
  895. .hidden-input {
  896. display: none;
  897. }
  898. // 分成信息卡片样式
  899. .address-header {
  900. display: flex;
  901. align-items: center;
  902. justify-content: space-between;
  903. margin-bottom: 20rpx;
  904. .address-title {
  905. @include font-styles($size: small, $weight: medium, $color: primary);
  906. margin-left: 10rpx;
  907. }
  908. }
  909. .split-content {
  910. padding: 10rpx 0;
  911. }
  912. .split-item {
  913. display: flex;
  914. justify-content: space-between;
  915. align-items: center;
  916. padding: 15rpx 0;
  917. border-bottom: 1rpx solid map-get($colors, border);
  918. &:last-child {
  919. border-bottom: none;
  920. }
  921. }
  922. .split-label {
  923. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  924. }
  925. .split-value {
  926. @include font-styles($size: small, $weight: regular, $color: secondary);
  927. }
  928. .add-button {
  929. padding: 0;
  930. width: 50rpx;
  931. height: 50rpx;
  932. display: flex;
  933. align-items: center;
  934. justify-content: center;
  935. }
  936. /* 分成信息表格样式 */
  937. .split-table {
  938. width: 100%;
  939. margin-top: 20rpx;
  940. background-color: #fff;
  941. border-radius: 8rpx;
  942. overflow: hidden;
  943. }
  944. .split-table-header {
  945. background-color: #f5f7fa;
  946. padding: 15rpx 0;
  947. border-bottom: 1rpx solid #e4e7ed;
  948. }
  949. .split-table-row {
  950. padding: 15rpx 0;
  951. border-bottom: 1rpx solid #e4e7ed;
  952. align-items: center;
  953. &:last-child {
  954. border-bottom: none;
  955. }
  956. }
  957. .header-text {
  958. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  959. text-align: center;
  960. display: block;
  961. }
  962. .table-cell {
  963. display: flex;
  964. align-items: center;
  965. justify-content: center;
  966. padding: 0 10rpx;
  967. box-sizing: border-box;
  968. }
  969. .action-column {
  970. display: flex;
  971. align-items: center;
  972. justify-content: center;
  973. }
  974. /* 自定义下拉框样式 - 隐藏原生箭头 */
  975. .custom-select {
  976. width: 100%;
  977. height: 50rpx;
  978. border-radius: 0;
  979. border: 1rpx solid #e5e7eb;
  980. text-align: center;
  981. /* 增加右侧内边距,为自定义箭头留出空间 */
  982. @include font-styles($size: tiny, $weight: regular, $color: secondary);
  983. background-color: #fff;
  984. /* 确保隐藏所有浏览器的原生箭头 */
  985. appearance: none !important;
  986. -webkit-appearance: none !important;
  987. -moz-appearance: none !important;
  988. -o-appearance: none !important;
  989. cursor: pointer;
  990. /* 使用自定义SVG箭头 */
  991. background-repeat: no-repeat;
  992. background-position: right 8rpx center;
  993. background-size: 12rpx 12rpx;
  994. box-sizing: border-box;
  995. position: relative;
  996. /* 防止箭头在焦点状态下显示 */
  997. &:focus {
  998. outline: none;
  999. border-color: #409eff;
  1000. box-shadow: 0 0 0 2rpx rgba(64, 158, 255, 0.2);
  1001. }
  1002. /* 针对IE/Edge浏览器的特殊处理 */
  1003. &::-ms-expand {
  1004. display: none !important;
  1005. }
  1006. /* 针对某些旧版浏览器的额外处理 */
  1007. &::-webkit-select-arrow {
  1008. display: none !important;
  1009. }
  1010. /* 添加伪元素覆盖可能残留的箭头 */
  1011. &::after {
  1012. content: '';
  1013. position: absolute;
  1014. right: 8rpx;
  1015. top: 50%;
  1016. transform: translateY(-50%);
  1017. width: 12rpx;
  1018. height: 12rpx;
  1019. 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");
  1020. background-repeat: no-repeat;
  1021. background-size: 100% 100%;
  1022. pointer-events: none;
  1023. z-index: 1;
  1024. }
  1025. }
  1026. /* 百分比输入框样式 */
  1027. .percentage-input {
  1028. text-align: center;
  1029. background-color: #f9f9f9;
  1030. color: #606266;
  1031. text-align: center;
  1032. padding: 0rpx !important;
  1033. }
  1034. /* 账户类型标签样式 */
  1035. .account-type {
  1036. padding: 4rpx 16rpx;
  1037. border-radius: 12rpx;
  1038. font-size: 24rpx;
  1039. font-weight: 500;
  1040. color: #fff;
  1041. text-align: center;
  1042. }
  1043. .account-type.frontend {
  1044. background-color: #409eff;
  1045. }
  1046. .account-type.backend {
  1047. background-color: #909399;
  1048. }
  1049. /* 调整表格布局,使其更紧凑 */
  1050. .split-table {
  1051. width: 100%;
  1052. margin-top: 10rpx;
  1053. }
  1054. .split-table-header,
  1055. .split-table-row {
  1056. padding: 10rpx 0;
  1057. }
  1058. .table-cell {
  1059. padding: 0 5rpx;
  1060. }
  1061. /* 归属公司单选框样式 */
  1062. .radio-wrapper {
  1063. cursor: pointer;
  1064. display: flex;
  1065. align-items: center;
  1066. justify-content: center;
  1067. }
  1068. .radio-circle {
  1069. width: 32rpx;
  1070. height: 32rpx;
  1071. border-radius: 50%;
  1072. border: 2rpx solid #dcdfe6;
  1073. display: flex;
  1074. align-items: center;
  1075. justify-content: center;
  1076. transition: all 0.3s ease;
  1077. }
  1078. .radio-circle.active {
  1079. border-color: #67c23a;
  1080. background-color: #67c23a;
  1081. }
  1082. /* 确认入库按钮样式 */
  1083. .confirm-button-container {
  1084. display: flex;
  1085. justify-content: center;
  1086. align-items: center;
  1087. padding: 40rpx 0;
  1088. margin-top: 20rpx;
  1089. }
  1090. /* 响应式布局调整 */
  1091. @media screen and (max-width: 750rpx) {
  1092. .split-table {
  1093. overflow-x: auto;
  1094. }
  1095. .custom-select {
  1096. width: 100%;
  1097. }
  1098. .account-type {
  1099. padding: 2rpx 10rpx;
  1100. font-size: 22rpx;
  1101. }
  1102. }
  1103. @media screen and (min-width: 751rpx) {
  1104. .table-cell {
  1105. padding: 0 10rpx;
  1106. }
  1107. }
  1108. .u-button {
  1109. height: 60rpx;
  1110. }
  1111. .delectBtn {
  1112. height: 40rpx;
  1113. .u-button {
  1114. width: 40rpx;
  1115. }
  1116. }
  1117. .delectBtn ::v-deep .u-button--mini {
  1118. min-width: 20rpx !important;
  1119. }
  1120. .next-btn {
  1121. position: fixed;
  1122. bottom: 10rpx;
  1123. left: 2.5%;
  1124. width: 95%;
  1125. height: 80rpx;
  1126. line-height: 80rpx;
  1127. text-align: center;
  1128. @include font-styles($size: medium, $weight: bold, $color: #fff);
  1129. border-radius: 0rpx 0rpx 20rpx 20rpx;
  1130. }
  1131. </style>