PageFour.vue 28 KB

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