PageFour.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948
  1. <template>
  2. <view class="page-four-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" />
  8. <text class="address-title">入库信息</text>
  9. </view>
  10. <!-- 编码、快递单号、物流图片 -->
  11. <!-- 收单物品、收单类型 -->
  12. <u-row class="info-row" justify="space-between">
  13. <u-col span="5.8">
  14. <u-form-item label="收单物品" prop="item">
  15. <u--input v-model="warehouseInfo.item" placeholder="请输入收单物品" class="info-input" />
  16. </u-form-item>
  17. </u-col>
  18. <view @tap="selectCustomerServiceName">
  19. <u-col span="5.8">
  20. <u-form-item label="收单类型" prop="customerServiceNameLabel">
  21. <view class="click-wrapper">
  22. <u--input v-model="warehouseInfo.customerServiceNameLabel" placeholder="点击选择收单类型" class="info-input"
  23. disabled />
  24. </view>
  25. </u-form-item>
  26. <u-picker :show="showCustomerServicePicker" :columns="customerServiceColumns" confirm keyName="label"
  27. @confirm="handleConfirmCustomerService" @cancel="showCustomerServicePicker = false" />
  28. </u-col>
  29. </view>
  30. </u-row>
  31. <!-- 类别、是否需要查码 -->
  32. <u-row class="info-row" justify="space-between">
  33. <u-col span="5.8">
  34. <view @tap="selectCategory">
  35. <u-form-item label="类别" prop="category">
  36. <view class="click-wrapper">
  37. <u--input v-model="warehouseInfo.categoryLabel" placeholder="点击选择类别" class="info-input" disabled />
  38. </view>
  39. </u-form-item>
  40. <u-picker :show="showCategoryPicker" :columns="categoryColumns" confirm keyName="label"
  41. @confirm="handleConfirmCategory" @cancel="showCategoryPicker = false" />
  42. </view>
  43. </u-col>
  44. <u-col span="5.8">
  45. <view @tap="selectNeedCheckCode">
  46. <u-form-item label="是否需要查码" prop="needCheckCode">
  47. <view class="click-wrapper">
  48. <u--input v-model="warehouseInfo.needCheckCodeLabel" placeholder="点击选择是否需要查码" class="info-input"
  49. disabled />
  50. </view>
  51. </u-form-item>
  52. <u-picker :show="showNeedCheckCodePicker" :columns="needCheckCodeColumns" confirm keyName="label"
  53. @confirm="handleConfirmNeedCheckCode" @cancel="showNeedCheckCodePicker = false" />
  54. </view>
  55. </u-col>
  56. </u-row>
  57. <u-row class="info-row" justify="space-between">
  58. <u-col span="4.5">
  59. <u-form-item label="编码" prop="codeStorage">
  60. <u--input v-model="warehouseInfo.codeStorage" placeholder="请输入编码" class="info-input"
  61. :disabled="warehouseInfo.needCheckCode === '2'" />
  62. </u-form-item>
  63. </u-col>
  64. <u-col span="4.5">
  65. <u-form-item label="快递单号" prop="expressOrderNo">
  66. <u--input v-model="warehouseInfo.expressOrderNo" placeholder="请输入快递单号" class="info-input" />
  67. </u-form-item>
  68. </u-col>
  69. <u-col span="2">
  70. <u-form-item label="物流图片" prop="uploadedImage">
  71. <view class="image-uploader" @click="selectImage">
  72. <u-icon v-if="!warehouseInfo.uploadedImage" name="camera-fill" size="48rpx" color="#909399"
  73. class="camera-icon" />
  74. <image v-else :src="warehouseInfo.uploadedImage" mode="aspectFill" class="image-preview" />
  75. </view>
  76. </u-form-item>
  77. </u-col>
  78. </u-row>
  79. <!-- 表款、查码费 -->
  80. <u-row class="info-row" justify="space-between">
  81. <u-col span="5.8">
  82. <u-form-item label="表款">
  83. <u--input v-model="warehouseInfo.watchPrice" placeholder="请输入表款" class="info-input" type="number" />
  84. </u-form-item>
  85. </u-col>
  86. <u-col span="5.8">
  87. <u-form-item label="查码费">
  88. <u--input v-model="warehouseInfo.checkCodeFee" placeholder="请输入查码费" class="info-input" type="number"
  89. :disabled="warehouseInfo.needCheckCode === '2'" />
  90. </u-form-item>
  91. </u-col>
  92. </u-row>
  93. <!-- 好处费、运费 -->
  94. <u-row class="info-row" justify="space-between">
  95. <u-col span="5.8">
  96. <u-form-item label="好处费">
  97. <u--input v-model="warehouseInfo.benefitFee" placeholder="请输入好处费" class="info-input" type="number" />
  98. </u-form-item>
  99. </u-col>
  100. <u-col span="5.8">
  101. <u-form-item label="运费">
  102. <u--input v-model="warehouseInfo.freight" placeholder="请输入运费" class="info-input" type="number" />
  103. </u-form-item>
  104. </u-col>
  105. </u-row>
  106. <!-- 维修金额、分单比例 -->
  107. <u-row class="info-row" justify="space-between">
  108. <u-col span="5.8">
  109. <u-form-item label="维修金额">
  110. <u--input v-model="warehouseInfo.repairAmount" placeholder="请输入维修金额" class="info-input" type="number" />
  111. </u-form-item>
  112. </u-col>
  113. <u-col span="5.8">
  114. <u-form-item label="分单比例(0~100)">
  115. <u--input v-model="warehouseInfo.splitRatio" placeholder="请输入分单比例(0~100)" class="info-input"
  116. type="number" />
  117. </u-form-item>
  118. </u-col>
  119. </u-row>
  120. <!-- 成本合计、业绩、毛业绩 -->
  121. <u-row class="info-row" justify="space-between">
  122. <u-col span="3.8">
  123. <u-form-item label="成本合计">
  124. <u--input :disabled="true" :value="computedTotalCost" placeholder="成本合计自动计算" class="info-input"
  125. type="number" />
  126. </u-form-item>
  127. </u-col>
  128. <u-col span="3.8">
  129. <u-form-item label="业绩">
  130. <u--input :disabled="true" :value="computedPerformance" placeholder="业绩自动计算" class="info-input"
  131. 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="computedGrossPerformance" placeholder="毛业绩自动计算" class="info-input"
  137. type="number" />
  138. </u-form-item>
  139. </u-col>
  140. </u-row>
  141. <!-- 收单备注 -->
  142. <u-row class="info-row">
  143. <u-col span="12">
  144. <u-form-item label="收单备注">
  145. <u--textarea v-model="warehouseInfo.remarks" placeholder="请输入收单备注" class="info-textarea"
  146. confirmType="done" rows="4" />
  147. </u-form-item>
  148. </u-col>
  149. </u-row>
  150. </u--form>
  151. </view>
  152. <!-- 分成信息卡片 -->
  153. <view class="card-wrap">
  154. <view class="address-section">
  155. <view class="address-header add-button-container">
  156. <text class="address-title">分成信息</text>
  157. <view class="add-button" @click="addSplit">
  158. <u-icon name="plus" size="24rpx" color="#108cff" />
  159. <text>添加</text>
  160. </view>
  161. </view>
  162. <!-- 分成信息表格 -->
  163. <view class="split-table">
  164. <u-row class="split-table-header">
  165. <u-col span="4"><text class="header-text">关联</text></u-col>
  166. <u-col span="2"><text class="header-text">分成人</text></u-col>
  167. <u-col span="2"><text class="header-text">比例</text></u-col>
  168. <u-col span="1"><text class="header-text">类型</text></u-col>
  169. <u-col span="1"><text class="header-text">公司</text></u-col>
  170. <u-col span="2" class="action-column"><text class="header-text">操作</text></u-col>
  171. </u-row>
  172. <u-row v-for="(item, index) in profitSharingList" :key="item.uuid" class="split-table-row">
  173. <u-col span="4">
  174. <view class="table-cell">
  175. <u-button @click="handleSelectOrg(item)" :text="item.orgName || '选择组织'" plain />
  176. </view>
  177. </u-col>
  178. <u-col span="2">
  179. <view class="table-cell">
  180. <u-button @click="handleSelectPerson(item)" :text="item.userName || '选择人员'" plain />
  181. </view>
  182. </u-col>
  183. <u-col span="2">
  184. <view class="table-cell">
  185. <u--input v-model="item.commissionRate" type="number" class="percentage-input"
  186. @input="handlePercentageInput(item)" min="0" max="100" precision="0" />
  187. </view>
  188. </u-col>
  189. <u-col span="1">
  190. <view class="table-cell">
  191. <view :class="['account-type', item.accountType == '1' ? 'frontend' : 'backend']"
  192. @click="toggleAccountType(item)">
  193. {{ item.accountType == '1' ? '前' : '后' }}
  194. </view>
  195. </view>
  196. </u-col>
  197. <u-col span="1">
  198. <view class="table-cell">
  199. <view class="radio-wrapper" @click="toggleBelongToCompany(item)">
  200. <view :class="['radio-circle', item.isCompanyPerformance == '1' ? 'active' : '']">
  201. <u-icon v-if="item.isCompanyPerformance == '1'" name="checkmark" size="20rpx" color="#fff" />
  202. </view>
  203. </view>
  204. </view>
  205. </u-col>
  206. <u-col span="2" class="action-column">
  207. <view class="table-cell">
  208. <u-button type="error" plain shape="circle" size="mini" @click="deleteRow(item.id, item.uuid)"
  209. class="delete-btn">
  210. <u-icon name="trash" size="20rpx" color="#ff6b6b" />
  211. </u-button>
  212. </view>
  213. </u-col>
  214. </u-row>
  215. </view>
  216. </view>
  217. </view>
  218. <!-- 确认入库按钮 -->
  219. <view class="confirm-button-container">
  220. <u-button class="next-btn" type="success" @click="confirmWarehouseEntry">
  221. <u-icon name="checkmark-circle-fill" size="28rpx" color="#fff" />
  222. <text style="margin-left: 8rpx;">确认入库</text>
  223. </u-button>
  224. </view>
  225. <!-- 组织选择器 -->
  226. <u-picker :show="showOrgPicker" title="请选择组织" :columns="columnsOrgList" keyName="label" @confirm="handleOrgConfirm"
  227. @cancel="showOrgPicker = false" />
  228. <!-- 人员选择器 -->
  229. <u-picker :show="showPersonPicker" title="请选择分成人" :columns="columnsPersonList" keyName="label"
  230. @confirm="handleConfirmPerson" @cancel="handleCancelPerson" />
  231. <u-toast ref="uToast" />
  232. </view>
  233. </template>
  234. <script>
  235. import imageUpload from '../utils/imageUpload.js'
  236. export default {
  237. name: 'PageFour',
  238. props: {
  239. orderDetail: {
  240. type: Object,
  241. default: () => ({})
  242. },
  243. currentReceipt: {
  244. type: Object,
  245. default: () => ({})
  246. }
  247. },
  248. data() {
  249. return {
  250. warehouseInfo: {
  251. codeStorage: '',
  252. expressOrderNo: '',
  253. uploadedImage: '',
  254. item: '',
  255. checkCodeFee: '',
  256. watchPrice: '',
  257. benefitFee: '',
  258. freight: '',
  259. repairAmount: '',
  260. grossPerformance: '',
  261. performance: '',
  262. splitRatio: '',
  263. remarks: '',
  264. customerServiceNameLabel: '',
  265. customerServiceName: '',
  266. categoryLabel: '',
  267. category: '',
  268. needCheckCodeLabel: '',
  269. needCheckCode: ''
  270. },
  271. profitSharingList: [],
  272. showOrgPicker: false,
  273. showPersonPicker: false,
  274. columnsOrgList: [],
  275. columnsPersonList: [],
  276. showCustomerServicePicker: false,
  277. customerServiceColumns: [[
  278. { label: '收单类', value: '1' },
  279. { label: '维修类', value: '2' },
  280. { label: '销售类', value: '3' }
  281. ]],
  282. showCategoryPicker: false,
  283. categoryColumns: [[
  284. { label: '腕表', value: '1' },
  285. { label: '包包', value: '2' },
  286. { label: '首饰', value: '4' },
  287. { label: '其他', value: '3' }
  288. ]],
  289. showNeedCheckCodePicker: false,
  290. needCheckCodeColumns: [[
  291. { label: '是', value: '1' },
  292. { label: '否', value: '2' }
  293. ]],
  294. currentEditItem: ''
  295. }
  296. },
  297. computed: {
  298. computedTotalCost() {
  299. const freight = Number(this.warehouseInfo.freight) || 0
  300. const benefitFee = Number(this.warehouseInfo.benefitFee) || 0
  301. const checkCodeFee = Number(this.warehouseInfo.checkCodeFee) || 0
  302. const watchPrice = Number(this.warehouseInfo.watchPrice) || 0
  303. const repairAmount = Number(this.warehouseInfo.repairAmount) || 0
  304. return freight + benefitFee + checkCodeFee + watchPrice + repairAmount
  305. },
  306. computedPerformance() {
  307. const sellingPrice = Number(this.currentReceipt.sellingPrice) || 0
  308. return sellingPrice - this.computedTotalCost
  309. },
  310. computedGrossPerformance() {
  311. const performance = this.computedPerformance || 0
  312. const splitRatio = Number(this.warehouseInfo.splitRatio) / 100 || 0
  313. return (performance * splitRatio).toFixed(2)
  314. }
  315. },
  316. watch: {
  317. currentReceipt: {
  318. handler(newVal) {
  319. if (newVal) {
  320. this.initWarehouseInfo(newVal)
  321. this.loadShareList()
  322. }
  323. },
  324. immediate: true,
  325. deep: true
  326. }
  327. },
  328. mounted() {
  329. this.loadCommissionUserList()
  330. },
  331. methods: {
  332. /**
  333. * 初始化入库信息
  334. */
  335. initWarehouseInfo(data) {
  336. const receiptRemark = data.receiptRemark || ''
  337. const remarkParts = receiptRemark.split(';')
  338. // 设置默认值:收单类型默认为"收单类",类别默认为"腕表",是否需要查码默认为"是"
  339. const defaultCustomerServiceName = data.customerServiceName || '1'
  340. const defaultCategory = data.category || '1'
  341. const defaultNeedCheckCode = data.needCheckCode || '1'
  342. this.warehouseInfo = {
  343. codeStorage: data.code || '',
  344. expressOrderNo: data.expressOrderNo || '',
  345. uploadedImage: remarkParts[1] || '',
  346. item: data.item || '',
  347. checkCodeFee: data.checkCodeFee || '',
  348. watchPrice: data.tableFee || '',
  349. benefitFee: data.benefitFee || '',
  350. freight: data.freight || '',
  351. repairAmount: data.repairAmount || '',
  352. grossPerformance: data.grossPerformance || '',
  353. performance: data.performance || '',
  354. splitRatio: data.splitRatio || '',
  355. remarks: remarkParts[0] || '',
  356. customerServiceName: defaultCustomerServiceName,
  357. customerServiceNameLabel: this.getLabelByValue(
  358. this.customerServiceColumns[0],
  359. defaultCustomerServiceName
  360. ),
  361. category: defaultCategory,
  362. categoryLabel: this.getLabelByValue(
  363. this.categoryColumns[0],
  364. defaultCategory
  365. ),
  366. needCheckCode: defaultNeedCheckCode,
  367. needCheckCodeLabel: this.getLabelByValue(
  368. this.needCheckCodeColumns[0],
  369. defaultNeedCheckCode
  370. )
  371. }
  372. },
  373. /**
  374. * 根据值获取标签
  375. */
  376. getLabelByValue(columns, value) {
  377. const item = columns.find(col => col.value == value)
  378. return item ? item.label : ''
  379. },
  380. /**
  381. * 选择物流图片
  382. */
  383. async selectImage() {
  384. try {
  385. const tempFilePaths = await imageUpload.chooseImage(1)
  386. if (!tempFilePaths || tempFilePaths.length === 0) {
  387. uni.$u.toast('未获取到图片路径,请重试')
  388. return
  389. }
  390. const tempFilePath = tempFilePaths[0]
  391. const rep = await uni.$u.api.uploadFile(tempFilePath)
  392. if (rep.code == 200) {
  393. this.warehouseInfo.uploadedImage = rep.data.url
  394. }
  395. } catch (error) {
  396. console.error('上传图片失败:', error)
  397. }
  398. },
  399. /**
  400. * 加载分成人名单
  401. */
  402. async loadCommissionUserList() {
  403. try {
  404. const res = await uni.$u.api.getCustomerManagerAllList()
  405. this.columnsOrgList = [res.data[0].children]
  406. } catch (error) {
  407. console.error('加载分成人名单失败:', error)
  408. }
  409. },
  410. /**
  411. * 加载分成列表
  412. */
  413. async loadShareList() {
  414. if (!this.currentReceipt.sendFormId) return
  415. try {
  416. const { rows } = await uni.$u.api.selectCommissionList({
  417. pageSize: 9999,
  418. pageNum: 1
  419. }, { sendFormId: this.currentReceipt.sendFormId })
  420. const newRows = rows
  421. .filter(item => item.receiptFormId == this.currentReceipt.id)
  422. .map(item => ({
  423. ...item,
  424. uuid: Math.random()
  425. }))
  426. this.profitSharingList = newRows
  427. } catch (error) {
  428. console.error('加载分成列表失败:', error)
  429. }
  430. },
  431. /**
  432. * 添加分成行
  433. */
  434. addSplit() {
  435. this.profitSharingList.push({
  436. deptId: '',
  437. accountType: '1',
  438. userId: '',
  439. commissionRate: 0,
  440. isCompanyPerformance: '2',
  441. orgName: '',
  442. userName: '',
  443. id: '',
  444. uuid: Math.random()
  445. })
  446. this.calculateTotalPercentage()
  447. },
  448. /**
  449. * 重新计算分成比例
  450. */
  451. calculateTotalPercentage() {
  452. const frontItems = this.profitSharingList.filter(item => item.accountType == '1')
  453. const backItems = this.profitSharingList.filter(item => item.accountType == '2')
  454. const totalFrontItems = frontItems.length || 1
  455. const totalBackItems = backItems.length || 1
  456. this.profitSharingList.forEach(item => {
  457. if (item.accountType == '1') {
  458. item.commissionRate = Math.floor(100 / totalFrontItems)
  459. }
  460. if (item.accountType == '2') {
  461. item.commissionRate = Math.floor(100 / totalBackItems)
  462. }
  463. })
  464. },
  465. /**
  466. * 切换账户类型
  467. */
  468. toggleAccountType(item) {
  469. item.accountType = item.accountType == '1' ? '2' : '1'
  470. this.calculateTotalPercentage()
  471. },
  472. /**
  473. * 处理百分比输入
  474. */
  475. handlePercentageInput(item) {
  476. let value = Number(item.commissionRate)
  477. if (isNaN(value)) value = 0
  478. if (value < 0) value = 0
  479. if (value > 100) value = 100
  480. item.commissionRate = Math.floor(value)
  481. },
  482. /**
  483. * 切换归属公司
  484. */
  485. toggleBelongToCompany(item) {
  486. item.isCompanyPerformance = item.isCompanyPerformance == '1' ? '2' : '1'
  487. },
  488. /**
  489. * 选择组织
  490. */
  491. handleSelectOrg(item) {
  492. this.currentEditItem = item.uuid
  493. this.showPersonPicker = true
  494. this.columnsPersonList = this.columnsOrgList
  495. },
  496. /**
  497. * 选择人员
  498. */
  499. handleSelectPerson(item) {
  500. this.currentEditItem = item.uuid
  501. const deptId = item.deptId
  502. const org = this.findOrg(this.columnsOrgList[0], deptId)
  503. if (org) {
  504. this.columnsPersonList = [org.children]
  505. }
  506. this.showPersonPicker = true
  507. },
  508. /**
  509. * 递归查找组织
  510. */
  511. findOrg(orgList, deptId) {
  512. for (const org of orgList) {
  513. if (org.id == deptId) {
  514. return org
  515. }
  516. if (org.children && org.children.length > 0) {
  517. const found = this.findOrg(org.children, deptId)
  518. if (found) return found
  519. }
  520. }
  521. return null
  522. },
  523. /**
  524. * 确认选择组织
  525. */
  526. handleOrgConfirm({ value }) {
  527. this.profitSharingList.forEach(item => {
  528. if (item.uuid == this.currentEditItem) {
  529. item.orgName = value[0].label
  530. item.deptId = value[0].id
  531. item.userId = ''
  532. item.userName = ''
  533. }
  534. })
  535. this.showOrgPicker = false
  536. },
  537. /**
  538. * 确认选择人员
  539. */
  540. handleConfirmPerson({ value }) {
  541. if (value[0].isUser) {
  542. this.profitSharingList.forEach(item => {
  543. if (item.uuid == this.currentEditItem) {
  544. item.userName = value[0].label
  545. item.userId = value[0].id
  546. }
  547. })
  548. this.columnsPersonList = []
  549. this.showPersonPicker = false
  550. } else {
  551. this.profitSharingList.forEach(item => {
  552. if (item.uuid == this.currentEditItem) {
  553. item.orgName = value[0].label
  554. item.deptId = value[0].id
  555. }
  556. })
  557. this.columnsPersonList = [value[0].children]
  558. }
  559. },
  560. /**
  561. * 取消选择人员
  562. */
  563. handleCancelPerson() {
  564. this.columnsPersonList = []
  565. this.showPersonPicker = false
  566. },
  567. /**
  568. * 删除分成行
  569. */
  570. async deleteRow(id, uuid) {
  571. uni.showModal({
  572. title: '确认删除',
  573. content: '是否确认删除当前行分成比例?',
  574. success: async (res) => {
  575. if (res.confirm) {
  576. if (!id) {
  577. this.profitSharingList = this.profitSharingList.filter(item => item.uuid != uuid)
  578. this.calculateTotalPercentage()
  579. return
  580. }
  581. try {
  582. await uni.$u.api.deleteClueCommissionForm(id)
  583. uni.$u.toast('删除成功')
  584. this.loadShareList()
  585. } catch (error) {
  586. uni.$u.toast('删除失败')
  587. }
  588. }
  589. }
  590. })
  591. },
  592. /**
  593. * 选择收单类型
  594. */
  595. selectCustomerServiceName() {
  596. this.showCustomerServicePicker = true
  597. },
  598. /**
  599. * 确认收单类型
  600. */
  601. handleConfirmCustomerService({ value }) {
  602. this.warehouseInfo.customerServiceNameLabel = value[0].label
  603. this.warehouseInfo.customerServiceName = value[0].value
  604. this.showCustomerServicePicker = false
  605. },
  606. /**
  607. * 选择类别
  608. */
  609. selectCategory() {
  610. this.showCategoryPicker = true
  611. },
  612. /**
  613. * 确认类别
  614. */
  615. handleConfirmCategory({ value }) {
  616. this.warehouseInfo.categoryLabel = value[0].label
  617. this.warehouseInfo.category = value[0].value
  618. this.showCategoryPicker = false
  619. },
  620. /**
  621. * 选择是否需要查码
  622. */
  623. selectNeedCheckCode() {
  624. this.showNeedCheckCodePicker = true
  625. },
  626. /**
  627. * 确认是否需要查码
  628. */
  629. handleConfirmNeedCheckCode({ value }) {
  630. this.warehouseInfo.needCheckCodeLabel = value[0].label
  631. this.warehouseInfo.needCheckCode = value[0].value
  632. // 如果选择"否",清空编码和查码费
  633. if (value[0].value === '2') {
  634. this.warehouseInfo.codeStorage = ''
  635. this.warehouseInfo.checkCodeFee = ''
  636. }
  637. this.showNeedCheckCodePicker = false
  638. },
  639. /**
  640. * 确认入库
  641. */
  642. async confirmWarehouseEntry() {
  643. uni.showModal({
  644. title: '确认入库',
  645. content: `是否确认入库该订单:${this.orderDetail.item}?`,
  646. success: async (res) => {
  647. if (res.confirm) {
  648. try {
  649. // 修改订单状态
  650. await uni.$u.api.oderForm({
  651. status: '3',
  652. id: this.orderDetail.id
  653. })
  654. // 更新收单表单
  655. await uni.$u.api.updateReceiptForm({
  656. id: this.currentReceipt.id,
  657. code: this.warehouseInfo.codeStorage || '',
  658. expressOrderNo: this.warehouseInfo.expressOrderNo || '',
  659. item: this.warehouseInfo.item || '',
  660. checkCodeFee: this.warehouseInfo.checkCodeFee || '',
  661. tableFee: this.warehouseInfo.watchPrice || '',
  662. benefitFee: this.warehouseInfo.benefitFee || '',
  663. freight: this.warehouseInfo.freight || '',
  664. repairAmount: this.warehouseInfo.repairAmount || '',
  665. grossPerformance: this.computedGrossPerformance || '',
  666. performance: this.computedPerformance || '',
  667. splitRatio: this.warehouseInfo.splitRatio || '',
  668. receiptRemark: `${this.warehouseInfo.remarks || ''};${this.warehouseInfo.uploadedImage || ''}`,
  669. customerServiceName: this.warehouseInfo.customerServiceName || '',
  670. category: this.warehouseInfo.category || '',
  671. needCheckCode: this.warehouseInfo.needCheckCode || '',
  672. totalCost: this.computedTotalCost || ''
  673. })
  674. // 上传分成数据
  675. await this.addShare()
  676. this.$refs.uToast.show({
  677. type: 'success',
  678. message: '入库成功',
  679. complete: () => {
  680. uni.navigateBack({
  681. delta: 1
  682. })
  683. }
  684. })
  685. } catch (error) {
  686. console.error('入库失败:', error)
  687. uni.$u.toast('入库失败')
  688. }
  689. }
  690. }
  691. })
  692. },
  693. /**
  694. * 上传分成
  695. */
  696. async addShare() {
  697. for (const item of this.profitSharingList) {
  698. const data = {
  699. id: item.id || '',
  700. accountType: item.accountType == '1' ? 1 : 2,
  701. clueId: this.currentReceipt.clueId,
  702. commissionRate: item.commissionRate,
  703. isCompanyPerformance: item.isCompanyPerformance == '1' ? 1 : 2,
  704. sendFormId: this.currentReceipt.sendFormId,
  705. userId: item.userId,
  706. userName: item.userName,
  707. receiptFormId: this.currentReceipt.id
  708. }
  709. if (item.id) {
  710. await uni.$u.api.clueCommissionUpdate(data)
  711. } else {
  712. await uni.$u.api.clueCommissionAdd(data)
  713. }
  714. }
  715. }
  716. }
  717. }
  718. </script>
  719. <style scoped lang="scss">
  720. @import '../styles/common.scss';
  721. .page-four-container {
  722. @extend .page-container;
  723. padding-bottom: 100rpx;
  724. }
  725. .address-section {
  726. padding: 20rpx;
  727. // 防止 label 换行
  728. ::v-deep .u-form-item__body__left__content__label {
  729. white-space: nowrap !important;
  730. overflow: visible;
  731. }
  732. }
  733. .info-row {
  734. margin-bottom: 20rpx;
  735. }
  736. .info-input {
  737. height: 65rpx;
  738. border-radius: 8rpx;
  739. border: 1rpx solid #e5e7eb;
  740. padding: 20rpx 16rpx;
  741. width: 100%;
  742. box-sizing: border-box;
  743. }
  744. .info-textarea {
  745. width: 100%;
  746. box-sizing: border-box;
  747. ::v-deep .u-textarea {
  748. min-height: 200rpx;
  749. border-radius: 8rpx;
  750. border: 1rpx solid #e5e7eb;
  751. padding: 20rpx 16rpx;
  752. line-height: 1.5;
  753. }
  754. ::v-deep textarea {
  755. min-height: 200rpx;
  756. border-radius: 8rpx;
  757. border: 1rpx solid #e5e7eb;
  758. padding: 20rpx 16rpx;
  759. width: 100%;
  760. box-sizing: border-box;
  761. line-height: 1.5;
  762. font-size: 28rpx;
  763. }
  764. }
  765. .click-wrapper {
  766. width: 100%;
  767. cursor: pointer;
  768. }
  769. .image-uploader {
  770. width: 100%;
  771. height: 65rpx;
  772. border: 2rpx dashed #409eff;
  773. border-radius: 8rpx;
  774. display: flex;
  775. align-items: center;
  776. justify-content: center;
  777. cursor: pointer;
  778. background-color: #ecf5ff;
  779. }
  780. .image-preview {
  781. width: 100%;
  782. height: 100%;
  783. object-fit: cover;
  784. border-radius: 10rpx;
  785. }
  786. .split-table {
  787. width: 100%;
  788. margin-top: 20rpx;
  789. }
  790. .split-table-header {
  791. background-color: #f5f7fa;
  792. padding: 15rpx 0;
  793. border-bottom: 1rpx solid #e4e7ed;
  794. }
  795. .split-table-row {
  796. padding: 15rpx 0;
  797. border-bottom: 1rpx solid #e4e7ed;
  798. align-items: center;
  799. }
  800. .header-text {
  801. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  802. text-align: center;
  803. display: block;
  804. }
  805. .table-cell {
  806. display: flex;
  807. align-items: center;
  808. justify-content: center;
  809. padding: 0 10rpx;
  810. }
  811. .percentage-input {
  812. text-align: center;
  813. background-color: #f9f9f9;
  814. padding: 0rpx !important;
  815. }
  816. .account-type {
  817. padding: 4rpx 16rpx;
  818. border-radius: 12rpx;
  819. font-size: 24rpx;
  820. font-weight: 500;
  821. color: #fff;
  822. text-align: center;
  823. cursor: pointer;
  824. &.frontend {
  825. background-color: #409eff;
  826. }
  827. &.backend {
  828. background-color: #909399;
  829. }
  830. }
  831. .radio-wrapper {
  832. cursor: pointer;
  833. display: flex;
  834. align-items: center;
  835. justify-content: center;
  836. }
  837. .radio-circle {
  838. width: 32rpx;
  839. height: 32rpx;
  840. border-radius: 50%;
  841. border: 2rpx solid #dcdfe6;
  842. display: flex;
  843. align-items: center;
  844. justify-content: center;
  845. transition: all 0.3s ease;
  846. &.active {
  847. border-color: #67c23a;
  848. background-color: #67c23a;
  849. }
  850. }
  851. .confirm-button-container {
  852. display: flex;
  853. justify-content: center;
  854. align-items: center;
  855. padding: 40rpx 0;
  856. margin-top: 20rpx;
  857. }
  858. .next-btn {
  859. width: 95%;
  860. height: 80rpx;
  861. line-height: 80rpx;
  862. text-align: center;
  863. border-radius: 11px;
  864. }
  865. .add-button-container {
  866. justify-content: space-between;
  867. }
  868. </style>