partner-org-mainten.vue 10.6 KB
Newer Older
Nature's avatar
Nature committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<template>
  <h-view class="public-style partner-mainten" title="客户信息">
    <!--<h-header :has-border="false" class="bar-custom">
      <div slot="left" class="h-header-btn" @click="$routeGo()">
        <i class="ion-ios-arrow-back"/>
      </div>
      <div slot="center">客户信息</div>
      <div v-show="index===0 || index===2" slot="right" class="h-header-btn" @click="scanCard()">
        <i class="icon ion-qr-scanner" style="font-size: 0.4rem"/>
      </div>
    </h-header>-->
    <s-tab @tabClick="changeData">
      <tab-item>基本信息</tab-item>
      <tab-item>开票信息</tab-item>
      <tab-item>银行信息</tab-item>
    </s-tab>
    <h-content>
      <section v-show="tabIndex[0]">
        <list-item>
          <item>
            <section slot="name">客户名称</section>
            <section slot="content">
Nature's avatar
Nature committed
23
              \{{ bpMaster.bp_name }}
Nature's avatar
Nature committed
24 25 26 27 28
            </section>
          </item>
          <item>
            <section slot="name">客户类型</section>
            <section slot="content">
Nature's avatar
Nature committed
29
              \{{ bpMaster.bp_type_n }}
Nature's avatar
Nature committed
30 31 32 33 34
            </section>
          </item>
          <item>
            <section slot="name">客户分类</section>
            <section slot="content">
Nature's avatar
Nature committed
35
              \{{ bpMaster.bp_class_n }}
Nature's avatar
Nature committed
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348
            </section>
          </item>
        </list-item>
        <list-item>
          <item>
            <img slot="left-icon" src="@/assets/image/bpMaster/user@2x.png" class="left-icon">
            <section slot="name">工商信息</section>
          </item>
          <item>
            <section slot="name" class="required">法人姓名</section>
            <input
              slot="content" v-model="bpMaster.corporate_code" type="text" placeholder="请输入法人姓名">
          </item>
          <item>
            <section slot="name" class="required">联系电话</section>
            <input
              slot="content" v-model="bpMaster.cell_phone" type="text"
              placeholder="请输入联系电话">
          </item>
          <item>
            <section slot="name" class="required">组织机构代码</section>
            <input
              slot="content" v-model="bpMaster.organization_code" type="text" required
              placeholder="请输入组织机构代码">
          </item>
          <item>
            <section slot="name">营业执照号</section>
            <input
              slot="content" v-model="bpMaster.business_license_num" type="text"
              placeholder="请输入营业执照号">
          </item>
          <item>
            <section slot="name">税务登记号</section>
            <input
              slot="content" v-model="bpMaster.tax_registry_num" type="text"
              placeholder="请输入税务登记号">
          </item>
          <item :show-arrow="true">
            <section slot="name">注册时间</section>
            <input
              slot="content" v-model="bpMaster.founded_date" type="text"
              placeholder="请输入注册时间" readonly @click="foundedDateClick">
          </item>
          <item>
            <section slot="name">注册资本(万元)</section>
            <input
              slot="content" v-model="bpMaster.registered_capital" type="number"
              placeholder="请输入注册资本">
          </item>
          <item>
            <section slot="name">经营地址</section>
            <input
              slot="content" v-model="bpMaster.work_unit_address" type="text"
              placeholder="请输入经营地址">
          </item>

        </list-item>
      </section>
      <section v-show="tabIndex[1]">
        <list-item>
          <item :show-arrow="true">
            <section slot="name" class="">纳税人类型</section>
            <input
              slot="content" v-model="bpMaster.taxpayer_type_n" type="text" placeholder="请输入账号名称"
              readonly @click="taxpayerTypeClick">
          </item>
          <item>
            <section slot="name" class="">发票抬头</section>
            <input slot="content" v-model="bpMaster.invoice_title" type="text" placeholder="请输入发票抬头">
          </item>
          <item>
            <section slot="name" class="">发票地址及电话</section>
            <input slot="content" v-model="bpMaster.invoice_bp_address_phone_num" type="text" placeholder="请输入发票地址及电话">
          </item>
          <item>
            <section slot="name" class="">发票开户行及账号</section>
            <input slot="content" v-model="bpMaster.invoice_bp_bank_account" type="text" placeholder="请输入发票开户行及账号">
          </item>

        </list-item>
      </section>
      <section v-show="tabIndex[2]">
        <list-item>
          <item>
            <img slot="left-icon" src="@/assets/image/bpMaster/bank-card@2x.png" class="left-icon">
            <section slot="name">银行信息</section>
          </item>
          <item>
            <section slot="name" class="">账号名称</section>
            <input slot="content" v-model="bpAccount.bank_account_name" type="text" placeholder="请输入账号名称">
          </item>
          <item>
            <section slot="name" class="">银行账号</section>
            <input
              slot="content" v-model="bpAccount.bank_account_num" type="text" placeholder="请输入银行账号">
          </item>
          <item>
            <section slot="name" class="">银行名称</section>
            <input slot="content" v-model="bpAccount.bank_full_name" type="text" placeholder="请输入银行名称">
          </item>
          <item>
            <section slot="name" class="">支行名称</section>
            <input slot="content" v-model="bpAccount.bank_branch_name" type="text" placeholder="请输入支行名称">
          </item>
        </list-item>
      </section>
    </h-content>
    <bottom-tab>
      <tab-button @click.native="save">
        保存
      </tab-button>
    </bottom-tab>
  </h-view>
