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. };
  424. },
  425. mounted() {
  426. // 获取分成人名单
  427. this.$nextTick(() => {
  428. this.getCommissionUserList();
  429. })
  430. },
  431. methods: {
  432. // 选择物流图片
  433. selectImage() {
  434. uni.chooseImage({
  435. count: 1,
  436. sizeType: ['compressed'],
  437. sourceType: ['album', 'camera'],
  438. success: async (res) => {
  439. const tempFilePath = res.tempFilePaths[0];
  440. //把选择的图片上传给服务器,然后获取返回路径
  441. const rep = await uni.$u.api.uploadFile(tempFilePath)
  442. if (rep.code == 200) {
  443. console.log('上传成功=====>', rep.data.url)
  444. this.warehouseInfo.uploadedImage = rep.data.url
  445. }
  446. }
  447. });
  448. },
  449. // 添加分成行
  450. addSplit() {
  451. // 添加新行
  452. this.profitSharingList.push({
  453. deptId: '',
  454. accountType: '1',
  455. userId: '',
  456. commissionRate: 0,
  457. isCompanyPerformance: '2',
  458. orgName: '',
  459. userName: '',
  460. id: '',
  461. uuid: Math.random()//唯一标识,仅vfor使用
  462. });
  463. //重新计算全部行的分成比例
  464. this.calculateTotalPercentage();
  465. },
  466. // 重新计算全部行的分成比例
  467. calculateTotalPercentage() {
  468. //获取选择前端的行的数量
  469. const frontItems = this.profitSharingList.filter(item => item.accountType == '1');
  470. const backItems = this.profitSharingList.filter(item => item.accountType == '2');
  471. const totalFrontItems = frontItems.length;
  472. const totalBackItems = backItems.length;
  473. console.log('选择前端的行的数量====>', totalFrontItems)
  474. console.log('选择后端的行的数量====>', totalBackItems)
  475. //把profitSharingList中的前端行的分成比例按照 100/数量 重新计算
  476. this.profitSharingList.map(item => {
  477. if (item.accountType == '1') {
  478. item.commissionRate = (100 / totalFrontItems).toFixed()
  479. }
  480. if (item.accountType == '2') {
  481. item.commissionRate = (100 / totalBackItems).toFixed()
  482. }
  483. })
  484. },
  485. // 切换账户类型
  486. toggleAccountType(item) {
  487. item.accountType = item.accountType == '1' ? '2' : '1';
  488. // 重新计算分成比例
  489. this.calculateTotalPercentage();
  490. },
  491. // 处理百分比输入
  492. handlePercentageInput(item) {
  493. // 确保输入是数字
  494. let value = Number(item.percentage);
  495. // 验证输入值是否在有效范围内(0-100)
  496. if (isNaN(value)) {
  497. item.percentage = 0;
  498. } else if (value < 0) {
  499. item.percentage = 0;
  500. } else if (value > 100) {
  501. item.percentage = 100;
  502. } else {
  503. // 确保是整数
  504. item.percentage = Math.floor(value);
  505. }
  506. },
  507. // 切换归属公司状态
  508. toggleBelongToCompany(item) {
  509. item.isCompanyPerformance = item.isCompanyPerformance == '1' ? '2' : '1';
  510. },
  511. // 确认入库方法
  512. async confirmWarehouseEntry() {
  513. console.log('确认入库', this.orderDetail.id)
  514. uni.showModal({
  515. title: '确认入库',
  516. content: `是否确认入库改订单:${this.orderDetail.item}?`,
  517. success: async (res) => {
  518. if (res.confirm) {
  519. //修改状态
  520. await uni.$u.api.oderForm({
  521. status: "3",
  522. id: this.orderDetail.id,
  523. });
  524. await uni.$u.api.updateReceiptForm({
  525. id: this.currentReceipt.id,
  526. code: this.warehouseInfo.codeStorage || '',//编码
  527. expressOrderNo: this.warehouseInfo.expressOrderNo || '',//快递单号
  528. item: this.warehouseInfo.item || '',//收单物品
  529. checkCodeFee: this.warehouseInfo.checkCodeFee || '',//查码费
  530. tableFee: this.warehouseInfo.watchPrice || '',//表款
  531. benefitFee: this.warehouseInfo.benefitFee || '',//好处费
  532. freight: this.warehouseInfo.freight || '',//运费
  533. repairAmount: this.warehouseInfo.repairAmount || '',//维修金额
  534. grossPerformance: this.computedGrossPerformance || '',//毛业绩
  535. performance: this.computedPerformance || '',//毛业绩
  536. splitRatio: this.warehouseInfo.splitRatio || '',//分单比例
  537. receiptRemark: this.warehouseInfo.remarks + ';' + this.warehouseInfo.uploadedImage || '',//收单备注
  538. customerServiceName: this.warehouseInfo.customerServiceName || '',//收单类型,1收单类,2维修类,3销售类
  539. category: this.warehouseInfo.category || '',//类别
  540. needCheckCode: this.warehouseInfo.needCheckCode || '',//是否需要查码
  541. totalCost: this.computedTotalCost || '',//成本合计
  542. });
  543. //废弃
  544. //上传物流表单数据
  545. // this.$emit('confirmInterStore', {
  546. // warehouseInfo: this.warehouseInfo,
  547. // })
  548. //保存入库信息
  549. //废弃
  550. //上传分成数据
  551. await this.addShare()
  552. this.$refs.uToast.show({
  553. type: "success",
  554. message: "入库成功",
  555. iconUrl: "https://uviewui.com/demo/toast/success.png",
  556. complete() {
  557. // uni.navigateTo({
  558. // url: '/pages/pagereceivecenter/pagereceivecenter',
  559. // })
  560. //退回上一页
  561. uni.navigateBack({
  562. delta: 1,
  563. animationType: 'pop-out'
  564. })
  565. },
  566. });
  567. } else if (res.cancel) {
  568. // 用户点击了取消,不执行任何操作
  569. uni.$u.toast('已取消入库');
  570. }
  571. }
  572. })
  573. },
  574. // 获取分成人名单
  575. async getCommissionUserList() {
  576. const commissionUserList = await uni.$u.api.getCustomerManagerAllList()
  577. console.log('分成人名单', commissionUserList.data[0].children)
  578. // this.associationOptions = commissionUserList.data[0].children
  579. this.columnsOrgList = [commissionUserList.data[0].children]
  580. },
  581. //初始化分成比例
  582. async getShareList() {
  583. console.log('当前收单信息', this.currentReceipt.id)
  584. const { rows, total } = await uni.$u.api.selectCommissionList({
  585. pageSize: 9999,
  586. pageNum: 1,
  587. }, { sendFormId: this.currentReceipt.sendFormId, });
  588. console.log('分成比例表格数据', rows)
  589. const newRows = rows.filter(item => item.receiptFormId == this.currentReceipt.id)
  590. newRows.map(item => {
  591. item.uuid = Math.random()//唯一标识
  592. })
  593. this.profitSharingList = newRows
  594. },
  595. //上传分成
  596. addShare() {
  597. this.profitSharingList.forEach(async item => {
  598. const data = {
  599. id: item.id || '',
  600. accountType: item.accountType == '1' ? 1 : 2,
  601. clueId: this.currentReceipt.clueId,
  602. commissionRate: item.commissionRate,
  603. isCompanyPerformance: item.isCompanyPerformance == '1' ? 1 : 2,
  604. sendFormId: this.currentReceipt.sendFormId,
  605. userId: item.userId,
  606. userName: item.userName,
  607. receiptFormId: this.currentReceipt.id,//关联的收单id
  608. }
  609. if (item.id) {
  610. //更新
  611. await uni.$u.api.clueCommissionUpdate(data);
  612. } else {
  613. //新增
  614. await uni.$u.api.clueCommissionAdd(data);
  615. }
  616. });
  617. },
  618. //删除分成
  619. async deleteRow(id, uuid) {
  620. console.log(id, 'id', uuid, 'uuid')
  621. // 确认删除
  622. uni.showModal({
  623. title: '确认删除',
  624. content: '是否确认删除当前行分成比例?',
  625. success: async (res) => {
  626. if (res.confirm) {
  627. //如果没有id说明是新增的,直接删除数组中的项
  628. if (!id) {
  629. this.profitSharingList = this.profitSharingList.filter(item => item.uuid != uuid)
  630. uni.$u.toast('删除成功')
  631. this.calculateTotalPercentage();
  632. return
  633. }
  634. try {
  635. await uni.$u.api.deleteClueCommissionForm(id)
  636. uni.$u.toast('删除成功')
  637. this.getShareList()
  638. } catch (error) {
  639. uni.$u.toast('删除失败,请稍后重试')
  640. }
  641. //重新计算全部行的分成比例
  642. this.calculateTotalPercentage();
  643. } else {
  644. uni.$u.toast('已取消删除')
  645. }
  646. }
  647. })
  648. },
  649. //打开选择框
  650. handleSelectOrg(item) {
  651. console.log(item.uuid, '当前选择的行的uuid')
  652. this.currentEditItem = item.uuid
  653. // this.showOrgPicker = true
  654. this.showPersonPicker = true
  655. //把当前的组织赋值给当前的组件
  656. this.columnsPersonList = this.columnsOrgList//获取到的分成人名单
  657. },
  658. //选择当前的分成人
  659. handleSelectPerson(item) {
  660. console.log(item, '当前选择的行')
  661. this.currentEditItem = item.uuid
  662. //获取当前选择组织的分成人名单
  663. // 获取当前行的关联id
  664. const deptId = item.deptId
  665. //递归查找当前选择的组织
  666. const org = this.findOrg(this.columnsOrgList[0], deptId)
  667. // const org = this.columnsOrgList[0].find(org => org.id == deptId)
  668. console.log(org, '当前选择的组织')
  669. if (org) {
  670. this.columnsPersonList = [org.children]
  671. }
  672. // 把当前选择组织的分成人名单赋值给当前行的分成人选项列表
  673. this.showPersonPicker = true
  674. },
  675. //递归查找当前选择的组织
  676. findOrg(orgList, deptId) {
  677. for (const org of orgList) {
  678. if (org.id == deptId) {
  679. return org
  680. }
  681. if (org.children && org.children.length > 0) {
  682. const found = this.findOrg(org.children, deptId)
  683. if (found) {
  684. return found
  685. }
  686. }
  687. }
  688. return null
  689. },
  690. //确认选择组织
  691. handleOrgConfirmOrg({ columnIndex, value, values },) {
  692. console.log(value, '选择的组织')
  693. //把值赋值给当前行
  694. this.profitSharingList.forEach(item => {
  695. if (item.uuid == this.currentEditItem) {
  696. item.orgName = value[0].label
  697. item.deptId = value[0].id
  698. // item.personOptions = value[0].children
  699. //将当前的行的分成人清空
  700. item.userId = ''
  701. item.userName = ''
  702. }
  703. })
  704. this.showOrgPicker = false
  705. },
  706. //确认选择人
  707. handleConfirmPerson({ columnIndex, value, values },) {
  708. console.log(value[0], '选择的人')
  709. console.log(value[0].isUser, '是否是用户')
  710. //把值赋值给当前行
  711. if (value[0].isUser) {
  712. //当前选择是用户
  713. this.profitSharingList.forEach(item => {
  714. if (item.uuid == this.currentEditItem) {
  715. item.userName = value[0].label
  716. item.userId = value[0].id
  717. }
  718. })
  719. this.columnsPersonList = []
  720. this.showPersonPicker = false
  721. } else {
  722. //当前选择是组织
  723. // 把组织的label赋值给当前的行的关联
  724. this.profitSharingList.forEach(item => {
  725. if (item.uuid == this.currentEditItem) {
  726. item.orgName = value[0].label
  727. item.deptId = value[0].id
  728. }
  729. })
  730. const childrens = value[0].children
  731. console.log('当前分公司的内部分成人', childrens)
  732. this.columnsPersonList = [childrens]
  733. }
  734. },
  735. // 取消选择人
  736. handleCancelPerson() {
  737. this.columnsPersonList = []
  738. this.showPersonPicker = false
  739. },
  740. //点击选择收单类型
  741. selectCustomerServiceName() {
  742. console.log('点击了选择收单类型')
  743. //打开选择收单类型的弹窗
  744. this.showCustomerServicePicker = true
  745. },
  746. handleConfirmCustomerService({ value }) {
  747. //选择了收单类型
  748. console.log(value[0].label, '选择的收单类型')
  749. console.log(value[0].value, '选择的收单类型')
  750. //把值赋值给当前行
  751. this.warehouseInfo.customerServiceNameLabel = value[0].label
  752. this.warehouseInfo.customerServiceName = value[0].value
  753. //关闭弹窗
  754. this.showCustomerServicePicker = false
  755. },
  756. //点击选择类别
  757. selectCategory() {
  758. console.log('点击了选择类别')
  759. //打开选择类别弹窗
  760. this.showCategoryPicker = true
  761. },
  762. handleConfirmCategory({ value }) {
  763. //选择了类别
  764. console.log(value[0].label, '选择的类别')
  765. console.log(value[0].value, '选择的类别')
  766. //把值赋值给当前行
  767. this.warehouseInfo.categoryLabel = value[0].label
  768. this.warehouseInfo.category = value[0].value
  769. //关闭弹窗
  770. this.showCategoryPicker = false
  771. },
  772. //点击选择是否需要查码
  773. selectNeedCheckCode() {
  774. console.log('点击了选择是否需要查码')
  775. //打开选择是否需要查码弹窗
  776. this.showNeedCheckCodePicker = true
  777. },
  778. handleConfirmNeedCheckCode({ value }) {
  779. //选择了是否需要查码
  780. console.log(value[0].label, '选择的是否需要查码')
  781. console.log(value[0].value, '选择的是否需要查码')
  782. //把值赋值给当前行
  783. this.warehouseInfo.needCheckCodeLabel = value[0].label
  784. this.warehouseInfo.needCheckCode = value[0].value
  785. //关闭弹窗
  786. this.showNeedCheckCodePicker = false
  787. },
  788. }
  789. };
  790. </script>
  791. <style lang="scss" scoped>
  792. // 导入公共样式
  793. @import './common.scss';
  794. // 主样式
  795. .page-container {
  796. box-sizing: border-box;
  797. padding: 0;
  798. background-color: map-get($colors, bg);
  799. font-family: map-get($font, family);
  800. -webkit-font-smoothing: map-get($font, smoothing);
  801. font-smoothing: map-get($font, smoothing);
  802. }
  803. .address-section {
  804. padding: map-get($sizes, padding-sm) map-get($sizes, padding);
  805. .u-col {
  806. padding: 0;
  807. box-sizing: border-box;
  808. }
  809. .u-col:first-child {
  810. padding-right: 15rpx;
  811. }
  812. .u-col:last-child {
  813. padding-left: 15rpx;
  814. }
  815. }
  816. // 表单行样式
  817. .info-row {
  818. margin-bottom: 20rpx;
  819. box-sizing: border-box;
  820. padding: 0;
  821. }
  822. // 表单标签样式
  823. .info-label {
  824. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  825. margin-bottom: 8rpx;
  826. display: block;
  827. }
  828. // 输入框样式
  829. .info-input {
  830. height: 65rpx;
  831. border-radius: 8rpx;
  832. border: 1rpx solid #e5e7eb;
  833. padding: 20rpx 16rpx;
  834. width: 100%;
  835. box-sizing: border-box;
  836. @include font-styles($size: small, $weight: regular, $color: secondary);
  837. // textarea特殊样式
  838. &[type="textarea"] {
  839. min-height: 160rpx;
  840. resize: vertical;
  841. padding-top: 20rpx;
  842. padding-bottom: 20rpx;
  843. }
  844. }
  845. // 防止表单label换行
  846. ::v-deep .u-form-item__body__left__content__label {
  847. white-space: nowrap;
  848. }
  849. ::v-deep .u-form-item__body {
  850. padding: 0;
  851. }
  852. // 图片上传样式
  853. .image-uploader {
  854. width: 100%;
  855. height: 65rpx;
  856. border: 2rpx dashed #409eff;
  857. border-radius: 8rpx;
  858. display: flex;
  859. align-items: center;
  860. justify-content: center;
  861. cursor: pointer;
  862. background-color: #ecf5ff;
  863. box-sizing: border-box;
  864. overflow: hidden;
  865. transition: all 0.3s ease;
  866. &:hover {
  867. border-color: #66b1ff;
  868. background-color: #f0f9ff;
  869. transform: scale(1.02);
  870. }
  871. }
  872. .camera-icon {
  873. margin: 0;
  874. font-size: 32rpx;
  875. color: #409eff;
  876. transition: all 0.3s ease;
  877. }
  878. .image-uploader:hover .camera-icon {
  879. color: #66b1ff;
  880. transform: scale(1.1);
  881. }
  882. .image-preview {
  883. width: 100%;
  884. height: 100%;
  885. object-fit: cover;
  886. border-radius: 10rpx;
  887. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  888. transition: all 0.3s ease;
  889. }
  890. .image-uploader:hover .image-preview {
  891. transform: scale(1.02);
  892. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.15);
  893. }
  894. .hidden-input {
  895. display: none;
  896. }
  897. // 分成信息卡片样式
  898. .address-header {
  899. display: flex;
  900. align-items: center;
  901. justify-content: space-between;
  902. margin-bottom: 20rpx;
  903. .address-title {
  904. @include font-styles($size: small, $weight: medium, $color: primary);
  905. margin-left: 10rpx;
  906. }
  907. }
  908. .split-content {
  909. padding: 10rpx 0;
  910. }
  911. .split-item {
  912. display: flex;
  913. justify-content: space-between;
  914. align-items: center;
  915. padding: 15rpx 0;
  916. border-bottom: 1rpx solid map-get($colors, border);
  917. &:last-child {
  918. border-bottom: none;
  919. }
  920. }
  921. .split-label {
  922. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  923. }
  924. .split-value {
  925. @include font-styles($size: small, $weight: regular, $color: secondary);
  926. }
  927. .add-button {
  928. padding: 0;
  929. width: 50rpx;
  930. height: 50rpx;
  931. display: flex;
  932. align-items: center;
  933. justify-content: center;
  934. }
  935. /* 分成信息表格样式 */
  936. .split-table {
  937. width: 100%;
  938. margin-top: 20rpx;
  939. background-color: #fff;
  940. border-radius: 8rpx;
  941. overflow: hidden;
  942. }
  943. .split-table-header {
  944. background-color: #f5f7fa;
  945. padding: 15rpx 0;
  946. border-bottom: 1rpx solid #e4e7ed;
  947. }
  948. .split-table-row {
  949. padding: 15rpx 0;
  950. border-bottom: 1rpx solid #e4e7ed;
  951. align-items: center;
  952. &:last-child {
  953. border-bottom: none;
  954. }
  955. }
  956. .header-text {
  957. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  958. text-align: center;
  959. display: block;
  960. }
  961. .table-cell {
  962. display: flex;
  963. align-items: center;
  964. justify-content: center;
  965. padding: 0 10rpx;
  966. box-sizing: border-box;
  967. }
  968. .action-column {
  969. display: flex;
  970. align-items: center;
  971. justify-content: center;
  972. }
  973. /* 自定义下拉框样式 - 隐藏原生箭头 */
  974. .custom-select {
  975. width: 100%;
  976. height: 50rpx;
  977. border-radius: 0;
  978. border: 1rpx solid #e5e7eb;
  979. text-align: center;
  980. /* 增加右侧内边距,为自定义箭头留出空间 */
  981. @include font-styles($size: tiny, $weight: regular, $color: secondary);
  982. background-color: #fff;
  983. /* 确保隐藏所有浏览器的原生箭头 */
  984. appearance: none !important;
  985. -webkit-appearance: none !important;
  986. -moz-appearance: none !important;
  987. -o-appearance: none !important;
  988. cursor: pointer;
  989. /* 使用自定义SVG箭头 */
  990. background-repeat: no-repeat;
  991. background-position: right 8rpx center;
  992. background-size: 12rpx 12rpx;
  993. box-sizing: border-box;
  994. position: relative;
  995. /* 防止箭头在焦点状态下显示 */
  996. &:focus {
  997. outline: none;
  998. border-color: #409eff;
  999. box-shadow: 0 0 0 2rpx rgba(64, 158, 255, 0.2);
  1000. }
  1001. /* 针对IE/Edge浏览器的特殊处理 */
  1002. &::-ms-expand {
  1003. display: none !important;
  1004. }
  1005. /* 针对某些旧版浏览器的额外处理 */
  1006. &::-webkit-select-arrow {
  1007. display: none !important;
  1008. }
  1009. /* 添加伪元素覆盖可能残留的箭头 */
  1010. &::after {
  1011. content: '';
  1012. position: absolute;
  1013. right: 8rpx;
  1014. top: 50%;
  1015. transform: translateY(-50%);
  1016. width: 12rpx;
  1017. height: 12rpx;
  1018. 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");
  1019. background-repeat: no-repeat;
  1020. background-size: 100% 100%;
  1021. pointer-events: none;
  1022. z-index: 1;
  1023. }
  1024. }
  1025. /* 百分比输入框样式 */
  1026. .percentage-input {
  1027. text-align: center;
  1028. background-color: #f9f9f9;
  1029. color: #606266;
  1030. text-align: center;
  1031. padding: 0rpx !important;
  1032. }
  1033. /* 账户类型标签样式 */
  1034. .account-type {
  1035. padding: 4rpx 16rpx;
  1036. border-radius: 12rpx;
  1037. font-size: 24rpx;
  1038. font-weight: 500;
  1039. color: #fff;
  1040. text-align: center;
  1041. }
  1042. .account-type.frontend {
  1043. background-color: #409eff;
  1044. }
  1045. .account-type.backend {
  1046. background-color: #909399;
  1047. }
  1048. /* 调整表格布局,使其更紧凑 */
  1049. .split-table {
  1050. width: 100%;
  1051. margin-top: 10rpx;
  1052. }
  1053. .split-table-header,
  1054. .split-table-row {
  1055. padding: 10rpx 0;
  1056. }
  1057. .table-cell {
  1058. padding: 0 5rpx;
  1059. }
  1060. /* 归属公司单选框样式 */
  1061. .radio-wrapper {
  1062. cursor: pointer;
  1063. display: flex;
  1064. align-items: center;
  1065. justify-content: center;
  1066. }
  1067. .radio-circle {
  1068. width: 32rpx;
  1069. height: 32rpx;
  1070. border-radius: 50%;
  1071. border: 2rpx solid #dcdfe6;
  1072. display: flex;
  1073. align-items: center;
  1074. justify-content: center;
  1075. transition: all 0.3s ease;
  1076. }
  1077. .radio-circle.active {
  1078. border-color: #67c23a;
  1079. background-color: #67c23a;
  1080. }
  1081. /* 确认入库按钮样式 */
  1082. .confirm-button-container {
  1083. display: flex;
  1084. justify-content: center;
  1085. align-items: center;
  1086. padding: 40rpx 0;
  1087. margin-top: 20rpx;
  1088. }
  1089. /* 响应式布局调整 */
  1090. @media screen and (max-width: 750rpx) {
  1091. .split-table {
  1092. overflow-x: auto;
  1093. }
  1094. .custom-select {
  1095. width: 100%;
  1096. }
  1097. .account-type {
  1098. padding: 2rpx 10rpx;
  1099. font-size: 22rpx;
  1100. }
  1101. }
  1102. @media screen and (min-width: 751rpx) {
  1103. .table-cell {
  1104. padding: 0 10rpx;
  1105. }
  1106. }
  1107. .u-button {
  1108. height: 60rpx;
  1109. }
  1110. .delectBtn {
  1111. height: 40rpx;
  1112. .u-button {
  1113. width: 40rpx;
  1114. }
  1115. }
  1116. .delectBtn ::v-deep .u-button--mini {
  1117. min-width: 20rpx !important;
  1118. }
  1119. .next-btn {
  1120. position: fixed;
  1121. bottom: 10rpx;
  1122. left: 2.5%;
  1123. width: 95%;
  1124. height: 80rpx;
  1125. line-height: 80rpx;
  1126. text-align: center;
  1127. @include font-styles($size: medium, $weight: bold, $color: #fff);
  1128. border-radius: 0rpx 0rpx 20rpx 20rpx;
  1129. }
  1130. </style>