123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- <template>
- <view class='content'>
- <view class='wrap'>
- <u--form ref="uForm">
- <u-form-item labelWidth='80' labelPosition='top' label="营业执照">
- <u-upload height='208' width='320' :fileList="fileList2" @afterRead="afterRead($event,1)" @delete="deletePic" name="2" multiple
- :maxCount="1">
- <image style='width:680rpx;height:417rpx;' src="@/static/image/enter/yingyezhizhao.png" mode=""></image>
- </u-upload>
- </u-form-item>
- <u-form-item labelWidth='80' labelPosition='top' label="经营许可证">
- <u-upload height='208' width='320' :fileList="fileList3" @afterRead="afterRead($event,2)" @delete="deletePic" name="3" multiple
- :maxCount="1">
- <image style='width:680rpx;height:417rpx;' src="@/static/image/enter/jingyingxukezheng.png" mode=""></image>
- </u-upload>
- </u-form-item>
- <u-form-item labelWidth='150' labelPosition='left' label="经营许可证有效期">
- <view style='text-align:right;' @click='openjyxkz'>{{currectData.operateCertificateDate?currectData.operateCertificateDate:'选择日期'}}<image src="@/static/image/yjt.png" mode=""
- style="margin-left:10rpx;width:12rpx;height: 21rpx;"></image></view>
- </u-form-item>
- <uni-calendar
- :insert="false"
- :lunar="true"
- ref="calendar"
- :start-date="startDate"
- @confirm="confirm"
- />
- </u--form>
- <view class="mercharts_footer">
- <button @click='submit' class="submit">提交</button>
- </view>
- </view>
- <u-modal :show="isSubmit" content='确定提交证件图片' @confirm="$u.debounce(confirmSubmit, 500)" showCancelButton
- @cancel="isSubmit=false" @close="isSubmit=false" closeOnClickOverlay></u-modal>
- </view>
- </template>
- <script>
- var that
- import uploadImage from '@/components/ossutil/uploadFile.js';
- export default {
- data() {
- return {
- isSubmit:false,
- currectData:{},
- fileList2:[],
- fileList3:[],
- startDate:'',
- }
- },
- onLoad() {
- that = this
- },
- onShow(){
- var date = new Date().toISOString().slice(0, 10)
- this.startDate=date
- if(uni.getStorageSync('myCateringdustry')){
- this.currectData=JSON.parse(uni.getStorageSync('myCateringdustry'))
- if(this.currectData.businessLicense){
- this.fileList2=[{url:this.currectData.businessLicense}]
- }
- if(this.currectData.operateCertificate){
- this.fileList3=[{url:this.currectData.operateCertificate}]
- }
- this.currectData.operateCertificateDate=this.parseTime(this.currectData.operateCertificateDate,'{y}-{m}-{d}')
- }
- },
- methods: {
- submit(){
- uni.showModal({
- title: '提示',
- content: '确定提交证件图片?',
- success (res) {
- if (res.confirm) {
- that.$u.debounce(that.confirmSubmit, 500)
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- }
- })
- },
- confirmSubmit() {
- uni.showLoading({
- title: '加载中',
- mask: true
- })
- this.$request.baseRequest('admin.tourism.foodInfo', 'update', {
- foodInfo: JSON.stringify(this.currectData)
- }, failres => {
- uni.showToast({
- icon: "none",
- title: failres.errmsg,
- duration: 3000
- });
-
- uni.hideLoading()
- }).then(res => {
- this.isSubmit = false
- uni.showToast({
- icon: "success",
- title: '编辑证件图片成功',
- duration: 2000
- });
- uni.setStorageSync('myCateringdustry',JSON.stringify(this.currectData))
- uni.navigateBack()
-
- })
- },
- openjyxkz(){
- this.$refs.calendar.open();
- },
- // 删除图片
- deletePic(event,status) {
- this[`fileList${event.name}`].splice(event.index, 1)
- that.indoorImageArray.splice(event.index, 1)
- that.currectData.indoorImage =that.indoorImageArray.toString()
- },
- // 新增图片
- async afterRead(event,status) {
- // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
- let lists = [].concat(event.file)
- let fileListLen = this[`fileList${event.name}`].length
- lists.map((item) => {
- this[`fileList${event.name}`].push({
- ...item,
- status: 'uploading',
- message: '上传中'
- })
- })
- for (let i = 0; i < lists.length; i++) {
- const result = await this.uploadFilePromise(lists[i].url,status)
-
- let item = this[`fileList${event.name}`][fileListLen]
- this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
- status: 'success',
- message: '',
- url: result
- }))
- fileListLen++
- console.log(that.currectData, this[`fileList${event.name}`])
-
- }
- },
- uploadFilePromise(res,status) {
- return new Promise((resolve, reject) => {
- uploadImage(res, 'cardImages/',
- result => {
- if(status==1){
- that.currectData.businessLicense = result
- }else if(status==2){
- that.currectData.operateCertificate = result
- }
- resolve(res)
- }
- )
- })
- },
- }
- }
- </script>
- <style>
- </style>
|