Commit 76b8812b authored by dcy's avatar dcy

Merge remote-tracking branch 'origin/dev' into dev

parents 48600ea5 a7115d5e
......@@ -17,7 +17,7 @@
// If absolute URL from the remote server is provided, configure the CORS
// header on that server.
//
const url = {data: 'data:application/pdf;base64,' + localStorage.pdfData} // './compressed.tracemonkey-pldi-09.pdf';
const url = './compressed.tracemonkey-pldi-09.pdf';
//
// The workerSrc property shall be specified.
......
/* Copyright 2014 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
"use strict";
if (!pdfjsLib.getDocument || !pdfjsViewer.PDFViewer) {
// eslint-disable-next-line no-alert
alert("Please build the pdfjs-dist library using\n `gulp dist-install`");
}
// The workerSrc property shall be specified.
//
pdfjsLib.GlobalWorkerOptions.workerSrc =
"../../node_modules/pdfjs-dist/build/pdf.worker.js";
// Some PDFs need external cmaps.
//
const CMAP_URL = "../../node_modules/pdfjs-dist/cmaps/";
const CMAP_PACKED = true;
const DEFAULT_URL = "../../web/compressed.tracemonkey-pldi-09.pdf";
// To test the AcroForm and/or scripting functionality, try e.g. this file:
// "../../test/pdfs/160F-2019.pdf"
const ENABLE_XFA = true;
const SEARCH_FOR = ""; // try "Mozilla";
const SANDBOX_BUNDLE_SRC = "../../node_modules/pdfjs-dist/build/pdf.sandbox.js";
const container = document.getElementById("viewerContainer");
const eventBus = new pdfjsViewer.EventBus();
// (Optionally) enable hyperlinks within PDF files.
const pdfLinkService = new pdfjsViewer.PDFLinkService({
eventBus,
});
// (Optionally) enable find controller.
const pdfFindController = new pdfjsViewer.PDFFindController({
eventBus,
linkService: pdfLinkService,
});
// (Optionally) enable scripting support.
const pdfScriptingManager = new pdfjsViewer.PDFScriptingManager({
eventBus,
sandboxBundleSrc: SANDBOX_BUNDLE_SRC,
});
const pdfViewer = new pdfjsViewer.PDFViewer({
container,
eventBus,
linkService: pdfLinkService,
findController: pdfFindController,
scriptingManager: pdfScriptingManager,
enableScripting: true, // Only necessary in PDF.js version 2.10.377 and below.
});
pdfLinkService.setViewer(pdfViewer);
pdfScriptingManager.setViewer(pdfViewer);
eventBus.on("pagesinit", function () {
// We can use pdfViewer now, e.g. let's change default scale.
pdfViewer.currentScaleValue = "page-width";
// We can try searching for things.
if (SEARCH_FOR) {
eventBus.dispatch("find", { type: "", query: SEARCH_FOR });
}
});
// Loading document.
const loadingTask = pdfjsLib.getDocument({
url: DEFAULT_URL,
cMapUrl: CMAP_URL,
cMapPacked: CMAP_PACKED,
enableXfa: ENABLE_XFA,
});
(async function () {
const pdfDocument = await loadingTask.promise;
// Document loaded, specifying document for the viewer and
// the (optional) linkService.
pdfViewer.setDocument(pdfDocument);
pdfLinkService.setDocument(pdfDocument, null);
})();
\ No newline at end of file
<!DOCTYPE html>
<!--
Copyright 2014 Mozilla Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html dir="ltr" mozdisallowselectionprint>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="google" content="notranslate">
<title>PDF.js viewer using built components</title>
<style>
body {
background-color: #808080;
margin: 0;
padding: 0;
}
#viewerContainer {
overflow: auto;
position: absolute;
width: 100%;
height: 100%;
}
</style>
<link rel="stylesheet" href="viewer.css">
<script src="./js/pdf.js"></script>
<script src="./viewer.js"></script>
</head>
<body tabindex="1">
<div id="viewerContainer">
<div id="viewer" class="pdfViewer"></div>
</div>
<script src="simpleviewer.js"></script>
</body>
</html>
\ No newline at end of file
......@@ -61,3 +61,12 @@ export function exportCouponExcel(query) {
responseType: 'blob'
})
}
// 获得用户可用优惠券
export function getCustomerAvailableCouponList(data){
return request({
url: '/product/coupon/customer/available/couponList',
method: 'post',
data
})
}
\ No newline at end of file
......@@ -112,11 +112,11 @@ export function specialNeedCreate(data){
}
// 获得提单pdf
export function getLadingBill(billLadingNo){
export function getLadingBill(query){
return request({
url:'ecw/order/billLading/template',
method: 'get',
responseType: 'arraybuffer',
params: {billLadingNo},
params: query,
})
}
......@@ -73,7 +73,7 @@ export default {
remoteMethod(keyword){
let params = {}
if(this.productType){
params.productType = this.productType
params.typeId = this.productType
}
params.titleZh = keyword
this.loading = true
......
......@@ -100,6 +100,7 @@ export const DICT_TYPE = {
ECW_SUING_METHOD: 'suing_method', // 出单方式
ECW_HARVEST_METHOD: 'harvest_method', // 收货方式
ECW_PAY_ADVANCE: 'pay_advance', // 是否预付
ECW_BEGINTIME_TYPE_ENDTIME: 'begintime_type_endtime', // 时间筛选字段(订单)
//--------ecw---------
CUSTOMER_STATUS: 'customer_status',
CUSTOMER_SOURCE: 'customer_source',
......
......@@ -435,3 +435,26 @@ export function arrryToKeyedObjectBy(arr, key){
})
return obj
}
// dataurl转blob
export function dataURLtoBlob(base64Data) {
//console.log(base64Data);//data:image/png;base64,
var byteString;
if(base64Data.split(',')[0].indexOf('base64') >= 0)
byteString = atob(base64Data.split(',')[1]);//base64 解码
else{
byteString = unescape(base64Data.split(',')[1]);
}
var mimeString = base64Data.split(',')[0].split(':')[1].split(';')[0];//mime类型 -- image/png
// var arrayBuffer = new ArrayBuffer(byteString.length); //创建缓冲数组
// var ia = new Uint8Array(arrayBuffer);//创建视图
var ia = new Uint8Array(byteString.length);//创建视图
for(var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
var blob = new Blob([ia], {
type: mimeString
});
return blob;
}
\ No newline at end of file
......@@ -170,7 +170,8 @@
label="适用用户"
prop="suitableUserType"
>
<dict-selector :type="DICT_TYPE.ECW_SUITABLE_USER_TYPE" v-model="form.suitableUserType" defaultable />
<dict-selector v-if="form.type != 1" :type="DICT_TYPE.ECW_SUITABLE_USER_TYPE" v-model="form.suitableUserType" defaultable />
<dict-selector form-type="radio" v-else :type="DICT_TYPE.ECW_SUITABLE_USER_TYPE" :filter="item => item.colorType == 'danger'" v-model="form.suitableUserType" defaultable />
<customers-selector v-if="showCustomerSelector" v-model="form.customerIds" style="margin-top:5px" />
</el-form-item>
<el-form-item
......
......@@ -39,6 +39,7 @@ export default {
detail: null,
preview: false,
billLadingNo: 'TD20220717',
type: 1,
pdfData: null
}
},
......@@ -57,7 +58,10 @@ export default {
},
methods:{
loadData(){
getLadingBill(this.billLadingNo)
getLadingBill({
billLadingNo: this.billLadingNo,
type: this.type
})
.then(arrayBuffer => {
this.pdfData = arrayBuffer
})
......
......@@ -233,8 +233,8 @@
</el-descriptions-item>
<el-descriptions-item label="其他费用">
<!--TODO 缺少其他费用字段-->
<el-input v-model="form.collectionProxy" placeholder="" style="width:200px"></el-input>
<selector v-model="form.collectionProxyCurrency" :options="currencyList" label-field="titleZh" value-field="id" defaultable style="width:100px" />
<el-input v-model="form.otherFee" placeholder="" style="width:100px"></el-input>
<selector v-model="form.otherFeeCurrencyId" :options="currencyList" label-field="titleZh" value-field="id" defaultable style="width:100px" />
</el-descriptions-item>
<el-descriptions-item label="原价" :span="2">
......@@ -249,8 +249,8 @@
<el-row v-for="(item, index) in getDictDatas(DICT_TYPE.ECW_COUPON_TYPE)" :key="item.value">
<el-col :span="2">{{index+1}}.{{item.label}}</el-col>
<el-col :span="4">
<el-select placeholder="">
</el-select>
<!-- <el-select placeholder="">
</el-select> -->
</el-col>
<el-col :span="2">-10美元</el-col>
<el-col :span="5">有效期:永久有效</el-col>
......@@ -397,6 +397,7 @@ import { getCustomer } from '@/api/ecw/customer';
import { getListTree } from "@/api/ecw/region";
import AreaSelector from '@/components/AreaSelector'
import {calculationPrice} from '@/api/ecw/product'
import {getCustomerAvailableCouponList} from '@/api/ecw/coupon'
export default {
name: "OrderEdit",
components: {
......@@ -426,6 +427,7 @@ export default {
transportList: [],
currencyList:[],
unitList:[],
couponList: [],
fee: {}, // 费用
// 表单参数
form: {
......@@ -520,8 +522,17 @@ export default {
consigneeContact(){
this.getConsignee()
},
productList(){
console.log('计算运费')
productList:{
deep: true,
handler(){
this.productList.map(item => {
item.prodAttrIds = item.prodAttrArr.join(',')
})
this.calculationPrice()
}
},
fee(){
this.getCoupons()
}
},
created() {
......@@ -540,36 +551,8 @@ export default {
}) */
if(this.$route.query.id){
getOffer(this.$route.query.id).then(res => {
this.$set(this, 'form', res.data)
if(res.data.offerProdRespVOList){
res.data.offerProdRespVOList.forEach(item => {
this.addProduct({
"goodsType": item.goodsType,
"brand": item.brand,
"unit": item.unit,
"channelId": item.channelId,
"lineId": item.lineId,
"prodId": item.prodId,
"num": item.num,
"boxGauge": item.boxGauge,
"volume": item.volume,
"transportId": item.transportId,
"weight": item.weight,
"worth": item.worth,
"prodAttrArr": item.prodAttrIds && item.prodAttrIds != '' ? item.prodAttrIds.split(',').filter(item => item != '').map(item => +item) : []
})
})
}
console.log('res.data.transportRespVOList', res.data.transportRespVOList)
res.data.transportRespVOList.forEach(item => {
let transport = this.transportList.find(t => t.transportId == item.transportId)
console.log(item.transportId, transport)
Object.assign(transport, item, {_enabled: true})
})
this.$nextTick(() => {
this.updateEnabledTransports()
})
getOrder(this.$route.query.id).then(res => {
})
}else this.addProduct()
},
......@@ -607,18 +590,32 @@ export default {
},
// 计算商品运费
calculationPrice(row){
let calcable = true
this.productList.forEach(item => {
if(!item.weight || !item.prodId){
calcable = false
}
})
if(this.calculating || !calcable) return false
this.calculating = true
console.log('calculationPrice', row)
if(!row.prodId || !this.form.transportId || !this.form.lineId)return false
/* if(!row.prodId || !this.form.transportId || !this.form.lineId)return false
if(row.prodAttrArr){
row.prodAttrIds = row.prodAttrArr.join(',')
}
} */
calculationPrice({
lineId: this.form.lineId,
transportId: this.form.transportId,
channelId: this.form.channelId,
prodConditionParamList: [row]
prodConditionParamList: this.productList //[row]
}).then(res => {
this.$set(row, 'fee', res.data.prodCostDtoList[0] || {})
this.$set(this, 'fee', res.data.costDto)
this.productList.map((item, index) => {
this.$set(item, 'fee', res.data.prodCostDtoList[index])
})
}).finally(() => {
this.calculating = false
})
},
// 获取路线
......@@ -648,9 +645,17 @@ export default {
this.productList.splice(index, 1)
})
},
// 显示更多报价
showMorePrice(index){
console.log('显示更多', index)
getCoupons(){
if(!this.form.consigneeContactsId || !this.form.consignorContactsId) return false
let data = Object.assign({}, this.form, {
prodConditionParamList: this.productList,
consigneeCustomerContactsId: this.form.consigneeContactsId,
consignorCustomerContactsId: this.form.consignorContactsId
})
getCustomerAvailableCouponList(data)
.then(res => {
this.couponList = res.data
})
},
/** 提交按钮 */
submitForm() {
......@@ -694,7 +699,7 @@ export default {
// 添加的提交
createOrder(data).then(response => {
this.$modal.msgSuccess("新增成功");
this.$router.replace('order')
this.$router.replace('success?orderId=' + response.data.id)
});
});
},
......
......@@ -18,8 +18,8 @@
<el-input v-model="queryParams.consigneeId" placeholder="收货人" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="日期筛选">
<dict-selector :type="DICT_TYPE.BEGINTIME_TYPE_ENDTYPE" v-model="dateFilterType" style="width: 220px;margin-right: 0" />
<el-date-picker v-model="dateFilter" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
<dict-selector :type="DICT_TYPE.ECW_BEGINTIME_TYPE_ENDTIME" v-model="dateFilterType" style="width: 150px; margin-right: 5px" />
<el-date-picker v-model="dateFilter" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd"></el-date-picker>
</el-form-item>
<el-form-item label="始发地" prop="startWarehouseId">
......@@ -152,13 +152,25 @@
v-hasPermi="['ecw:order:update']">特价</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['ecw:order:delete']">删除</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="printTagOrderId=scope.row.orderId">打印标签</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="printWarehouseReceiptOrderId=scope.row.orderId">打印入仓单</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="printLadingBillOrderId=scope.row.orderId">打印提单</el-button>
<el-button type="text" size="mini" @click="$router.push(`/order/fee-application/${scope.row.orderId}`)">费用申请</el-button>
<el-button type="text" size="mini" @click="orderId = scope.row.orderId;isShow = true" >特需</el-button>
<el-button type="text" size="mini" @click="$router.push(`/order/associated-order/${scope.row.orderId}`)" >关联</el-button>
<el-button type="text" size="mini" @click="$router.push(`/order/mutex-order/${scope.row.orderId}`)" >互斥</el-button>
<el-popover
style="margin-left: 10px;"
placement="bottom"
width="100"
trigger="hover">
<div style=" display:flex; flex-direction:column">
<el-button size="mini" type="text" @click="printTagOrderId=scope.row.orderId">打印标签</el-button>
<el-button size="mini" type="text" @click="printWarehouseReceiptOrderId=scope.row.orderId">打印入仓单</el-button>
<el-button size="mini" type="text" @click="printLadingBillOrderId=scope.row.orderId">打印提单</el-button>
</div>
<el-button type="text" slot="reference">打印</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
......@@ -323,6 +335,14 @@ export default {
},
importCityList() {
return this.tradeCityList.filter(item => item.type == 1)
},
combinedQueryParams(){
let timeParams = {}
if(this.dateFilterType && this.dateFilter){
timeParams['begin' + this.dateFilterType] = this.dateFilter[0]
timeParams['end' + this.dateFilterType] = this.dateFilter[1]
}
return Object.assign({}, this.queryParams, timeParams)
}
},
created() {
......@@ -331,26 +351,13 @@ export default {
getTradeCityList().then(res => this.tradeCityList = res.data)
},
methods: {
printTag(item){
},
/** 查询列表 */
getList() {
this.loading = true;
// 处理查询参数
let params = { ...this.queryParams };
console.log('params', params)
this.addBeginAndEndTime(params, this.dateRangeRucangtime, 'rucangtime');
this.addBeginAndEndTime(params, this.dateRangeDaogangtime, 'daogangtime');
this.addBeginAndEndTime(params, this.dateRangeQingguantime, 'qingguantime');
this.addBeginAndEndTime(params, this.dateRangePreLoadTime, 'preLoadTime');
this.addBeginAndEndTime(params, this.dateRangeLoadTime, 'loadTime');
this.addBeginAndEndTime(params, this.dateRangeUnloadTime, 'unloadTime');
this.addBeginAndEndTime(params, this.dateRangeTakeTime, 'takeTime');
this.addBeginAndEndTime(params, this.dateRangeSplitTime, 'splitTime');
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
console.log('this.combinedQueryParams', this.combinedQueryParams)
// 执行查询
getOrderPage(params).then(response => {
getOrderPage(this.combinedQueryParams).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
......@@ -436,33 +443,16 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
this.dateRangeRucangtime = [];
this.dateRangeDaogangtime = [];
this.dateRangeQingguantime = [];
this.dateRangePreLoadTime = [];
this.dateRangeLoadTime = [];
this.dateRangeUnloadTime = [];
this.dateRangeTakeTime = [];
this.dateRangeSplitTime = [];
this.dateRangeCreateTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加订单";
this.$router.push('edit')
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const orderId = row.orderId;
getOrder(orderId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改订单";
});
this.$router.push('edit?id=' + row.orderId)
},
/** 提交按钮 */
submitForm() {
......@@ -500,22 +490,10 @@ export default {
/** 导出按钮操作 */
handleExport() {
// 处理查询参数
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.addBeginAndEndTime(params, this.dateRangeRucangtime, 'rucangtime');
this.addBeginAndEndTime(params, this.dateRangeDaogangtime, 'daogangtime');
this.addBeginAndEndTime(params, this.dateRangeQingguantime, 'qingguantime');
this.addBeginAndEndTime(params, this.dateRangePreLoadTime, 'preLoadTime');
this.addBeginAndEndTime(params, this.dateRangeLoadTime, 'loadTime');
this.addBeginAndEndTime(params, this.dateRangeUnloadTime, 'unloadTime');
this.addBeginAndEndTime(params, this.dateRangeTakeTime, 'takeTime');
this.addBeginAndEndTime(params, this.dateRangeSplitTime, 'splitTime');
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
// 执行导出
this.$modal.confirm('是否确认导出所有订单数据项?').then(() => {
this.exportLoading = true;
return exportOrderExcel(params);
return exportOrderExcel(this.combinedQueryParams);
}).then(response => {
this.$download.excel(response, '${table.classComment}.xls');
this.exportLoading = false;
......
<template>
<div v-if="order">
<el-row class="wrapper">
<el-col :span="10" class="icon">
<img src="../../../assets/images/u5.png" />
</el-col>
<el-col :span="14">
<div class="title">新增订单生成成功</div>
<div class="line">订单号:{{order.orderNo}}</div>
<div class="line">运输方式:<dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="order.transportId" /></div>
<div class="line">路线:{{order.logisticsInfoDto.startTitleZh}} >> {{order.logisticsInfoDto.destTitleZh}}</div>
<div class="line">商品列表:
<span v-for="(item, index) in order.orderItemVOList" :key="index">
{{item.titleZh}}
<template v-if="index < order.orderItemVOList.length - 1"></template>
</span>
</div>
<div class="line">仓库地址:{{order.logisticsInfoDto.startAddressZh}}</div>
<div class="line">仓库电话: <!--TODO--></div>
<div class="line"></div>
<div class="line">您的订单已提交,谢谢您选择捷道物流!</div>
</el-col>
</el-row>
<div class="actions">
<el-button type="primary" @click="$router.replace('detail?orderId=' + order.orderId)">查看订单</el-button>
<el-button type="warning" @click="showNotice = true">入仓须知</el-button>
<el-button type="info" @click="$router.replace('edit')">再来一单</el-button>
</div>
<el-dialog title="查看须知" :visible.sync="showNotice" width="700px">
<img :src="noticeUrl" id="noticeImg" />
<div style="text-align:center">
<el-button type="primary" @click="download">下载</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {getOrder} from '@/api/ecw/order'
import FileSaver from 'file-saver'
import {dataURLtoBlob} from '@/utils/index'
export default {
data(){
return {
order: null,
showNotice: false,
noticeUrl: 'http://v4.groupage.cn/Public/images/notice.png'
}
},
created(){
this.loadData()
},
methods:{
loadData(){
getOrder(this.$route.query.orderId)
.then(res => {
this.order = res.data
})
},
download(){
let el = document.getElementById('noticeImg')
this.downloadIamge(this.noticeUrl, 'ce')
},
downloadIamge(imgsrc, name) {
//下载图片地址和图片名
var image = new Image()
// 解决跨域 Canvas 污染问题
image.setAttribute('crossOrigin', 'anonymous')
image.onload = function () {
var canvas = document.createElement('canvas')
canvas.width = image.width
canvas.height = image.height
var context = canvas.getContext('2d')
context.drawImage(image, 0, 0, image.width, image.height)
var base64 = canvas.toDataURL('image/png') //得到图片的base64编码数据
document.getElementById('noticeImg').setAttribute('src', base64)
window.base64 = base64
let blob = dataURLtoBlob(base64)
FileSaver.saveAs(blob, '入仓须知.png');
}
image.src = imgsrc
}
}
}
</script>
<style scoped lang="scss">
.wrapper{
padding:100px;
display: flex;
justify-content: center;
.icon{
display: flex;
justify-content: flex-end;
margin-right: 20px;
align-items: center;
img{
width: 200px;
height: 200px;
}
}
.title{
font-size: 30px;
margin-bottom: 20px;
}
.line{
font-size: 14px;
margin-bottom: 10px;
}
}
.actions{
display: flex;
justify-content: center;
}
</style>
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment