PageFour.vue 28 KB

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