| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <template>
- <view class="">
- <u-sticky offset-top="50">
- <u-subsection fontSize='25' mode='subsection' :list="list" :current="curNow" @change="sectionChange"
- activeColor='#157A2C'></u-subsection>
- </u-sticky>
- <view v-show='curNow===0'>
- <u--form style="margin: 0 20px;" labelPosition="left" :model="form" ref="uForm" labelWidth='140rpx'>
- <!-- @tap="showDeptPicker" -->
- <u-form-item label="客户名称" prop="contactName" borderBottom>
- <u--input style="width: 100%;" disabled :value='`${form.contactName}`'></u--input>
- </u-form-item>
- <!-- @tap="showUserPicker" -->
- <u-form-item label="商机名称" prop="name" borderBottom>
- <u--input style="width: 100%;" disabled v-model="form.name"></u--input>
- <!-- <u-icon slot="right" name="arrow-right"></u-icon> -->
- </u-form-item>
- <u-form-item label="负责人名称" prop="responsibleName" borderBottom>
- <u--input style="width: 100%;" disabled v-model="form.responsibleName"></u--input>
- </u-form-item>
- <u-form-item label="赢单率(%)" prop="winRate" borderBottom>
- <u--input style="width: 100%;" disabled v-model="form.winRate"></u--input>
- </u-form-item>
- <u-form-item label="预算(万元)" prop="budget" borderBottom>
- <u--input style="width: 100%;" disabled v-model="form.budget"></u--input>
- </u-form-item>
- <u-form-item label="商机阶段" prop="stageName" borderBottom>
- <u--input style="width: 100%;" disabled v-model="form.stageName"></u--input>
- </u-form-item>
- <u-form-item label="预计结单日期" prop="expectedClosingDate" borderBottom>
- <u--input style="width: 100%;" disabled v-model="form.expectedClosingDate"></u--input>
- </u-form-item>
- </u--form>
- </view>
- <view v-show='curNow===1'>
- <u-sticky offset-top="100">
- <u-tag :text="`总计: ${totalPrice.toFixed(2)}`" size="large" type="success"></u-tag>
- </u-sticky>
- <view v-for="(item,index) in form['productList']" :key="index">
- <u--form style="margin: 0 20px;" labelPosition="left" :model="form" :ref='`uForm${index}`'
- labelWidth='140rpx'>
- <u-row v-for="(key,index1) in tableField" :key="index1">
- <u-col :span="12">
- <u-form-item v-if="key.type=='date'" required :label="key.label"
- prop="produceDeliveryDeadline" borderBottom>
- <u--input style="width: 100%;" :disabled='key.disabled' v-model="item[key.field]"
- @click.native="(e)=>openCalendar(e,index)"></u--input>
- </u-form-item>
- <u-form-item v-else :label="key.label" :prop="key.field" borderBottom>
- <u--input style="width: 100%;" disabled v-model="item[key.field]"></u--input>
- </u-form-item>
- </u-col>
- </u-row>
- </u--form>
- <u-gap height="40" bgColor="#f0f0f0"></u-gap>
- </view>
- </view>
- <u-calendar :show="calendarShow" @confirm="confirm" @close='calendarShow=false'></u-calendar>
- </view>
- </template>
- <script>
- import {
- getBusinessOpportunityDetailAPI,
- businessOpportunityUpdateAPI
- } from '@/api/wt/index.js'
- export default {
- props: {
- businessId: {
- default: ''
- },
- taskDefinitionKey: {
- default: ''
- },
- },
- data() {
- return {
- form: {},
- calendarShow: false,
- tableField: [{
- label: '名称',
- field: 'productName',
- },
- {
- label: '编码',
- field: 'productCode',
- },
- {
- label: '类型',
- field: 'productCategoryName',
- },
- {
- label: '单价',
- field: 'singlePrice',
- },
- {
- label: '数量',
- field: 'totalCount',
- },
- {
- label: '合计',
- field: 'totalPrice',
- },
- {
- label: '生产交付交期',
- field: 'produceDeliveryDeadline',
- type: 'date',
- disabled: !['productionSupervisorApprove1','productionSupervisorApprove2'].includes(this.taskDefinitionKey)
- },
- ],
- list: ['基本信息', '产品清单'],
- totalPrice: 0,
- curNow: 0,
- curIndex: null,
- rules: {
- produceDeliveryDeadline: {
- type: 'string',
- required: true,
- message: '请选择生产交付日期',
- trigger: ['blur', 'change']
- },
- }
- }
- },
- async mounted() {
- await this.getDetailData(this.businessId);
- },
- methods: {
- sectionChange(index) {
- this.curNow = index;
- },
- async getDetailData(id) {
- const data = await getBusinessOpportunityDetailAPI(id);
- if (data) {
- this.form = data;
- console.log(this.form.productList)
- this.totalPrice = this.form.productList.reduce((num, row) => num += row.totalPrice, 0)
- }
- },
- openCalendar(e, index) {
- this.calendarShow = true
- this.curIndex = index
- },
- confirm(e) {
- this.$set(this.form.productList[this.curIndex], 'produceDeliveryDeadline', ...e)
- this.calendarShow = false
- },
- //
- getTableValue() {
- let validField = ['produceDeliveryDeadline']
- let valid = false
- for (var i = 0; i < validField.length; i++) {
- valid = this.form.productList.some(item => !!item[validField[i]] == false)
- if (valid) break
- }
- return new Promise(async (resolve, reject) => {
- valid ? reject(uni.$u.toast('请完善产品清单信息')) : resolve(this.form)
- })
- },
- }
- }
- </script>
- <style>
- </style>
|