pageFour.vue 47 KB

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