Compare commits
4 Commits
7415eb9f60
...
1b50cae07b
Author | SHA1 | Date |
---|---|---|
|
1b50cae07b | |
|
b97398d075 | |
|
cdc3efb281 | |
|
e66db9a9ec |
34
api/admin.js
34
api/admin.js
|
@ -74,6 +74,14 @@ export function getAdminOrderDetail(merId, orderId) {
|
||||||
login: true
|
login: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 其他订单详情
|
||||||
|
*/
|
||||||
|
export function getAdminOtherOrderDetail(merId, orderId) {
|
||||||
|
return request.get("admin/other/" + merId + "/order/" + orderId, {}, {
|
||||||
|
login: true
|
||||||
|
});
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 订单发货信息获取
|
* 订单发货信息获取
|
||||||
*/
|
*/
|
||||||
|
@ -91,6 +99,15 @@ export function setAdminOrderDelivery(merId, id, data) {
|
||||||
login: true
|
login: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 其他订单发货保存
|
||||||
|
*/
|
||||||
|
export function setAdminOtherOrderDelivery(merId, id, data) {
|
||||||
|
return request.post("admin/other/" + merId + "/delivery/" + id, data, {
|
||||||
|
login: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单统计图
|
* 订单统计图
|
||||||
*/
|
*/
|
||||||
|
@ -149,6 +166,13 @@ export function verifierOrder(mer_id, code) {
|
||||||
export function orderStatistics(mer_id, data) {
|
export function orderStatistics(mer_id, data) {
|
||||||
return request.get("admin/" + mer_id + "/statistics", data);
|
return request.get("admin/" + mer_id + "/statistics", data);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 其他订单统计数
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
export function otherOrderStatistics(mer_id, data) {
|
||||||
|
return request.get("admin/other/" + mer_id + "/statistics", data);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 订单
|
* 订单
|
||||||
* @returns {*}
|
* @returns {*}
|
||||||
|
@ -174,6 +198,15 @@ export function getOrderList(where, merId) {
|
||||||
login: true
|
login: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 其他订单列表
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
export function getOtherOrderList(where, merId) {
|
||||||
|
return request.get(`admin/other/${merId}/order_list`, where, {
|
||||||
|
login: true
|
||||||
|
});
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 退款订单列表
|
* 退款订单列表
|
||||||
* @returns {*}
|
* @returns {*}
|
||||||
|
@ -270,6 +303,7 @@ export function setRefundMark(merId, orderId, data) {
|
||||||
login: true
|
login: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 去核销
|
* 去核销
|
||||||
* @param object data
|
* @param object data
|
||||||
|
|
37
api/order.js
37
api/order.js
|
@ -47,6 +47,14 @@ export function getOrderList(data) {
|
||||||
return request.get('order/list', data);
|
return request.get('order/list', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 其他订单列表
|
||||||
|
* @param object data
|
||||||
|
*/
|
||||||
|
export function getOtherOrderList(data) {
|
||||||
|
return request.get('other_order/list', data);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单产品信息
|
* 订单产品信息
|
||||||
* @param string unique
|
* @param string unique
|
||||||
|
@ -78,6 +86,13 @@ export function orderPay(id, data) {
|
||||||
export function orderData(data) {
|
export function orderData(data) {
|
||||||
return request.get('order/number', data)
|
return request.get('order/number', data)
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 其他订单统计数据
|
||||||
|
*/
|
||||||
|
export function otherOrderData(data) {
|
||||||
|
return request.get('other_order/number', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单取消
|
* 订单取消
|
||||||
|
@ -114,6 +129,14 @@ export function getOrderDetail(uni) {
|
||||||
return request.get('order/detail/' + uni);
|
return request.get('order/detail/' + uni);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 其他订单详情
|
||||||
|
* @param string uni
|
||||||
|
*/
|
||||||
|
export function getOtherOrderDetail(uni) {
|
||||||
|
return request.get('other_order/detail/' + uni);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 未付款订单详情
|
* 未付款订单详情
|
||||||
* @param string uni
|
* @param string uni
|
||||||
|
@ -145,6 +168,16 @@ export function orderTake(uni) {
|
||||||
return request.post('order/take/' + uni);
|
return request.post('order/take/' + uni);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 其他订单收货
|
||||||
|
* @param string uni
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
export function otherOrderTake(uni) {
|
||||||
|
return request.post('other_order/take/' + uni);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单查询物流信息
|
* 订单查询物流信息
|
||||||
* @returns {*}
|
* @returns {*}
|
||||||
|
@ -218,6 +251,10 @@ export function orderCreate(data) {
|
||||||
export function createOrder(data) {
|
export function createOrder(data) {
|
||||||
return request.post("v2/order/create", data, { noAuth: true });
|
return request.post("v2/order/create", data, { noAuth: true });
|
||||||
}
|
}
|
||||||
|
// 生成其他订单
|
||||||
|
export function createOtherOrder(data) {
|
||||||
|
return request.post("other_order/create", data);
|
||||||
|
}
|
||||||
// 未支付订单
|
// 未支付订单
|
||||||
export function groupOrderList(data) {
|
export function groupOrderList(data) {
|
||||||
return request.get("order/group_order_list", data, { noAuth: true });
|
return request.get("order/group_order_list", data, { noAuth: true });
|
||||||
|
|
|
@ -0,0 +1,115 @@
|
||||||
|
<template>
|
||||||
|
<view class="component text-center">
|
||||||
|
<view class="component-title">蛋黄酥</view>
|
||||||
|
<view class="component-code">
|
||||||
|
<tki-barcode
|
||||||
|
ref="barcode"
|
||||||
|
onval
|
||||||
|
:val="code"
|
||||||
|
:load-make="true"
|
||||||
|
:opations="barOpations"/>
|
||||||
|
</view>
|
||||||
|
<view class="example">{{code}}</view>
|
||||||
|
<!-- <view class="component-qr">
|
||||||
|
<tki-qrcode
|
||||||
|
ref="qrcode"
|
||||||
|
onval
|
||||||
|
:val="code"
|
||||||
|
:size="250"
|
||||||
|
:load-make="true"
|
||||||
|
:show-loading="false"/>
|
||||||
|
</view> -->
|
||||||
|
<!-- <view class="coupon-no-view">
|
||||||
|
<text>编号:</text>
|
||||||
|
<text class="coupon-no">{{ code }}</text>
|
||||||
|
</view> -->
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import tkiBarcode from '@/components/tki-barcode/tki-barcode'
|
||||||
|
import tkiQrcode from '@/components/tki-qrcode/tki-qrcode'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
tkiBarcode,
|
||||||
|
tkiQrcode
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
code: '',
|
||||||
|
barOpations: {
|
||||||
|
height: 150,
|
||||||
|
displayValue: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init () {
|
||||||
|
this.code = '0000000000000' // 生成一维码和二维码
|
||||||
|
// setTimeout(() => {
|
||||||
|
// this.code = '0987654321' // 5 秒后刷新一维码和二维码
|
||||||
|
// }, 5000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.component {
|
||||||
|
border-radius: 16rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background: #FFFFFF;
|
||||||
|
flex: 1;
|
||||||
|
margin: 32rpx;
|
||||||
|
padding: 64rpx 32rpx;
|
||||||
|
&-title {
|
||||||
|
max-height: 112rpx;
|
||||||
|
font-size: 40rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 56rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
&-code {
|
||||||
|
height: 150rpx;
|
||||||
|
margin: 32rpx 32rpx 0;
|
||||||
|
}
|
||||||
|
&-qr {
|
||||||
|
height: 250rpx;
|
||||||
|
margin-top: 36rpx;
|
||||||
|
}
|
||||||
|
.coupon-no-view {
|
||||||
|
margin: 0 18rpx;
|
||||||
|
height: 76rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
border: 2px solid #F5F5F5;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 24rpx;
|
||||||
|
margin-top: 36rpx;
|
||||||
|
text {
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
&:first-child {
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.coupon-no {
|
||||||
|
flex: 1;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.component-title{
|
||||||
|
text-align: center;
|
||||||
|
font-size: 34rpx;
|
||||||
|
}
|
||||||
|
.example {
|
||||||
|
text-align: center;
|
||||||
|
letter-spacing: 12rpx; /* 设置字符间距 */
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -106,7 +106,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="right-btn-box">
|
<view class="right-btn-box" v-if="btn">
|
||||||
<view class="btn-item err" v-if="item.is_refund ==1">退款中 x
|
<view class="btn-item err" v-if="item.is_refund ==1">退款中 x
|
||||||
{{item.product_num - item.refund_num}}</view>
|
{{item.product_num - item.refund_num}}</view>
|
||||||
<view class='btn-item err' v-if="item.is_refund >1">已退款 x {{item.product_num - item.refund_num}}
|
<view class='btn-item err' v-if="item.is_refund >1">已退款 x {{item.product_num - item.refund_num}}
|
||||||
|
@ -181,7 +181,11 @@
|
||||||
order_status:{
|
order_status:{
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0,
|
default: 0,
|
||||||
}
|
},
|
||||||
|
btn:{
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: mapGetters(['viewColor']),
|
computed: mapGetters(['viewColor']),
|
||||||
data() {
|
data() {
|
||||||
|
|
|
@ -78,7 +78,7 @@ import { Toast } from '../libs/uniApi';
|
||||||
name: "shortPopup",
|
name: "shortPopup",
|
||||||
props: {
|
props: {
|
||||||
source:{
|
source:{
|
||||||
type: Number,
|
type: String | Number,
|
||||||
default: null
|
default: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -230,7 +230,7 @@ import { Toast } from '../libs/uniApi';
|
||||||
product_attr_unique: this.sku[this.changeSkuKey].unique,
|
product_attr_unique: this.sku[this.changeSkuKey].unique,
|
||||||
product_id: this.datas.product_id,
|
product_id: this.datas.product_id,
|
||||||
product_type: this.datas.product_type,
|
product_type: this.datas.product_type,
|
||||||
source: this.source||200, // 200-供货采购
|
source: this.source||13, // 13-供货采购
|
||||||
spread_id: "",
|
spread_id: "",
|
||||||
}
|
}
|
||||||
let that = this
|
let that = this
|
||||||
|
|
|
@ -0,0 +1,190 @@
|
||||||
|
const barcodes = require('./barcodes/index.js')['default'];
|
||||||
|
let barcode = {};
|
||||||
|
(function () {
|
||||||
|
// 初始化
|
||||||
|
barcode = function (cont, ctxid, options, ctxsize, result) {
|
||||||
|
let ops = {}, newOptions, encodings, globaContext, ctx, globaCtxid, cbCanvasSize, cbResult;
|
||||||
|
globaCtxid = ctxid
|
||||||
|
cbCanvasSize = ctxsize
|
||||||
|
cbResult = result
|
||||||
|
newOptions = Object.assign(ops, options);
|
||||||
|
// 修成margin
|
||||||
|
fixMargin(newOptions)
|
||||||
|
// 处理options 数据
|
||||||
|
if (newOptions.text == '' || cont == '') {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// 获取ctx
|
||||||
|
globaContext = cont
|
||||||
|
ctx = uni.createCanvasContext(globaCtxid, globaContext)
|
||||||
|
// 获取编码数据
|
||||||
|
encodings = new barcodes[newOptions.format.toUpperCase()](newOptions.text, newOptions).encode()
|
||||||
|
let fixencodings = fixEncodings(encodings, newOptions)
|
||||||
|
// 返回canvas实际大小
|
||||||
|
cbCanvasSize({ width: fixencodings.width, height: fixencodings.height })
|
||||||
|
// 绘制canvas
|
||||||
|
setTimeout(() => {
|
||||||
|
drawCanvas.render(newOptions, fixencodings)
|
||||||
|
}, 50);
|
||||||
|
// 绘制canvas
|
||||||
|
let drawCanvas = {
|
||||||
|
render(options, encoding) {
|
||||||
|
this.prepare(options, encoding)
|
||||||
|
encoding.encodings.forEach((v, i) => {
|
||||||
|
this.barcode(options, v)
|
||||||
|
this.text(options, v)
|
||||||
|
this.move(v)
|
||||||
|
});
|
||||||
|
this.draw(options, encoding)
|
||||||
|
},
|
||||||
|
barcode(options, encoding) {
|
||||||
|
let binary = encoding.data;
|
||||||
|
let yFrom;
|
||||||
|
if (options.textPosition == "top") {
|
||||||
|
yFrom = options.marginTop + options.fontSize + options.textMargin;
|
||||||
|
} else {
|
||||||
|
yFrom = options.marginTop;
|
||||||
|
}
|
||||||
|
// 绘制条码
|
||||||
|
ctx.fillStyle = options.lineColor;
|
||||||
|
for (let b = 0; b < binary.length; b++) {
|
||||||
|
let x = b * options.width + encoding.barcodePadding;
|
||||||
|
let height = options.height
|
||||||
|
if (encoding.options) {
|
||||||
|
if (encoding.options.height != undefined) {
|
||||||
|
height = encoding.options.height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (binary[b] === "1") {
|
||||||
|
ctx.fillRect(x, yFrom, options.width, height);
|
||||||
|
} else if (binary[b]) {
|
||||||
|
ctx.fillRect(x, yFrom, options.width, height * binary[b]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
text(options, encoding) {
|
||||||
|
if (options.displayValue) {
|
||||||
|
let x, y, align, size;
|
||||||
|
if (options.textPosition == "top") {
|
||||||
|
y = options.marginTop + options.fontSize;
|
||||||
|
} else {
|
||||||
|
y = options.height + options.textMargin + options.marginTop + options.fontSize;
|
||||||
|
}
|
||||||
|
if (encoding.options) {
|
||||||
|
if (encoding.options.textAlign != undefined) {
|
||||||
|
align = encoding.options.textAlign
|
||||||
|
}
|
||||||
|
if (encoding.options.fontSize != undefined) {
|
||||||
|
size = encoding.options.fontSize
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
align = options.textAlign
|
||||||
|
size = options.fontSize
|
||||||
|
}
|
||||||
|
ctx.setFontSize(size)
|
||||||
|
if (align == "left" || encoding.barcodePadding > 0) {
|
||||||
|
x = 0;
|
||||||
|
ctx.setTextAlign('left')
|
||||||
|
} else if (align == "right") {
|
||||||
|
x = encoding.width - 1;
|
||||||
|
ctx.setTextAlign('right')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
x = encoding.width / 2;
|
||||||
|
ctx.setTextAlign('center');
|
||||||
|
}
|
||||||
|
ctx.fillStyle = options.fontColor;
|
||||||
|
if (encoding.text != undefined) {
|
||||||
|
ctx.fillText(encoding.text, x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
move(encoding) {
|
||||||
|
ctx.translate(encoding.width, 0);
|
||||||
|
},
|
||||||
|
prepare(options, encoding) {
|
||||||
|
// 绘制背景
|
||||||
|
if (options.background) {
|
||||||
|
ctx.fillStyle = options.background;
|
||||||
|
ctx.fillRect(0, 0, encoding.width, encoding.height);
|
||||||
|
}
|
||||||
|
ctx.translate(options.marginLeft, 0);
|
||||||
|
},
|
||||||
|
draw(options, encoding) {
|
||||||
|
ctx.draw(false, () => {
|
||||||
|
this.toImgs(options, encoding)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
toImgs(options, encoding) {
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.canvasToTempFilePath({
|
||||||
|
width: encoding.width,
|
||||||
|
height: encoding.height,
|
||||||
|
destWidth: encoding.width,
|
||||||
|
destHeight: encoding.height,
|
||||||
|
canvasId: globaCtxid,
|
||||||
|
fileType: 'png',
|
||||||
|
success: function (res) {
|
||||||
|
cbResult(res.tempFilePath)
|
||||||
|
},
|
||||||
|
fail: function (res) {
|
||||||
|
cbResult(res)
|
||||||
|
},
|
||||||
|
complete: function () {
|
||||||
|
// uni.hideLoading();
|
||||||
|
},
|
||||||
|
}, globaContext);
|
||||||
|
}, options.text.length + 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 混入canvas数据
|
||||||
|
function fixEncodings(encoding, options) {
|
||||||
|
let encodingArr = [], width = options.marginLeft + options.marginRight, height;
|
||||||
|
if (!Array.isArray(encoding)) {
|
||||||
|
encodingArr[0] = JSON.parse(JSON.stringify(encoding))
|
||||||
|
} else {
|
||||||
|
encodingArr = [...encoding]
|
||||||
|
}
|
||||||
|
encodingArr.forEach((v, i) => {
|
||||||
|
// 获取文本宽度
|
||||||
|
let textWidth = ctx.measureText(encodingArr[i].text ? encodingArr[i].text : '').width;
|
||||||
|
// 获取条形码宽度
|
||||||
|
let barcodeWidth = encodingArr[i].data.length * options.width;
|
||||||
|
// 获取内边距
|
||||||
|
let barcodePadding = 0;
|
||||||
|
if (options.displayValue && barcodeWidth < textWidth) {
|
||||||
|
if (options.textAlign == "center") {
|
||||||
|
barcodePadding = Math.floor((textWidth - barcodeWidth) / 2);
|
||||||
|
} else if (options.textAlign == "left") {
|
||||||
|
barcodePadding = 0;
|
||||||
|
} else if (options.textAlign == "right") {
|
||||||
|
barcodePadding = Math.floor(textWidth - barcodeWidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 混入encodingArr[i]
|
||||||
|
encodingArr[i].barcodePadding = barcodePadding
|
||||||
|
encodingArr[i].width = Math.ceil(Math.max(textWidth, barcodeWidth))
|
||||||
|
width += encodingArr[i].width
|
||||||
|
if (encodingArr[i].options) {
|
||||||
|
if (encodingArr[i].options.height != undefined) {
|
||||||
|
encodingArr[i].height = encodingArr[i].options.height + (options.displayValue && (encodingArr[i].text ? encodingArr[i].text : '').length > 0 ? options.fontSize + options.textMargin : 0) + options.marginTop + options.marginBottom;
|
||||||
|
} else {
|
||||||
|
encodingArr[i].height = height = options.height + (options.displayValue && (encodingArr[i].text ? encodingArr[i].text : '').length > 0 ? options.fontSize + options.textMargin : 0) + options.marginTop + options.marginBottom;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
encodingArr[i].height = height = options.height + (options.displayValue && (encodingArr[i].text ? encodingArr[i].text : '').length > 0 ? options.fontSize + options.textMargin : 0) + options.marginTop + options.marginBottom;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return { encodings: encodingArr, width, height };
|
||||||
|
}
|
||||||
|
// 修正Margin
|
||||||
|
function fixMargin(options) {
|
||||||
|
options.marginTop = options.marginTop == undefined ? options.margin : options.marginTop;
|
||||||
|
options.marginBottom = options.marginBottom == undefined ? options.margin : options.marginBottom;
|
||||||
|
options.marginRight = options.marginRight == undefined ? options.margin : options.marginRight;
|
||||||
|
options.marginLeft = options.marginLeft == undefined ? options.margin : options.marginLeft;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})()
|
||||||
|
|
||||||
|
export default barcode
|
|
@ -0,0 +1,17 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
var Barcode = function Barcode(data, options) {
|
||||||
|
_classCallCheck(this, Barcode);
|
||||||
|
|
||||||
|
this.data = data;
|
||||||
|
this.text = options.text || data;
|
||||||
|
this.options = options;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.default = Barcode;
|
|
@ -0,0 +1,167 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||||
|
|
||||||
|
var _Barcode2 = require('../Barcode.js');
|
||||||
|
|
||||||
|
var _Barcode3 = _interopRequireDefault(_Barcode2);
|
||||||
|
|
||||||
|
var _constants = require('./constants');
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||||
|
|
||||||
|
// This is the master class,
|
||||||
|
// it does require the start code to be included in the string
|
||||||
|
var CODE128 = function (_Barcode) {
|
||||||
|
_inherits(CODE128, _Barcode);
|
||||||
|
|
||||||
|
function CODE128(data, options) {
|
||||||
|
_classCallCheck(this, CODE128);
|
||||||
|
|
||||||
|
// Get array of ascii codes from data
|
||||||
|
var _this = _possibleConstructorReturn(this, (CODE128.__proto__ || Object.getPrototypeOf(CODE128)).call(this, data.substring(1), options));
|
||||||
|
|
||||||
|
_this.bytes = data.split('').map(function (char) {
|
||||||
|
return char.charCodeAt(0);
|
||||||
|
});
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
|
||||||
|
_createClass(CODE128, [{
|
||||||
|
key: 'valid',
|
||||||
|
value: function valid() {
|
||||||
|
// ASCII value ranges 0-127, 200-211
|
||||||
|
return (/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The public encoding function
|
||||||
|
|
||||||
|
}, {
|
||||||
|
key: 'encode',
|
||||||
|
value: function encode() {
|
||||||
|
var bytes = this.bytes;
|
||||||
|
// Remove the start code from the bytes and set its index
|
||||||
|
var startIndex = bytes.shift() - 105;
|
||||||
|
// Get start set by index
|
||||||
|
var startSet = _constants.SET_BY_CODE[startIndex];
|
||||||
|
|
||||||
|
if (startSet === undefined) {
|
||||||
|
throw new RangeError('The encoding does not start with a start character.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.shouldEncodeAsEan128() === true) {
|
||||||
|
bytes.unshift(_constants.FNC1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start encode with the right type
|
||||||
|
var encodingResult = CODE128.next(bytes, 1, startSet);
|
||||||
|
|
||||||
|
return {
|
||||||
|
text: this.text === this.data ? this.text.replace(/[^\x20-\x7E]/g, '') : this.text,
|
||||||
|
data:
|
||||||
|
// Add the start bits
|
||||||
|
CODE128.getBar(startIndex) +
|
||||||
|
// Add the encoded bits
|
||||||
|
encodingResult.result +
|
||||||
|
// Add the checksum
|
||||||
|
CODE128.getBar((encodingResult.checksum + startIndex) % _constants.MODULO) +
|
||||||
|
// Add the end bits
|
||||||
|
CODE128.getBar(_constants.STOP)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// GS1-128/EAN-128
|
||||||
|
|
||||||
|
}, {
|
||||||
|
key: 'shouldEncodeAsEan128',
|
||||||
|
value: function shouldEncodeAsEan128() {
|
||||||
|
var isEAN128 = this.options.ean128 || false;
|
||||||
|
if (typeof isEAN128 === 'string') {
|
||||||
|
isEAN128 = isEAN128.toLowerCase() === 'true';
|
||||||
|
}
|
||||||
|
return isEAN128;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get a bar symbol by index
|
||||||
|
|
||||||
|
}], [{
|
||||||
|
key: 'getBar',
|
||||||
|
value: function getBar(index) {
|
||||||
|
return _constants.BARS[index] ? _constants.BARS[index].toString() : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Correct an index by a set and shift it from the bytes array
|
||||||
|
|
||||||
|
}, {
|
||||||
|
key: 'correctIndex',
|
||||||
|
value: function correctIndex(bytes, set) {
|
||||||
|
if (set === _constants.SET_A) {
|
||||||
|
var charCode = bytes.shift();
|
||||||
|
return charCode < 32 ? charCode + 64 : charCode - 32;
|
||||||
|
} else if (set === _constants.SET_B) {
|
||||||
|
return bytes.shift() - 32;
|
||||||
|
} else {
|
||||||
|
return (bytes.shift() - 48) * 10 + bytes.shift() - 48;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'next',
|
||||||
|
value: function next(bytes, pos, set) {
|
||||||
|
if (!bytes.length) {
|
||||||
|
return { result: '', checksum: 0 };
|
||||||
|
}
|
||||||
|
|
||||||
|
var nextCode = void 0,
|
||||||
|
index = void 0;
|
||||||
|
|
||||||
|
// Special characters
|
||||||
|
if (bytes[0] >= 200) {
|
||||||
|
index = bytes.shift() - 105;
|
||||||
|
var nextSet = _constants.SWAP[index];
|
||||||
|
|
||||||
|
// Swap to other set
|
||||||
|
if (nextSet !== undefined) {
|
||||||
|
nextCode = CODE128.next(bytes, pos + 1, nextSet);
|
||||||
|
}
|
||||||
|
// Continue on current set but encode a special character
|
||||||
|
else {
|
||||||
|
// Shift
|
||||||
|
if ((set === _constants.SET_A || set === _constants.SET_B) && index === _constants.SHIFT) {
|
||||||
|
// Convert the next character so that is encoded correctly
|
||||||
|
bytes[0] = set === _constants.SET_A ? bytes[0] > 95 ? bytes[0] - 96 : bytes[0] : bytes[0] < 32 ? bytes[0] + 96 : bytes[0];
|
||||||
|
}
|
||||||
|
nextCode = CODE128.next(bytes, pos + 1, set);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Continue encoding
|
||||||
|
else {
|
||||||
|
index = CODE128.correctIndex(bytes, set);
|
||||||
|
nextCode = CODE128.next(bytes, pos + 1, set);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the correct binary encoding and calculate the weight
|
||||||
|
var enc = CODE128.getBar(index);
|
||||||
|
var weight = index * pos;
|
||||||
|
|
||||||
|
return {
|
||||||
|
result: enc + nextCode.result,
|
||||||
|
checksum: weight + nextCode.checksum
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return CODE128;
|
||||||
|
}(_Barcode3.default);
|
||||||
|
|
||||||
|
exports.default = CODE128;
|
|
@ -0,0 +1,42 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||||
|
|
||||||
|
var _CODE2 = require('./CODE128.js');
|
||||||
|
|
||||||
|
var _CODE3 = _interopRequireDefault(_CODE2);
|
||||||
|
|
||||||
|
var _constants = require('./constants');
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||||
|
|
||||||
|
var CODE128A = function (_CODE) {
|
||||||
|
_inherits(CODE128A, _CODE);
|
||||||
|
|
||||||
|
function CODE128A(string, options) {
|
||||||
|
_classCallCheck(this, CODE128A);
|
||||||
|
|
||||||
|
return _possibleConstructorReturn(this, (CODE128A.__proto__ || Object.getPrototypeOf(CODE128A)).call(this, _constants.A_START_CHAR + string, options));
|
||||||
|
}
|
||||||
|
|
||||||
|
_createClass(CODE128A, [{
|
||||||
|
key: 'valid',
|
||||||
|
value: function valid() {
|
||||||
|
return new RegExp('^' + _constants.A_CHARS + '+$').test(this.data);
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return CODE128A;
|
||||||
|
}(_CODE3.default);
|
||||||
|
|
||||||
|
exports.default = CODE128A;
|
|
@ -0,0 +1,42 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||||
|
|
||||||
|
var _CODE2 = require('./CODE128.js');
|
||||||
|
|
||||||
|
var _CODE3 = _interopRequireDefault(_CODE2);
|
||||||
|
|
||||||
|
var _constants = require('./constants');
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||||
|
|
||||||
|
var CODE128B = function (_CODE) {
|
||||||
|
_inherits(CODE128B, _CODE);
|
||||||
|
|
||||||
|
function CODE128B(string, options) {
|
||||||
|
_classCallCheck(this, CODE128B);
|
||||||
|
|
||||||
|
return _possibleConstructorReturn(this, (CODE128B.__proto__ || Object.getPrototypeOf(CODE128B)).call(this, _constants.B_START_CHAR + string, options));
|
||||||
|
}
|
||||||
|
|
||||||
|
_createClass(CODE128B, [{
|
||||||
|
key: 'valid',
|
||||||
|
value: function valid() {
|
||||||
|
return new RegExp('^' + _constants.B_CHARS + '+$').test(this.data);
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return CODE128B;
|
||||||
|
}(_CODE3.default);
|
||||||
|
|
||||||
|
exports.default = CODE128B;
|
|
@ -0,0 +1,42 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||||
|
|
||||||
|
var _CODE2 = require('./CODE128.js');
|
||||||
|
|
||||||
|
var _CODE3 = _interopRequireDefault(_CODE2);
|
||||||
|
|
||||||
|
var _constants = require('./constants');
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||||
|
|
||||||
|
var CODE128C = function (_CODE) {
|
||||||
|
_inherits(CODE128C, _CODE);
|
||||||
|
|
||||||
|
function CODE128C(string, options) {
|
||||||
|
_classCallCheck(this, CODE128C);
|
||||||
|
|
||||||
|
return _possibleConstructorReturn(this, (CODE128C.__proto__ || Object.getPrototypeOf(CODE128C)).call(this, _constants.C_START_CHAR + string, options));
|
||||||
|
}
|
||||||
|
|
||||||
|
_createClass(CODE128C, [{
|
||||||
|
key: 'valid',
|
||||||
|
value: function valid() {
|
||||||
|
return new RegExp('^' + _constants.C_CHARS + '+$').test(this.data);
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return CODE128C;
|
||||||
|
}(_CODE3.default);
|
||||||
|
|
||||||
|
exports.default = CODE128C;
|
|
@ -0,0 +1,41 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _CODE2 = require('./CODE128');
|
||||||
|
|
||||||
|
var _CODE3 = _interopRequireDefault(_CODE2);
|
||||||
|
|
||||||
|
var _auto = require('./auto');
|
||||||
|
|
||||||
|
var _auto2 = _interopRequireDefault(_auto);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||||
|
|
||||||
|
var CODE128AUTO = function (_CODE) {
|
||||||
|
_inherits(CODE128AUTO, _CODE);
|
||||||
|
|
||||||
|
function CODE128AUTO(data, options) {
|
||||||
|
_classCallCheck(this, CODE128AUTO);
|
||||||
|
|
||||||
|
// ASCII value ranges 0-127, 200-211
|
||||||
|
if (/^[\x00-\x7F\xC8-\xD3]+$/.test(data)) {
|
||||||
|
var _this = _possibleConstructorReturn(this, (CODE128AUTO.__proto__ || Object.getPrototypeOf(CODE128AUTO)).call(this, (0, _auto2.default)(data), options));
|
||||||
|
} else {
|
||||||
|
var _this = _possibleConstructorReturn(this, (CODE128AUTO.__proto__ || Object.getPrototypeOf(CODE128AUTO)).call(this, data, options));
|
||||||
|
}
|
||||||
|
return _possibleConstructorReturn(_this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return CODE128AUTO;
|
||||||
|
}(_CODE3.default);
|
||||||
|
|
||||||
|
exports.default = CODE128AUTO;
|
|
@ -0,0 +1,73 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _constants = require('./constants');
|
||||||
|
|
||||||
|
// Match Set functions
|
||||||
|
var matchSetALength = function matchSetALength(string) {
|
||||||
|
return string.match(new RegExp('^' + _constants.A_CHARS + '*'))[0].length;
|
||||||
|
};
|
||||||
|
var matchSetBLength = function matchSetBLength(string) {
|
||||||
|
return string.match(new RegExp('^' + _constants.B_CHARS + '*'))[0].length;
|
||||||
|
};
|
||||||
|
var matchSetC = function matchSetC(string) {
|
||||||
|
return string.match(new RegExp('^' + _constants.C_CHARS + '*'))[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
// CODE128A or CODE128B
|
||||||
|
function autoSelectFromAB(string, isA) {
|
||||||
|
var ranges = isA ? _constants.A_CHARS : _constants.B_CHARS;
|
||||||
|
var untilC = string.match(new RegExp('^(' + ranges + '+?)(([0-9]{2}){2,})([^0-9]|$)'));
|
||||||
|
|
||||||
|
if (untilC) {
|
||||||
|
return untilC[1] + String.fromCharCode(204) + autoSelectFromC(string.substring(untilC[1].length));
|
||||||
|
}
|
||||||
|
|
||||||
|
var chars = string.match(new RegExp('^' + ranges + '+'))[0];
|
||||||
|
|
||||||
|
if (chars.length === string.length) {
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
|
return chars + String.fromCharCode(isA ? 205 : 206) + autoSelectFromAB(string.substring(chars.length), !isA);
|
||||||
|
}
|
||||||
|
|
||||||
|
// CODE128C
|
||||||
|
function autoSelectFromC(string) {
|
||||||
|
var cMatch = matchSetC(string);
|
||||||
|
var length = cMatch.length;
|
||||||
|
|
||||||
|
if (length === string.length) {
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
|
string = string.substring(length);
|
||||||
|
|
||||||
|
// Select A/B depending on the longest match
|
||||||
|
var isA = matchSetALength(string) >= matchSetBLength(string);
|
||||||
|
return cMatch + String.fromCharCode(isA ? 206 : 205) + autoSelectFromAB(string, isA);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detect Code Set (A, B or C) and format the string
|
||||||
|
|
||||||
|
exports.default = function (string) {
|
||||||
|
var newString = void 0;
|
||||||
|
var cLength = matchSetC(string).length;
|
||||||
|
|
||||||
|
// Select 128C if the string start with enough digits
|
||||||
|
if (cLength >= 2) {
|
||||||
|
newString = _constants.C_START_CHAR + autoSelectFromC(string);
|
||||||
|
} else {
|
||||||
|
// Select A/B depending on the longest match
|
||||||
|
var isA = matchSetALength(string) > matchSetBLength(string);
|
||||||
|
newString = (isA ? _constants.A_START_CHAR : _constants.B_START_CHAR) + autoSelectFromAB(string, isA);
|
||||||
|
}
|
||||||
|
|
||||||
|
return newString.replace(/[\xCD\xCE]([^])[\xCD\xCE]/, // Any sequence between 205 and 206 characters
|
||||||
|
function (match, char) {
|
||||||
|
return String.fromCharCode(203) + char;
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,54 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _SET_BY_CODE;
|
||||||
|
|
||||||
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||||
|
|
||||||
|
// constants for internal usage
|
||||||
|
var SET_A = exports.SET_A = 0;
|
||||||
|
var SET_B = exports.SET_B = 1;
|
||||||
|
var SET_C = exports.SET_C = 2;
|
||||||
|
|
||||||
|
// Special characters
|
||||||
|
var SHIFT = exports.SHIFT = 98;
|
||||||
|
var START_A = exports.START_A = 103;
|
||||||
|
var START_B = exports.START_B = 104;
|
||||||
|
var START_C = exports.START_C = 105;
|
||||||
|
var MODULO = exports.MODULO = 103;
|
||||||
|
var STOP = exports.STOP = 106;
|
||||||
|
var FNC1 = exports.FNC1 = 207;
|
||||||
|
|
||||||
|
// Get set by start code
|
||||||
|
var SET_BY_CODE = exports.SET_BY_CODE = (_SET_BY_CODE = {}, _defineProperty(_SET_BY_CODE, START_A, SET_A), _defineProperty(_SET_BY_CODE, START_B, SET_B), _defineProperty(_SET_BY_CODE, START_C, SET_C), _SET_BY_CODE);
|
||||||
|
|
||||||
|
// Get next set by code
|
||||||
|
var SWAP = exports.SWAP = {
|
||||||
|
101: SET_A,
|
||||||
|
100: SET_B,
|
||||||
|
99: SET_C
|
||||||
|
};
|
||||||
|
|
||||||
|
var A_START_CHAR = exports.A_START_CHAR = String.fromCharCode(208); // START_A + 105
|
||||||
|
var B_START_CHAR = exports.B_START_CHAR = String.fromCharCode(209); // START_B + 105
|
||||||
|
var C_START_CHAR = exports.C_START_CHAR = String.fromCharCode(210); // START_C + 105
|
||||||
|
|
||||||
|
// 128A (Code Set A)
|
||||||
|
// ASCII characters 00 to 95 (0–9, A–Z and control codes), special characters, and FNC 1–4
|
||||||
|
var A_CHARS = exports.A_CHARS = "[\x00-\x5F\xC8-\xCF]";
|
||||||
|
|
||||||
|
// 128B (Code Set B)
|
||||||
|
// ASCII characters 32 to 127 (0–9, A–Z, a–z), special characters, and FNC 1–4
|
||||||
|
var B_CHARS = exports.B_CHARS = "[\x20-\x7F\xC8-\xCF]";
|
||||||
|
|
||||||
|
// 128C (Code Set C)
|
||||||
|
// 00–99 (encodes two digits with a single code point) and FNC1
|
||||||
|
var C_CHARS = exports.C_CHARS = "(\xCF*[0-9]{2}\xCF*)";
|
||||||
|
|
||||||
|
// CODE128 includes 107 symbols:
|
||||||
|
// 103 data symbols, 3 start symbols (A, B and C), and 1 stop symbol (the last one)
|
||||||
|
// Each symbol consist of three black bars (1) and three white spaces (0).
|
||||||
|
var BARS = exports.BARS = [11011001100, 11001101100, 11001100110, 10010011000, 10010001100, 10001001100, 10011001000, 10011000100, 10001100100, 11001001000, 11001000100, 11000100100, 10110011100, 10011011100, 10011001110, 10111001100, 10011101100, 10011100110, 11001110010, 11001011100, 11001001110, 11011100100, 11001110100, 11101101110, 11101001100, 11100101100, 11100100110, 11101100100, 11100110100, 11100110010, 11011011000, 11011000110, 11000110110, 10100011000, 10001011000, 10001000110, 10110001000, 10001101000, 10001100010, 11010001000, 11000101000, 11000100010, 10110111000, 10110001110, 10001101110, 10111011000, 10111000110, 10001110110, 11101110110, 11010001110, 11000101110, 11011101000, 11011100010, 11011101110, 11101011000, 11101000110, 11100010110, 11101101000, 11101100010, 11100011010, 11101111010, 11001000010, 11110001010, 10100110000, 10100001100, 10010110000, 10010000110, 10000101100, 10000100110, 10110010000, 10110000100, 10011010000, 10011000010, 10000110100, 10000110010, 11000010010, 11001010000, 11110111010, 11000010100, 10001111010, 10100111100, 10010111100, 10010011110, 10111100100, 10011110100, 10011110010, 11110100100, 11110010100, 11110010010, 11011011110, 11011110110, 11110110110, 10101111000, 10100011110, 10001011110, 10111101000, 10111100010, 11110101000, 11110100010, 10111011110, 10111101110, 11101011110, 11110101110, 11010000100, 11010010000, 11010011100, 1100011101011];
|
|
@ -0,0 +1,29 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.CODE128C = exports.CODE128B = exports.CODE128A = exports.CODE128 = undefined;
|
||||||
|
|
||||||
|
var _CODE128_AUTO = require('./CODE128_AUTO.js');
|
||||||
|
|
||||||
|
var _CODE128_AUTO2 = _interopRequireDefault(_CODE128_AUTO);
|
||||||
|
|
||||||
|
var _CODE128A = require('./CODE128A.js');
|
||||||
|
|
||||||
|
var _CODE128A2 = _interopRequireDefault(_CODE128A);
|
||||||
|
|
||||||
|
var _CODE128B = require('./CODE128B.js');
|
||||||
|
|
||||||
|
var _CODE128B2 = _interopRequireDefault(_CODE128B);
|
||||||
|
|
||||||
|
var _CODE128C = require('./CODE128C.js');
|
||||||
|
|
||||||
|
var _CODE128C2 = _interopRequireDefault(_CODE128C);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
exports.CODE128 = _CODE128_AUTO2.default;
|
||||||
|
exports.CODE128A = _CODE128A2.default;
|
||||||
|
exports.CODE128B = _CODE128B2.default;
|
||||||
|
exports.CODE128C = _CODE128C2.default;
|
|
@ -0,0 +1,104 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.CODE39 = undefined;
|
||||||
|
|
||||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||||
|
|
||||||
|
var _Barcode2 = require("../Barcode.js");
|
||||||
|
|
||||||
|
var _Barcode3 = _interopRequireDefault(_Barcode2);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation:
|
||||||
|
// https://en.wikipedia.org/wiki/Code_39#Encoding
|
||||||
|
|
||||||
|
var CODE39 = function (_Barcode) {
|
||||||
|
_inherits(CODE39, _Barcode);
|
||||||
|
|
||||||
|
function CODE39(data, options) {
|
||||||
|
_classCallCheck(this, CODE39);
|
||||||
|
|
||||||
|
data = data.toUpperCase();
|
||||||
|
|
||||||
|
// Calculate mod43 checksum if enabled
|
||||||
|
if (options.mod43) {
|
||||||
|
data += getCharacter(mod43checksum(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
return _possibleConstructorReturn(this, (CODE39.__proto__ || Object.getPrototypeOf(CODE39)).call(this, data, options));
|
||||||
|
}
|
||||||
|
|
||||||
|
_createClass(CODE39, [{
|
||||||
|
key: "encode",
|
||||||
|
value: function encode() {
|
||||||
|
// First character is always a *
|
||||||
|
var result = getEncoding("*");
|
||||||
|
|
||||||
|
// Take every character and add the binary representation to the result
|
||||||
|
for (var i = 0; i < this.data.length; i++) {
|
||||||
|
result += getEncoding(this.data[i]) + "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Last character is always a *
|
||||||
|
result += getEncoding("*");
|
||||||
|
return {
|
||||||
|
data: result,
|
||||||
|
text: this.text
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "valid",
|
||||||
|
value: function valid() {
|
||||||
|
return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/) !== -1;
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return CODE39;
|
||||||
|
}(_Barcode3.default);
|
||||||
|
|
||||||
|
// All characters. The position in the array is the (checksum) value
|
||||||
|
|
||||||
|
|
||||||
|
var characters = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "-", ".", " ", "$", "/", "+", "%", "*"];
|
||||||
|
|
||||||
|
// The decimal representation of the characters, is converted to the
|
||||||
|
// corresponding binary with the getEncoding function
|
||||||
|
var encodings = [20957, 29783, 23639, 30485, 20951, 29813, 23669, 20855, 29789, 23645, 29975, 23831, 30533, 22295, 30149, 24005, 21623, 29981, 23837, 22301, 30023, 23879, 30545, 22343, 30161, 24017, 21959, 30065, 23921, 22385, 29015, 18263, 29141, 17879, 29045, 18293, 17783, 29021, 18269, 17477, 17489, 17681, 20753, 35770];
|
||||||
|
|
||||||
|
// Get the binary representation of a character by converting the encodings
|
||||||
|
// from decimal to binary
|
||||||
|
function getEncoding(character) {
|
||||||
|
return getBinary(characterValue(character));
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBinary(characterValue) {
|
||||||
|
return encodings[characterValue].toString(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCharacter(characterValue) {
|
||||||
|
return characters[characterValue];
|
||||||
|
}
|
||||||
|
|
||||||
|
function characterValue(character) {
|
||||||
|
return characters.indexOf(character);
|
||||||
|
}
|
||||||
|
|
||||||
|
function mod43checksum(data) {
|
||||||
|
var checksum = 0;
|
||||||
|
for (var i = 0; i < data.length; i++) {
|
||||||
|
checksum += characterValue(data[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
checksum = checksum % 43;
|
||||||
|
return checksum;
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.CODE39 = CODE39;
|
|
@ -0,0 +1,92 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||||
|
|
||||||
|
var _constants = require('./constants');
|
||||||
|
|
||||||
|
var _encoder = require('./encoder');
|
||||||
|
|
||||||
|
var _encoder2 = _interopRequireDefault(_encoder);
|
||||||
|
|
||||||
|
var _Barcode2 = require('../Barcode');
|
||||||
|
|
||||||
|
var _Barcode3 = _interopRequireDefault(_Barcode2);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||||
|
|
||||||
|
// Base class for EAN8 & EAN13
|
||||||
|
var EAN = function (_Barcode) {
|
||||||
|
_inherits(EAN, _Barcode);
|
||||||
|
|
||||||
|
function EAN(data, options) {
|
||||||
|
_classCallCheck(this, EAN);
|
||||||
|
|
||||||
|
// Make sure the font is not bigger than the space between the guard bars
|
||||||
|
var _this = _possibleConstructorReturn(this, (EAN.__proto__ || Object.getPrototypeOf(EAN)).call(this, data, options));
|
||||||
|
|
||||||
|
_this.fontSize = !options.flat && options.fontSize > options.width * 10 ? options.width * 10 : options.fontSize;
|
||||||
|
|
||||||
|
// Make the guard bars go down half the way of the text
|
||||||
|
_this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin;
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
|
||||||
|
_createClass(EAN, [{
|
||||||
|
key: 'encode',
|
||||||
|
value: function encode() {
|
||||||
|
return this.options.flat ? this.encodeFlat() : this.encodeGuarded();
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'leftText',
|
||||||
|
value: function leftText(from, to) {
|
||||||
|
return this.text.substr(from, to);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'leftEncode',
|
||||||
|
value: function leftEncode(data, structure) {
|
||||||
|
return (0, _encoder2.default)(data, structure);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'rightText',
|
||||||
|
value: function rightText(from, to) {
|
||||||
|
return this.text.substr(from, to);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'rightEncode',
|
||||||
|
value: function rightEncode(data, structure) {
|
||||||
|
return (0, _encoder2.default)(data, structure);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'encodeGuarded',
|
||||||
|
value: function encodeGuarded() {
|
||||||
|
var textOptions = { fontSize: this.fontSize };
|
||||||
|
var guardOptions = { height: this.guardHeight };
|
||||||
|
|
||||||
|
return [{ data: _constants.SIDE_BIN, options: guardOptions }, { data: this.leftEncode(), text: this.leftText(), options: textOptions }, { data: _constants.MIDDLE_BIN, options: guardOptions }, { data: this.rightEncode(), text: this.rightText(), options: textOptions }, { data: _constants.SIDE_BIN, options: guardOptions }];
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'encodeFlat',
|
||||||
|
value: function encodeFlat() {
|
||||||
|
var data = [_constants.SIDE_BIN, this.leftEncode(), _constants.MIDDLE_BIN, this.rightEncode(), _constants.SIDE_BIN];
|
||||||
|
|
||||||
|
return {
|
||||||
|
data: data.join(''),
|
||||||
|
text: this.text
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return EAN;
|
||||||
|
}(_Barcode3.default);
|
||||||
|
|
||||||
|
exports.default = EAN;
|
|
@ -0,0 +1,119 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||||
|
|
||||||
|
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
|
||||||
|
|
||||||
|
var _constants = require('./constants');
|
||||||
|
|
||||||
|
var _EAN2 = require('./EAN');
|
||||||
|
|
||||||
|
var _EAN3 = _interopRequireDefault(_EAN2);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation:
|
||||||
|
// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Binary_encoding_of_data_digits_into_EAN-13_barcode
|
||||||
|
|
||||||
|
// Calculate the checksum digit
|
||||||
|
// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit
|
||||||
|
var checksum = function checksum(number) {
|
||||||
|
var res = number.substr(0, 12).split('').map(function (n) {
|
||||||
|
return +n;
|
||||||
|
}).reduce(function (sum, a, idx) {
|
||||||
|
return idx % 2 ? sum + a * 3 : sum + a;
|
||||||
|
}, 0);
|
||||||
|
|
||||||
|
return (10 - res % 10) % 10;
|
||||||
|
};
|
||||||
|
|
||||||
|
var EAN13 = function (_EAN) {
|
||||||
|
_inherits(EAN13, _EAN);
|
||||||
|
|
||||||
|
function EAN13(data, options) {
|
||||||
|
_classCallCheck(this, EAN13);
|
||||||
|
|
||||||
|
// Add checksum if it does not exist
|
||||||
|
if (data.search(/^[0-9]{12}$/) !== -1) {
|
||||||
|
data += checksum(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adds a last character to the end of the barcode
|
||||||
|
var _this = _possibleConstructorReturn(this, (EAN13.__proto__ || Object.getPrototypeOf(EAN13)).call(this, data, options));
|
||||||
|
|
||||||
|
_this.lastChar = options.lastChar;
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
|
||||||
|
_createClass(EAN13, [{
|
||||||
|
key: 'valid',
|
||||||
|
value: function valid() {
|
||||||
|
return this.data.search(/^[0-9]{13}$/) !== -1 && +this.data[12] === checksum(this.data);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'leftText',
|
||||||
|
value: function leftText() {
|
||||||
|
return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'leftText', this).call(this, 1, 6);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'leftEncode',
|
||||||
|
value: function leftEncode() {
|
||||||
|
var data = this.data.substr(1, 6);
|
||||||
|
var structure = _constants.EAN13_STRUCTURE[this.data[0]];
|
||||||
|
return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'leftEncode', this).call(this, data, structure);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'rightText',
|
||||||
|
value: function rightText() {
|
||||||
|
return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'rightText', this).call(this, 7, 6);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'rightEncode',
|
||||||
|
value: function rightEncode() {
|
||||||
|
var data = this.data.substr(7, 6);
|
||||||
|
return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'rightEncode', this).call(this, data, 'RRRRRR');
|
||||||
|
}
|
||||||
|
|
||||||
|
// The "standard" way of printing EAN13 barcodes with guard bars
|
||||||
|
|
||||||
|
}, {
|
||||||
|
key: 'encodeGuarded',
|
||||||
|
value: function encodeGuarded() {
|
||||||
|
var data = _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'encodeGuarded', this).call(this);
|
||||||
|
|
||||||
|
// Extend data with left digit & last character
|
||||||
|
if (this.options.displayValue) {
|
||||||
|
data.unshift({
|
||||||
|
data: '000000000000',
|
||||||
|
text: this.text.substr(0, 1),
|
||||||
|
options: { textAlign: 'left', fontSize: this.fontSize }
|
||||||
|
});
|
||||||
|
|
||||||
|
if (this.options.lastChar) {
|
||||||
|
data.push({
|
||||||
|
data: '00'
|
||||||
|
});
|
||||||
|
data.push({
|
||||||
|
data: '00000',
|
||||||
|
text: this.options.lastChar,
|
||||||
|
options: { fontSize: this.fontSize }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return EAN13;
|
||||||
|
}(_EAN3.default);
|
||||||
|
|
||||||
|
exports.default = EAN13;
|
|
@ -0,0 +1,58 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||||
|
|
||||||
|
var _constants = require('./constants');
|
||||||
|
|
||||||
|
var _encoder = require('./encoder');
|
||||||
|
|
||||||
|
var _encoder2 = _interopRequireDefault(_encoder);
|
||||||
|
|
||||||
|
var _Barcode2 = require('../Barcode');
|
||||||
|
|
||||||
|
var _Barcode3 = _interopRequireDefault(_Barcode2);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation:
|
||||||
|
// https://en.wikipedia.org/wiki/EAN_2#Encoding
|
||||||
|
|
||||||
|
var EAN2 = function (_Barcode) {
|
||||||
|
_inherits(EAN2, _Barcode);
|
||||||
|
|
||||||
|
function EAN2(data, options) {
|
||||||
|
_classCallCheck(this, EAN2);
|
||||||
|
|
||||||
|
return _possibleConstructorReturn(this, (EAN2.__proto__ || Object.getPrototypeOf(EAN2)).call(this, data, options));
|
||||||
|
}
|
||||||
|
|
||||||
|
_createClass(EAN2, [{
|
||||||
|
key: 'valid',
|
||||||
|
value: function valid() {
|
||||||
|
return this.data.search(/^[0-9]{2}$/) !== -1;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'encode',
|
||||||
|
value: function encode() {
|
||||||
|
// Choose the structure based on the number mod 4
|
||||||
|
var structure = _constants.EAN2_STRUCTURE[parseInt(this.data) % 4];
|
||||||
|
return {
|
||||||
|
// Start bits + Encode the two digits with 01 in between
|
||||||
|
data: '1011' + (0, _encoder2.default)(this.data, structure, '01'),
|
||||||
|
text: this.text
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return EAN2;
|
||||||
|
}(_Barcode3.default);
|
||||||
|
|
||||||
|
exports.default = EAN2;
|
|
@ -0,0 +1,65 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||||
|
|
||||||
|
var _constants = require('./constants');
|
||||||
|
|
||||||
|
var _encoder = require('./encoder');
|
||||||
|
|
||||||
|
var _encoder2 = _interopRequireDefault(_encoder);
|
||||||
|
|
||||||
|
var _Barcode2 = require('../Barcode');
|
||||||
|
|
||||||
|
var _Barcode3 = _interopRequireDefault(_Barcode2);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation:
|
||||||
|
// https://en.wikipedia.org/wiki/EAN_5#Encoding
|
||||||
|
|
||||||
|
var checksum = function checksum(data) {
|
||||||
|
var result = data.split('').map(function (n) {
|
||||||
|
return +n;
|
||||||
|
}).reduce(function (sum, a, idx) {
|
||||||
|
return idx % 2 ? sum + a * 9 : sum + a * 3;
|
||||||
|
}, 0);
|
||||||
|
return result % 10;
|
||||||
|
};
|
||||||
|
|
||||||
|
var EAN5 = function (_Barcode) {
|
||||||
|
_inherits(EAN5, _Barcode);
|
||||||
|
|
||||||
|
function EAN5(data, options) {
|
||||||
|
_classCallCheck(this, EAN5);
|
||||||
|
|
||||||
|
return _possibleConstructorReturn(this, (EAN5.__proto__ || Object.getPrototypeOf(EAN5)).call(this, data, options));
|
||||||
|
}
|
||||||
|
|
||||||
|
_createClass(EAN5, [{
|
||||||
|
key: 'valid',
|
||||||
|
value: function valid() {
|
||||||
|
return this.data.search(/^[0-9]{5}$/) !== -1;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'encode',
|
||||||
|
value: function encode() {
|
||||||
|
var structure = _constants.EAN5_STRUCTURE[checksum(this.data)];
|
||||||
|
return {
|
||||||
|
data: '1011' + (0, _encoder2.default)(this.data, structure, '01'),
|
||||||
|
text: this.text
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return EAN5;
|
||||||
|
}(_Barcode3.default);
|
||||||
|
|
||||||
|
exports.default = EAN5;
|
|
@ -0,0 +1,81 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||||
|
|
||||||
|
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
|
||||||
|
|
||||||
|
var _EAN2 = require('./EAN');
|
||||||
|
|
||||||
|
var _EAN3 = _interopRequireDefault(_EAN2);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation:
|
||||||
|
// http://www.barcodeisland.com/ean8.phtml
|
||||||
|
|
||||||
|
// Calculate the checksum digit
|
||||||
|
var checksum = function checksum(number) {
|
||||||
|
var res = number.substr(0, 7).split('').map(function (n) {
|
||||||
|
return +n;
|
||||||
|
}).reduce(function (sum, a, idx) {
|
||||||
|
return idx % 2 ? sum + a : sum + a * 3;
|
||||||
|
}, 0);
|
||||||
|
|
||||||
|
return (10 - res % 10) % 10;
|
||||||
|
};
|
||||||
|
|
||||||
|
var EAN8 = function (_EAN) {
|
||||||
|
_inherits(EAN8, _EAN);
|
||||||
|
|
||||||
|
function EAN8(data, options) {
|
||||||
|
_classCallCheck(this, EAN8);
|
||||||
|
|
||||||
|
// Add checksum if it does not exist
|
||||||
|
if (data.search(/^[0-9]{7}$/) !== -1) {
|
||||||
|
data += checksum(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return _possibleConstructorReturn(this, (EAN8.__proto__ || Object.getPrototypeOf(EAN8)).call(this, data, options));
|
||||||
|
}
|
||||||
|
|
||||||
|
_createClass(EAN8, [{
|
||||||
|
key: 'valid',
|
||||||
|
value: function valid() {
|
||||||
|
return this.data.search(/^[0-9]{8}$/) !== -1 && +this.data[7] === checksum(this.data);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'leftText',
|
||||||
|
value: function leftText() {
|
||||||
|
return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), 'leftText', this).call(this, 0, 4);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'leftEncode',
|
||||||
|
value: function leftEncode() {
|
||||||
|
var data = this.data.substr(0, 4);
|
||||||
|
return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), 'leftEncode', this).call(this, data, 'LLLL');
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'rightText',
|
||||||
|
value: function rightText() {
|
||||||
|
return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), 'rightText', this).call(this, 4, 4);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'rightEncode',
|
||||||
|
value: function rightEncode() {
|
||||||
|
var data = this.data.substr(4, 4);
|
||||||
|
return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), 'rightEncode', this).call(this, data, 'RRRR');
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return EAN8;
|
||||||
|
}(_EAN3.default);
|
||||||
|
|
||||||
|
exports.default = EAN8;
|
|
@ -0,0 +1,165 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||||
|
|
||||||
|
exports.checksum = checksum;
|
||||||
|
|
||||||
|
var _encoder = require("./encoder");
|
||||||
|
|
||||||
|
var _encoder2 = _interopRequireDefault(_encoder);
|
||||||
|
|
||||||
|
var _Barcode2 = require("../Barcode.js");
|
||||||
|
|
||||||
|
var _Barcode3 = _interopRequireDefault(_Barcode2);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation:
|
||||||
|
// https://en.wikipedia.org/wiki/Universal_Product_Code#Encoding
|
||||||
|
|
||||||
|
var UPC = function (_Barcode) {
|
||||||
|
_inherits(UPC, _Barcode);
|
||||||
|
|
||||||
|
function UPC(data, options) {
|
||||||
|
_classCallCheck(this, UPC);
|
||||||
|
|
||||||
|
// Add checksum if it does not exist
|
||||||
|
if (data.search(/^[0-9]{11}$/) !== -1) {
|
||||||
|
data += checksum(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
var _this = _possibleConstructorReturn(this, (UPC.__proto__ || Object.getPrototypeOf(UPC)).call(this, data, options));
|
||||||
|
|
||||||
|
_this.displayValue = options.displayValue;
|
||||||
|
|
||||||
|
// Make sure the font is not bigger than the space between the guard bars
|
||||||
|
if (options.fontSize > options.width * 10) {
|
||||||
|
_this.fontSize = options.width * 10;
|
||||||
|
} else {
|
||||||
|
_this.fontSize = options.fontSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make the guard bars go down half the way of the text
|
||||||
|
_this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin;
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
|
||||||
|
_createClass(UPC, [{
|
||||||
|
key: "valid",
|
||||||
|
value: function valid() {
|
||||||
|
return this.data.search(/^[0-9]{12}$/) !== -1 && this.data[11] == checksum(this.data);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "encode",
|
||||||
|
value: function encode() {
|
||||||
|
if (this.options.flat) {
|
||||||
|
return this.flatEncoding();
|
||||||
|
} else {
|
||||||
|
return this.guardedEncoding();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "flatEncoding",
|
||||||
|
value: function flatEncoding() {
|
||||||
|
var result = "";
|
||||||
|
|
||||||
|
result += "101";
|
||||||
|
result += (0, _encoder2.default)(this.data.substr(0, 6), "LLLLLL");
|
||||||
|
result += "01010";
|
||||||
|
result += (0, _encoder2.default)(this.data.substr(6, 6), "RRRRRR");
|
||||||
|
result += "101";
|
||||||
|
|
||||||
|
return {
|
||||||
|
data: result,
|
||||||
|
text: this.text
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "guardedEncoding",
|
||||||
|
value: function guardedEncoding() {
|
||||||
|
var result = [];
|
||||||
|
|
||||||
|
// Add the first digit
|
||||||
|
if (this.displayValue) {
|
||||||
|
result.push({
|
||||||
|
data: "00000000",
|
||||||
|
text: this.text.substr(0, 1),
|
||||||
|
options: { textAlign: "left", fontSize: this.fontSize }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the guard bars
|
||||||
|
result.push({
|
||||||
|
data: "101" + (0, _encoder2.default)(this.data[0], "L"),
|
||||||
|
options: { height: this.guardHeight }
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add the left side
|
||||||
|
result.push({
|
||||||
|
data: (0, _encoder2.default)(this.data.substr(1, 5), "LLLLL"),
|
||||||
|
text: this.text.substr(1, 5),
|
||||||
|
options: { fontSize: this.fontSize }
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add the middle bits
|
||||||
|
result.push({
|
||||||
|
data: "01010",
|
||||||
|
options: { height: this.guardHeight }
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add the right side
|
||||||
|
result.push({
|
||||||
|
data: (0, _encoder2.default)(this.data.substr(6, 5), "RRRRR"),
|
||||||
|
text: this.text.substr(6, 5),
|
||||||
|
options: { fontSize: this.fontSize }
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add the end bits
|
||||||
|
result.push({
|
||||||
|
data: (0, _encoder2.default)(this.data[11], "R") + "101",
|
||||||
|
options: { height: this.guardHeight }
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add the last digit
|
||||||
|
if (this.displayValue) {
|
||||||
|
result.push({
|
||||||
|
data: "00000000",
|
||||||
|
text: this.text.substr(11, 1),
|
||||||
|
options: { textAlign: "right", fontSize: this.fontSize }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return UPC;
|
||||||
|
}(_Barcode3.default);
|
||||||
|
|
||||||
|
// Calulate the checksum digit
|
||||||
|
// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit
|
||||||
|
|
||||||
|
|
||||||
|
function checksum(number) {
|
||||||
|
var result = 0;
|
||||||
|
|
||||||
|
var i;
|
||||||
|
for (i = 1; i < 11; i += 2) {
|
||||||
|
result += parseInt(number[i]);
|
||||||
|
}
|
||||||
|
for (i = 0; i < 11; i += 2) {
|
||||||
|
result += parseInt(number[i]) * 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (10 - result % 10) % 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.default = UPC;
|
|
@ -0,0 +1,185 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||||
|
|
||||||
|
var _encoder = require('./encoder');
|
||||||
|
|
||||||
|
var _encoder2 = _interopRequireDefault(_encoder);
|
||||||
|
|
||||||
|
var _Barcode2 = require('../Barcode.js');
|
||||||
|
|
||||||
|
var _Barcode3 = _interopRequireDefault(_Barcode2);
|
||||||
|
|
||||||
|
var _UPC = require('./UPC.js');
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation:
|
||||||
|
// https://en.wikipedia.org/wiki/Universal_Product_Code#Encoding
|
||||||
|
//
|
||||||
|
// UPC-E documentation:
|
||||||
|
// https://en.wikipedia.org/wiki/Universal_Product_Code#UPC-E
|
||||||
|
|
||||||
|
var EXPANSIONS = ["XX00000XXX", "XX10000XXX", "XX20000XXX", "XXX00000XX", "XXXX00000X", "XXXXX00005", "XXXXX00006", "XXXXX00007", "XXXXX00008", "XXXXX00009"];
|
||||||
|
|
||||||
|
var PARITIES = [["EEEOOO", "OOOEEE"], ["EEOEOO", "OOEOEE"], ["EEOOEO", "OOEEOE"], ["EEOOOE", "OOEEEO"], ["EOEEOO", "OEOOEE"], ["EOOEEO", "OEEOOE"], ["EOOOEE", "OEEEOO"], ["EOEOEO", "OEOEOE"], ["EOEOOE", "OEOEEO"], ["EOOEOE", "OEEOEO"]];
|
||||||
|
|
||||||
|
var UPCE = function (_Barcode) {
|
||||||
|
_inherits(UPCE, _Barcode);
|
||||||
|
|
||||||
|
function UPCE(data, options) {
|
||||||
|
_classCallCheck(this, UPCE);
|
||||||
|
|
||||||
|
var _this = _possibleConstructorReturn(this, (UPCE.__proto__ || Object.getPrototypeOf(UPCE)).call(this, data, options));
|
||||||
|
// Code may be 6 or 8 digits;
|
||||||
|
// A 7 digit code is ambiguous as to whether the extra digit
|
||||||
|
// is a UPC-A check or number system digit.
|
||||||
|
|
||||||
|
|
||||||
|
_this.isValid = false;
|
||||||
|
if (data.search(/^[0-9]{6}$/) !== -1) {
|
||||||
|
_this.middleDigits = data;
|
||||||
|
_this.upcA = expandToUPCA(data, "0");
|
||||||
|
_this.text = options.text || '' + _this.upcA[0] + data + _this.upcA[_this.upcA.length - 1];
|
||||||
|
_this.isValid = true;
|
||||||
|
} else if (data.search(/^[01][0-9]{7}$/) !== -1) {
|
||||||
|
_this.middleDigits = data.substring(1, data.length - 1);
|
||||||
|
_this.upcA = expandToUPCA(_this.middleDigits, data[0]);
|
||||||
|
|
||||||
|
if (_this.upcA[_this.upcA.length - 1] === data[data.length - 1]) {
|
||||||
|
_this.isValid = true;
|
||||||
|
} else {
|
||||||
|
// checksum mismatch
|
||||||
|
return _possibleConstructorReturn(_this);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return _possibleConstructorReturn(_this);
|
||||||
|
}
|
||||||
|
|
||||||
|
_this.displayValue = options.displayValue;
|
||||||
|
|
||||||
|
// Make sure the font is not bigger than the space between the guard bars
|
||||||
|
if (options.fontSize > options.width * 10) {
|
||||||
|
_this.fontSize = options.width * 10;
|
||||||
|
} else {
|
||||||
|
_this.fontSize = options.fontSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make the guard bars go down half the way of the text
|
||||||
|
_this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin;
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
|
||||||
|
_createClass(UPCE, [{
|
||||||
|
key: 'valid',
|
||||||
|
value: function valid() {
|
||||||
|
return this.isValid;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'encode',
|
||||||
|
value: function encode() {
|
||||||
|
if (this.options.flat) {
|
||||||
|
return this.flatEncoding();
|
||||||
|
} else {
|
||||||
|
return this.guardedEncoding();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'flatEncoding',
|
||||||
|
value: function flatEncoding() {
|
||||||
|
var result = "";
|
||||||
|
|
||||||
|
result += "101";
|
||||||
|
result += this.encodeMiddleDigits();
|
||||||
|
result += "010101";
|
||||||
|
|
||||||
|
return {
|
||||||
|
data: result,
|
||||||
|
text: this.text
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'guardedEncoding',
|
||||||
|
value: function guardedEncoding() {
|
||||||
|
var result = [];
|
||||||
|
|
||||||
|
// Add the UPC-A number system digit beneath the quiet zone
|
||||||
|
if (this.displayValue) {
|
||||||
|
result.push({
|
||||||
|
data: "00000000",
|
||||||
|
text: this.text[0],
|
||||||
|
options: { textAlign: "left", fontSize: this.fontSize }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the guard bars
|
||||||
|
result.push({
|
||||||
|
data: "101",
|
||||||
|
options: { height: this.guardHeight }
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add the 6 UPC-E digits
|
||||||
|
result.push({
|
||||||
|
data: this.encodeMiddleDigits(),
|
||||||
|
text: this.text.substring(1, 7),
|
||||||
|
options: { fontSize: this.fontSize }
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add the end bits
|
||||||
|
result.push({
|
||||||
|
data: "010101",
|
||||||
|
options: { height: this.guardHeight }
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add the UPC-A check digit beneath the quiet zone
|
||||||
|
if (this.displayValue) {
|
||||||
|
result.push({
|
||||||
|
data: "00000000",
|
||||||
|
text: this.text[7],
|
||||||
|
options: { textAlign: "right", fontSize: this.fontSize }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'encodeMiddleDigits',
|
||||||
|
value: function encodeMiddleDigits() {
|
||||||
|
var numberSystem = this.upcA[0];
|
||||||
|
var checkDigit = this.upcA[this.upcA.length - 1];
|
||||||
|
var parity = PARITIES[parseInt(checkDigit)][parseInt(numberSystem)];
|
||||||
|
return (0, _encoder2.default)(this.middleDigits, parity);
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return UPCE;
|
||||||
|
}(_Barcode3.default);
|
||||||
|
|
||||||
|
function expandToUPCA(middleDigits, numberSystem) {
|
||||||
|
var lastUpcE = parseInt(middleDigits[middleDigits.length - 1]);
|
||||||
|
var expansion = EXPANSIONS[lastUpcE];
|
||||||
|
|
||||||
|
var result = "";
|
||||||
|
var digitIndex = 0;
|
||||||
|
for (var i = 0; i < expansion.length; i++) {
|
||||||
|
var c = expansion[i];
|
||||||
|
if (c === 'X') {
|
||||||
|
result += middleDigits[digitIndex++];
|
||||||
|
} else {
|
||||||
|
result += c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result = '' + numberSystem + result;
|
||||||
|
return '' + result + (0, _UPC.checksum)(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.default = UPCE;
|
|
@ -0,0 +1,30 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
// Standard start end and middle bits
|
||||||
|
var SIDE_BIN = exports.SIDE_BIN = '101';
|
||||||
|
var MIDDLE_BIN = exports.MIDDLE_BIN = '01010';
|
||||||
|
|
||||||
|
var BINARIES = exports.BINARIES = {
|
||||||
|
'L': [// The L (left) type of encoding
|
||||||
|
'0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', '0001011'],
|
||||||
|
'G': [// The G type of encoding
|
||||||
|
'0100111', '0110011', '0011011', '0100001', '0011101', '0111001', '0000101', '0010001', '0001001', '0010111'],
|
||||||
|
'R': [// The R (right) type of encoding
|
||||||
|
'1110010', '1100110', '1101100', '1000010', '1011100', '1001110', '1010000', '1000100', '1001000', '1110100'],
|
||||||
|
'O': [// The O (odd) encoding for UPC-E
|
||||||
|
'0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', '0001011'],
|
||||||
|
'E': [// The E (even) encoding for UPC-E
|
||||||
|
'0100111', '0110011', '0011011', '0100001', '0011101', '0111001', '0000101', '0010001', '0001001', '0010111']
|
||||||
|
};
|
||||||
|
|
||||||
|
// Define the EAN-2 structure
|
||||||
|
var EAN2_STRUCTURE = exports.EAN2_STRUCTURE = ['LL', 'LG', 'GL', 'GG'];
|
||||||
|
|
||||||
|
// Define the EAN-5 structure
|
||||||
|
var EAN5_STRUCTURE = exports.EAN5_STRUCTURE = ['GGLLL', 'GLGLL', 'GLLGL', 'GLLLG', 'LGGLL', 'LLGGL', 'LLLGG', 'LGLGL', 'LGLLG', 'LLGLG'];
|
||||||
|
|
||||||
|
// Define the EAN-13 structure
|
||||||
|
var EAN13_STRUCTURE = exports.EAN13_STRUCTURE = ['LLLLLL', 'LLGLGG', 'LLGGLG', 'LLGGGL', 'LGLLGG', 'LGGLLG', 'LGGGLL', 'LGLGLG', 'LGLGGL', 'LGGLGL'];
|
|
@ -0,0 +1,27 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _constants = require('./constants');
|
||||||
|
|
||||||
|
// Encode data string
|
||||||
|
var encode = function encode(data, structure, separator) {
|
||||||
|
var encoded = data.split('').map(function (val, idx) {
|
||||||
|
return _constants.BINARIES[structure[idx]];
|
||||||
|
}).map(function (val, idx) {
|
||||||
|
return val ? val[data[idx]] : '';
|
||||||
|
});
|
||||||
|
|
||||||
|
if (separator) {
|
||||||
|
var last = data.length - 1;
|
||||||
|
encoded = encoded.map(function (val, idx) {
|
||||||
|
return idx < last ? val + separator : val;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return encoded.join('');
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.default = encode;
|
|
@ -0,0 +1,39 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.UPCE = exports.UPC = exports.EAN2 = exports.EAN5 = exports.EAN8 = exports.EAN13 = undefined;
|
||||||
|
|
||||||
|
var _EAN = require('./EAN13.js');
|
||||||
|
|
||||||
|
var _EAN2 = _interopRequireDefault(_EAN);
|
||||||
|
|
||||||
|
var _EAN3 = require('./EAN8.js');
|
||||||
|
|
||||||
|
var _EAN4 = _interopRequireDefault(_EAN3);
|
||||||
|
|
||||||
|
var _EAN5 = require('./EAN5.js');
|
||||||
|
|
||||||
|
var _EAN6 = _interopRequireDefault(_EAN5);
|
||||||
|
|
||||||
|
var _EAN7 = require('./EAN2.js');
|
||||||
|
|
||||||
|
var _EAN8 = _interopRequireDefault(_EAN7);
|
||||||
|
|
||||||
|
var _UPC = require('./UPC.js');
|
||||||
|
|
||||||
|
var _UPC2 = _interopRequireDefault(_UPC);
|
||||||
|
|
||||||
|
var _UPCE = require('./UPCE.js');
|
||||||
|
|
||||||
|
var _UPCE2 = _interopRequireDefault(_UPCE);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
exports.EAN13 = _EAN2.default;
|
||||||
|
exports.EAN8 = _EAN4.default;
|
||||||
|
exports.EAN5 = _EAN6.default;
|
||||||
|
exports.EAN2 = _EAN8.default;
|
||||||
|
exports.UPC = _UPC2.default;
|
||||||
|
exports.UPCE = _UPCE2.default;
|
|
@ -0,0 +1,55 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.GenericBarcode = undefined;
|
||||||
|
|
||||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||||
|
|
||||||
|
var _Barcode2 = require("../Barcode.js");
|
||||||
|
|
||||||
|
var _Barcode3 = _interopRequireDefault(_Barcode2);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||||
|
|
||||||
|
var GenericBarcode = function (_Barcode) {
|
||||||
|
_inherits(GenericBarcode, _Barcode);
|
||||||
|
|
||||||
|
function GenericBarcode(data, options) {
|
||||||
|
_classCallCheck(this, GenericBarcode);
|
||||||
|
|
||||||
|
return _possibleConstructorReturn(this, (GenericBarcode.__proto__ || Object.getPrototypeOf(GenericBarcode)).call(this, data, options)); // Sets this.data and this.text
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the corresponding binary numbers for the data provided
|
||||||
|
|
||||||
|
|
||||||
|
_createClass(GenericBarcode, [{
|
||||||
|
key: "encode",
|
||||||
|
value: function encode() {
|
||||||
|
return {
|
||||||
|
data: "10101010101010101010101010101010101010101",
|
||||||
|
text: this.text
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resturn true/false if the string provided is valid for this encoder
|
||||||
|
|
||||||
|
}, {
|
||||||
|
key: "valid",
|
||||||
|
value: function valid() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return GenericBarcode;
|
||||||
|
}(_Barcode3.default);
|
||||||
|
|
||||||
|
exports.GenericBarcode = GenericBarcode;
|
|
@ -0,0 +1,69 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||||
|
|
||||||
|
var _constants = require('./constants');
|
||||||
|
|
||||||
|
var _Barcode2 = require('../Barcode');
|
||||||
|
|
||||||
|
var _Barcode3 = _interopRequireDefault(_Barcode2);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||||
|
|
||||||
|
var ITF = function (_Barcode) {
|
||||||
|
_inherits(ITF, _Barcode);
|
||||||
|
|
||||||
|
function ITF() {
|
||||||
|
_classCallCheck(this, ITF);
|
||||||
|
|
||||||
|
return _possibleConstructorReturn(this, (ITF.__proto__ || Object.getPrototypeOf(ITF)).apply(this, arguments));
|
||||||
|
}
|
||||||
|
|
||||||
|
_createClass(ITF, [{
|
||||||
|
key: 'valid',
|
||||||
|
value: function valid() {
|
||||||
|
return this.data.search(/^([0-9]{2})+$/) !== -1;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'encode',
|
||||||
|
value: function encode() {
|
||||||
|
var _this2 = this;
|
||||||
|
|
||||||
|
// Calculate all the digit pairs
|
||||||
|
var encoded = this.data.match(/.{2}/g).map(function (pair) {
|
||||||
|
return _this2.encodePair(pair);
|
||||||
|
}).join('');
|
||||||
|
|
||||||
|
return {
|
||||||
|
data: _constants.START_BIN + encoded + _constants.END_BIN,
|
||||||
|
text: this.text
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate the data of a number pair
|
||||||
|
|
||||||
|
}, {
|
||||||
|
key: 'encodePair',
|
||||||
|
value: function encodePair(pair) {
|
||||||
|
var second = _constants.BINARIES[pair[1]];
|
||||||
|
|
||||||
|
return _constants.BINARIES[pair[0]].split('').map(function (first, idx) {
|
||||||
|
return (first === '1' ? '111' : '1') + (second[idx] === '1' ? '000' : '0');
|
||||||
|
}).join('');
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return ITF;
|
||||||
|
}(_Barcode3.default);
|
||||||
|
|
||||||
|
exports.default = ITF;
|
|
@ -0,0 +1,55 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||||
|
|
||||||
|
var _ITF2 = require('./ITF');
|
||||||
|
|
||||||
|
var _ITF3 = _interopRequireDefault(_ITF2);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||||
|
|
||||||
|
// Calculate the checksum digit
|
||||||
|
var checksum = function checksum(data) {
|
||||||
|
var res = data.substr(0, 13).split('').map(function (num) {
|
||||||
|
return parseInt(num, 10);
|
||||||
|
}).reduce(function (sum, n, idx) {
|
||||||
|
return sum + n * (3 - idx % 2 * 2);
|
||||||
|
}, 0);
|
||||||
|
|
||||||
|
return Math.ceil(res / 10) * 10 - res;
|
||||||
|
};
|
||||||
|
|
||||||
|
var ITF14 = function (_ITF) {
|
||||||
|
_inherits(ITF14, _ITF);
|
||||||
|
|
||||||
|
function ITF14(data, options) {
|
||||||
|
_classCallCheck(this, ITF14);
|
||||||
|
|
||||||
|
// Add checksum if it does not exist
|
||||||
|
if (data.search(/^[0-9]{13}$/) !== -1) {
|
||||||
|
data += checksum(data);
|
||||||
|
}
|
||||||
|
return _possibleConstructorReturn(this, (ITF14.__proto__ || Object.getPrototypeOf(ITF14)).call(this, data, options));
|
||||||
|
}
|
||||||
|
|
||||||
|
_createClass(ITF14, [{
|
||||||
|
key: 'valid',
|
||||||
|
value: function valid() {
|
||||||
|
return this.data.search(/^[0-9]{14}$/) !== -1 && +this.data[13] === checksum(this.data);
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return ITF14;
|
||||||
|
}(_ITF3.default);
|
||||||
|
|
||||||
|
exports.default = ITF14;
|
|
@ -0,0 +1,9 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
var START_BIN = exports.START_BIN = '1010';
|
||||||
|
var END_BIN = exports.END_BIN = '11101';
|
||||||
|
|
||||||
|
var BINARIES = exports.BINARIES = ['00110', '10001', '01001', '11000', '00101', '10100', '01100', '00011', '10010', '01010'];
|
|
@ -0,0 +1,19 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.ITF14 = exports.ITF = undefined;
|
||||||
|
|
||||||
|
var _ITF = require('./ITF');
|
||||||
|
|
||||||
|
var _ITF2 = _interopRequireDefault(_ITF);
|
||||||
|
|
||||||
|
var _ITF3 = require('./ITF14');
|
||||||
|
|
||||||
|
var _ITF4 = _interopRequireDefault(_ITF3);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
exports.ITF = _ITF2.default;
|
||||||
|
exports.ITF14 = _ITF4.default;
|
|
@ -0,0 +1,74 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||||
|
|
||||||
|
var _Barcode2 = require("../Barcode.js");
|
||||||
|
|
||||||
|
var _Barcode3 = _interopRequireDefault(_Barcode2);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation
|
||||||
|
// https://en.wikipedia.org/wiki/MSI_Barcode#Character_set_and_binary_lookup
|
||||||
|
|
||||||
|
var MSI = function (_Barcode) {
|
||||||
|
_inherits(MSI, _Barcode);
|
||||||
|
|
||||||
|
function MSI(data, options) {
|
||||||
|
_classCallCheck(this, MSI);
|
||||||
|
|
||||||
|
return _possibleConstructorReturn(this, (MSI.__proto__ || Object.getPrototypeOf(MSI)).call(this, data, options));
|
||||||
|
}
|
||||||
|
|
||||||
|
_createClass(MSI, [{
|
||||||
|
key: "encode",
|
||||||
|
value: function encode() {
|
||||||
|
// Start bits
|
||||||
|
var ret = "110";
|
||||||
|
|
||||||
|
for (var i = 0; i < this.data.length; i++) {
|
||||||
|
// Convert the character to binary (always 4 binary digits)
|
||||||
|
var digit = parseInt(this.data[i]);
|
||||||
|
var bin = digit.toString(2);
|
||||||
|
bin = addZeroes(bin, 4 - bin.length);
|
||||||
|
|
||||||
|
// Add 100 for every zero and 110 for every 1
|
||||||
|
for (var b = 0; b < bin.length; b++) {
|
||||||
|
ret += bin[b] == "0" ? "100" : "110";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// End bits
|
||||||
|
ret += "1001";
|
||||||
|
|
||||||
|
return {
|
||||||
|
data: ret,
|
||||||
|
text: this.text
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "valid",
|
||||||
|
value: function valid() {
|
||||||
|
return this.data.search(/^[0-9]+$/) !== -1;
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return MSI;
|
||||||
|
}(_Barcode3.default);
|
||||||
|
|
||||||
|
function addZeroes(number, n) {
|
||||||
|
for (var i = 0; i < n; i++) {
|
||||||
|
number = "0" + number;
|
||||||
|
}
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.default = MSI;
|
|
@ -0,0 +1,33 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _MSI2 = require('./MSI.js');
|
||||||
|
|
||||||
|
var _MSI3 = _interopRequireDefault(_MSI2);
|
||||||
|
|
||||||
|
var _checksums = require('./checksums.js');
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||||
|
|
||||||
|
var MSI10 = function (_MSI) {
|
||||||
|
_inherits(MSI10, _MSI);
|
||||||
|
|
||||||
|
function MSI10(data, options) {
|
||||||
|
_classCallCheck(this, MSI10);
|
||||||
|
|
||||||
|
return _possibleConstructorReturn(this, (MSI10.__proto__ || Object.getPrototypeOf(MSI10)).call(this, data + (0, _checksums.mod10)(data), options));
|
||||||
|
}
|
||||||
|
|
||||||
|
return MSI10;
|
||||||
|
}(_MSI3.default);
|
||||||
|
|
||||||
|
exports.default = MSI10;
|
|
@ -0,0 +1,35 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _MSI2 = require('./MSI.js');
|
||||||
|
|
||||||
|
var _MSI3 = _interopRequireDefault(_MSI2);
|
||||||
|
|
||||||
|
var _checksums = require('./checksums.js');
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||||
|
|
||||||
|
var MSI1010 = function (_MSI) {
|
||||||
|
_inherits(MSI1010, _MSI);
|
||||||
|
|
||||||
|
function MSI1010(data, options) {
|
||||||
|
_classCallCheck(this, MSI1010);
|
||||||
|
|
||||||
|
data += (0, _checksums.mod10)(data);
|
||||||
|
data += (0, _checksums.mod10)(data);
|
||||||
|
return _possibleConstructorReturn(this, (MSI1010.__proto__ || Object.getPrototypeOf(MSI1010)).call(this, data, options));
|
||||||
|
}
|
||||||
|
|
||||||
|
return MSI1010;
|
||||||
|
}(_MSI3.default);
|
||||||
|
|
||||||
|
exports.default = MSI1010;
|
|
@ -0,0 +1,33 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _MSI2 = require('./MSI.js');
|
||||||
|
|
||||||
|
var _MSI3 = _interopRequireDefault(_MSI2);
|
||||||
|
|
||||||
|
var _checksums = require('./checksums.js');
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||||
|
|
||||||
|
var MSI11 = function (_MSI) {
|
||||||
|
_inherits(MSI11, _MSI);
|
||||||
|
|
||||||
|
function MSI11(data, options) {
|
||||||
|
_classCallCheck(this, MSI11);
|
||||||
|
|
||||||
|
return _possibleConstructorReturn(this, (MSI11.__proto__ || Object.getPrototypeOf(MSI11)).call(this, data + (0, _checksums.mod11)(data), options));
|
||||||
|
}
|
||||||
|
|
||||||
|
return MSI11;
|
||||||
|
}(_MSI3.default);
|
||||||
|
|
||||||
|
exports.default = MSI11;
|
|
@ -0,0 +1,35 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _MSI2 = require('./MSI.js');
|
||||||
|
|
||||||
|
var _MSI3 = _interopRequireDefault(_MSI2);
|
||||||
|
|
||||||
|
var _checksums = require('./checksums.js');
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||||
|
|
||||||
|
var MSI1110 = function (_MSI) {
|
||||||
|
_inherits(MSI1110, _MSI);
|
||||||
|
|
||||||
|
function MSI1110(data, options) {
|
||||||
|
_classCallCheck(this, MSI1110);
|
||||||
|
|
||||||
|
data += (0, _checksums.mod11)(data);
|
||||||
|
data += (0, _checksums.mod10)(data);
|
||||||
|
return _possibleConstructorReturn(this, (MSI1110.__proto__ || Object.getPrototypeOf(MSI1110)).call(this, data, options));
|
||||||
|
}
|
||||||
|
|
||||||
|
return MSI1110;
|
||||||
|
}(_MSI3.default);
|
||||||
|
|
||||||
|
exports.default = MSI1110;
|
|
@ -0,0 +1,29 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.mod10 = mod10;
|
||||||
|
exports.mod11 = mod11;
|
||||||
|
function mod10(number) {
|
||||||
|
var sum = 0;
|
||||||
|
for (var i = 0; i < number.length; i++) {
|
||||||
|
var n = parseInt(number[i]);
|
||||||
|
if ((i + number.length) % 2 === 0) {
|
||||||
|
sum += n;
|
||||||
|
} else {
|
||||||
|
sum += n * 2 % 10 + Math.floor(n * 2 / 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (10 - sum % 10) % 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mod11(number) {
|
||||||
|
var sum = 0;
|
||||||
|
var weights = [2, 3, 4, 5, 6, 7];
|
||||||
|
for (var i = 0; i < number.length; i++) {
|
||||||
|
var n = parseInt(number[number.length - 1 - i]);
|
||||||
|
sum += weights[i % weights.length] * n;
|
||||||
|
}
|
||||||
|
return (11 - sum % 11) % 11;
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.MSI1110 = exports.MSI1010 = exports.MSI11 = exports.MSI10 = exports.MSI = undefined;
|
||||||
|
|
||||||
|
var _MSI = require('./MSI.js');
|
||||||
|
|
||||||
|
var _MSI2 = _interopRequireDefault(_MSI);
|
||||||
|
|
||||||
|
var _MSI3 = require('./MSI10.js');
|
||||||
|
|
||||||
|
var _MSI4 = _interopRequireDefault(_MSI3);
|
||||||
|
|
||||||
|
var _MSI5 = require('./MSI11.js');
|
||||||
|
|
||||||
|
var _MSI6 = _interopRequireDefault(_MSI5);
|
||||||
|
|
||||||
|
var _MSI7 = require('./MSI1010.js');
|
||||||
|
|
||||||
|
var _MSI8 = _interopRequireDefault(_MSI7);
|
||||||
|
|
||||||
|
var _MSI9 = require('./MSI1110.js');
|
||||||
|
|
||||||
|
var _MSI10 = _interopRequireDefault(_MSI9);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
exports.MSI = _MSI2.default;
|
||||||
|
exports.MSI10 = _MSI4.default;
|
||||||
|
exports.MSI11 = _MSI6.default;
|
||||||
|
exports.MSI1010 = _MSI8.default;
|
||||||
|
exports.MSI1110 = _MSI10.default;
|
|
@ -0,0 +1,92 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.codabar = undefined;
|
||||||
|
|
||||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||||
|
|
||||||
|
var _Barcode2 = require("../Barcode.js");
|
||||||
|
|
||||||
|
var _Barcode3 = _interopRequireDefault(_Barcode2);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding specification:
|
||||||
|
// http://www.barcodeisland.com/codabar.phtml
|
||||||
|
|
||||||
|
var codabar = function (_Barcode) {
|
||||||
|
_inherits(codabar, _Barcode);
|
||||||
|
|
||||||
|
function codabar(data, options) {
|
||||||
|
_classCallCheck(this, codabar);
|
||||||
|
|
||||||
|
if (data.search(/^[0-9\-\$\:\.\+\/]+$/) === 0) {
|
||||||
|
data = "A" + data + "A";
|
||||||
|
}
|
||||||
|
|
||||||
|
var _this = _possibleConstructorReturn(this, (codabar.__proto__ || Object.getPrototypeOf(codabar)).call(this, data.toUpperCase(), options));
|
||||||
|
|
||||||
|
_this.text = _this.options.text || _this.text.replace(/[A-D]/g, '');
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
|
||||||
|
_createClass(codabar, [{
|
||||||
|
key: "valid",
|
||||||
|
value: function valid() {
|
||||||
|
return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/) !== -1;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "encode",
|
||||||
|
value: function encode() {
|
||||||
|
var result = [];
|
||||||
|
var encodings = this.getEncodings();
|
||||||
|
for (var i = 0; i < this.data.length; i++) {
|
||||||
|
result.push(encodings[this.data.charAt(i)]);
|
||||||
|
// for all characters except the last, append a narrow-space ("0")
|
||||||
|
if (i !== this.data.length - 1) {
|
||||||
|
result.push("0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
text: this.text,
|
||||||
|
data: result.join('')
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "getEncodings",
|
||||||
|
value: function getEncodings() {
|
||||||
|
return {
|
||||||
|
"0": "101010011",
|
||||||
|
"1": "101011001",
|
||||||
|
"2": "101001011",
|
||||||
|
"3": "110010101",
|
||||||
|
"4": "101101001",
|
||||||
|
"5": "110101001",
|
||||||
|
"6": "100101011",
|
||||||
|
"7": "100101101",
|
||||||
|
"8": "100110101",
|
||||||
|
"9": "110100101",
|
||||||
|
"-": "101001101",
|
||||||
|
"$": "101100101",
|
||||||
|
":": "1101011011",
|
||||||
|
"/": "1101101011",
|
||||||
|
".": "1101101101",
|
||||||
|
"+": "101100110011",
|
||||||
|
"A": "1011001001",
|
||||||
|
"B": "1001001011",
|
||||||
|
"C": "1010010011",
|
||||||
|
"D": "1010011001"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return codabar;
|
||||||
|
}(_Barcode3.default);
|
||||||
|
|
||||||
|
exports.codabar = codabar;
|
|
@ -0,0 +1,34 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _CODE = require('./CODE39/');
|
||||||
|
|
||||||
|
var _CODE2 = require('./CODE128/');
|
||||||
|
|
||||||
|
var _EAN_UPC = require('./EAN_UPC/');
|
||||||
|
|
||||||
|
var _ITF = require('./ITF/');
|
||||||
|
|
||||||
|
var _MSI = require('./MSI/');
|
||||||
|
|
||||||
|
var _pharmacode = require('./pharmacode/');
|
||||||
|
|
||||||
|
var _codabar = require('./codabar');
|
||||||
|
|
||||||
|
var _GenericBarcode = require('./GenericBarcode/');
|
||||||
|
|
||||||
|
exports.default = {
|
||||||
|
CODE39: _CODE.CODE39,
|
||||||
|
CODE128: _CODE2.CODE128, CODE128A: _CODE2.CODE128A, CODE128B: _CODE2.CODE128B, CODE128C: _CODE2.CODE128C,
|
||||||
|
EAN13: _EAN_UPC.EAN13, EAN8: _EAN_UPC.EAN8, EAN5: _EAN_UPC.EAN5, EAN2: _EAN_UPC.EAN2,
|
||||||
|
UPC: _EAN_UPC.UPC, UPCE: _EAN_UPC.UPCE,
|
||||||
|
ITF14: _ITF.ITF14,
|
||||||
|
ITF: _ITF.ITF,
|
||||||
|
MSI: _MSI.MSI, MSI10: _MSI.MSI10, MSI11: _MSI.MSI11, MSI1010: _MSI.MSI1010, MSI1110: _MSI.MSI1110,
|
||||||
|
PHARMACODE: _pharmacode.pharmacode,
|
||||||
|
CODABAR: _codabar.codabar,
|
||||||
|
GENERICBARCODE: _GenericBarcode.GenericBarcode
|
||||||
|
};
|
|
@ -0,0 +1,73 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.pharmacode = undefined;
|
||||||
|
|
||||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||||
|
|
||||||
|
var _Barcode2 = require("../Barcode.js");
|
||||||
|
|
||||||
|
var _Barcode3 = _interopRequireDefault(_Barcode2);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||||
|
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation
|
||||||
|
// http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf
|
||||||
|
|
||||||
|
var pharmacode = function (_Barcode) {
|
||||||
|
_inherits(pharmacode, _Barcode);
|
||||||
|
|
||||||
|
function pharmacode(data, options) {
|
||||||
|
_classCallCheck(this, pharmacode);
|
||||||
|
|
||||||
|
var _this = _possibleConstructorReturn(this, (pharmacode.__proto__ || Object.getPrototypeOf(pharmacode)).call(this, data, options));
|
||||||
|
|
||||||
|
_this.number = parseInt(data, 10);
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
|
||||||
|
_createClass(pharmacode, [{
|
||||||
|
key: "encode",
|
||||||
|
value: function encode() {
|
||||||
|
var z = this.number;
|
||||||
|
var result = "";
|
||||||
|
|
||||||
|
// http://i.imgur.com/RMm4UDJ.png
|
||||||
|
// (source: http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf, page: 34)
|
||||||
|
while (!isNaN(z) && z != 0) {
|
||||||
|
if (z % 2 === 0) {
|
||||||
|
// Even
|
||||||
|
result = "11100" + result;
|
||||||
|
z = (z - 2) / 2;
|
||||||
|
} else {
|
||||||
|
// Odd
|
||||||
|
result = "100" + result;
|
||||||
|
z = (z - 1) / 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the two last zeroes
|
||||||
|
result = result.slice(0, -2);
|
||||||
|
|
||||||
|
return {
|
||||||
|
data: result,
|
||||||
|
text: this.text
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "valid",
|
||||||
|
value: function valid() {
|
||||||
|
return this.number >= 3 && this.number <= 131070;
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return pharmacode;
|
||||||
|
}(_Barcode3.default);
|
||||||
|
|
||||||
|
exports.pharmacode = pharmacode;
|
|
@ -0,0 +1,201 @@
|
||||||
|
<template xlang="wxml" minapp="mpvue">
|
||||||
|
<view class="tki-barcode">
|
||||||
|
<!-- #ifndef MP-ALIPAY -->
|
||||||
|
<canvas class="tki-barcode-canvas" :canvas-id="cid" :style="{width:canvasWidth+'px',height:canvasHeight+'px'}" />
|
||||||
|
<!-- #endif -->
|
||||||
|
<!-- #ifdef MP-ALIPAY -->
|
||||||
|
<canvas v-if="val === '' || defaultOpations.text === val" :id="cid" :width="canvasWidth" :height="canvasHeight" class="tki-barcode-canvas" />
|
||||||
|
<!-- #endif -->
|
||||||
|
<image v-show="show" :src="result" :style="{width:canvasWidth+'px',height:canvasHeight+'px', maxWidth: '100%'}" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// const barcode = require('./barcode.js');
|
||||||
|
import barCode from "./barcode.js"
|
||||||
|
const opations = {
|
||||||
|
// format: "CODE128",//选择要使用的条形码类型 微信支持的条码类型有 code128\code39\ena13\ean8\upc\itf14\
|
||||||
|
width: 4,//设置条之间的宽度
|
||||||
|
height: 120,//高度
|
||||||
|
displayValue: true,//是否在条形码下方显示文字
|
||||||
|
// text: "1234567890",//覆盖显示的文本
|
||||||
|
textAlign: "center",//设置文本的水平对齐方式
|
||||||
|
textPosition: "bottom",//设置文本的垂直位置
|
||||||
|
textMargin: 0,//设置条形码和文本之间的间距
|
||||||
|
fontSize: 24,//设置文本的大小
|
||||||
|
fontColor: "#000000",//设置文本的颜色
|
||||||
|
lineColor: "#000000",//设置条形码的颜色
|
||||||
|
background: "#FFFFFF",//设置条形码的背景色
|
||||||
|
margin: 0,//设置条形码周围的空白边距
|
||||||
|
marginTop: undefined,//设置条形码周围的上边距
|
||||||
|
marginBottom: undefined,//设置条形码周围的下边距
|
||||||
|
marginLeft: undefined,//设置条形码周围的左边距
|
||||||
|
marginRight: undefined,//设置条形码周围的右边距
|
||||||
|
}
|
||||||
|
export default {
|
||||||
|
name: "tkiBarcode",
|
||||||
|
props: {
|
||||||
|
show: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
cid: {
|
||||||
|
type: String,
|
||||||
|
default: 'tki-barcode-canvas'
|
||||||
|
},
|
||||||
|
unit: {
|
||||||
|
type: String,
|
||||||
|
default: 'upx'
|
||||||
|
},
|
||||||
|
val: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
format: {
|
||||||
|
type: String,
|
||||||
|
default: 'CODE128'
|
||||||
|
},
|
||||||
|
opations: {
|
||||||
|
type: Object,
|
||||||
|
default: function () {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onval: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
loadMake: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
result: '',
|
||||||
|
canvasWidth: 0,
|
||||||
|
canvasHeight: 0,
|
||||||
|
defaultOpations: Object.assign({}, opations)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onUnload: function () {
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
_makeCode() {
|
||||||
|
let that = this
|
||||||
|
// 合并参数
|
||||||
|
Object.assign(this.defaultOpations, this.opations)
|
||||||
|
if (that.unit == "upx") {
|
||||||
|
/* if (that.defaultOpations.width) {
|
||||||
|
that.defaultOpations.width = uni.upx2px(that.defaultOpations.width)
|
||||||
|
} */
|
||||||
|
if (that.defaultOpations.height) {
|
||||||
|
that.defaultOpations.height = uni.upx2px(that.defaultOpations.height)
|
||||||
|
}
|
||||||
|
if (that.defaultOpations.fontSize) {
|
||||||
|
that.defaultOpations.fontSize = uni.upx2px(that.defaultOpations.fontSize)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (that._empty(that.defaultOpations.text)) {
|
||||||
|
that.defaultOpations.text = that.val
|
||||||
|
}
|
||||||
|
if (that._empty(that.defaultOpations.format)) {
|
||||||
|
that.defaultOpations.format = that.format
|
||||||
|
}
|
||||||
|
// console.log(JSON.stringify(that.defaultOpations))
|
||||||
|
this.$nextTick(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
new barCode(that, that.cid, that.defaultOpations,
|
||||||
|
function (res) { // 生成条形码款高回调
|
||||||
|
that.canvasWidth = res.width
|
||||||
|
that.canvasHeight = res.height
|
||||||
|
},
|
||||||
|
function (res) { // 生成条形码的回调
|
||||||
|
// 返回值
|
||||||
|
that._result(res)
|
||||||
|
// 重置默认参数
|
||||||
|
that.defaultOpations = opations
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}, 100)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
_clearCode() {
|
||||||
|
this._result('')
|
||||||
|
},
|
||||||
|
_saveCode() {
|
||||||
|
let that = this;
|
||||||
|
if (this.result != "") {
|
||||||
|
uni.saveImageToPhotosAlbum({
|
||||||
|
filePath: that.result,
|
||||||
|
success: function () {
|
||||||
|
uni.showToast({
|
||||||
|
title: '条形码保存成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_result(res) {
|
||||||
|
this.result = res;
|
||||||
|
this.$emit('result', res)
|
||||||
|
},
|
||||||
|
_empty(v) {
|
||||||
|
let tp = typeof v,
|
||||||
|
rt = false;
|
||||||
|
if (tp == "number" && String(v) == "") {
|
||||||
|
rt = true
|
||||||
|
} else if (tp == "undefined") {
|
||||||
|
rt = true
|
||||||
|
} else if (tp == "object") {
|
||||||
|
if (JSON.stringify(v) == "{}" || JSON.stringify(v) == "[]" || v == null) rt = true
|
||||||
|
} else if (tp == "string") {
|
||||||
|
if (v == "" || v == "undefined" || v == "null" || v == "{}" || v == "[]") rt = true
|
||||||
|
} else if (tp == "function") {
|
||||||
|
rt = false
|
||||||
|
}
|
||||||
|
return rt
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
val(n, o) {
|
||||||
|
this.defaultOpations.text = n
|
||||||
|
if (this.onval) {
|
||||||
|
if (n != o && !this._empty(n)) {
|
||||||
|
this._makeCode()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
opations: {
|
||||||
|
handler(n,o){
|
||||||
|
if (this.onval) {
|
||||||
|
if (!this._empty(n)) {
|
||||||
|
this._makeCode()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
if (this.loadMake) {
|
||||||
|
if (!this._empty(this.val)) {
|
||||||
|
this._makeCode()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
.tki-barcode {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.tki-barcode-canvas {
|
||||||
|
position: fixed!important;
|
||||||
|
top: -99999upx;
|
||||||
|
left: -99999upx;
|
||||||
|
z-index: -99999;
|
||||||
|
}
|
||||||
|
</style>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,206 @@
|
||||||
|
<template xlang="wxml" minapp="mpvue">
|
||||||
|
<view class="tki-qrcode">
|
||||||
|
<!-- #ifndef MP-ALIPAY -->
|
||||||
|
<canvas class="tki-qrcode-canvas" :canvas-id="cid" :style="{width:cpSize+'px',height:cpSize+'px'}" />
|
||||||
|
<!-- #endif -->
|
||||||
|
<!-- #ifdef MP-ALIPAY -->
|
||||||
|
<canvas :id="cid" :width="cpSize" :height="cpSize" class="tki-qrcode-canvas" />
|
||||||
|
<!-- #endif -->
|
||||||
|
<image v-show="show" :src="result" :style="{width:cpSize+'px',height:cpSize+'px'}" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import QRCode from "./qrcode.js"
|
||||||
|
let qrcode
|
||||||
|
export default {
|
||||||
|
name: "tki-qrcode",
|
||||||
|
props: {
|
||||||
|
cid: {
|
||||||
|
type: String,
|
||||||
|
default: 'tki-qrcode-canvas'
|
||||||
|
},
|
||||||
|
size: {
|
||||||
|
type: Number,
|
||||||
|
default: 200
|
||||||
|
},
|
||||||
|
unit: {
|
||||||
|
type: String,
|
||||||
|
default: 'upx'
|
||||||
|
},
|
||||||
|
show: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
val: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
background: {
|
||||||
|
type: String,
|
||||||
|
default: '#ffffff'
|
||||||
|
},
|
||||||
|
foreground: {
|
||||||
|
type: String,
|
||||||
|
default: '#000000'
|
||||||
|
},
|
||||||
|
pdground: {
|
||||||
|
type: String,
|
||||||
|
default: '#000000'
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
iconSize: {
|
||||||
|
type: Number,
|
||||||
|
default: 40
|
||||||
|
},
|
||||||
|
lv: {
|
||||||
|
type: Number,
|
||||||
|
default: 3
|
||||||
|
},
|
||||||
|
onval: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
loadMake: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
usingComponents: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
showLoading: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
loadingText: {
|
||||||
|
type: String,
|
||||||
|
default: '二维码生成中'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
result: '',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
_makeCode() {
|
||||||
|
let that = this
|
||||||
|
if (!this._empty(this.val)) {
|
||||||
|
setTimeout(() => {
|
||||||
|
qrcode = new QRCode({
|
||||||
|
context: that, // 上下文环境
|
||||||
|
canvasId:that.cid, // canvas-id
|
||||||
|
usingComponents: that.usingComponents, // 是否是自定义组件
|
||||||
|
showLoading: that.showLoading, // 是否显示loading
|
||||||
|
loadingText: that.loadingText, // loading文字
|
||||||
|
text: that.val, // 生成内容
|
||||||
|
size: that.cpSize, // 二维码大小
|
||||||
|
background: that.background, // 背景色
|
||||||
|
foreground: that.foreground, // 前景色
|
||||||
|
pdground: that.pdground, // 定位角点颜色
|
||||||
|
correctLevel: that.lv, // 容错级别
|
||||||
|
image: that.icon, // 二维码图标
|
||||||
|
imageSize: that.iconSize,// 二维码图标大小
|
||||||
|
cbResult: function (res) { // 生成二维码的回调
|
||||||
|
that._result(res)
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}, 1)
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '二维码内容不能为空',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_clearCode() {
|
||||||
|
this._result('')
|
||||||
|
qrcode.clear()
|
||||||
|
},
|
||||||
|
_saveCode() {
|
||||||
|
let that = this;
|
||||||
|
if (this.result != "") {
|
||||||
|
uni.saveImageToPhotosAlbum({
|
||||||
|
filePath: that.result,
|
||||||
|
success: function () {
|
||||||
|
uni.showToast({
|
||||||
|
title: '二维码保存成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_result(res) {
|
||||||
|
this.result = res;
|
||||||
|
this.$emit('result', res)
|
||||||
|
},
|
||||||
|
_empty(v) {
|
||||||
|
let tp = typeof v,
|
||||||
|
rt = false;
|
||||||
|
if (tp == "number" && String(v) == "") {
|
||||||
|
rt = true
|
||||||
|
} else if (tp == "undefined") {
|
||||||
|
rt = true
|
||||||
|
} else if (tp == "object") {
|
||||||
|
if (JSON.stringify(v) == "{}" || JSON.stringify(v) == "[]" || v == null) rt = true
|
||||||
|
} else if (tp == "string") {
|
||||||
|
if (v == "" || v == "undefined" || v == "null" || v == "{}" || v == "[]") rt = true
|
||||||
|
} else if (tp == "function") {
|
||||||
|
rt = false
|
||||||
|
}
|
||||||
|
return rt
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
size: function (n, o) {
|
||||||
|
if (n != o && !this._empty(n)) {
|
||||||
|
this.cSize = n
|
||||||
|
if (!this._empty(this.val)) {
|
||||||
|
this._makeCode()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
val: function (n, o) {
|
||||||
|
if (this.onval) {
|
||||||
|
if (n != o && !this._empty(n)) {
|
||||||
|
this._makeCode()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
cpSize() {
|
||||||
|
if(this.unit == "upx"){
|
||||||
|
return uni.upx2px(this.size)
|
||||||
|
}else{
|
||||||
|
return this.size
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
if (this.loadMake) {
|
||||||
|
if (!this._empty(this.val)) {
|
||||||
|
this._makeCode()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
.tki-qrcode {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.tki-qrcode-canvas {
|
||||||
|
position: fixed!important;
|
||||||
|
top: -99999upx;
|
||||||
|
left: -99999upx;
|
||||||
|
z-index: -99999;
|
||||||
|
}
|
||||||
|
</style>
|
56
pages.json
56
pages.json
|
@ -91,6 +91,12 @@
|
||||||
"navigationBarTitleText": "采购车"
|
"navigationBarTitleText": "采购车"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/nongKe/supply_chain/shopping_trolley_other",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "采购车"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/moreProject/moreProject",
|
"path": "pages/moreProject/moreProject",
|
||||||
"style": {
|
"style": {
|
||||||
|
@ -304,6 +310,18 @@
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "indexOther",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "订单详情"
|
||||||
|
//,
|
||||||
|
//"navigationBarBackgroundColor": "#e93323"
|
||||||
|
// #ifdef MP || APP-PLUS
|
||||||
|
// ,
|
||||||
|
//"navigationBarTextStyle": "#fff"
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "stay",
|
"path": "stay",
|
||||||
"style": {
|
"style": {
|
||||||
|
@ -441,7 +459,13 @@
|
||||||
"navigationBarTitleText": "供货采购",
|
"navigationBarTitleText": "供货采购",
|
||||||
"enablePullDownRefresh": true
|
"enablePullDownRefresh": true
|
||||||
}
|
}
|
||||||
|
},{
|
||||||
|
"path": "cloud_entrepot/indexOther",
|
||||||
|
"style": {
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"navigationBarTitleText": "供货采购",
|
||||||
|
"enablePullDownRefresh": true
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
"path": "teach_video/teach_video",
|
"path": "teach_video/teach_video",
|
||||||
"style": {
|
"style": {
|
||||||
|
@ -711,6 +735,12 @@
|
||||||
"navigationBarTitleText": "提交订单"
|
"navigationBarTitleText": "提交订单"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "order_confirm/indexOther",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "提交订单"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "goods_details_store/index",
|
"path": "goods_details_store/index",
|
||||||
"style": {
|
"style": {
|
||||||
|
@ -753,6 +783,12 @@
|
||||||
"navigationBarTitleText": "采购订单"
|
"navigationBarTitleText": "采购订单"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "order_list/indexOther",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "赊账订单"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "order_list/relase",
|
"path": "order_list/relase",
|
||||||
"style": {
|
"style": {
|
||||||
|
@ -1150,6 +1186,12 @@
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "订单列表"
|
"navigationBarTitleText": "订单列表"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "orderList/indexOther",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "订单列表"
|
||||||
|
}
|
||||||
},{
|
},{
|
||||||
"path": "financial_management/index",
|
"path": "financial_management/index",
|
||||||
"style": {
|
"style": {
|
||||||
|
@ -1175,6 +1217,12 @@
|
||||||
"navigationBarTitleText": "订单详情"
|
"navigationBarTitleText": "订单详情"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "orderDetail/indexOther",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "订单详情"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "refundDetail/index",
|
"path": "refundDetail/index",
|
||||||
"style": {
|
"style": {
|
||||||
|
@ -1187,6 +1235,12 @@
|
||||||
"navigationBarTitleText": "订单发货"
|
"navigationBarTitleText": "订单发货"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "delivery/indexOther",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "订单发货"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "statistics/index",
|
"path": "statistics/index",
|
||||||
"style": {
|
"style": {
|
||||||
|
|
|
@ -0,0 +1,851 @@
|
||||||
|
<template>
|
||||||
|
<view class="deliver-goods" :style="viewColor">
|
||||||
|
<header>
|
||||||
|
<view class="order-num acea-row row-between-wrapper">
|
||||||
|
<view class="num line1">订单号:{{ delivery.order_sn }}</view>
|
||||||
|
<view class="name line1">
|
||||||
|
<span class="iconfont icon-yonghu2"></span>{{ delivery.user && delivery.user.nickname }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="address">
|
||||||
|
<view class="name">
|
||||||
|
{{ delivery.real_name }}<span class="phone">{{ delivery.user && delivery.user_phone }}</span>
|
||||||
|
</view>
|
||||||
|
<view>{{ delivery.user_address }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="line">
|
||||||
|
<image :src="`${domain}/static/images/line.jpg`" />
|
||||||
|
</view>
|
||||||
|
</header>
|
||||||
|
<view class="wrapper">
|
||||||
|
<view class="item acea-row row-between-wrapper">
|
||||||
|
<view>发货方式</view>
|
||||||
|
<view class="mode acea-row row-middle row-right">
|
||||||
|
<view class="goods" :class="active === index ? 'on' : ''" v-for="(item, index) in types" :key="index" @click="changeType(item, index)">
|
||||||
|
<span class="iconfont icon-xuanzhong2"></span>{{ item.title }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<block v-if="logistics.length>0">
|
||||||
|
<view class="list">
|
||||||
|
<block v-if="delivery_type == 1">
|
||||||
|
<view class="item acea-row row-between-wrapper">
|
||||||
|
<view>快递公司</view>
|
||||||
|
<view class="select-box">
|
||||||
|
<picker class="pickerBox" @change="bindPickerChange" :value="seIndex" :range="logistics" range-key="label">
|
||||||
|
<view class="uni-input">{{logistics[seIndex].label}}</view>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item acea-row row-between-wrapper">
|
||||||
|
<view>快递单号</view>
|
||||||
|
<input type="text" placeholder="填写快递单号" v-model="delivery_id" class="mode" />
|
||||||
|
<!-- #ifdef MP -->
|
||||||
|
<text class="iconfont icon-xiangji" @click="scanCode"></text>
|
||||||
|
<!-- #endif -->
|
||||||
|
<!-- #ifdef H5 -->
|
||||||
|
<text v-if="isWeixin" class="iconfont icon-xiangji" @click="scanCode"></text>
|
||||||
|
<!-- #endif -->
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<block v-if="delivery_type == 4">
|
||||||
|
<view class="item acea-row row-between-wrapper">
|
||||||
|
<view>快递公司</view>
|
||||||
|
<view class="select-box">
|
||||||
|
<picker class="pickerBox" @change="bindPickerChange" :value="seIndex" :range="logistics" range-key="label">
|
||||||
|
<view class="uni-input">{{logistics[seIndex].label}}</view>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item acea-row row-between-wrapper" v-if="expTemp.length > 0 && delivery_type == 4">
|
||||||
|
<view>电子面单</view>
|
||||||
|
<div style="display: flex;align-items: center;">
|
||||||
|
<picker class="pickerBox" @change="bindTempChange" :value="expIndex" :range="expTemp" range-key="title">
|
||||||
|
<view class="uni-input input-inline">{{expTemp[expIndex].title}}</view>
|
||||||
|
</picker>
|
||||||
|
<div class="look" @click="previewImage">预览</div>
|
||||||
|
</div>
|
||||||
|
</view>
|
||||||
|
<view class="item acea-row row-between-wrapper">
|
||||||
|
<view>寄件人姓名</view>
|
||||||
|
<input type="text" placeholder="填写寄件人姓名" v-model="from_name" class="mode" />
|
||||||
|
</view>
|
||||||
|
<view class="item acea-row row-between-wrapper">
|
||||||
|
<view>寄件人电话</view>
|
||||||
|
<input type="text" placeholder="填写寄件人电话" v-model="from_tel" class="mode" />
|
||||||
|
</view>
|
||||||
|
<view class="item acea-row row-between-wrapper">
|
||||||
|
<view>寄件人地址</view>
|
||||||
|
<input type="text" placeholder="填写寄件人地址" v-model="from_addr" class="mode" />
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<view class="list" v-if="delivery_type == 2">
|
||||||
|
<view class="item acea-row row-between-wrapper">
|
||||||
|
<view>送货人姓名</view>
|
||||||
|
<input type="text" placeholder="填写送货人姓名" maxlength="10" v-model="to_name" class="mode" />
|
||||||
|
</view>
|
||||||
|
<view class="item acea-row row-between-wrapper">
|
||||||
|
<view>送货人电话</view>
|
||||||
|
<input type="text" placeholder="填写送货人电话" v-model="to_phone" class="mode" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<block v-if="delivery_type == 5">
|
||||||
|
<view class="item acea-row row-between-wrapper">
|
||||||
|
<view>发货点</view>
|
||||||
|
<view class="select-box">
|
||||||
|
<picker class="pickerBox" @change="bindStoreChange" :value="storeIndex" :range="storeList" range-key="label">
|
||||||
|
<view class="uni-input">{{storeList[storeIndex] && storeList[storeIndex].label}}</view>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item acea-row row-between-wrapper">
|
||||||
|
<view>包裹重量</view>
|
||||||
|
<input type="number" placeholder="填写包裹重量" v-model="cargo_weight" class="mode" />
|
||||||
|
</view>
|
||||||
|
<view class="item acea-row row-between-wrapper">
|
||||||
|
<view>配送备注</view>
|
||||||
|
<input type="textarea" placeholder="填写配送备注" v-model="mark" class="mode textarea" />
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<view class="list">
|
||||||
|
<view class="item acea-row row-between-wrapper">
|
||||||
|
<view>发货备注</view>
|
||||||
|
<input type="textarea" placeholder="填写发货备注" v-model="remark" class="mode textarea" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<block v-if="(delivery.orderProduct) && ((delivery.orderProduct.length > 1) || (delivery.orderProduct.length==1 && delivery.orderProduct[0]['refund_num']>1)) && activity_type != 2">
|
||||||
|
<view class="item acea-row row-between-wrapper">
|
||||||
|
<view>分单发货</view>
|
||||||
|
<view class="mode acea-row row-middle row-right">
|
||||||
|
<view class="goods" :class="curSplit === item.key ? 'on' : ''" v-for="(item, index) in splitList" :key="index" @click="changeSplit(item, index)">
|
||||||
|
<span class="iconfont icon-xuanzhong2"></span>{{ item.title }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<block v-if="curSplit">
|
||||||
|
<view v-for="(item, index) in delivery.orderProduct">
|
||||||
|
<view class="pro_list acea-row">
|
||||||
|
<view class="checkbox" @tap.stop="checkedChange(item)">
|
||||||
|
<text v-if="item.checked" class="iconfont icon-xuanzhong1"></text>
|
||||||
|
<text v-else class="iconfont icon-weixuanzhong"></text>
|
||||||
|
</view>
|
||||||
|
<view v-if="item.cart_info && item.cart_info.product" class="picture">
|
||||||
|
<image :src="item.cart_info.product.image"></image>
|
||||||
|
</view>
|
||||||
|
<view class="info" v-if="item.cart_info && item.cart_info.product">
|
||||||
|
<view class="name line2">{{item.cart_info.product.store_name}}</view>
|
||||||
|
<view class="info_sku" v-if="item.cart_info && item.cart_info.productAttr">{{item.cart_info.productAttr.sku}}</view>
|
||||||
|
<view class="info_price" v-if="item.cart_info && item.cart_info.productAttr">¥<text>{{item.cart_info.productAttr.price}}</text></view>
|
||||||
|
<view class='carnum acea-row row-center-wrapper'>
|
||||||
|
<view class="reduce" :class="item.numSub ? 'on' : ''" @click.stop='subCart(item)'>-</view>
|
||||||
|
<view class='num'>{{item.split_num}}</view>
|
||||||
|
<view class="plus" :class="item.numAdd ? 'on' : ''" @click.stop='addCart(item)'>+</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</block>
|
||||||
|
<block v-if="!curSplit">
|
||||||
|
<view class="pro_count" v-if="delivery.orderProduct">
|
||||||
|
<view class="title">共{{delivery.orderProduct.length}}件商品</view>
|
||||||
|
<view v-for="(item, index) in delivery.orderProduct">
|
||||||
|
<view class="pro_list acea-row">
|
||||||
|
<view v-if="item.cart_info && item.cart_info.product" class="picture">
|
||||||
|
<image :src="item.cart_info.product.image"></image>
|
||||||
|
</view>
|
||||||
|
<view class="info pro_info" v-if="item.cart_info && item.cart_info.product">
|
||||||
|
<view class="name line2">{{item.cart_info.product.store_name}}</view>
|
||||||
|
<view class="info_sku" v-if="item.cart_info && item.cart_info.productAttr">{{item.cart_info.productAttr.sku}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="pro_price" v-if="item.cart_info && item.cart_info.productAttr">
|
||||||
|
<view class="info_price">¥{{item.cart_info.productAttr.price}}</view>
|
||||||
|
<view class="info_num">x{{item.product_num}}</view>
|
||||||
|
<view class="refund_num" v-if="item.product_num-item.refund_num>0">{{item.product_num-item.refund_num}}件{{item.is_refund==1?'退款中' : item.is_refund==2 ? '已退款' : item.is_refund==3?'全部退款':''}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- <view class="footer">
|
||||||
|
共{{delivery.orderProduct.length}}件商品,应支付<text> ¥{{delivery.pay_price}} </text>(运费¥{{delivery.pay_postage}})
|
||||||
|
</view> -->
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
<view style="height:5.4rem;"></view>
|
||||||
|
<view class="confirm_btn"><view class="confirm" @click="saveInfo">确认提交</view></view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: CRMEB Team <admin@crmeb.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
import {
|
||||||
|
getAdminOrderDetail,
|
||||||
|
getAdminOtherOrderDetail,
|
||||||
|
setAdminOrderDelivery,
|
||||||
|
setAdminOtherOrderDelivery,
|
||||||
|
orderExportTemp,
|
||||||
|
orderDeliveryInfo,
|
||||||
|
getTempAndDelivery,
|
||||||
|
getDeliveryStoreLst
|
||||||
|
} from "@/api/admin";
|
||||||
|
import { mapGetters } from "vuex";
|
||||||
|
import { expressList } from "@/api/order";
|
||||||
|
import { checkPhone } from '@/utils/validate.js';
|
||||||
|
import { HTTP_REQUEST_URL } from '@/config/app';
|
||||||
|
export default {
|
||||||
|
name: "GoodsDeliver",
|
||||||
|
components: {},
|
||||||
|
props: {},
|
||||||
|
data: function() {
|
||||||
|
return {
|
||||||
|
types: [
|
||||||
|
// {
|
||||||
|
// type: 1,
|
||||||
|
// title: "发货"
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
type: 2,
|
||||||
|
title: "送货"
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// type: 3,
|
||||||
|
// title: "无需物流"
|
||||||
|
// }
|
||||||
|
],
|
||||||
|
splitList: [
|
||||||
|
{
|
||||||
|
title: '开启',
|
||||||
|
key: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '关闭',
|
||||||
|
key: 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
curSplit: 0,
|
||||||
|
curExpress: 1,
|
||||||
|
active: 0,
|
||||||
|
order_id: "",
|
||||||
|
delivery: {
|
||||||
|
user: {}
|
||||||
|
},
|
||||||
|
logistics: [],
|
||||||
|
delivery_type: 2,
|
||||||
|
delivery_name: "",
|
||||||
|
to_phone: '', //送货人电话
|
||||||
|
to_name: '', //送货人姓名
|
||||||
|
remark: "",
|
||||||
|
mark: "",
|
||||||
|
cargo_weight: 0,
|
||||||
|
delivery_id: "",
|
||||||
|
mer_config_temp_id: "",
|
||||||
|
mer_from_com: "",
|
||||||
|
seIndex: 0,
|
||||||
|
storeIndex: 0,
|
||||||
|
merId: "",
|
||||||
|
expIndex:0,
|
||||||
|
expTemp:[], // 快递模板
|
||||||
|
from_name:'', // 发货人名称
|
||||||
|
from_tel:'', // 发货人电话
|
||||||
|
from_addr:"", // 发货人地址
|
||||||
|
fictitious_content: '',
|
||||||
|
isTemp: false,
|
||||||
|
isDelivery: false,
|
||||||
|
is_virtual: 0,
|
||||||
|
splitProducts: [],
|
||||||
|
storeList: [],
|
||||||
|
activity_type: 0,
|
||||||
|
domain: HTTP_REQUEST_URL,
|
||||||
|
// #ifdef H5
|
||||||
|
isWeixin: this.$wechat.isWeixin()
|
||||||
|
// #endif
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
"$route.params.oid": function(newVal) {
|
||||||
|
let that = this;
|
||||||
|
if (newVal != undefined) {
|
||||||
|
that.order_id = newVal;
|
||||||
|
that.getIndex();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: mapGetters(['viewColor']),
|
||||||
|
onLoad: function(option) {
|
||||||
|
this.order_id = option.id;
|
||||||
|
this.merId = option.merId
|
||||||
|
this.getIndex();
|
||||||
|
this.expressList();
|
||||||
|
this.orderDeliveryInfo();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 扫描快递单号一维码
|
||||||
|
scanCode() {
|
||||||
|
// #ifdef MP
|
||||||
|
let that = this;
|
||||||
|
uni.scanCode({
|
||||||
|
scanType: ['barCode'],
|
||||||
|
success(res) {
|
||||||
|
let code = res.result.split(",")
|
||||||
|
that.delivery_id = code.length == 1 ? code[0] : code[1];
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
// #ifdef H5
|
||||||
|
if (this.$wechat.isWeixin()) {
|
||||||
|
this.$wechat.wechatEvevt('scanQRCode', {
|
||||||
|
needResult: 1,
|
||||||
|
scanType: ['barCode']
|
||||||
|
}).then(res => {
|
||||||
|
let code = res.resultStr.split(",")
|
||||||
|
that.delivery_id = code.length == 1 ? code[0] : code[1];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
// 预览图片
|
||||||
|
previewImage(){
|
||||||
|
uni.previewImage({
|
||||||
|
urls: [this.expTemp[this.expIndex].pic],
|
||||||
|
success:function(){},
|
||||||
|
fail:function(error){}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 是否开启电子面单和同城配送
|
||||||
|
isOpenDeliveryTemp(is_virtual){
|
||||||
|
let that = this
|
||||||
|
getTempAndDelivery(that.merId).then(
|
||||||
|
res => {
|
||||||
|
if(is_virtual == 1){
|
||||||
|
that.delivery_type = 3
|
||||||
|
that.types = [
|
||||||
|
{type: 3,title: "虚拟发货"}
|
||||||
|
]
|
||||||
|
}else{
|
||||||
|
if(res.data.crmeb_serve_dump == 1){
|
||||||
|
that.types.push({type: 4,title: "电子面单"})
|
||||||
|
}
|
||||||
|
if(res.data.delivery_status == 1){
|
||||||
|
that.types.push({type: 5,title: "同城配送"})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
that.$util.Tips({
|
||||||
|
title: error
|
||||||
|
})
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
//获取电子面单默认数据
|
||||||
|
getDump(){
|
||||||
|
let that = this;
|
||||||
|
that.expTemp.forEach((val,index) =>{
|
||||||
|
if(val.temp_id == that.mer_config_temp_id){
|
||||||
|
that.expIndex = index;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//获取门店列表
|
||||||
|
getStoreList() {
|
||||||
|
getDeliveryStoreLst(this.merId).then((res) => {
|
||||||
|
this.storeList = res.data
|
||||||
|
}).catch((error) => {
|
||||||
|
this.$util.Tips({
|
||||||
|
title: error
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
changeType: function(item, index) {
|
||||||
|
this.active = index;
|
||||||
|
this.delivery_type = item.type;
|
||||||
|
this.delivery_name = "";
|
||||||
|
this.delivery_id = "";
|
||||||
|
if(item.type == 5){
|
||||||
|
this.getStoreList()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
changeSplit: function(item, index) {
|
||||||
|
this.curSplit = item.key;
|
||||||
|
},
|
||||||
|
getIndex: function() {
|
||||||
|
let that = this;
|
||||||
|
getAdminOtherOrderDetail(that.merId,that.order_id).then(
|
||||||
|
res => {
|
||||||
|
res.data.orderProduct.forEach((goods, j) => {
|
||||||
|
goods.checked = true
|
||||||
|
goods.split_num = goods.refund_num
|
||||||
|
})
|
||||||
|
that.delivery = res.data;
|
||||||
|
that.activity_type = res.data.activity_type;
|
||||||
|
that.is_virtual = res.data.is_virtual;
|
||||||
|
that.isOpenDeliveryTemp(that.is_virtual);
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
that.$util.Tips({
|
||||||
|
title: error
|
||||||
|
})
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
expressList: function() {
|
||||||
|
let that = this;
|
||||||
|
expressList().then(
|
||||||
|
res => {
|
||||||
|
that.logistics = res.data;
|
||||||
|
that.getExpTemp(res.data[0].value)
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
that.$util.Tips({
|
||||||
|
title: error
|
||||||
|
})
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
/*选择分单商品*/
|
||||||
|
checkedChange(item) {
|
||||||
|
item.checked = !item.checked;
|
||||||
|
},
|
||||||
|
/*获取分单商品*/
|
||||||
|
getSplitProduct() {
|
||||||
|
let that = this;
|
||||||
|
let data = [];
|
||||||
|
that.delivery.orderProduct.map((item) => {
|
||||||
|
if(item.checked){
|
||||||
|
data.push({id:item.order_product_id,num:item.split_num})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
subCart(item) {
|
||||||
|
if(item.split_num > 1){
|
||||||
|
item.split_num--
|
||||||
|
}
|
||||||
|
},
|
||||||
|
addCart(item) {
|
||||||
|
if(item.split_num < item.refund_num){
|
||||||
|
item.split_num++
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async saveInfo() {
|
||||||
|
let that = this,
|
||||||
|
delivery_type = that.delivery_type,
|
||||||
|
delivery_name = that.logistics[that.seIndex].value,
|
||||||
|
delivery_id = that.delivery_id,
|
||||||
|
save = {};
|
||||||
|
save.delivery_name = delivery_name
|
||||||
|
save.delivery_type = delivery_type
|
||||||
|
save.is_split = that.curSplit
|
||||||
|
if(that.curSplit){
|
||||||
|
that.splitProducts = that.getSplitProduct()
|
||||||
|
if(that.splitProducts.length == 0){
|
||||||
|
return this.$util.Tips({
|
||||||
|
title: '请选择分单商品'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
save.split = that.splitProducts;
|
||||||
|
if(delivery_type==1){
|
||||||
|
if (!delivery_id) {
|
||||||
|
return this.$util.Tips({
|
||||||
|
title: '请填写快递单号'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
save.delivery_id = delivery_id
|
||||||
|
that.setInfo(save);
|
||||||
|
}
|
||||||
|
if(delivery_type == 2){
|
||||||
|
if (!that.to_name) {
|
||||||
|
return this.$util.Tips({
|
||||||
|
title: '请填写送货人姓名'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (!that.to_phone) {
|
||||||
|
return this.$util.Tips({
|
||||||
|
title: '请填写送货人手机号码'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (!(/^1[3456789]\d{9}$/.test(that.to_phone))) {
|
||||||
|
return this.$util.Tips({
|
||||||
|
title: '请填写正确的手机号码'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
save.delivery_name = that.to_name;
|
||||||
|
save.delivery_id = that.to_phone;
|
||||||
|
that.setInfo(save);
|
||||||
|
}
|
||||||
|
if(delivery_type == 3){
|
||||||
|
save.remark = that.remark;
|
||||||
|
that.setInfo(save);
|
||||||
|
}
|
||||||
|
if(delivery_type==4){
|
||||||
|
if (!that.from_name) {
|
||||||
|
return this.$util.Tips({
|
||||||
|
title: '请填写寄件人姓名'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (!that.from_tel) {
|
||||||
|
return this.$util.Tips({
|
||||||
|
title: '请填写寄件人手机号码'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (!(/^1[3456789]\d{9}$/.test(that.from_tel))) {
|
||||||
|
return this.$util.Tips({
|
||||||
|
title: '请填写正确的手机号码'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (!that.from_addr) {
|
||||||
|
return this.$util.Tips({
|
||||||
|
title: '请填写寄件人地址'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if(that.expTemp.length==0){
|
||||||
|
return this.$util.Tips({
|
||||||
|
title: '请选择电子面单'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
save.from_name = that.from_name
|
||||||
|
save.from_tel = that.from_tel
|
||||||
|
save.from_addr = that.from_addr
|
||||||
|
save.temp_id = that.expTemp[that.expIndex].temp_id
|
||||||
|
that.setInfo(save);
|
||||||
|
}
|
||||||
|
if(delivery_type == 5){
|
||||||
|
save.station_id = that.storeList[that.storeIndex].value
|
||||||
|
save.cargo_weight = that.cargo_weight;
|
||||||
|
save.mark = that.mark;
|
||||||
|
that.setInfo(save);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setInfo: function(item) {
|
||||||
|
let that = this;
|
||||||
|
setAdminOtherOrderDelivery(that.merId,that.order_id,item).then(
|
||||||
|
res => {
|
||||||
|
that.$util.Tips({
|
||||||
|
title: res.message,
|
||||||
|
icon: 'success',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
setTimeout(res => {
|
||||||
|
uni.redirectTo({
|
||||||
|
url:`/pages/admin/orderList/indexOther?types=3&merId=${that.merId}`
|
||||||
|
})
|
||||||
|
}, 1000)
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
that.$util.Tips({
|
||||||
|
title: error
|
||||||
|
})
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
bindPickerChange(e) {
|
||||||
|
this.seIndex = e.detail.value
|
||||||
|
this.getExpTemp(this.logistics[e.detail.value].value)
|
||||||
|
},
|
||||||
|
bindTempChange(e) {
|
||||||
|
this.expIndex = e.detail.value
|
||||||
|
},
|
||||||
|
bindStoreChange(e){
|
||||||
|
this.storeIndex = e.detail.value
|
||||||
|
},
|
||||||
|
getExpTemp(code){
|
||||||
|
orderExportTemp({
|
||||||
|
com: code
|
||||||
|
}).then(res=>{
|
||||||
|
this.expTemp = res.data.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取订单打印默认配置
|
||||||
|
orderDeliveryInfo(){
|
||||||
|
let that = this
|
||||||
|
orderDeliveryInfo(that.merId).then(
|
||||||
|
res => {
|
||||||
|
that.from_name = res.data.mer_from_name;
|
||||||
|
that.from_tel = res.data.mer_from_tel;
|
||||||
|
that.from_addr = res.data.mer_from_addr;
|
||||||
|
that.mer_config_temp_id = res.data.mer_config_temp_id;
|
||||||
|
that.mer_from_com = res.data.mer_from_com
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
that.$util.Tips({
|
||||||
|
title: error
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
/*发货*/
|
||||||
|
.uni-input{
|
||||||
|
display: block;
|
||||||
|
width: 400rpx;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.input-inline{
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
.deliver-goods header {
|
||||||
|
width: 100%;
|
||||||
|
background-color: #fff;
|
||||||
|
margin-top: 10upx;
|
||||||
|
}
|
||||||
|
.deliver-goods header .order-num {
|
||||||
|
padding: 0 30upx;
|
||||||
|
border-bottom: 1px solid #f5f5f5;
|
||||||
|
height: 67upx;
|
||||||
|
}
|
||||||
|
.deliver-goods header .order-num .num {
|
||||||
|
width: 430upx;
|
||||||
|
font-size: 26upx;
|
||||||
|
color: #282828;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.deliver-goods header .order-num .num:after {
|
||||||
|
position: absolute;
|
||||||
|
content: '';
|
||||||
|
width: 1px;
|
||||||
|
height: 30upx;
|
||||||
|
background-color: #ddd;
|
||||||
|
top: 50%;
|
||||||
|
margin-top: -15upx;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
.deliver-goods header .order-num .name {
|
||||||
|
width: 260upx;
|
||||||
|
font-size: 26upx;
|
||||||
|
color: #282828;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.deliver-goods header .order-num .name .iconfont {
|
||||||
|
font-size: 35upx;
|
||||||
|
color: #477ef3;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-right: 10upx;
|
||||||
|
}
|
||||||
|
.deliver-goods header .address {
|
||||||
|
font-size: 26upx;
|
||||||
|
color: #868686;
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 30upx;
|
||||||
|
}
|
||||||
|
.look{
|
||||||
|
margin-left: 20rpx;
|
||||||
|
color: #1890FF;
|
||||||
|
}
|
||||||
|
.deliver-goods header .address .name {
|
||||||
|
font-size: 34upx;
|
||||||
|
color: #282828;
|
||||||
|
margin-bottom: 10upx;
|
||||||
|
}
|
||||||
|
.deliver-goods header .address .name .phone {
|
||||||
|
margin-left: 40upx;
|
||||||
|
}
|
||||||
|
.deliver-goods header .line {
|
||||||
|
width: 100%;
|
||||||
|
height: 3upx;
|
||||||
|
}
|
||||||
|
.deliver-goods header .line image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.deliver-goods .wrapper {
|
||||||
|
width: 100%;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
.deliver-goods .wrapper .item {
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
padding: 0 30upx;
|
||||||
|
min-height: 96upx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #282828;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.deliver-goods .wrapper .item .mode {
|
||||||
|
width: 480upx;
|
||||||
|
height: 100%;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.deliver-goods .wrapper .item .mode .iconfont {
|
||||||
|
font-size: 30upx;
|
||||||
|
margin-left: 13upx;
|
||||||
|
}
|
||||||
|
.deliver-goods .wrapper .item .mode .goods~.goods {
|
||||||
|
margin-left: 30upx;
|
||||||
|
}
|
||||||
|
.deliver-goods .wrapper .item .mode .goods {
|
||||||
|
color: #bbb;
|
||||||
|
margin: 10rpx 0;
|
||||||
|
}
|
||||||
|
.deliver-goods .wrapper .item .mode .goods.on {
|
||||||
|
color: #477ef3;
|
||||||
|
}
|
||||||
|
.deliver-goods .wrapper .item .icon-up {
|
||||||
|
position: absolute;
|
||||||
|
font-size: 35upx;
|
||||||
|
color: #2c2c2c;
|
||||||
|
right: 30upx;
|
||||||
|
}
|
||||||
|
.deliver-goods .wrapper .item select {
|
||||||
|
direction: rtl;
|
||||||
|
padding-right: 60upx;
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
.deliver-goods .wrapper .item input::placeholder {
|
||||||
|
color: #bbb;
|
||||||
|
}
|
||||||
|
.deliver-goods .confirm_btn {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
padding: 20rpx 30rpx;
|
||||||
|
background: #fff;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.deliver-goods .confirm {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: #fff;
|
||||||
|
width: 100%;
|
||||||
|
height: 90upx;
|
||||||
|
background-color: #477ef3;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 90upx;
|
||||||
|
border-radius: 60rpx;
|
||||||
|
}
|
||||||
|
.select-box {
|
||||||
|
flex: 1;
|
||||||
|
height: 100%;
|
||||||
|
.pickerBox {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
text-align: right;
|
||||||
|
position: relative;
|
||||||
|
// padding-right: 30rpx;
|
||||||
|
.iconfont{
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #bbb;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 10rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.pro_list{
|
||||||
|
width: 100%;
|
||||||
|
padding: 20rpx 30rpx;
|
||||||
|
position: relative;
|
||||||
|
align-items: center;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.pro_list .checkbox{
|
||||||
|
width: 60rpx;
|
||||||
|
.icon-xuanzhong1{
|
||||||
|
color: var(--view-theme);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.pro_list .picture{
|
||||||
|
width: 180rpx;
|
||||||
|
height: 180rpx;
|
||||||
|
}
|
||||||
|
/deep/.pro_list .picture image{
|
||||||
|
width: 180rpx;
|
||||||
|
height: 180rpx;
|
||||||
|
border-radius: 6rpx;
|
||||||
|
}
|
||||||
|
.pro_count .title{
|
||||||
|
padding: 20rpx 30rpx;
|
||||||
|
line-height: 50rpx;
|
||||||
|
border-bottom: 1px solid #EEEEEE;
|
||||||
|
}
|
||||||
|
.pro_list .info{
|
||||||
|
width: 420rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #282828;
|
||||||
|
}
|
||||||
|
.pro_list .pro_info{
|
||||||
|
width: 360rpx;
|
||||||
|
}
|
||||||
|
.pro_list .info_num{
|
||||||
|
color: #ff9600;
|
||||||
|
margin-top: 10rpx;
|
||||||
|
}
|
||||||
|
.pro_list .refund_num{
|
||||||
|
margin-top: 10rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
.pro_list .pro_price{
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.pro_list .info .name{
|
||||||
|
line-height: 46rpx;
|
||||||
|
}
|
||||||
|
.pro_list .info .carnum{
|
||||||
|
height: 47rpx;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 30rpx;
|
||||||
|
right: 30rpx;
|
||||||
|
}
|
||||||
|
.pro_list .info .carnum view{
|
||||||
|
border: 1px solid #a4a4a4;
|
||||||
|
min-width: 66rpx;
|
||||||
|
text-align: center;
|
||||||
|
height: 100%;
|
||||||
|
line-height: 46rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #a4a4a4;
|
||||||
|
}
|
||||||
|
.pro_list .info .carnum .reduce{
|
||||||
|
border-right: 0;
|
||||||
|
border-radius: 3rpx 0 0 3rpx;
|
||||||
|
}
|
||||||
|
.pro_list .info .carnum .reduce.on {
|
||||||
|
border-color: #e3e3e3;
|
||||||
|
color: #dedede;
|
||||||
|
}
|
||||||
|
.pro_list .info .carnum .plus {
|
||||||
|
border-left: 0;
|
||||||
|
border-radius: 0 3rpx 3rpx 0;
|
||||||
|
}
|
||||||
|
.pro_list .info .carnum .num {
|
||||||
|
color: #282828;
|
||||||
|
}
|
||||||
|
.pro_list .info .info_sku{
|
||||||
|
color: #868686;
|
||||||
|
font-size: 24rpx;
|
||||||
|
margin-top: 6rpx;
|
||||||
|
}
|
||||||
|
.pro_list .pro_info .info_sku{
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
.pro_list .info .info_price{
|
||||||
|
margin-top: 30rpx;
|
||||||
|
}
|
||||||
|
.footer{
|
||||||
|
padding: 20rpx 30rpx;
|
||||||
|
text-align: right;
|
||||||
|
line-height: 50rpx;
|
||||||
|
text{
|
||||||
|
color: #ff9600;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,991 @@
|
||||||
|
<template>
|
||||||
|
<view class="order-details pos-order-details">
|
||||||
|
<view class="header acea-row row-middle">
|
||||||
|
<view class="state">{{ title }}</view>
|
||||||
|
<view class="data">
|
||||||
|
<view class="order-num">订单:{{ orderInfo.order_sn }}</view>
|
||||||
|
<view>
|
||||||
|
<span class="time">{{ orderInfo.create_time }}</span>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="remarks acea-row" v-if="goname != 'looks'" style="align-items: center;">
|
||||||
|
<span class="iconfont icon-zhinengkefu-"></span>
|
||||||
|
<view class="line1" style="text-align: left; flex: 1; margin-left: 10rpx;" @click="modify('1')">
|
||||||
|
{{orderInfo.remark ? orderInfo.remark : '订单未备注,点击添加备注信息'}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="orderingUser acea-row row-middle">
|
||||||
|
<span class="iconfont icon-yonghu2"></span>{{ (orderInfo.user && orderInfo.user.nickname) || '' }}
|
||||||
|
</view>
|
||||||
|
<view class="address">
|
||||||
|
<view class="name">
|
||||||
|
{{ orderInfo.real_name }}<span class="phone">{{ orderInfo.user_phone }}</span>
|
||||||
|
</view>
|
||||||
|
<view>{{ orderInfo.user_address }}</view>
|
||||||
|
<!-- #ifdef H5 -->
|
||||||
|
<button class="copy copy-data" :data-clipboard-text="'收货人姓名:'+orderInfo.real_name+'\n收货人电话:'+ orderInfo.user_phone+'\n收货人地址:'+orderInfo.user_address">复制</button>
|
||||||
|
<!-- #endif -->
|
||||||
|
<!-- #ifdef MP || APP-PLUS -->
|
||||||
|
<button class="copy" @tap="copyText">复制</button>
|
||||||
|
<!-- #endif -->
|
||||||
|
</view>
|
||||||
|
<view class="line">
|
||||||
|
<image :src="`${domain}/static/images/line.jpg`" />
|
||||||
|
</view>
|
||||||
|
<view class="pos-order-goods">
|
||||||
|
<navigator :url="`/pages/goods_details/index?id=${item.cart_info.product.product_id}`" hover-class="none" class="goods" v-for="(item, index) in orderInfo.orderProduct" :key="index">
|
||||||
|
<view class="acea-row row-between-wrapper">
|
||||||
|
<view class="picTxt acea-row row-between-wrapper">
|
||||||
|
<view class="pictrue">
|
||||||
|
<image :src="item.cart_info.productAttr.image || item.cart_info.product.image" />
|
||||||
|
</view>
|
||||||
|
<view class="text acea-row row-between row-column">
|
||||||
|
<view class="info line2">
|
||||||
|
{{ item.cart_info.product.store_name }}
|
||||||
|
</view>
|
||||||
|
<view class="attr">{{ item.cart_info.product.suk }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="money">
|
||||||
|
<view class="x-money">¥{{ item.cart_info.productAttr.price }}</view>
|
||||||
|
<view class="num">x{{ item.product_num }}
|
||||||
|
<text class="font-color refund_num" v-if="item.product_num-item.refund_num>0">(-{{item.product_num-item.refund_num}})</text>
|
||||||
|
</view>
|
||||||
|
<view v-if="orderInfo.order_type == 0" class="y-money">¥{{ item.cart_info.productAttr.ot_price }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</navigator>
|
||||||
|
</view>
|
||||||
|
<!-- <view class="public-total">
|
||||||
|
共{{ orderInfo.total_num }}件商品,应支付
|
||||||
|
<span class="money">¥{{ orderInfo.pay_price }}</span> ( 邮费 ¥{{orderInfo.pay_postage}})
|
||||||
|
</view> -->
|
||||||
|
<view class="wrapper">
|
||||||
|
<view class="item acea-row row-between">
|
||||||
|
<view>订单编号:</view>
|
||||||
|
<view class="conter acea-row row-middle row-right">
|
||||||
|
{{ orderInfo.order_sn }}
|
||||||
|
<!-- #ifdef H5 -->
|
||||||
|
<button class="copy copy-data" :data-clipboard-text="orderInfo.order_sn">复制</button>
|
||||||
|
<!-- #endif -->
|
||||||
|
<!-- #ifdef MP || APP-PLUS -->
|
||||||
|
<span class="copy copy-data" @click="copyNum(orderInfo.order_sn)">复制</span>
|
||||||
|
<!-- #endif -->
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item acea-row row-between">
|
||||||
|
<view>下单时间:</view>
|
||||||
|
<view class="conter">{{ orderInfo.create_time }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="item acea-row row-between">
|
||||||
|
<view>支付状态:</view>
|
||||||
|
<!-- <view class="conter">
|
||||||
|
{{ orderInfo.paid == 1 ? "已支付" : "未支付" }}
|
||||||
|
</view> -->
|
||||||
|
</view>
|
||||||
|
<view class="item acea-row row-between">
|
||||||
|
<view>支付方式:</view>
|
||||||
|
<!-- <view class="conter">{{ orderInfo.pay_type == 0 ? "余额支付" : (orderInfo.pay_type == 1 || orderInfo.pay_type == 2 || orderInfo.pay_type == 3) ? "微信支付" : "先货后款" }}</view> -->
|
||||||
|
</view>
|
||||||
|
<view class="item acea-row row-between">
|
||||||
|
<view>买家留言:</view>
|
||||||
|
<view class="conter">{{ orderInfo.mark }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="orderInfo.is_virtual == 1" class='wrapper'>
|
||||||
|
<view v-for="(item,index) in orderInfo.order_extend" v-if="item && index" :key="index" class='item acea-row row-between'>
|
||||||
|
<view>{{index}}:</view>
|
||||||
|
<view v-if="!Array.isArray(item)" class='conter'>{{item}}</view>
|
||||||
|
<view v-else class='conter virtual_image'>
|
||||||
|
<image v-for="(pic,i) in item" :key="i" class="picture" :src="pic" @click="getPhotoClickIdx(item,i)"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- <view class="wrapper">
|
||||||
|
<view class="item acea-row row-between">
|
||||||
|
<view>支付金额:</view>
|
||||||
|
<view class="conter">¥{{ orderInfo.total_price }}</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="orderInfo.coupon_price > 0" class="item acea-row row-between">
|
||||||
|
<view>优惠券抵扣:</view>
|
||||||
|
<view class="conter">-¥{{ orderInfo.coupon_price }}</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="orderInfo.integral_price > 0" class="item acea-row row-between">
|
||||||
|
<view>积分抵扣:</view>
|
||||||
|
<view class="conter">-¥{{ orderInfo.integral_price }}</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="orderInfo.pay_postage > 0" class="item acea-row row-between">
|
||||||
|
<view>运费:</view>
|
||||||
|
<view class="conter">¥{{ orderInfo.pay_postage }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="actualPay acea-row row-right">
|
||||||
|
实付款:<span class="money font-color-red">¥{{ orderInfo.pay_price }}</span>
|
||||||
|
</view>
|
||||||
|
</view> -->
|
||||||
|
<view class="wrapper" v-if="orderInfo.delivery_type != '3' && orderInfo.order_type === 0 && orderInfo.delivery_type">
|
||||||
|
<view class="item acea-row row-between">
|
||||||
|
<view>配送方式:</view>
|
||||||
|
<view class="conter" v-if="orderInfo.delivery_type === '1' || orderInfo.delivery_type === '4'">
|
||||||
|
快递
|
||||||
|
</view>
|
||||||
|
<view class="conter" v-if="orderInfo.delivery_type === '2'">送货</view>
|
||||||
|
</view>
|
||||||
|
<view class="item acea-row row-between">
|
||||||
|
<view v-if="orderInfo.delivery_type === '1' || orderInfo.delivery_type === '4'">快递公司:</view>
|
||||||
|
<view v-if="orderInfo.delivery_type === '2'">送货人:</view>
|
||||||
|
<view class="conter line1">{{ orderInfo.delivery_name ? orderInfo.delivery_name : '' }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="item acea-row row-between">
|
||||||
|
<view v-if="orderInfo.delivery_type === '1' || orderInfo.delivery_type === '4'">快递单号:</view>
|
||||||
|
<view v-if="orderInfo.delivery_type === '2'">送货人电话:</view>
|
||||||
|
<view class="conter" style="display: flex;">
|
||||||
|
<text>{{ orderInfo.delivery_id ? orderInfo.delivery_id : ''}}</text>
|
||||||
|
<text class="copy copy-data" :data-clipboard-text="orderInfo.delivery_id">复制</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view style="height:120upx;"></view>
|
||||||
|
<!-- <view class="footer acea-row row-right row-middle" v-if="goname != 'looks'" style="margin-bottom: var(--status-bar-height);">
|
||||||
|
<view class="more"></view>
|
||||||
|
<view class="bnt cancel" v-if="orderInfo.pay_type == 8 && orderInfo.status == 12" @click="tongyi(order_id,1)">
|
||||||
|
同意
|
||||||
|
</view>
|
||||||
|
<view class="bnt cancel" v-if="orderInfo.pay_type == 8 && orderInfo.status == 12" @click="tongyi(order_id,2)">
|
||||||
|
拒绝
|
||||||
|
</view>
|
||||||
|
<view class="bnt cancel" @click="modify('0')" v-if="orderInfo.paid == 0">
|
||||||
|
一键改价
|
||||||
|
</view>
|
||||||
|
<view class="bnt cancel" @click="modify('0')" v-if="types == -1">
|
||||||
|
立即退款
|
||||||
|
</view>
|
||||||
|
<view class="bnt cancel" @click="modify('1')">订单备注</view>
|
||||||
|
<view class="bnt cancel" v-if="orderInfo.pay_type === 'offline' && orderInfo.paid === 0" @click="offlinePay">
|
||||||
|
确认付款
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="bnt delivery" @click="toPostagequ(orderInfo)" v-if="orderInfo.status == 0&&orderInfo.activity_type==0&& orderInfo.order_type !=1 ">
|
||||||
|
收件码
|
||||||
|
</view>
|
||||||
|
<navigator class="bnt delivery" v-if="orderInfo.paid == 1 && orderInfo.status == 0 && orderInfo.order_type == 0&&orderInfo.activity_type==98" :url="'/pages/admin/delivery/indexOther?id='+orderInfo.order_id+'&merId='+mer_id">去发货</navigator>
|
||||||
|
<view class="bnt delivery" v-if="orderInfo.paid == 1 && (orderInfo.status == 0 || orderInfo.status == 9) && orderInfo.order_type == 1" @click="goCancellation">去核销</view>
|
||||||
|
</view> -->
|
||||||
|
<PriceChange :change="change" :orderInfo="orderInfo" v-on:closechange="changeclose($event)" v-on:savePrice="savePrice"
|
||||||
|
:status="status"></PriceChange>
|
||||||
|
<u-popup :show="popUpShow" mode="center" :closeOnClickOverlay="true" round="12" @close="popUpClose">
|
||||||
|
<view style="text-align: center;margin-top: 30rpx;">
|
||||||
|
请把二维码展示给取货人员
|
||||||
|
</view>
|
||||||
|
<view style="padding: 28.07rpx;">
|
||||||
|
<image :src="payCodeUrl" style="width:400rpx;height: 400rpx;"></image>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: CRMEB Team <admin@crmeb.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
import PriceChange from "@/components/PriceChange";
|
||||||
|
// #ifdef H5
|
||||||
|
import ClipboardJS from "@/plugin/clipboard/clipboard.js";
|
||||||
|
// #endif
|
||||||
|
import {
|
||||||
|
getAdminOrderDetail,
|
||||||
|
getAdminOtherOrderDetail,
|
||||||
|
setAdminOrderPrice,
|
||||||
|
setAdminOrderRemark,
|
||||||
|
setOfflinePay,
|
||||||
|
setOrderRefund,
|
||||||
|
orderCancellation,
|
||||||
|
logisticsCode,
|
||||||
|
postconfirm
|
||||||
|
} from "@/api/admin";
|
||||||
|
import { isMoney } from '@/utils/validate.js'
|
||||||
|
import { HTTP_REQUEST_URL } from '@/config/app';
|
||||||
|
export default {
|
||||||
|
name: "AdminOrder",
|
||||||
|
components: {
|
||||||
|
PriceChange
|
||||||
|
},
|
||||||
|
props: {},
|
||||||
|
data: function() {
|
||||||
|
return {
|
||||||
|
order: false,
|
||||||
|
change: false,
|
||||||
|
order_id: "",
|
||||||
|
mer_id: '',
|
||||||
|
orderInfo: {
|
||||||
|
_status: {},
|
||||||
|
user: {}
|
||||||
|
},
|
||||||
|
domain: HTTP_REQUEST_URL,
|
||||||
|
status: "",
|
||||||
|
title: "",
|
||||||
|
payType: "",
|
||||||
|
types: "",
|
||||||
|
clickNum: 1,
|
||||||
|
|
||||||
|
goname:'',
|
||||||
|
popUpShow: false,
|
||||||
|
payCodeUrl:''
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
"$route.params.oid": function(newVal) {
|
||||||
|
let that = this;
|
||||||
|
if (newVal != undefined) {
|
||||||
|
that.order_id = newVal;
|
||||||
|
that.getIndex();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad: function(option) {
|
||||||
|
let self = this
|
||||||
|
self.order_id = option.id
|
||||||
|
self.mer_id = option.mer_id
|
||||||
|
self.goname = option.goname
|
||||||
|
self.getIndex();
|
||||||
|
// #ifdef H5
|
||||||
|
self.$nextTick(function() {
|
||||||
|
var clipboard = new ClipboardJS('.copy-data');
|
||||||
|
// var copybtn = document.getElementsByClassName("copy-data");
|
||||||
|
// var clipboard = new Clipboard(copybtn);
|
||||||
|
clipboard.on('success', function(e) {
|
||||||
|
self.$util.Tips({
|
||||||
|
title:'复制成功'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
clipboard.on('error', function(e) {
|
||||||
|
self.$util.Tips({
|
||||||
|
title:'复制失败'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
//收件码
|
||||||
|
toPostagequ(item){
|
||||||
|
this.popUpShow = true
|
||||||
|
logisticsCode(item.order_id).then(res => {
|
||||||
|
|
||||||
|
if (res.status == 200) {
|
||||||
|
this.payCodeUrl = res.data.qrcode
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 关闭二维码弹窗
|
||||||
|
popUpClose() {
|
||||||
|
this.popUpShow = false
|
||||||
|
|
||||||
|
},
|
||||||
|
//同意先货后款订单
|
||||||
|
tongyi(id,number){
|
||||||
|
let data={
|
||||||
|
id:id,
|
||||||
|
type:number
|
||||||
|
}
|
||||||
|
if(number == 1){
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
uni.navigateTo({
|
||||||
|
url:`/pages/admin/orderList/index?types=1&merId=${this.mer_id}`
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}else if(number == 2){
|
||||||
|
uni.navigateTo({
|
||||||
|
url:`/pages/admin/orderList/index?types=1&merId=${this.mer_id}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
postconfirm(this.mer_id,data).then(res=>{
|
||||||
|
})
|
||||||
|
},
|
||||||
|
more: function() {
|
||||||
|
this.order = !this.order;
|
||||||
|
},
|
||||||
|
modify: function(status) {
|
||||||
|
this.change = true;
|
||||||
|
this.status = status;
|
||||||
|
},
|
||||||
|
changeclose: function(msg) {
|
||||||
|
this.change = msg;
|
||||||
|
},
|
||||||
|
// 图片预览
|
||||||
|
getPhotoClickIdx(list, idx) {
|
||||||
|
uni.previewImage({
|
||||||
|
current: list[idx], // 传 Number H5端出现不兼容
|
||||||
|
urls: list
|
||||||
|
});
|
||||||
|
},
|
||||||
|
copyText: function (e) {
|
||||||
|
// var copy = e.currentTarget.dataset.copy; //data-copy传过来的数值
|
||||||
|
let arr = [
|
||||||
|
{
|
||||||
|
name: "收货人姓名",
|
||||||
|
value: this.orderInfo.real_name
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "收货人电话",
|
||||||
|
value: this.orderInfo.user_phone
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "收货人地址",
|
||||||
|
value: this.orderInfo.user_address
|
||||||
|
}
|
||||||
|
]
|
||||||
|
// console.log(`${arr.map(item =>`${item.name}: ${item.value}`).join("\n")}`)
|
||||||
|
wx.setClipboardData({
|
||||||
|
data: `${arr.map(item =>`${item.name}: ${item.value}`).join("\n")}`,
|
||||||
|
success: function (res) {
|
||||||
|
wx.getClipboardData({
|
||||||
|
success: function (res) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '复制成功'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
getIndex: function() {
|
||||||
|
let that = this;
|
||||||
|
getAdminOtherOrderDetail(that.mer_id,that.order_id).then(
|
||||||
|
res => {
|
||||||
|
that.orderInfo = res.data;
|
||||||
|
},
|
||||||
|
err => {
|
||||||
|
that.$util.Tips({
|
||||||
|
title: err
|
||||||
|
}, {
|
||||||
|
tab: 3,
|
||||||
|
url: 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
/*核销订单*/
|
||||||
|
goCancellation() {
|
||||||
|
let that = this;
|
||||||
|
// uni.navigateTo({
|
||||||
|
// url: '/pages/admin/cancellate_result/index?mer_id='+that.mer_id+'&code='+that.orderInfo.verify_code,
|
||||||
|
// })
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/admin/order_cancellation/index?mer_id=${that.mer_id}`
|
||||||
|
})
|
||||||
|
// uni.showModal({
|
||||||
|
// title: '订单核销',
|
||||||
|
// content: '请确认是否核销该订单?',
|
||||||
|
// success: function(res) {
|
||||||
|
// if (res.confirm) {
|
||||||
|
// orderCancellation(that.mer_id,that.orderInfo.order_id).then(res => {
|
||||||
|
// return that.$util.Tips({
|
||||||
|
// title: '操作成功',
|
||||||
|
// icon: 'success'
|
||||||
|
// }, function() {
|
||||||
|
// that.getIndex();
|
||||||
|
// });
|
||||||
|
// }).catch(err => {
|
||||||
|
// return that.$util.Tips({
|
||||||
|
// title: err
|
||||||
|
// });
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
},
|
||||||
|
async savePrice(opt) {
|
||||||
|
let that = this,
|
||||||
|
data = {},
|
||||||
|
price = opt.price,
|
||||||
|
refund_price = opt.refund_price,
|
||||||
|
refund_status = that.orderInfo.refund_status,
|
||||||
|
remark = opt.remark;
|
||||||
|
data.order_id = that.orderInfo.order_id;
|
||||||
|
if (that.status == 0) {
|
||||||
|
// if (!isMoney(price)) {
|
||||||
|
// return that.$util.Tips({
|
||||||
|
// title: '请输入正确的金额'
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
data.price = price;
|
||||||
|
let parmas = {
|
||||||
|
pay_postage: opt.orderInfo.pay_postage,
|
||||||
|
coupon_price: opt.orderInfo.coupon_price,
|
||||||
|
total_price: Number(opt.orderInfo.total_price)
|
||||||
|
}
|
||||||
|
setAdminOrderPrice(that.mer_id,data.order_id, parmas ).then(
|
||||||
|
res => {
|
||||||
|
that.change = false;
|
||||||
|
that.$util.Tips({
|
||||||
|
title: '改价成功',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
that.getIndex();
|
||||||
|
},
|
||||||
|
err => {
|
||||||
|
// console.log(err, 'err')
|
||||||
|
that.change = false;
|
||||||
|
that.$util.Tips({
|
||||||
|
title: err
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else if (that.status == 0 && refund_status === 1) {
|
||||||
|
if (!isMoney(refund_price)) {
|
||||||
|
return that.$util.Tips({
|
||||||
|
title: '请输入正确的金额'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
data.price = refund_price;
|
||||||
|
data.type = opt.type;
|
||||||
|
setOrderRefund(that.mer_id,data).then(
|
||||||
|
res => {
|
||||||
|
that.change = false;
|
||||||
|
that.$util.Tips({
|
||||||
|
title: res.message
|
||||||
|
});
|
||||||
|
that.getIndex();
|
||||||
|
},
|
||||||
|
err => {
|
||||||
|
// console.log(err, 'err')
|
||||||
|
that.change = false;
|
||||||
|
that.$util.Tips({
|
||||||
|
title: err
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
if (!remark) {
|
||||||
|
return this.$util.Tips({
|
||||||
|
title: '请输入备注'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// data.remark = remark;
|
||||||
|
// console.log(data);
|
||||||
|
setAdminOrderRemark(that.mer_id,data.order_id,{ remark: remark }).then(
|
||||||
|
res => {
|
||||||
|
that.change = false;
|
||||||
|
this.$util.Tips({
|
||||||
|
title: res.message,
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
that.getIndex();
|
||||||
|
},
|
||||||
|
err => {
|
||||||
|
that.change = false;
|
||||||
|
that.$util.Tips({
|
||||||
|
title: err
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
offlinePay: function() {
|
||||||
|
setOfflinePay(this.mer_id,{
|
||||||
|
order_id: this.orderInfo.order_id
|
||||||
|
}).then(
|
||||||
|
res => {
|
||||||
|
this.$util.Tips({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'success'
|
||||||
|
});
|
||||||
|
this.getIndex();
|
||||||
|
},
|
||||||
|
err => {
|
||||||
|
this.$util.Tips({
|
||||||
|
title: err
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
copyNum(id) {
|
||||||
|
uni.setClipboardData({
|
||||||
|
data: id,
|
||||||
|
success: function() {
|
||||||
|
// console.log('success');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
copyData(id){
|
||||||
|
uni.setClipboardData({
|
||||||
|
data: id,
|
||||||
|
success: function() {
|
||||||
|
// console.log('success');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// #ifdef H5
|
||||||
|
webCopy(item, index) {
|
||||||
|
// console.log('yunxingle')
|
||||||
|
let items = item
|
||||||
|
let indexs = index
|
||||||
|
let self = this
|
||||||
|
|
||||||
|
if (self.clickNum == 1) {
|
||||||
|
// console.log('22')
|
||||||
|
self.clickNum += 1
|
||||||
|
self.webCopy(items, indexs)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
/*商户管理订单详情*/
|
||||||
|
.pos-order-details .header {
|
||||||
|
background: linear-gradient(to right, #2291f8 0%, #1cd1dc 100%);
|
||||||
|
background: -webkit-linear-gradient(to right, #2291f8 0%, #1cd1dc 100%);
|
||||||
|
background: -moz-linear-gradient(to right, #2291f8 0%, #1cd1dc 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-details .header .state {
|
||||||
|
font-size: 36upx;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-details .header .data {
|
||||||
|
margin-left: 35upx;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-details .header .data .order-num {
|
||||||
|
font-size: 30upx;
|
||||||
|
margin-bottom: 8upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-details .remarks {
|
||||||
|
width: 100%;
|
||||||
|
height: 86upx;
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 0 30upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-details .remarks .iconfont {
|
||||||
|
font-size: 40upx;
|
||||||
|
color: #2a7efb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-details .remarks input {
|
||||||
|
width: 630upx;
|
||||||
|
height: 100%;
|
||||||
|
font-size: 30upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-details .remarks input::placeholder {
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-details .orderingUser {
|
||||||
|
font-size: 26upx;
|
||||||
|
color: #282828;
|
||||||
|
padding: 0 30upx;
|
||||||
|
height: 67upx;
|
||||||
|
background-color: #fff;
|
||||||
|
margin-top: 16upx;
|
||||||
|
border-bottom: 1px solid #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-details .orderingUser .iconfont {
|
||||||
|
font-size: 40upx;
|
||||||
|
color: #2a7efb;
|
||||||
|
margin-right: 15upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-details .address {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-details .pos-order-goods {
|
||||||
|
margin-top: 17upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-details .footer .more {
|
||||||
|
font-size: 27upx;
|
||||||
|
color: #aaa;
|
||||||
|
width: 100upx;
|
||||||
|
height: 64upx;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 64upx;
|
||||||
|
margin-right: 25upx;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-details .footer .delivery {
|
||||||
|
background: linear-gradient(to right, #2291f8 0%, #1cd1dc 100%);
|
||||||
|
background: -webkit-linear-gradient(to right, #2291f8 0%, #1cd1dc 100%);
|
||||||
|
background: -moz-linear-gradient(to right, #2291f8 0%, #1cd1dc 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-details .footer .more .order .arrow {
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
border-left: 11upx solid transparent;
|
||||||
|
border-right: 11upx solid transparent;
|
||||||
|
border-top: 20upx solid #e5e5e5;
|
||||||
|
position: absolute;
|
||||||
|
left: 15upx;
|
||||||
|
bottom: -18upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-details .footer .more .order .arrow:before {
|
||||||
|
content: '';
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
border-left: 9upx solid transparent;
|
||||||
|
border-right: 9upx solid transparent;
|
||||||
|
border-top: 19upx solid #fff;
|
||||||
|
position: absolute;
|
||||||
|
left: -10upx;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-details .footer .more .order {
|
||||||
|
width: 200upx;
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #eee;
|
||||||
|
border-radius: 10upx;
|
||||||
|
position: absolute;
|
||||||
|
top: -200upx;
|
||||||
|
z-index: 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-details .footer .more .order .item {
|
||||||
|
height: 77upx;
|
||||||
|
line-height: 77upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-details .footer .more .order .item~.item {
|
||||||
|
border-top: 1px solid #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-details .footer .more .moreName {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*订单详情*/
|
||||||
|
.order-details .header {
|
||||||
|
padding: 0 30upx;
|
||||||
|
height: 150upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .header.on {
|
||||||
|
background-color: #666 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .header .pictrue {
|
||||||
|
width: 110upx;
|
||||||
|
height: 110upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .header .pictrue image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .header .data {
|
||||||
|
color: rgba(255, 255, 255, 0.8);
|
||||||
|
font-size: 24upx;
|
||||||
|
margin-left: 27upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .header.on .data {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .header .data .state {
|
||||||
|
font-size: 30upx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #fff;
|
||||||
|
margin-bottom: 7upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* .order-details .header .data .time{margin-left:20upx;} */
|
||||||
|
.order-details .nav {
|
||||||
|
background-color: #fff;
|
||||||
|
font-size: 26upx;
|
||||||
|
color: #282828;
|
||||||
|
padding: 25upx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .nav .navCon {
|
||||||
|
padding: 0 40upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .nav .navCon .on {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #e93323;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .nav .progress {
|
||||||
|
padding: 0 65upx;
|
||||||
|
margin-top: 10upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .nav .progress .line {
|
||||||
|
width: 100upx;
|
||||||
|
height: 2upx;
|
||||||
|
background-color: #939390;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .nav .progress .iconfont {
|
||||||
|
font-size: 25upx;
|
||||||
|
color: #939390;
|
||||||
|
margin-top: -2upx;
|
||||||
|
width: 30upx;
|
||||||
|
height: 30upx;
|
||||||
|
line-height: 33upx;
|
||||||
|
text-align: center;
|
||||||
|
margin-right: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .address {
|
||||||
|
font-size: 26upx;
|
||||||
|
color: #868686;
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 25upx 30upx 30upx 30upx;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .address .name {
|
||||||
|
font-size: 30upx;
|
||||||
|
color: #282828;
|
||||||
|
margin-bottom: 0.1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .address .name .phone {
|
||||||
|
margin-left: 40upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .line {
|
||||||
|
width: 100%;
|
||||||
|
height: 3upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .line image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .wrapper {
|
||||||
|
background-color: #fff;
|
||||||
|
margin-top: 12upx;
|
||||||
|
padding: 30upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .wrapper .item {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #282828;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .wrapper .item~.item {
|
||||||
|
margin-top: 20upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .wrapper .item .conter {
|
||||||
|
color: #868686;
|
||||||
|
text-align: right;
|
||||||
|
max-width: 450rpx;
|
||||||
|
}
|
||||||
|
.order-details .wrapper .item .virtual_image {
|
||||||
|
// text-align: left;
|
||||||
|
margin-left: 50rpx;
|
||||||
|
}
|
||||||
|
.order-details .wrapper .item .virtual_image .picture{
|
||||||
|
width: 106rpx;
|
||||||
|
height: 106rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
&:last-child{
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.order-details .wrapper .item .conter .copy {
|
||||||
|
font-size: 20rpx;
|
||||||
|
color: #868686;
|
||||||
|
border-radius: 3rpx;
|
||||||
|
border: 1px solid #868686;
|
||||||
|
padding: 0rpx 15rpx;
|
||||||
|
margin-left: 24rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
}
|
||||||
|
.address .copy{
|
||||||
|
font-size: 20rpx;
|
||||||
|
color: #868686;
|
||||||
|
border-radius: 3rpx;
|
||||||
|
border: 1px solid #868686;
|
||||||
|
padding: 0rpx 15rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
position: absolute;
|
||||||
|
right: 30rpx;
|
||||||
|
top: 20rpx;
|
||||||
|
|
||||||
|
}
|
||||||
|
.order-details .wrapper .actualPay {
|
||||||
|
border-top: 1upx solid #eee;
|
||||||
|
margin-top: 30upx;
|
||||||
|
padding-top: 30upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .wrapper .actualPay .money {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 30upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .footer {
|
||||||
|
width: 100%;
|
||||||
|
height: 100upx;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 0 30upx;
|
||||||
|
border-top: 1px solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .footer .bnt {
|
||||||
|
width: auto;
|
||||||
|
height: 60upx;
|
||||||
|
line-height: 60upx;
|
||||||
|
text-align: center;
|
||||||
|
line-height: upx;
|
||||||
|
border-radius: 50upx;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 27upx;
|
||||||
|
padding: 0 3%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .footer .bnt.cancel {
|
||||||
|
color: #aaa;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .footer .bnt.default {
|
||||||
|
color: #444;
|
||||||
|
border: 1px solid #444;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-details .footer .bnt~.bnt {
|
||||||
|
margin-left: 18upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-goods {
|
||||||
|
padding: 0 30upx;
|
||||||
|
background-color: #fff;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-goods .goods {
|
||||||
|
padding: 20rpx 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-goods .goods~.goods {
|
||||||
|
border-top: 1px dashed #e5e5e5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-goods .goods .picTxt {
|
||||||
|
width: 515upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-goods .goods .picTxt .pictrue {
|
||||||
|
width: 130upx;
|
||||||
|
height: 130upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-goods .goods .picTxt .pictrue image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 6upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-goods .goods .picTxt .text {
|
||||||
|
width: 365upx;
|
||||||
|
height: 130upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-goods .goods .picTxt .text .info {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #282828;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-goods .goods .picTxt .text .attr {
|
||||||
|
font-size: 24upx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-goods .goods .money {
|
||||||
|
width: 164upx;
|
||||||
|
text-align: right;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
.pos-order-goods .goods .money .refund_num{
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 10rpx;
|
||||||
|
}
|
||||||
|
.pos-order-goods .goods .money .x-money {
|
||||||
|
color: #282828;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-goods .goods .money .num {
|
||||||
|
color: #ff9600;
|
||||||
|
margin: 5upx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-order-goods .goods .money .y-money {
|
||||||
|
color: #999;
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
.pos-order-goods .cancellate{
|
||||||
|
font-size: 24rpx;
|
||||||
|
float: right;
|
||||||
|
margin-top: 10rpx;
|
||||||
|
text{
|
||||||
|
margin-left: 26rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.pos-order-goods .cancelled{
|
||||||
|
color: #FF9600;
|
||||||
|
}
|
||||||
|
.pos-order-goods .goods .uncancell{
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
.public-total {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #282828;
|
||||||
|
border-top: 1px solid #eee;
|
||||||
|
height: 92upx;
|
||||||
|
line-height: 92upx;
|
||||||
|
text-align: right;
|
||||||
|
padding: 0 30upx;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-total .money {
|
||||||
|
color: #ff4c3c;
|
||||||
|
}
|
||||||
|
</style>
|
File diff suppressed because it is too large
Load Diff
|
@ -69,6 +69,25 @@
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="content-tools" style="margin-top: 10rpx;" v-if="$store.state.app.userInfo&&$store.state.app.userInfo.mer_info&&$store.state.app.userInfo.mer_info.type_code=='TypeSupplyChain'">
|
||||||
|
<view class="tools-one">
|
||||||
|
赊账订单
|
||||||
|
<view class=""></view>
|
||||||
|
</view>
|
||||||
|
<view class="content-order" >
|
||||||
|
<view class="" v-for="(item,i) in other_order" :key='i' @click="other_shopporder(item)">
|
||||||
|
<view class="content-order-two">
|
||||||
|
{{item.value}}
|
||||||
|
</view>
|
||||||
|
<view class="content-order-one">
|
||||||
|
{{item.name}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="" v-for="item in 3" :key="'empty'+item">
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="content-tools">
|
<view class="content-tools">
|
||||||
<view class="tools-one">
|
<view class="tools-one">
|
||||||
|
@ -373,6 +392,7 @@
|
||||||
import image from '../../uni_modules/uview-ui/libs/config/props/image';
|
import image from '../../uni_modules/uview-ui/libs/config/props/image';
|
||||||
import {
|
import {
|
||||||
orderStatistics,
|
orderStatistics,
|
||||||
|
otherOrderStatistics,
|
||||||
getOrderList
|
getOrderList
|
||||||
|
|
||||||
} from "@/api/admin";
|
} from "@/api/admin";
|
||||||
|
@ -423,7 +443,15 @@ import { Toast } from '../../libs/uniApi';
|
||||||
type: 6,
|
type: 6,
|
||||||
value: 0
|
value: 0
|
||||||
}],
|
}],
|
||||||
|
other_order: [{
|
||||||
|
name: '待发货',
|
||||||
|
type: 2,
|
||||||
|
value: 0
|
||||||
|
}, {
|
||||||
|
name: '待收货',
|
||||||
|
type: 3,
|
||||||
|
value: 0
|
||||||
|
}],
|
||||||
typelist: [{
|
typelist: [{
|
||||||
name: '商品管理',
|
name: '商品管理',
|
||||||
type: 1,
|
type: 1,
|
||||||
|
@ -667,8 +695,49 @@ import { Toast } from '../../libs/uniApi';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.isAuto = true;
|
||||||
|
this.isShowAuth = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
other_shopporder(item) {
|
||||||
|
if (this.userid) {
|
||||||
|
switch (item.type) {
|
||||||
|
case 1:
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/admin/orderList/indexOther?merId=' + this.userInfoData.service.mer_id +
|
||||||
|
'&types=' + item.type
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/admin/orderList/indexOther?merId=' + this.userInfoData.service.mer_id +
|
||||||
|
'&types=' + item.type
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/admin/orderList/indexOther?merId=' + this.userInfoData.service.mer_id +
|
||||||
|
'&types=' + item.type
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/admin/orderList/indexOther?merId=' + this.userInfoData.service.mer_id +
|
||||||
|
'&types=' + item.type
|
||||||
|
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/admin/orderList/indexOther?merId=' + this.userInfoData.service.mer_id +
|
||||||
|
'&types=' + item.type
|
||||||
|
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.isAuto = true;
|
this.isAuto = true;
|
||||||
this.isShowAuth = true
|
this.isShowAuth = true
|
||||||
|
@ -938,6 +1007,17 @@ import { Toast } from '../../libs/uniApi';
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
otherOrderStatistics(this.userInfoData.service.mer_id, data).then(
|
||||||
|
res => {
|
||||||
|
this.other_order[0].value = res.data.order.unshipped
|
||||||
|
this.other_order[1].value = res.data.order.untake
|
||||||
|
},
|
||||||
|
err => {
|
||||||
|
that.$util.Tips({
|
||||||
|
title: err.msg
|
||||||
|
})
|
||||||
|
}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
open() {
|
open() {
|
||||||
this.isshow = !this.isshow
|
this.isshow = !this.isshow
|
||||||
|
@ -1779,13 +1859,14 @@ import { Toast } from '../../libs/uniApi';
|
||||||
.content-tops {
|
.content-tops {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 96rpx;
|
height: 96rpx;
|
||||||
line-height: 96rpx;
|
align-items: center;
|
||||||
|
|
||||||
.content-top_img {
|
.content-top_img {
|
||||||
margin-left: 16rpx;
|
margin-left: 16rpx;
|
||||||
width: 96rpx;
|
width: 96rpx;
|
||||||
height: 96rpx;
|
height: 96rpx;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
image {
|
image {
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
@ -1799,16 +1880,25 @@ import { Toast } from '../../libs/uniApi';
|
||||||
.content-top-title {
|
.content-top-title {
|
||||||
margin-left: 11rpx;
|
margin-left: 11rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
font-size: 33rpx;
|
font-size: 33rpx;
|
||||||
font-family: PingFang SC-Medium, PingFang SC;
|
font-family: PingFang SC-Medium, PingFang SC;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
|
|
||||||
|
.top-titlea{
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
.top-titleb {
|
.top-titleb {
|
||||||
width: 30rpx;
|
width: 30rpx;
|
||||||
height: 30rpx;
|
height: 30rpx;
|
||||||
margin-top: 5rpx;
|
margin-top: 5rpx;
|
||||||
margin-left: 10rpx;
|
margin-left: 10rpx;
|
||||||
|
margin-right: 15rpx;
|
||||||
|
|
||||||
image {
|
image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
@ -155,6 +155,10 @@
|
||||||
<image class="icon_img" src="@/static/images/index5.png" mode="aspectFit"></image>
|
<image class="icon_img" src="@/static/images/index5.png" mode="aspectFit"></image>
|
||||||
<text class="text">进货管理</text>
|
<text class="text">进货管理</text>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="examine" @click="navigator('/pages/users/order_list/indexOther?status=-1&product_type=98&source=12')">
|
||||||
|
<image class="icon_img" src="@/static/images/index13.png" mode="aspectFit"></image>
|
||||||
|
<text class="text">赊账订单</text>
|
||||||
|
</view>
|
||||||
<view class="examine" @click="navigator(`/pages/admin/stockOut/index?mer_id=${mer_id}`)">
|
<view class="examine" @click="navigator(`/pages/admin/stockOut/index?mer_id=${mer_id}`)">
|
||||||
<image class="icon_img" src="@/static/images/index10.png" mode="aspectFit">
|
<image class="icon_img" src="@/static/images/index10.png" mode="aspectFit">
|
||||||
</image>
|
</image>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -380,6 +380,12 @@
|
||||||
type: 2
|
type: 2
|
||||||
})
|
})
|
||||||
this.cloudList = data;
|
this.cloudList = data;
|
||||||
|
this.cloudList.unshift({
|
||||||
|
cate_name: '全部',
|
||||||
|
children: [],
|
||||||
|
pic: "https://lihai001.oss-cn-chengdu.aliyuncs.com/def/de2be202312151001024597.png",
|
||||||
|
store_category_id: -1
|
||||||
|
})
|
||||||
this.cloudList.forEach((item)=>{
|
this.cloudList.forEach((item)=>{
|
||||||
item.children.unshift({
|
item.children.unshift({
|
||||||
cate_name: '全部',
|
cate_name: '全部',
|
||||||
|
@ -711,12 +717,13 @@
|
||||||
// console.log({...this.userInfoData});
|
// console.log({...this.userInfoData});
|
||||||
let query = {
|
let query = {
|
||||||
product_type: this.product_type,
|
product_type: this.product_type,
|
||||||
cate_pid: this.storeParam.category_id,
|
// cate_pid: this.storeParam.category_id,
|
||||||
page: this.storeParam.page,
|
page: this.storeParam.page,
|
||||||
order: this.storeParam.order,
|
order: this.storeParam.order,
|
||||||
keyword: this.storeParam.keyword
|
keyword: this.storeParam.keyword
|
||||||
};
|
};
|
||||||
if(!this.merchantTow.pid) query.cate_pid = this.storeParam.category_id; // 全部是查询一级分类pid
|
if(this.storeParam.category_id==-1) null;
|
||||||
|
else if(!this.merchantTow.pid) query.cate_pid = this.storeParam.category_id; // 全部是查询一级分类pid
|
||||||
else query.cate_id = this.storeParam.category_id; // 否则查询二级分类
|
else query.cate_id = this.storeParam.category_id; // 否则查询二级分类
|
||||||
getProductslist(query).then((res)=>{
|
getProductslist(query).then((res)=>{
|
||||||
// console.log(res);
|
// console.log(res);
|
||||||
|
@ -765,7 +772,8 @@
|
||||||
// 购物车信息
|
// 购物车信息
|
||||||
cartFn() {
|
cartFn() {
|
||||||
getCartList({
|
getCartList({
|
||||||
product_type: 98
|
product_type: 98,
|
||||||
|
source: 13
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.totalMoney = 0
|
this.totalMoney = 0
|
||||||
this.cartList = res.data.list
|
this.cartList = res.data.list
|
||||||
|
@ -777,7 +785,8 @@
|
||||||
this.totalMoney = this.totalMoney.toFixed(2)
|
this.totalMoney = this.totalMoney.toFixed(2)
|
||||||
})
|
})
|
||||||
getCartCounts({
|
getCartCounts({
|
||||||
product_type: 98
|
product_type: 98,
|
||||||
|
source: 13
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.goodsNum = res.data[0].count
|
this.goodsNum = res.data[0].count
|
||||||
})
|
})
|
||||||
|
|
|
@ -680,7 +680,7 @@
|
||||||
},
|
},
|
||||||
getCartNum: function() {
|
getCartNum: function() {
|
||||||
let that = this;
|
let that = this;
|
||||||
getCartCounts({ product_type: 98 }).then(res => {
|
getCartCounts({ product_type: 98, source: 13 }).then(res => {
|
||||||
// console.log(res);
|
// console.log(res);
|
||||||
that.cartTotalCount = res.data[0].count || 0;
|
that.cartTotalCount = res.data[0].count || 0;
|
||||||
});
|
});
|
||||||
|
@ -688,7 +688,7 @@
|
||||||
// 购物车列表
|
// 购物车列表
|
||||||
getCartList: function(isChange) {
|
getCartList: function(isChange) {
|
||||||
let that = this;
|
let that = this;
|
||||||
getCartList({ product_type: 98 }).then(res => {
|
getCartList({ product_type: 98, source: 13 }).then(res => {
|
||||||
this.type_id=res.data?.list[0]?.type_id||[]
|
this.type_id=res.data?.list[0]?.type_id||[]
|
||||||
res.data.list.forEach((item, index) => {
|
res.data.list.forEach((item, index) => {
|
||||||
item.allCheck = true
|
item.allCheck = true
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -336,7 +336,7 @@
|
||||||
<emptyPage title="暂无订单~"></emptyPage>
|
<emptyPage title="暂无订单~"></emptyPage>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<home></home>
|
<!-- <home></home> -->
|
||||||
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
|
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
|
||||||
<payment :payMode='payMode' :pay_close="pay_close" :order_type='order_type' @onChangeFun='onChangeFun'
|
<payment :payMode='payMode' :pay_close="pay_close" :order_type='order_type' @onChangeFun='onChangeFun'
|
||||||
:order_id="pay_order_id" :totalPrice='totalPrice'></payment>
|
:order_id="pay_order_id" :totalPrice='totalPrice'></payment>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -21,12 +21,12 @@
|
||||||
<view class="con_kuo"
|
<view class="con_kuo"
|
||||||
v-for="(item, index) in list"
|
v-for="(item, index) in list"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
@click="navigator(`/pages/nongKe/supply_chain/supplierA?tit=1&type_id=12&isDetail=1&product_type=98&cate_id=${id}`)">
|
@click="navigator(`/pages/nongKe/cloud_entrepot/${item.name=='现款现货'?'indexb':'indexOther'}?type_id=12&value=${item.value}&tips=${item.content}`)">
|
||||||
<image class="con_img" src="@/static/images/bg1.png" mode=""></image>
|
<image class="con_img" :src="item.bg" mode=""></image>
|
||||||
<image class="con_ico" src="@/static/images/bgic1.png" mode=""></image>
|
<image class="con_ico" src="@/static/images/bgic1.png" mode=""></image>
|
||||||
<view class="con_text">
|
<view class="con_text">
|
||||||
<h3>{{item.name}}</h3>
|
<h3>{{item.name}}</h3>
|
||||||
<span>先付款后发货</span>
|
<span>{{item.content}}</span>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -50,9 +50,25 @@
|
||||||
systemGroupValue({
|
systemGroupValue({
|
||||||
name: 'purchasing_navigation'
|
name: 'purchasing_navigation'
|
||||||
}).then(res=>{
|
}).then(res=>{
|
||||||
console.log(res);
|
res.data.forEach((item)=>{
|
||||||
|
if(item.name=='线上铺货'){
|
||||||
|
item.bg = 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/71e06202312151146467207.png';
|
||||||
|
item.content = '线上选品 一键铺货';
|
||||||
|
}
|
||||||
|
if(item.name=='实体铺货'){
|
||||||
|
item.bg = 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/8cb7a202312151147485701.png';
|
||||||
|
item.content = '先售利润 后结货款';
|
||||||
|
}
|
||||||
|
if(item.name=='现款现货'){
|
||||||
|
item.bg = 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/f4521202312151148087081.png';
|
||||||
|
item.content = '先付款 后发货';
|
||||||
|
}
|
||||||
|
if(item.name=='赊账进货'){
|
||||||
|
item.bg = 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/899a4202312151148319478.png';
|
||||||
|
item.content = '先发货 后付款';
|
||||||
|
}
|
||||||
|
})
|
||||||
this.list = res.data;
|
this.list = res.data;
|
||||||
console.log(this.list);
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
navigator(url, t) {
|
navigator(url, t) {
|
||||||
|
@ -73,7 +89,7 @@
|
||||||
.conent {
|
.conent {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-around;
|
justify-content: space-evenly;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
|
|
||||||
|
@ -81,13 +97,13 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
.con_img {
|
.con_img {
|
||||||
width: 192px;
|
width: 360rpx;
|
||||||
height: 92px;
|
height: 92px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.con_ico {
|
.con_ico {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 25px;
|
left: 15px;
|
||||||
top: 32px;
|
top: 32px;
|
||||||
width: 31px;
|
width: 31px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
|
@ -95,7 +111,7 @@
|
||||||
|
|
||||||
.con_text {
|
.con_text {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 66px;
|
left: 55px;
|
||||||
top: 20px;
|
top: 20px;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue