| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064 |
- <template>
- <view class="page-four-container">
- <!-- 入库信息卡片 -->
- <view class="card-wrap">
- <u--form labelPosition="top" :model="warehouseInfo" ref="form" class="address-section">
- <view class="address-header">
- <u-icon name="car-fill" size="36rpx" color="#108cff" class="location-icon" />
- <text class="address-title">入库信息</text>
- </view>
- <!-- 编码、快递单号、物流图片 -->
- <!-- 收单物品、收单类型 -->
- <u-row class="info-row" justify="space-between">
- <u-col span="5.8">
- <u-form-item label="收单物品" prop="item">
- <u--input v-model="warehouseInfo.item" placeholder="请输入收单物品" class="info-input" />
- </u-form-item>
- </u-col>
- <u-col span="5.8">
- <view @tap="selectCustomerServiceName">
- <u-form-item label="收单类型" prop="customerServiceNameLabel">
- <view class="click-wrapper info-input">
- {{ warehouseInfo.customerServiceNameLabel || '点击选择收单类型' }}
- </view>
- </u-form-item>
- <u-picker :show="showCustomerServicePicker" :columns="customerServiceColumns" confirm keyName="label"
- @confirm="handleConfirmCustomerService" @cancel="showCustomerServicePicker = false" />
- </view>
- </u-col>
- </u-row>
- <!-- 类别、是否需要查码 -->
- <u-row class="info-row" justify="space-between">
- <u-col span="5.8">
- <view @tap="selectCategory">
- <u-form-item label="类别" prop="category">
- <view class="click-wrapper info-input">
- {{ warehouseInfo.categoryLabel || '点击选择类别' }}
- </view>
- </u-form-item>
- <u-picker :show="showCategoryPicker" :columns="categoryColumns" confirm keyName="label"
- @confirm="handleConfirmCategory" @cancel="showCategoryPicker = false" />
- </view>
- </u-col>
- <u-col span="5.8">
- <view @tap="selectNeedCheckCode">
- <u-form-item label="是否需要查码" prop="needCheckCode">
- <view class="click-wrapper info-input">
- {{ warehouseInfo.needCheckCodeLabel || '点击选择是否需要查码' }}
- </view>
- </u-form-item>
- <u-picker :show="showNeedCheckCodePicker" :columns="needCheckCodeColumns" confirm keyName="label"
- @confirm="handleConfirmNeedCheckCode" @cancel="showNeedCheckCodePicker = false" />
- </view>
- </u-col>
- </u-row>
- <u-row class="info-row" justify="space-between">
- <u-col span="4.5">
- <u-form-item label="编码" prop="codeStorage">
- <u--input v-model="warehouseInfo.codeStorage" placeholder="请输入编码" class="info-input"
- :disabled="warehouseInfo.needCheckCode === '2'" />
- </u-form-item>
- </u-col>
- <u-col span="4.5">
- <u-form-item label="快递单号" prop="expressOrderNo">
- <u--input v-model="warehouseInfo.expressOrderNo" placeholder="请输入快递单号" class="info-input" />
- </u-form-item>
- </u-col>
- <u-col span="2">
- <u-form-item label="物流图片" prop="uploadedImage">
- <view class="image-uploader" @click="selectImage">
- <u-icon v-if="!warehouseInfo.uploadedImage" name="camera-fill" size="48rpx" color="#909399"
- class="camera-icon" />
- <image v-else :src="warehouseInfo.uploadedImage" mode="aspectFill" class="image-preview" />
- </view>
- </u-form-item>
- </u-col>
- </u-row>
- <!-- 表款、查码费 -->
- <u-row class="info-row" justify="space-between">
- <u-col span="5.8">
- <u-form-item label="表款">
- <u--input v-model="warehouseInfo.watchPrice" placeholder="请输入表款" class="info-input" type="number" />
- </u-form-item>
- </u-col>
- <u-col span="5.8">
- <u-form-item label="查码费">
- <u--input v-model="warehouseInfo.checkCodeFee" placeholder="请输入查码费" class="info-input" type="number"
- :disabled="warehouseInfo.needCheckCode === '2'" />
- </u-form-item>
- </u-col>
- </u-row>
- <!-- 好处费、运费 -->
- <u-row class="info-row" justify="space-between">
- <u-col span="5.8">
- <u-form-item label="好处费">
- <u--input v-model="warehouseInfo.benefitFee" placeholder="请输入好处费" class="info-input" type="number" />
- </u-form-item>
- </u-col>
- <u-col span="5.8">
- <u-form-item label="运费">
- <u--input v-model="warehouseInfo.freight" placeholder="请输入运费" class="info-input" type="number" />
- </u-form-item>
- </u-col>
- </u-row>
- <!-- 维修金额、分单比例 -->
- <u-row class="info-row" justify="space-between">
- <u-col span="5.8">
- <u-form-item label="维修金额">
- <u--input v-model="warehouseInfo.repairAmount" placeholder="请输入维修金额" class="info-input" type="number" />
- </u-form-item>
- </u-col>
- <u-col span="5.8">
- <u-form-item label="分单比例(0~100)">
- <u--input v-model="warehouseInfo.splitRatio" placeholder="请输入分单比例(0~100)" class="info-input"
- type="number" />
- </u-form-item>
- </u-col>
- </u-row>
- <!-- 成本合计、业绩、毛业绩 -->
- <u-row class="info-row" justify="space-between">
- <u-col span="3.8">
- <u-form-item label="成本合计">
- <u--input :disabled="true" :value="computedTotalCost" placeholder="成本合计自动计算" class="info-input"
- type="number" />
- </u-form-item>
- </u-col>
- <u-col span="3.8">
- <u-form-item label="业绩">
- <u--input :disabled="true" :value="computedPerformance" placeholder="业绩自动计算" class="info-input"
- type="number" />
- </u-form-item>
- </u-col>
- <u-col span="3.8">
- <u-form-item label="毛业绩">
- <u--input :disabled="true" :value="computedGrossPerformance" placeholder="毛业绩自动计算" class="info-input"
- type="number" />
- </u-form-item>
- </u-col>
- </u-row>
- <!-- 是否入库 -->
- <!-- <u-row class="info-row">
- <u-col span="12">
- <view @tap="selectIsWarehouse">
- <u-form-item label="是否入库" prop="isWarehouse">
- <view class="click-wrapper info-input">
- {{ isWarehouseLabel || '点击选择是否入库' }}
- </view>
- </u-form-item>
- <u-picker :show="showIsWarehousePicker" :columns="isWarehouseColumns" confirm keyName="label"
- @confirm="handleConfirmIsWarehouse" @cancel="showIsWarehousePicker = false" />
- </view>
- </u-col>
- </u-row> -->
- <!-- 收单备注 -->
- <u-row class="info-row">
- <u-col span="12">
- <u-form-item label="收单备注">
- <u--textarea v-model="warehouseInfo.remarks" placeholder="请输入收单备注" class="info-textarea"
- confirmType="done" rows="4" />
- </u-form-item>
- </u-col>
- </u-row>
- </u--form>
- </view>
- <!-- 分成信息卡片 -->
- <view class="card-wrap">
- <view class="address-section">
- <view class="address-header add-button-container">
- <text class="address-title">分成信息</text>
- <view class="add-button" @click="addSplit">
- <u-icon name="plus" size="24rpx" color="#108cff" />
- <text>添加</text>
- </view>
- </view>
- <!-- 分成信息表格 -->
- <view class="split-table">
- <u-row class="split-table-header">
- <u-col span="4"><text class="header-text">关联</text></u-col>
- <u-col span="2"><text class="header-text">分成人</text></u-col>
- <u-col span="2"><text class="header-text">比例</text></u-col>
- <u-col span="1"><text class="header-text">类型</text></u-col>
- <u-col span="1"><text class="header-text">公司</text></u-col>
- <u-col span="2" class="action-column"><text class="header-text">操作</text></u-col>
- </u-row>
- <u-row v-for="(item, index) in profitSharingList" :key="item.uuid" class="split-table-row">
- <u-col span="4">
- <view class="table-cell">
- <u-button @click="handleSelectOrg(item)" :text="item.orgName || '选择组织'" plain />
- </view>
- </u-col>
- <u-col span="2">
- <view class="table-cell">
- <u-button @click="handleSelectPerson(item)" :text="item.userName || '选择人员'" plain />
- </view>
- </u-col>
- <u-col span="2">
- <view class="table-cell">
- <u--input v-model="item.commissionRate" type="number" class="percentage-input"
- @input="handlePercentageInput(item)" min="0" max="100" precision="0" />
- </view>
- </u-col>
- <u-col span="1">
- <view class="table-cell">
- <view :class="['account-type', item.accountType == '1' ? 'frontend' : 'backend']"
- @click="toggleAccountType(item)">
- {{ item.accountType == '1' ? '前' : '后' }}
- </view>
- </view>
- </u-col>
- <u-col span="1">
- <view class="table-cell">
- <view class="radio-wrapper" @click="toggleBelongToCompany(item)">
- <view :class="['radio-circle', item.isCompanyPerformance == '1' ? 'active' : '']">
- <u-icon v-if="item.isCompanyPerformance == '1'" name="checkmark" size="20rpx" color="#fff" />
- </view>
- </view>
- </view>
- </u-col>
- <u-col span="2" class="action-column">
- <view class="table-cell">
- <u-button type="error" plain shape="circle" size="mini" @click="deleteRow(item.id, item.uuid)"
- class="delete-btn">
- <u-icon name="trash" size="20rpx" color="#ff6b6b" />
- </u-button>
- </view>
- </u-col>
- </u-row>
- </view>
- </view>
- </view>
- <!-- 确认入库按钮 -->
- <view class="confirm-button-container">
- <u-button class="next-btn" type="success" @click="confirmWarehouseEntry">
- <u-icon name="checkmark-circle-fill" size="28rpx" color="#fff" />
- <text style="margin-left: 8rpx;" v-show="isWarehouse == '2'">确认收单</text>
- <text style="margin-left: 8rpx;" v-show="isWarehouse == '1'">确认收单并入库</text>
- </u-button>
- </view>
- <!-- 组织选择器 -->
- <u-picker :show="showOrgPicker" title="请选择组织" :columns="columnsOrgList" keyName="label" @confirm="handleOrgConfirm"
- @cancel="showOrgPicker = false" />
- <!-- 人员选择器 -->
- <u-picker :show="showPersonPicker" title="请选择分成人" :columns="columnsPersonList" keyName="label"
- @confirm="handleConfirmPerson" @cancel="handleCancelPerson" />
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- import imageUpload from '../utils/imageUpload.js'
- import dayjs from 'dayjs'
- export default {
- name: 'PageFour',
- props: {
- orderDetail: {
- type: Object,
- default: () => ({})
- },
- currentReceipt: {
- type: Object,
- default: () => ({})
- }
- },
- data() {
- return {
- warehouseInfo: {
- codeStorage: '',
- expressOrderNo: '',
- uploadedImage: '',
- item: '',
- checkCodeFee: '',
- watchPrice: '',
- benefitFee: '',
- freight: '',
- repairAmount: '',
- grossPerformance: '',
- performance: '',
- splitRatio: '',
- remarks: '',
- customerServiceNameLabel: '',
- customerServiceName: '',
- categoryLabel: '',
- category: '',
- needCheckCodeLabel: '',
- needCheckCode: ''
- },
- profitSharingList: [],
- showOrgPicker: false,
- showPersonPicker: false,
- columnsOrgList: [],
- columnsPersonList: [],
- showCustomerServicePicker: false,
- customerServiceColumns: [[
- { label: '收单类', value: '1' },
- { label: '维修类', value: '2' },
- { label: '销售类', value: '3' }
- ]],
- showCategoryPicker: false,
- categoryColumns: [[
- { label: '腕表', value: '1' },
- { label: '包包', value: '2' },
- { label: '首饰', value: '4' },
- { label: '其他', value: '3' }
- ]],
- showNeedCheckCodePicker: false,
- needCheckCodeColumns: [[
- { label: '是', value: '1' },
- { label: '否', value: '2' }
- ]],
- currentEditItem: '',
- isWarehouse: '2',
- isWarehouseLabel: '不入库',
- showIsWarehousePicker: false,
- isWarehouseColumns: [[
- { label: '确认入库', value: '1' },
- { label: '不入库', value: '2' }
- ]],
- brandList: []
- }
- },
- computed: {
- computedTotalCost() {
- const freight = Number(this.warehouseInfo.freight) || 0
- const benefitFee = Number(this.warehouseInfo.benefitFee) || 0
- const checkCodeFee = Number(this.warehouseInfo.checkCodeFee) || 0
- const watchPrice = Number(this.warehouseInfo.watchPrice) || 0
- const repairAmount = Number(this.warehouseInfo.repairAmount) || 0
- return freight + benefitFee + checkCodeFee + watchPrice + repairAmount
- },
- computedPerformance() {
- const sellingPrice = Number(this.currentReceipt.sellingPrice) || 0
- return sellingPrice - this.computedTotalCost
- },
- computedGrossPerformance() {
- const performance = this.computedPerformance || 0
- const splitRatio = Number(this.warehouseInfo.splitRatio) / 100 || 0
- return (performance * splitRatio).toFixed(2)
- }
- },
- watch: {
- currentReceipt: {
- handler(newVal) {
- if (newVal) {
- this.initWarehouseInfo(newVal)
- this.loadShareList()
- }
- },
- immediate: true,
- deep: true
- }
- },
- mounted() {
- this.loadCommissionUserList()
- this.loadBrandList()
- },
- methods: {
- /**
- * 加载品牌列表
- */
- async loadBrandList() {
- try {
- const res = await this.$getDicts('crm_form_brand')
- this.brandList = res
- } catch (error) {
- console.error('加载品牌列表失败:', error)
- }
- },
- /**
- * 初始化入库信息
- */
- initWarehouseInfo(data) {
- const receiptRemark = data.receiptRemark || ''
- const remarkParts = receiptRemark.split(';')
- // 设置默认值:收单类型默认为"收单类",类别默认为"腕表",是否需要查码默认为"是"
- const defaultCustomerServiceName = data.customerServiceName || '1'
- const defaultCategory = data.category || '1'
- const defaultNeedCheckCode = data.needCheckCode || '1'
- this.warehouseInfo = {
- codeStorage: data.code || '',
- expressOrderNo: data.expressOrderNo || '',
- uploadedImage: remarkParts[1] || '',
- item: data.item || '',
- checkCodeFee: data.checkCodeFee || '',
- watchPrice: data.tableFee || '',
- benefitFee: data.benefitFee || '',
- freight: data.freight || '',
- repairAmount: data.repairAmount || '',
- grossPerformance: data.grossPerformance || '',
- performance: data.performance || '',
- splitRatio: data.splitRatio || '',
- remarks: remarkParts[0] || '',
- customerServiceName: defaultCustomerServiceName,
- customerServiceNameLabel: this.getLabelByValue(
- this.customerServiceColumns[0],
- defaultCustomerServiceName
- ),
- category: defaultCategory,
- categoryLabel: this.getLabelByValue(
- this.categoryColumns[0],
- defaultCategory
- ),
- needCheckCode: defaultNeedCheckCode,
- needCheckCodeLabel: this.getLabelByValue(
- this.needCheckCodeColumns[0],
- defaultNeedCheckCode
- )
- }
- },
- /**
- * 根据值获取标签
- */
- getLabelByValue(columns, value) {
- const item = columns.find(col => col.value == value)
- return item ? item.label : ''
- },
- /**
- * 选择物流图片
- */
- async selectImage() {
- try {
- const tempFilePaths = await imageUpload.chooseImage(1)
- if (!tempFilePaths || tempFilePaths.length === 0) {
- uni.$u.toast('未获取到图片路径,请重试')
- return
- }
- const tempFilePath = tempFilePaths[0]
- const rep = await uni.$u.api.uploadFile(tempFilePath)
- if (rep.code == 200) {
- this.warehouseInfo.uploadedImage = rep.data.url
- }
- } catch (error) {
- console.error('上传图片失败:', error)
- }
- },
- /**
- * 加载分成人名单
- */
- async loadCommissionUserList() {
- try {
- const res = await uni.$u.api.getCustomerManagerAllList()
- this.columnsOrgList = [res.data[0].children]
- } catch (error) {
- console.error('加载分成人名单失败:', error)
- }
- },
- /**
- * 加载分成列表
- */
- async loadShareList() {
- if (!this.currentReceipt.sendFormId) return
- try {
- const { rows } = await uni.$u.api.selectCommissionList({
- pageSize: 9999,
- pageNum: 1
- }, { sendFormId: this.currentReceipt.sendFormId })
- const newRows = rows
- .filter(item => item.receiptFormId == this.currentReceipt.id)
- .map(item => ({
- ...item,
- uuid: Math.random()
- }))
- this.profitSharingList = newRows
- } catch (error) {
- console.error('加载分成列表失败:', error)
- }
- },
- /**
- * 添加分成行
- */
- addSplit() {
- this.profitSharingList.push({
- deptId: '',
- accountType: '1',
- userId: '',
- commissionRate: 0,
- isCompanyPerformance: '2',
- orgName: '',
- userName: '',
- id: '',
- uuid: Math.random()
- })
- this.calculateTotalPercentage()
- },
- /**
- * 重新计算分成比例
- */
- calculateTotalPercentage() {
- const frontItems = this.profitSharingList.filter(item => item.accountType == '1')
- const backItems = this.profitSharingList.filter(item => item.accountType == '2')
- const totalFrontItems = frontItems.length || 1
- const totalBackItems = backItems.length || 1
- this.profitSharingList.forEach(item => {
- if (item.accountType == '1') {
- item.commissionRate = Math.floor(100 / totalFrontItems)
- }
- if (item.accountType == '2') {
- item.commissionRate = Math.floor(100 / totalBackItems)
- }
- })
- },
- /**
- * 切换账户类型
- */
- toggleAccountType(item) {
- item.accountType = item.accountType == '1' ? '2' : '1'
- this.calculateTotalPercentage()
- },
- /**
- * 处理百分比输入
- */
- handlePercentageInput(item) {
- let value = Number(item.commissionRate)
- if (isNaN(value)) value = 0
- if (value < 0) value = 0
- if (value > 100) value = 100
- item.commissionRate = Math.floor(value)
- },
- /**
- * 切换归属公司
- */
- toggleBelongToCompany(item) {
- item.isCompanyPerformance = item.isCompanyPerformance == '1' ? '2' : '1'
- },
- /**
- * 选择组织
- */
- handleSelectOrg(item) {
- this.currentEditItem = item.uuid
- this.showPersonPicker = true
- this.columnsPersonList = this.columnsOrgList
- },
- /**
- * 选择人员
- */
- handleSelectPerson(item) {
- this.currentEditItem = item.uuid
- const deptId = item.deptId
- const org = this.findOrg(this.columnsOrgList[0], deptId)
- if (org) {
- this.columnsPersonList = [org.children]
- }
- this.showPersonPicker = true
- },
- /**
- * 递归查找组织
- */
- findOrg(orgList, deptId) {
- for (const org of orgList) {
- if (org.id == deptId) {
- return org
- }
- if (org.children && org.children.length > 0) {
- const found = this.findOrg(org.children, deptId)
- if (found) return found
- }
- }
- return null
- },
- /**
- * 确认选择组织
- */
- handleOrgConfirm({ value }) {
- this.profitSharingList.forEach(item => {
- if (item.uuid == this.currentEditItem) {
- item.orgName = value[0].label
- item.deptId = value[0].id
- item.userId = ''
- item.userName = ''
- }
- })
- this.showOrgPicker = false
- },
- /**
- * 确认选择人员
- */
- handleConfirmPerson({ value }) {
- if (value[0].isUser) {
- this.profitSharingList.forEach(item => {
- if (item.uuid == this.currentEditItem) {
- item.userName = value[0].label
- item.userId = value[0].id
- }
- })
- this.columnsPersonList = []
- this.showPersonPicker = false
- } else {
- this.profitSharingList.forEach(item => {
- if (item.uuid == this.currentEditItem) {
- item.orgName = value[0].label
- item.deptId = value[0].id
- }
- })
- this.columnsPersonList = [value[0].children]
- }
- },
- /**
- * 取消选择人员
- */
- handleCancelPerson() {
- this.columnsPersonList = []
- this.showPersonPicker = false
- },
- /**
- * 删除分成行
- */
- async deleteRow(id, uuid) {
- uni.showModal({
- title: '确认删除',
- content: '是否确认删除当前行分成比例?',
- success: async (res) => {
- if (res.confirm) {
- if (!id) {
- this.profitSharingList = this.profitSharingList.filter(item => item.uuid != uuid)
- this.calculateTotalPercentage()
- return
- }
- try {
- await uni.$u.api.deleteClueCommissionForm(id)
- uni.$u.toast('删除成功')
- this.loadShareList()
- } catch (error) {
- uni.$u.toast('删除失败')
- }
- }
- }
- })
- },
- /**
- * 选择收单类型
- */
- selectCustomerServiceName() {
- this.showCustomerServicePicker = true
- },
- /**
- * 确认收单类型
- */
- handleConfirmCustomerService({ value }) {
- this.warehouseInfo.customerServiceNameLabel = value[0].label
- this.warehouseInfo.customerServiceName = value[0].value
- this.showCustomerServicePicker = false
- },
- /**
- * 选择类别
- */
- selectCategory() {
- this.showCategoryPicker = true
- },
- /**
- * 确认类别
- */
- handleConfirmCategory({ value }) {
- this.warehouseInfo.categoryLabel = value[0].label
- this.warehouseInfo.category = value[0].value
- this.showCategoryPicker = false
- },
- /**
- * 选择是否需要查码
- */
- selectNeedCheckCode() {
- this.showNeedCheckCodePicker = true
- },
- /**
- * 确认是否需要查码
- */
- handleConfirmNeedCheckCode({ value }) {
- this.warehouseInfo.needCheckCodeLabel = value[0].label
- this.warehouseInfo.needCheckCode = value[0].value
- // 如果选择"否",清空编码和查码费
- if (value[0].value === '2') {
- this.warehouseInfo.codeStorage = ''
- this.warehouseInfo.checkCodeFee = ''
- }
- this.showNeedCheckCodePicker = false
- },
- /**
- * 确认入库
- */
- async confirmWarehouseEntry() {
- uni.showModal({
- title: '确认入库',
- content: `是否确认入库该订单:${this.orderDetail.item}?`,
- success: async (res) => {
- if (res.confirm) {
- try {
- // 修改订单状态
- await uni.$u.api.oderForm({
- status: '3',
- id: this.orderDetail.id
- })
- // 更新收单表单
- await uni.$u.api.updateReceiptForm({
- id: this.currentReceipt.id,
- code: this.warehouseInfo.codeStorage || '',
- expressOrderNo: this.warehouseInfo.expressOrderNo || '',
- item: this.warehouseInfo.item || '',
- checkCodeFee: this.warehouseInfo.checkCodeFee || '',
- tableFee: this.warehouseInfo.watchPrice || '',
- benefitFee: this.warehouseInfo.benefitFee || '',
- freight: this.warehouseInfo.freight || '',
- repairAmount: this.warehouseInfo.repairAmount || '',
- grossPerformance: this.computedGrossPerformance || '',
- performance: this.computedPerformance || '',
- splitRatio: this.warehouseInfo.splitRatio || '',
- receiptRemark: `${this.warehouseInfo.remarks || ''};${this.warehouseInfo.uploadedImage || ''}`,
- customerServiceName: this.warehouseInfo.customerServiceName || '',
- category: this.warehouseInfo.category || '',
- needCheckCode: this.warehouseInfo.needCheckCode || '',
- totalCost: this.computedTotalCost || ''
- })
- // 上传分成数据
- await this.addShare()
- //新增仓库或者编辑仓库
- //等于1的时候放入仓库表
- if (this.isWarehouse == '1') {
- // 获取品牌ID
- const brandObj = this.brandList.find(item => item.dictLabel === this.currentReceipt.brand)
- const brandId = brandObj ? brandObj.dictValue : ''
- //建立入库data
- const warehouseData = {
- // goodPicFileList: [''],//商品图片 必填
- // desc: '',//商品描述 必填
- type: this.warehouseInfo.category || '',//商品分类
- dictLabel: this.currentReceipt.brand || '',//品牌名称 必填
- dictValue: brandId || '',//品牌id 必填
- // series: '',//系列
- // model: this.warehouseInfo.model||'',//型号
- // dialType: '',//机芯类型
- // caseMaterial: '',//表壳材质
- // dialDiameter: '',//表盘直径
- // material: '',//材质
- // size: '',//尺寸
- // yardage: '',//尺码
- // price: '',//官方指导价
- // productCondition: '',//商品成色 必填 1-闲置未使用 2-二手
- // detailPicFileList: [''],//细节图片
- // title: '',//商品标题
- // productNo: '',//商品货号
- // productAttribute: '1',//商品属性 必填 1-自有商品 2-寄卖商品 3-质押商品 4-其它
- // stock: '',//库存数量 必填
- costPrice: this.computedTotalCost || '',//总成本价
- // peerPrice: '',//同行价格
- // agentPrice: '',//代理价格
- // salePrice: '',//销售价格
- // productPosition: '',//商品位置
- // watchYear: '',//手表年份
- // identifyingPerson: '',//鉴定人员
- // identifyingPersonId: '',//鉴定人员id
- // recycleType: '1',//回收类型 1-线上 2-同行 3-门店 4-其它
- // label: '1', 1-完美 2-普通 3-瑕疵 4-假货 5-亏损
- // recyclePerson: '',//回收人员
- // recyclePersonId: '',//回收人员id
- // recycleBottomDesc: '',//回收留底图描述
- // recycleBottomFileList: [' '],//回收留底图
- recycleTime: dayjs().format('YYYY-MM-DD'),//回收时间 必填
- // indentifyCode: '',//独立编码
- // targetAudience: 'general',// general-通用 man-男 woman-女
- // productCard: '',//商品保卡 has-有 no-无
- // cardYear: '',//保卡年份 如果有商品保卡就有这个字段,如果没有商品保卡,这个字段为空
- // productCardPicFileList: [''],//商品保卡图片留底
- // productTag: '',//商品标签
- // productAttachment: '',//商品附件
- // productDesc: '',//商品备注
- // productDescPicFileList: [''],//商品备注图片
- // payType: '1',//付款方式 1:微信 2:支付宝 3:银行卡 4:现金 5:数字货币 6:挂账
- // submitType: 'inAndUp',//提交类型 onlyIn:仅入库 inAndUp:入库并上架
- // continuousWarehousing: '0',//是否连续入库 1:是 0:否
- }
- if (!this.currentReceipt.warehouseId) {
- //当没有仓库id的时候调用新增仓库接口
- await uni.$u.api.addWarehouse(warehouseData)
- } else {
- //当有仓库id的时候调用编辑仓库接口
- warehouseData.id = this.currentReceipt.warehouseId
- await uni.$u.api.updateWarehouse(warehouseData)
- }
- } else if (this.isWarehouse == '2') {
- //等于2的时候不放入仓库表
- }
- this.$refs.uToast.show({
- type: 'success',
- message: '入库成功',
- complete: () => {
- uni.navigateBack({
- delta: 1
- })
- }
- })
- } catch (error) {
- console.error('入库失败:', error)
- uni.$u.toast('入库失败')
- }
- }
- }
- })
- },
- /**
- * 上传分成
- */
- async addShare() {
- for (const item of this.profitSharingList) {
- const data = {
- id: item.id || '',
- accountType: item.accountType == '1' ? 1 : 2,
- clueId: this.currentReceipt.clueId,
- commissionRate: item.commissionRate,
- isCompanyPerformance: item.isCompanyPerformance == '1' ? 1 : 2,
- sendFormId: this.currentReceipt.sendFormId,
- userId: item.userId,
- userName: item.userName,
- receiptFormId: this.currentReceipt.id
- }
- if (item.id) {
- await uni.$u.api.clueCommissionUpdate(data)
- } else {
- await uni.$u.api.clueCommissionAdd(data)
- }
- }
- },
- selectIsWarehouse() {
- this.showIsWarehousePicker = true
- },
- handleConfirmIsWarehouse({ value }) {
- this.isWarehouse = value[0].value
- this.isWarehouseLabel = value[0].label
- this.showIsWarehousePicker = false
- },
- }
- }
- </script>
- <style scoped lang="scss">
- @import '../styles/common.scss';
- .page-four-container {
- @extend .page-container;
- padding-bottom: 100rpx;
- }
- .address-section {
- padding: 20rpx;
- // 防止 label 换行
- ::v-deep .u-form-item__body__left__content__label {
- white-space: nowrap !important;
- overflow: visible;
- }
- }
- .info-row {
- margin-bottom: 20rpx;
- }
- .info-input {
- height: 65rpx;
- border-radius: 8rpx;
- border: 1rpx solid #e5e7eb;
- padding: 20rpx 16rpx;
- width: 100%;
- box-sizing: border-box;
- }
- .info-textarea {
- width: 100%;
- box-sizing: border-box;
- ::v-deep .u-textarea {
- min-height: 200rpx;
- border-radius: 8rpx;
- border: 1rpx solid #e5e7eb;
- padding: 20rpx 16rpx;
- line-height: 1.5;
- }
- ::v-deep textarea {
- min-height: 200rpx;
- border-radius: 8rpx;
- width: 100%;
- box-sizing: border-box;
- line-height: 1.5;
- font-size: 28rpx;
- }
- }
- .click-wrapper {
- width: 100%;
- cursor: pointer;
- display: flex;
- align-items: center;
- }
- .image-uploader {
- width: 100%;
- height: 65rpx;
- border: 2rpx dashed #409eff;
- border-radius: 8rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- background-color: #ecf5ff;
- }
- .image-preview {
- width: 100%;
- height: 100%;
- object-fit: cover;
- border-radius: 10rpx;
- }
- .split-table {
- width: 100%;
- margin-top: 20rpx;
- }
- .split-table-header {
- background-color: #f5f7fa;
- padding: 15rpx 0;
- border-bottom: 1rpx solid #e4e7ed;
- }
- .split-table-row {
- padding: 15rpx 0;
- border-bottom: 1rpx solid #e4e7ed;
- align-items: center;
- }
- .header-text {
- @include font-styles($size: tiny, $weight: regular, $color: tertiary);
- text-align: center;
- display: block;
- }
- .table-cell {
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 0 10rpx;
- }
- .percentage-input {
- text-align: center;
- background-color: #f9f9f9;
- padding: 0rpx !important;
- }
- .account-type {
- padding: 4rpx 16rpx;
- border-radius: 12rpx;
- font-size: 24rpx;
- font-weight: 500;
- color: #fff;
- text-align: center;
- cursor: pointer;
- &.frontend {
- background-color: #409eff;
- }
- &.backend {
- background-color: #909399;
- }
- }
- .radio-wrapper {
- cursor: pointer;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .radio-circle {
- width: 32rpx;
- height: 32rpx;
- border-radius: 50%;
- border: 2rpx solid #dcdfe6;
- display: flex;
- align-items: center;
- justify-content: center;
- transition: all 0.3s ease;
- &.active {
- border-color: #67c23a;
- background-color: #67c23a;
- }
- }
- .confirm-button-container {
- display: flex;
- justify-content: center;
- align-items: center;
- padding: 40rpx 0;
- margin-top: 20rpx;
- }
- .next-btn {
- width: 95%;
- height: 80rpx;
- line-height: 80rpx;
- text-align: center;
- border-radius: 11px;
- }
- .add-button-container {
- justify-content: space-between;
- }
- </style>
|