admin liche update for order bill upload as file

This commit is contained in:
xxb
2021-10-08 17:11:10 +08:00
committed by lccsw
parent 545e0c82d2
commit 2aa0a3aadc
6 changed files with 87 additions and 20 deletions
+2
View File
@@ -116,6 +116,8 @@ class Upload extends CI_Controller
$config['server'] = $this->qiniu->getUploadQiniuUrl(true);
$config['token'] = $this->qiniu->getToken($filename);
$config['file_title'] = substr($filename, strrpos($filename, '/')+1);
return $this->show_json('NOT_FOUND', $config);
}
+3 -4
View File
@@ -229,7 +229,7 @@
</div>
<div class="am-panel-bd am-g" style="margin-top: 10px;margin-bottom: 10px;">
<div class="am-form-inline">
<div class="am-form-group am-u-lg-6">
<div class="am-form-group am-u-lg-12">
<label class="am-para-label label-width"><span class="span-bold">发票:</span></label>
<div class="am-para-input">
<div class="am-form-inline">
@@ -241,9 +241,8 @@
</a>
</label>
</div>
<div class="am-form-group ml10" v-if="info.bill && info.bill.file">
<img data-tips-image style="height:auto;max-height:32px;max-width:32px;"
class="ml5 mt5" :src="info.bill.file"/>
<div class="am-form-group" v-if="info.bill && info.bill.file">
<a :href="info.bill.file" target="_blank" class="mt5" style="width:100px;line-height:20px;">查看发票</a>
</div>
<div class="am-form-group ml10">
<template v-if="info.status>=3">
+62 -10
View File
@@ -1,10 +1,10 @@
<form class="am-form am-form-horizontal" action="/receiver/orders/edit_bill" data-auto="true" method="post"
<form id="vue-bill" class="am-form am-form-horizontal" action="/receiver/orders/edit_bill" data-auto="true" method="post"
style="width: 90%;padding-top: 10px">
<input type="hidden" name="id" value="<?= $bill['id'] ?>">
<input type="hidden" name="id" v-model="info.id">
<div class="am-form-group">
<label class="am-para-label">到账金额:</label>
<div class="am-para-input w150">
<input type="number" id="fp_money" name="money" value="<?=$bill['money']?>"/>
<input type="number" id="fp_money" name="money" v-model="info.money"/>
</div>
</div>
@@ -13,23 +13,75 @@
<div class="am-para-input">
<div class="am-form-group am-form-file">
<button type="button" class="am-btn am-btn-default am-btn-sm"
data-file="1" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-field="file">
<i class="am-icon-cloud-upload"></i> 选择图片
<button type="button" class="am-btn am-btn-default am-btn-sm fl"
data-file="1" data-mark="file" data-type="pdf,jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-params-source="vue_bill.bill_file">
<i class="am-icon-cloud-upload"></i> 选择要上传的文件
</button>
<div class="photo-upload mt10 fl">
<div class="photo-upload-item" v-if="bill_file.src.length>0">
<a :href="bill_file.src" target="_blank" :data-value='bill_file.value' class="ml10 mt5"
style="width:100px;line-height:20px;">{{bill_file.title}}</a>
<span class="photo-upload-item-remove">
<i class="fa fa-remove" data-rm-vue="vue_bill.bill_file"></i>
</span>
</div>
</div>
<input type="hidden" name="file" value="<?=$bill['file']?>" class="layui-input">
<img data-tips-image style="height:auto;max-height:32px;max-width:32px" src="<?=$bill['src_file']?>"/>
<input type="hidden" name="file" v-model="info.file" class="layui-input">
</div>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 2rem">
<div class="am-para-input">
<button class="am-btn am-btn-secondary" type="submit">保存</button>
<button class="am-btn am-btn-secondary" type="button" @click="saveEdit">保存</button>
</div>
</div>
</form>
<script>
var vue_bill;
var loading = false;
$(function(){
vue_bill = new Vue({
el: '#vue-bill',
data: {
info: {},
bill_file:{src:'',value:'',title:''}
},
mounted: function () {
var that = this;
that.info = <?=json_encode($bill, JSON_UNESCAPED_UNICODE)?>;
that.bill_file = {
src: that.info.src_file,
value: that.info.file,
title: that.info.file.substring(that.info.file.lastIndexOf("/")+1)
};
},
methods:{
saveEdit:function(){
if(loading){
return;
}
loading = true;
var post_data = $('#vue-bill').serialize();
$.post("/receiver/orders/edit_bill", post_data, function (data) {
if (data.code) {
layer.msg(data.msg, {time: 2000, icon: 1}, function () {
window.location.reload();
});
} else {
layer.msg(data.msg, {icon: 2});
loading = false;
}
}, 'json');
}
},
watch:{
"bill_file.value":function(nv, ov){
this.info.file = nv;
}
}
});
});
</script>
+10 -3
View File
@@ -187,10 +187,17 @@
if(1 == mode){
//单张图替换对象
if(Object.prototype.toString.call(source) == "[object Array]"){//源数据为数组
console.log(source);
source.splice(0, 1, v);
source[0].src = v.src;
source[0].value = v.value;
source[0].width = v.width;
source[0].height = v.height;
source[0].rheight = v.rheight;
} else {//源数据为对象
source = v;
source.src = v.src;
source.value = v.value;
source.width = v.width;
source.height = v.height;
source.rheight = v.rheight;
}
} else if(0==mode || source.length<mode){
//多张图限制上传
+7 -3
View File
@@ -43,7 +43,7 @@
function uploaded(ret, file) {
var url = ret.url || ret.site_url;
var file_url = ret.file_url || url;
var file_title = ret.file_title || file.md5;
var file_title = ret.file_title || file.file_title || file.md5;
$('#' + file.id).attr('data-md5', file.md5).attr('data-src', url).attr('data-value', file_url).attr('data-title', file_title);
}
@@ -73,9 +73,13 @@
if(1 == mode){//只有一个替换
//单个替换对象
if(Object.prototype.toString.call(source) == "[object Array]"){//源数据为数组
source.splice(0, 1, v);
source[0].src = v.src;
source[0].value = v.value;
source[0].title = v.title;
} else {//源数据为对象
source = v;
source.src = v.src;
source.value = v.value;
source.title = v.title;
}
} else if(0==mode || source.length<mode){
source.push(v);
+3
View File
@@ -753,6 +753,9 @@ $(function () {
obj = obj[keys[i]];
}
if(index == undefined){
for(var k in obj){
obj[k] = '';
}
} else {
obj.splice(index, 1);
}