123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457 |
- <template>
- <div class="authPass-wrap">
- <a-page-header :ghost="false" :backIcon="false" class="authPass-back">
- <!-- 自定义的二级文字标题 -->
- <template slot="subTitle">
- <a id="authPass-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
- </template>
- </a-page-header>
- <a-spin :spinning="spinning" tip="Loading...">
- <a-card size="small" :bordered="false" class="authPass-table-page-wrapper">
- <a-form-model
- id="authPass-form"
- ref="ruleForm"
- :model="form"
- :rules="rules"
- :label-col="formItemLayout.labelCol"
- :wrapper-col="formItemLayout.wrapperCol"
- >
- <a-row :gutter="15">
- <a-col :span="12">
- <a-form-model-item label="门头照片" prop="storeImage">
- <Upload
- class="upload"
- id="authPass-storeImage"
- v-model="form.storeImage"
- ref="storeImage"
- :fileSize="10"
- :maxNums="1"
- @remove="removeImage1"
- @change="changeImage1"
- listType="picture-card"></Upload>
- <div class="upload-desc">说明:单张大小小于10Mb,最多1张。</div>
- </a-form-model-item>
- </a-col>
- <a-col :span="12">
- <a-form-model-item label="营业执照" prop="licenseImage">
- <Upload
- class="upload"
- id="authPass-licenseImage"
- v-model="form.licenseImage"
- ref="licenseImage"
- :fileSize="10"
- :maxNums="1"
- @remove="removeImage2"
- @change="changeImage2"
- listType="picture-card"></Upload>
- <div class="upload-desc">说明:单张大小小于10Mb,最多1张。</div>
- </a-form-model-item>
- </a-col>
- <a-col :span="12">
- <a-form-model-item label="门店名称" prop="storeName">
- <a-input id="authPass-storeName" :maxLength="30" v-model.trim="form.storeName" placeholder="请输入门店名称(最多30个字符)" allowClear />
- </a-form-model-item>
- </a-col>
- </a-row>
- <a-row :gutter="15">
- <a-col :span="12">
- <a-form-model-item label="客户地址" required style="margin: 0;">
- <a-row :gutter="15">
- <!-- 客户地址 -->
- <a-col span="6">
- <a-form-model-item prop="addrProvince">
- <a-select id="authPass-addrProvince" allowClear @change="getCityList" v-model="form.addrProvince" placeholder="请选择省">
- <a-select-option v-for="item in addrProvinceList" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
- </a-select>
- </a-form-model-item>
- </a-col>
- <a-col span="6">
- <a-form-model-item prop="addrCity">
- <a-select id="authPass-addrCity" allowClear @change="getAreaList" v-model="form.addrCity" placeholder="请选择市">
- <a-select-option v-for="item in addrCityList" :value="item.areaSn" :key="item.areaSn + 'b'">{{ item.name }}</a-select-option>
- </a-select>
- </a-form-model-item>
- </a-col>
- <a-col span="6">
- <a-form-model-item prop="addrDistrict">
- <a-select id="authPass-addrDistrict" allowClear @change="areaCharged" v-model="form.addrDistrict" placeholder="请选择区/县">
- <a-select-option v-for="item in addrDistrictList" :value="item.areaSn" :key="item.areaSn + 'c'">{{ item.name }}</a-select-option>
- </a-select>
- </a-form-model-item>
- </a-col>
- </a-row>
- </a-form-model-item>
- </a-col>
- <a-col :span="12">
- <a-form-model-item label="详细地址" prop="addrDetail">
- <a-textarea id="authPass-addrDetail" :maxLength="100" v-model.trim="form.addrDetail" placeholder="请输入详细地址(最多100个字符)" allowClear />
- </a-form-model-item>
- </a-col>
- </a-row>
- <a-row :gutter="15">
- <a-col :span="12">
- <a-form-model-item label="联系人姓名" prop="contactName">
- <a-input
- id="authPass-contactName"
- :maxLength="20"
- v-model.trim="form.contactName"
- @change="filterEmpty"
- placeholder="请输入联系人姓名(最多20个字符)"
- allowClear />
- </a-form-model-item>
- </a-col>
- <a-col :span="12">
- <a-form-model-item label="联系人手机" prop="contactPhone">
- <a-input
- id="authPass-contactPhone"
- :maxLength="30"
- disabled
- v-model.trim="form.contactPhone"
- allowClear />
- </a-form-model-item>
- </a-col>
- <a-col :span="12">
- <a-form-model-item label="结算方式" prop="settleType">
- <v-select
- code="SHELF_SETTLE_TYPE"
- id="authPass-settleType"
- v-model="form.settleType"
- allowClear
- placeholder="请选择结算方式"
- ></v-select>
- </a-form-model-item>
- </a-col>
- <a-col :span="12">
- <a-form-model-item label="关联客户" prop="customerSn">
- <custList id="authPass-customerSn" ref="custList" :isEnabled="true" @change="custChange"></custList>
- </a-form-model-item>
- </a-col>
- <a-col :span="12" v-if="form.settleType == 'CREDIT'">
- <a-form-model-item label="授信额度" prop="creditLimit">
- <a-input-number
- :min="100"
- :max="9999999"
- style="width:100%"
- id="authPass-creditLimit"
- :precision="2"
- v-model="form.creditLimit"
- placeholder="请输入大于100的数字(最多允许两位小数)"></a-input-number>
- </a-form-model-item>
- </a-col>
- <a-col :span="12">
- <a-form-model-item prop="showPrice">
- <template slot="label">
- <a-tooltip placement="top">
- <template slot="title">
- 不勾选则不显示价格,结算价:即易码通进货价。
- </template>
- 价格权限设置<a-icon type="question-circle" style="color: rgba(0,0,0,.65);font-size: 16px;margin-left: 2px;vertical-align: sub;cursor: pointer;" />
- </a-tooltip>
- </template>
- <a-checkbox-group v-model="showPrice">
- <div style="display: flex;padding:10px 0;">
- <div style="width: 80px;font-weight: bold;">货架产品:</div>
- <a-checkbox value="shelf_price_show" id="authPass-shelf_price_show">
- 车主价
- </a-checkbox>
- <a-checkbox value="shelf_cost_show" id="authPass-shelf_cost_show">
- 结算价
- </a-checkbox>
- </div>
- <div style="display: flex;padding:10px 0;">
- <div style="width: 80px;font-weight: bold;">非货架产品:</div>
- <a-checkbox value="non_shelf_price_show" id="authPass-nonshelf_price_show">
- 车主价
- </a-checkbox>
- <a-checkbox value="non_shelf_cost_show" id="authPass-nonshelf_cost_show">
- 结算价
- </a-checkbox>
- </div>
- </a-checkbox-group>
- </a-form-model-item>
- </a-col>
- </a-row>
- <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;margin-top: 30px;">
- <a-button type="primary" @click="saveForm" size="large" id="authPass-btn-submit" style="padding: 0 60px;">审核通过</a-button>
- </a-form-model-item>
- </a-form-model>
- </a-card>
- </a-spin>
- </div>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { STable, VSelect, Upload } from '@/components'
- import custList from '@/views/common/custList.vue'
- // 接口
- import { getAreaCgj } from '@/api/data'
- import { xprhStoreApplyDetail, xprhStoreApplyAudit } from '@/api/approveStore'
- import { updateShelfPriceShow } from '@/api/shelf'
- export default {
- name: 'ApproveStoreAuthPass',
- components: { STable, VSelect, custList, Upload },
- mixins: [commonMixin],
- data () {
- return {
- spinning: false,
- formItemLayout: {
- labelCol: { span: 6 },
- wrapperCol: { span: 16 }
- },
- form: {
- storeName: '', // 门店名称
- contactPhone: '', // 联系手机
- contactName: '', // 联系人
- addrProvince: undefined, // 省
- addrProvinceName: '',
- addrCity: undefined, // 市
- addrCityName: '',
- addrDistrict: undefined, // 区
- addrDistrictName: '',
- addrDetail: '', // 详细地址
- storeImage: '', // 门头照片
- licenseImage: '', // 营业执照
- settleType: '', // 结算方式
- customerSn: undefined, // 关联客户
- creditLimit: '', // 授信额度
- delearSn: undefined,
- applySn: undefined,
- auditStatus: 'PASS' // 通过
- },
- showPrice: ['shelf_price_show', 'non_shelf_price_show'], // 价格显示
- rules: {
- storeImage: [{ required: true, message: '请上传门头照片', trigger: 'change' }],
- storeName: [{ required: true, message: '请输入门店名称', trigger: 'change' }],
- addrProvince: [{ required: true, message: '请选择省', trigger: 'change' }],
- addrCity: [{ required: true, message: '请选择市', trigger: 'change' }],
- addrDistrict: [{ required: true, message: '请选择区/县', trigger: 'change' }],
- addrDetail: [{ required: true, message: '请输入详细地址', trigger: 'change' }],
- contactName: [{ required: true, message: '请输入联系人姓名', trigger: 'change' }],
- settleType: [{ required: true, message: '请选择收结算方式', trigger: 'change' }],
- customerSn: [{ required: true, message: '请选择关联客户', trigger: 'change' }],
- creditLimit: [{ required: true, message: '请输入授信额度', trigger: 'change' }]
- },
- addrProvinceList: [], // 省下拉
- addrCityList: [], // 市下拉
- addrDistrictList: [], // 区下拉
- settleStyleList: [] // 收款方式 下拉数据
- }
- },
- methods: {
- // 过滤空字符
- filterEmpty () {
- let str = this.form.storeName
- str = str.replace(/\ +/g, '')
- str = str.replace(/[ ]/g, '')
- str = str.replace(/[\r\n]/g, '')
- this.form.storeName = str
- },
- // 关联客户
- custChange (obj, row) {
- this.form.customerSn = row ? row.customerSn : undefined
- },
- // 门店图片上传
- changeImage1 (file) {
- this.form.storeImage = file
- },
- // 删除门店图片
- removeImage1 () {
- this.form.storeImage = ''
- this.$refs.storeImage.setFileList('')
- },
- // 营业执照图片上传
- changeImage2 (file) {
- this.form.licenseImage = file
- },
- // 删除营业执照图片
- removeImage2 () {
- this.form.licenseImage = ''
- this.$refs.licenseImage.setFileList('')
- },
- // 获取客户信息
- getDetail () {
- xprhStoreApplyDetail({ sn: this.$route.params.sn }).then(res => {
- if (res.status == 200) {
- if (res.data.addrProvince) { this.getArea('city', res.data.addrProvince) }
- if (res.data.addrDistrict) { this.getArea('district', res.data.addrCity) }
- this.form = Object.assign(this.form, res.data)
- this.$refs.storeImage.setFileList(res.data.storeImage)
- this.$refs.licenseImage.setFileList(res.data.licenseImage)
- this.form.auditStatus = 'PASS' // 通过
- } else {
- this.$refs.ruleForm.resetFields()
- }
- })
- },
- // 保存门店信息
- saveForm () {
- const _this = this
- _this.$refs.ruleForm.validate(valid => {
- if (valid) {
- _this.$confirm({
- title: '操作提示',
- content: <div><div>审核通过后,即可成为认证门店,</div><div>确认审核通过吗?</div></div>,
- centered: true,
- closable: true,
- onOk () {
- _this.handleSubmit()
- }
- })
- } else {
- return false
- }
- })
- },
- // 提交门店数据
- handleSubmit (e) {
- const _this = this
- _this.spinning = true
- xprhStoreApplyAudit(_this.form).then(res => {
- if (res.status == 200) {
- const shelfSn = res.data.shelfSn
- // 更新价格显示设置
- const priceStr = [
- { paramCode: 'shelf_price_show', paramValue: 0 },
- { paramCode: 'shelf_cost_show', paramValue: 0 },
- { paramCode: 'non_shelf_price_show', paramValue: 0 },
- { paramCode: 'non_shelf_cost_show', paramValue: 0 }
- ]
- priceStr.map(item => {
- item.paramValue = _this.showPrice.includes(item.paramCode) ? 1 : 0
- })
- // 保存价格显示
- updateShelfPriceShow({
- shelfSn: shelfSn,
- paramValue: priceStr
- }).then(ret => {
- if (ret.status == 200) {
- setTimeout(() => {
- _this.$message.success(res.message)
- _this.handleBack()
- _this.spinning = false
- }, 100)
- } else {
- _this.spinning = false
- }
- })
- } else {
- _this.spinning = false
- }
- })
- },
- // 返回列表
- handleBack () {
- this.$router.push({ name: 'approveStoreList' })
- },
- // 获取城市列表
- getCityList (val) {
- this.addrCityList = []
- this.addrDistrictList = []
- this.form.addrCity = undefined
- this.form.addrDistrict = undefined
- if (val) {
- this.getArea('city', val)
- this.form.addrProvinceName = this.addrProvinceList.find(item => item.areaSn == val).name
- } else {
- this.form.addrProvinceName = ''
- }
- },
- // 获取区县列表
- getAreaList (val) {
- this.addrDistrictList = []
- this.form.addrDistrict = undefined
- if (val) {
- this.getArea('district', val)
- this.form.addrCityName = this.addrCityList.find(item => item.areaSn == val).name
- } else {
- this.form.addrCityName = ''
- }
- },
- // 区县变更
- areaCharged (val) {
- if (val) {
- this.form.addrDistrictName = this.addrDistrictList.find(item => item.areaSn == val).name
- } else {
- this.form.addrDistrictName = ''
- }
- },
- // 省/市/区
- getArea (leve, sn) {
- let params
- if (leve == 'province') {
- params = { type: '2' }
- } else {
- params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
- }
- getAreaCgj(params).then(res => {
- if (res.status == 200) {
- if (leve == 'province') {
- this.addrProvinceList = res.data || []
- } else if (leve == 'city') {
- this.addrCityList = res.data || []
- } else if (leve == 'district') {
- this.addrDistrictList = res.data || []
- }
- } else {
- if (leve == 'province') {
- this.addrProvinceList = []
- } else if (leve == 'city') {
- this.addrCityList = []
- } else if (leve == 'district') {
- this.addrDistrictList = []
- }
- }
- })
- },
- // 获取基础数据
- getBaseData () {
- this.getArea('province') // 省市区
- this.$refs.ruleForm.resetFields()
- },
- // 初始页面
- initPage () {
- // 获取审核信息
- this.getBaseData()
- // 编辑页
- if (this.$route.params.sn) {
- this.getDetail()
- }
- }
- },
- mounted () {
- this.initPage()
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {
- console.log('beforeRouteEnter')
- })
- }
- }
- </script>
- <style lang="less" scoped>
- .authPass-wrap {
- height: 100%;
- >.ant-spin-nested-loading{
- overflow-y: auto;
- height: calc(100% - 52px);
- .ant-spin-container{
- height: 100%;
- }
- .upload-desc {
- color:#999;
- clear:both;
- }
- }
- .ant-form-item-children{
- display:block;
- }
- .authPass-back {
- margin-bottom: 10px;
- }
- .authPass-table-page-wrapper{
- height: 100%;
- }
- }
- </style>
|