pageFour.vue 39 KB

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