pageFour.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098
  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 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. // 图片上传样式
  710. .image-uploader {
  711. width: 100%;
  712. height: 65rpx;
  713. border: 2rpx dashed #409eff;
  714. border-radius: 8rpx;
  715. display: flex;
  716. align-items: center;
  717. justify-content: center;
  718. cursor: pointer;
  719. background-color: #ecf5ff;
  720. box-sizing: border-box;
  721. overflow: hidden;
  722. transition: all 0.3s ease;
  723. &:hover {
  724. border-color: #66b1ff;
  725. background-color: #f0f9ff;
  726. transform: scale(1.02);
  727. }
  728. }
  729. .camera-icon {
  730. margin: 0;
  731. font-size: 32rpx;
  732. color: #409eff;
  733. transition: all 0.3s ease;
  734. }
  735. .image-uploader:hover .camera-icon {
  736. color: #66b1ff;
  737. transform: scale(1.1);
  738. }
  739. .image-preview {
  740. width: 100%;
  741. height: 100%;
  742. object-fit: cover;
  743. border-radius: 10rpx;
  744. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  745. transition: all 0.3s ease;
  746. }
  747. .image-uploader:hover .image-preview {
  748. transform: scale(1.02);
  749. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.15);
  750. }
  751. .hidden-input {
  752. display: none;
  753. }
  754. // 分成信息卡片样式
  755. .address-header {
  756. display: flex;
  757. align-items: center;
  758. justify-content: space-between;
  759. margin-bottom: 20rpx;
  760. .address-title {
  761. @include font-styles($size: small, $weight: medium, $color: primary);
  762. margin-left: 10rpx;
  763. }
  764. }
  765. .split-content {
  766. padding: 10rpx 0;
  767. }
  768. .split-item {
  769. display: flex;
  770. justify-content: space-between;
  771. align-items: center;
  772. padding: 15rpx 0;
  773. border-bottom: 1rpx solid map-get($colors, border);
  774. &:last-child {
  775. border-bottom: none;
  776. }
  777. }
  778. .split-label {
  779. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  780. }
  781. .split-value {
  782. @include font-styles($size: small, $weight: regular, $color: secondary);
  783. }
  784. .add-button {
  785. padding: 0;
  786. width: 50rpx;
  787. height: 50rpx;
  788. display: flex;
  789. align-items: center;
  790. justify-content: center;
  791. }
  792. /* 分成信息表格样式 */
  793. .split-table {
  794. width: 100%;
  795. margin-top: 20rpx;
  796. background-color: #fff;
  797. border-radius: 8rpx;
  798. overflow: hidden;
  799. }
  800. .split-table-header {
  801. background-color: #f5f7fa;
  802. padding: 15rpx 0;
  803. border-bottom: 1rpx solid #e4e7ed;
  804. }
  805. .split-table-row {
  806. padding: 15rpx 0;
  807. border-bottom: 1rpx solid #e4e7ed;
  808. align-items: center;
  809. &:last-child {
  810. border-bottom: none;
  811. }
  812. }
  813. .header-text {
  814. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  815. text-align: center;
  816. display: block;
  817. }
  818. .table-cell {
  819. display: flex;
  820. align-items: center;
  821. justify-content: center;
  822. padding: 0 10rpx;
  823. box-sizing: border-box;
  824. }
  825. .action-column {
  826. display: flex;
  827. align-items: center;
  828. justify-content: center;
  829. }
  830. /* 自定义下拉框样式 - 隐藏原生箭头 */
  831. .custom-select {
  832. width: 100%;
  833. height: 50rpx;
  834. border-radius: 0;
  835. border: 1rpx solid #e5e7eb;
  836. text-align: center;
  837. /* 增加右侧内边距,为自定义箭头留出空间 */
  838. @include font-styles($size: tiny, $weight: regular, $color: secondary);
  839. background-color: #fff;
  840. /* 确保隐藏所有浏览器的原生箭头 */
  841. appearance: none !important;
  842. -webkit-appearance: none !important;
  843. -moz-appearance: none !important;
  844. -o-appearance: none !important;
  845. cursor: pointer;
  846. /* 使用自定义SVG箭头 */
  847. background-repeat: no-repeat;
  848. background-position: right 8rpx center;
  849. background-size: 12rpx 12rpx;
  850. box-sizing: border-box;
  851. position: relative;
  852. /* 防止箭头在焦点状态下显示 */
  853. &:focus {
  854. outline: none;
  855. border-color: #409eff;
  856. box-shadow: 0 0 0 2rpx rgba(64, 158, 255, 0.2);
  857. }
  858. /* 针对IE/Edge浏览器的特殊处理 */
  859. &::-ms-expand {
  860. display: none !important;
  861. }
  862. /* 针对某些旧版浏览器的额外处理 */
  863. &::-webkit-select-arrow {
  864. display: none !important;
  865. }
  866. /* 添加伪元素覆盖可能残留的箭头 */
  867. &::after {
  868. content: '';
  869. position: absolute;
  870. right: 8rpx;
  871. top: 50%;
  872. transform: translateY(-50%);
  873. width: 12rpx;
  874. height: 12rpx;
  875. 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");
  876. background-repeat: no-repeat;
  877. background-size: 100% 100%;
  878. pointer-events: none;
  879. z-index: 1;
  880. }
  881. }
  882. /* 百分比输入框样式 */
  883. .percentage-input {
  884. text-align: center;
  885. background-color: #f9f9f9;
  886. color: #606266;
  887. text-align: center;
  888. padding: 0rpx !important;
  889. }
  890. /* 账户类型标签样式 */
  891. .account-type {
  892. padding: 4rpx 16rpx;
  893. border-radius: 12rpx;
  894. font-size: 24rpx;
  895. font-weight: 500;
  896. color: #fff;
  897. text-align: center;
  898. }
  899. .account-type.frontend {
  900. background-color: #409eff;
  901. }
  902. .account-type.backend {
  903. background-color: #909399;
  904. }
  905. /* 调整表格布局,使其更紧凑 */
  906. .split-table {
  907. width: 100%;
  908. margin-top: 10rpx;
  909. }
  910. .split-table-header,
  911. .split-table-row {
  912. padding: 10rpx 0;
  913. }
  914. .table-cell {
  915. padding: 0 5rpx;
  916. }
  917. /* 归属公司单选框样式 */
  918. .radio-wrapper {
  919. cursor: pointer;
  920. display: flex;
  921. align-items: center;
  922. justify-content: center;
  923. }
  924. .radio-circle {
  925. width: 32rpx;
  926. height: 32rpx;
  927. border-radius: 50%;
  928. border: 2rpx solid #dcdfe6;
  929. display: flex;
  930. align-items: center;
  931. justify-content: center;
  932. transition: all 0.3s ease;
  933. }
  934. .radio-circle.active {
  935. border-color: #67c23a;
  936. background-color: #67c23a;
  937. }
  938. /* 确认入库按钮样式 */
  939. .confirm-button-container {
  940. display: flex;
  941. justify-content: center;
  942. align-items: center;
  943. padding: 40rpx 0;
  944. margin-top: 20rpx;
  945. }
  946. /* 响应式布局调整 */
  947. @media screen and (max-width: 750rpx) {
  948. .split-table {
  949. overflow-x: auto;
  950. }
  951. .custom-select {
  952. width: 100%;
  953. }
  954. .account-type {
  955. padding: 2rpx 10rpx;
  956. font-size: 22rpx;
  957. }
  958. }
  959. @media screen and (min-width: 751rpx) {
  960. .table-cell {
  961. padding: 0 10rpx;
  962. }
  963. }
  964. .u-button {
  965. height: 60rpx;
  966. }
  967. .delectBtn {
  968. height: 40rpx;
  969. .u-button {
  970. width: 40rpx;
  971. }
  972. }
  973. .delectBtn ::v-deep .u-button--mini {
  974. min-width: 20rpx !important;
  975. }
  976. </style>