</template>

<script>
export default {
  name: 'PartnerOrgMainten',
  data () {
    return {
      index: 0,
      tabIndex: [1, 0, 0],
      bpMaster: {
        bp_id: '',
        bp_code: '',
        bp_name: '',
        bp_type: '',
        bp_type_n: '',
        bp_class: '',
        bp_class_n: '',
        bp_category: '',
        bp_category_n: '',
        province_id: null,
        province_id_n: null,
        city_sp: null,
        city_sp_n: null,
        corporate_code: '',
        cell_phone: '',
        organization_code: '',
        business_license_num: '',
        tax_registry_num: '',
        founded_date: '',
        registered_capital: '',
        taxpayer_type: '',
        taxpayer_type_n: '',
        invoice_title: '',
        invoice_bp_address_phone_num: '',
        invoice_bp_bank_account: '',
        contact_person: '',
        phone_extra: '',
        work_unit_address: '',
      },
      bpAccount: {
        bp_id: null,
        bank_account_id: null,
        bank_account_name: null,
        bank_account_num: null,
        bank_full_name: null,
        bank_branch_name: null,
      },
      taxpayerTypeList: [
        {
          'code': 'GENERAL_TAXPAYER',
          'code_name': '一般纳税人',
        },
        {
          'code': 'SMALL_SCALE_TAXPAYER',
          'code_name': '小规模纳税人',
        },
      ],
    }
  },
  watch: {
  },
  mounted () {
    this.bpAssign()
    this.load()
  },
  methods: {
    bpAssign () {
      let vm = this
      Object.assign(vm.bpMaster, vm.$route.params.bpData)
    },
    changeData (index) {
      let vm = this
      vm.index = index
      vm.tabIndex = [0, 0, 0]
      vm.tabIndex[index] = 1
    },

    /**
       * 加载时调用
       */
    load () {
      let vm = this
      /**
         * 加载商业伙伴
         * 和银行信息
         */
      if (vm.bpMaster.bp_id) {
        let url1 = $config.basePath + 'query_bp_master'
        let param1 = {
          'bp_id': vm.bpMaster.bp_id,
        }
        vm.hlsPopup.showLoading('请稍候')
        vm.hlsHttp.post(url1, param1).then(function (res) {
          vm.hlsPopup.hideLoading()
          if (res.result === 'S') {
            // 商业伙伴
            vm.bpMaster = Object.assign(vm.bpMaster, res.bpMaster_list[0])
            // 如果有银行信息则赋值
            if (res.account_list.length !== 0) {
              vm.bpAccount = Object.assign(vm.bpAccount, res.account_list[0])
            }
          }
        })
      }
    },

    taxpayerTypeClick () {
      let vm = this
      vm.hlsPopup.selectList({
        list: vm.taxpayerTypeList,
        code: 'taxpayer_type',
        object: vm.bpMaster,
        returnItem: function (index, obj) {
          vm.bpMaster = obj
        },
      })
    },

    foundedDateClick () {
      let vm = this
      vm.hlsPopup.showTime({
        nowDate: ' ',
        format: 'YYYY-MM-DD',
        callback: (date) => {
          vm.bpMaster.founded_date = date
        },
      })
    },

    // 保存函数
    save () {
      let vm = this
      if (!vm.bpMaster.corporate_code || !vm.bpMaster.organization_code) {
        vm.hlsPopup.showLongBottom('必输字段不能为空!')
      } else {
        let url = $config.basePath + 'bp_master_save'
        vm.bpMaster.user_id = window.localStorage.user_id
        let param = {
          master: vm.bpMaster,
        }
        vm.hlsPopup.showLoading('请稍候')
        vm.hlsHttp.post(url, param).then(function (res) {
          if (res.result === 'S') {
            vm.bpMaster.bp_id = res.resp_master[0].bp_id
            vm.bpAccount.bp_id = res.resp_master[0].bp_id
            // 调用银行信息保存;
            vm.saveBpAccount(vm.bpAccount)
            // hlsPopup.hideLoading();
          }
        })
      }
    },

    /**
       * 保存商业伙伴银行信息
       */
    saveBpAccount (account) {
      let vm = this
      let url = $config.basePath + 'bp_master_account_save'
      account.user_id = window.localStorage.user_id
      let param = {
        account: account,
      }
      hlsHttp.post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          vm.bpAccount.bank_account_id = res.resp_account[0].bank_account_id
          vm.hlsPopup.showLongBottom('保存成功')
        }
      })
    },
  },
}
</script>

<style lang="less">
  .partner-mainten {
    .hls-switch-tab-top {
      position: relative;
    }
    .content{
      padding-bottom: 100px;
    }
    .hls-item {
      .contents {
        .add-content {
          .right-icon {
            //transform: rotate(90deg);
          }
        }
      }
    }

    .bottom-tab-button {
      background-color: @headerColor;
      color: #fff;
    }
  }

</style>