up
This commit is contained in:
@@ -53,6 +53,7 @@ func ApiRoot(r *gin.RouterGroup) {
|
|||||||
ApiStatic(r.Group("/static"))
|
ApiStatic(r.Group("/static"))
|
||||||
ApiUser(r.Group("/users"))
|
ApiUser(r.Group("/users"))
|
||||||
ApiFiles(r.Group("/files"))
|
ApiFiles(r.Group("/files"))
|
||||||
|
ApiPurchase(r.Group("/purchase"))
|
||||||
|
|
||||||
r.GET("/", func(ctx *gin.Context) {
|
r.GET("/", func(ctx *gin.Context) {
|
||||||
ReturnJson(ctx, "apiOK", nil)
|
ReturnJson(ctx, "apiOK", nil)
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package routers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ApiPurchase(r *gin.RouterGroup) {
|
||||||
|
|
||||||
|
r.POST("/addorder", func(ctx *gin.Context) {
|
||||||
|
isAuth, user, data := AuthenticationAuthority(ctx)
|
||||||
|
if isAuth {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ReturnJson(ctx, "jsonErr", nil)
|
||||||
|
}
|
||||||
|
fmt.Println(isAuth)
|
||||||
|
fmt.Println(user)
|
||||||
|
fmt.Println(data)
|
||||||
|
ReturnJson(ctx, "apiErr", nil)
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
@@ -31,6 +31,11 @@ const datatimepack_config = reactive({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const sele_data = reactive();
|
const sele_data = reactive();
|
||||||
|
const emit = defineEmits(['update:modelValue'])
|
||||||
|
const handleChange = (e) => {
|
||||||
|
//console.log(e)
|
||||||
|
emit("update:modelValue", e.target.value);
|
||||||
|
};
|
||||||
|
|
||||||
function getCurrentDateTime() {
|
function getCurrentDateTime() {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
@@ -69,6 +74,8 @@ onMounted(() => {
|
|||||||
|
|
||||||
datatimepack_config.locale = locale.value == "zh-CN" ? "zh" : "en";
|
datatimepack_config.locale = locale.value == "zh-CN" ? "zh" : "en";
|
||||||
flatpickr(datatimepack.value, datatimepack_config);
|
flatpickr(datatimepack.value, datatimepack_config);
|
||||||
|
|
||||||
|
emit("update:modelValue", datatimepack_config.defaultDate);
|
||||||
});
|
});
|
||||||
|
|
||||||
defineExpose({});
|
defineExpose({});
|
||||||
@@ -80,6 +87,7 @@ defineExpose({});
|
|||||||
ref="datatimepack"
|
ref="datatimepack"
|
||||||
type="datetime-local"
|
type="datetime-local"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
v-model="sele_data"
|
|
||||||
|
@input="handleChange"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, watch, ref ,defineProps} from "vue";
|
import { onMounted, watch, ref, defineProps, defineEmits } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
|
||||||
import TomSelect from "tom-select";
|
import TomSelect from "tom-select";
|
||||||
@@ -7,11 +7,11 @@ import "tom-select/dist/css/tom-select.css";
|
|||||||
|
|
||||||
const { t, locale } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
|
|
||||||
const disable_backspace=ref()
|
const disable_backspace = ref();
|
||||||
|
|
||||||
function sele_tag_init() {
|
function sele_tag_init() {
|
||||||
new TomSelect(disable_backspace.value, {
|
new TomSelect(disable_backspace.value, {
|
||||||
plugins: [ "remove_button"],
|
plugins: ["remove_button"],
|
||||||
|
|
||||||
persist: false,
|
persist: false,
|
||||||
createOnBlur: true,
|
createOnBlur: true,
|
||||||
@@ -19,35 +19,60 @@ function sele_tag_init() {
|
|||||||
|
|
||||||
// 自定义提示文本
|
// 自定义提示文本
|
||||||
render: {
|
render: {
|
||||||
no_results: function(data, escape) {
|
no_results: function (data, escape) {
|
||||||
return '<div class="no-results">'+t("tagadder.not_fund_item")+'</div>';
|
return (
|
||||||
|
'<div class="no-results">' + t("tagadder.not_fund_item") + "</div>"
|
||||||
|
);
|
||||||
|
},
|
||||||
|
loading: function (data, escape) {
|
||||||
|
return '<div class="loading">' + t("tagadder.loding") + "</div>";
|
||||||
|
},
|
||||||
|
option_create: function (data, escape) {
|
||||||
|
return (
|
||||||
|
'<div class="create">' +
|
||||||
|
t("tagadder.add") +
|
||||||
|
"<strong>" +
|
||||||
|
escape(data.input) +
|
||||||
|
"</strong></div>"
|
||||||
|
);
|
||||||
},
|
},
|
||||||
loading: function(data, escape) {
|
|
||||||
return '<div class="loading">'+t("tagadder.loding")+'</div>';
|
|
||||||
},
|
},
|
||||||
option_create: function(data, escape) {
|
|
||||||
return '<div class="create">'+t("tagadder.add")+'<strong>' + escape(data.input) + '</strong></div>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
defineProps({
|
const props = defineProps({
|
||||||
placeholder: {
|
placeholder: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: "",
|
||||||
},
|
},
|
||||||
})
|
modelValue: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:modelValue'])
|
||||||
|
|
||||||
|
//const emit = defineEmits(['update:modelValue'])
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
sele_tag_init();
|
sele_tag_init();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const handleChange = (e) => {
|
||||||
|
emit("update:modelValue", e.target.value);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div ref="example_wrapper">
|
<div ref="example_wrapper">
|
||||||
<input type="text" ref="disable_backspace" value="" autocomplete="off" :placeholder="placeholder"/>
|
<input
|
||||||
|
type="text"
|
||||||
|
ref="disable_backspace"
|
||||||
|
:value="modelValue"
|
||||||
|
@input="handleChange"
|
||||||
|
autocomplete="off"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import "dropzone/dist/dropzone.css";
|
|||||||
import { useUserStore } from "@/stores/user";
|
import { useUserStore } from "@/stores/user";
|
||||||
|
|
||||||
import "fslightbox";
|
import "fslightbox";
|
||||||
const lightbox = new FsLightbox();
|
//var lightbox = new FsLightbox();
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
|
||||||
@@ -108,6 +108,9 @@ const initDropzone = () => {
|
|||||||
this.on("success", (file, response) => {
|
this.on("success", (file, response) => {
|
||||||
//console.log("上传成功:", file, response);
|
//console.log("上传成功:", file, response);
|
||||||
file.previewElement.addEventListener("click", function (e) {
|
file.previewElement.addEventListener("click", function (e) {
|
||||||
|
//delete lightbox
|
||||||
|
const lightbox = new FsLightbox();
|
||||||
|
//console.log(files)
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
@@ -116,7 +119,7 @@ const initDropzone = () => {
|
|||||||
|
|
||||||
//动态把文件载入灯箱
|
//动态把文件载入灯箱
|
||||||
//先移除原有数据
|
//先移除原有数据
|
||||||
lightbox.props.sources.splice(0, lightbox.props.sources.length);
|
//lightbox.props.sources.splice(0, lightbox.props.sources.length);
|
||||||
|
|
||||||
var dis_id = 0;
|
var dis_id = 0;
|
||||||
var dis_id_t = 0;
|
var dis_id_t = 0;
|
||||||
@@ -131,23 +134,8 @@ const initDropzone = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lightbox.open(dis_id);
|
lightbox.open(dis_id);
|
||||||
|
|
||||||
// 可以在这里实现:
|
|
||||||
// 1. 预览大图
|
|
||||||
// 2. 显示文件详情
|
|
||||||
// 3. 触发自定义操作
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//将后台接收到的url添加到文件列表
|
|
||||||
// var t = {
|
|
||||||
// //uuid:file.upload.uuid,
|
|
||||||
// hash: response.return.hash,
|
|
||||||
// get_url: response.return.get,
|
|
||||||
// download_url: response.return.download,
|
|
||||||
// name: file.name,
|
|
||||||
// size: file.size,
|
|
||||||
// };
|
|
||||||
|
|
||||||
var file_id = get_file_from_uuid(file.upload.uuid);
|
var file_id = get_file_from_uuid(file.upload.uuid);
|
||||||
if (file_id >= 0) {
|
if (file_id >= 0) {
|
||||||
files[file_id]["hash"] = response.return.hash;
|
files[file_id]["hash"] = response.return.hash;
|
||||||
@@ -179,23 +167,21 @@ const initDropzone = () => {
|
|||||||
});
|
});
|
||||||
this.on("addedfile", (file) => {
|
this.on("addedfile", (file) => {
|
||||||
//添加文件
|
//添加文件
|
||||||
console.log(get_file_from_uuid(file.upload.uuid));
|
|
||||||
|
|
||||||
//判断文件是否重复
|
//控制排序 需要从添加文件开始操作
|
||||||
if (get_file_from_uuid(file.upload.uuid) <0) {
|
|
||||||
// //控制排序 需要从添加文件开始操作
|
//限制文件数量
|
||||||
|
if (files.length < prop.maxFiles) {
|
||||||
var t = {
|
var t = {
|
||||||
uuid: file.upload.uuid,
|
uuid: file.upload.uuid,
|
||||||
is_upload: false,
|
is_upload: false,
|
||||||
};
|
};
|
||||||
files.push(t);
|
files.push(t);
|
||||||
console.log(files);
|
} else {
|
||||||
return;
|
this.removeFile(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
//this.removeFile(file)
|
//console.log(files);
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
this.on("sending", function (file, xhr, formData) {
|
this.on("sending", function (file, xhr, formData) {
|
||||||
// 获取表单值并添加到 FormData
|
// 获取表单值并添加到 FormData
|
||||||
@@ -326,6 +312,7 @@ defineExpose({
|
|||||||
<!-- 移除按钮 -->
|
<!-- 移除按钮 -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-end">{{ files.length }}/{{ maxFiles }}</div>
|
<div class="text-end">{{ files.length }}/{{ maxFiles }}</div>
|
||||||
<div ref="dropzoneElement" class="dropzone"></div>
|
<div ref="dropzoneElement" class="dropzone"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
"title": "Title",
|
"title": "Title",
|
||||||
"input_title": "Enter order title",
|
"input_title": "Enter order title",
|
||||||
"remarks": "Remarks",
|
"remarks": "Remarks",
|
||||||
|
"photo_remarks": "Photos Remarks",
|
||||||
"remarks_text": "Enter text notes",
|
"remarks_text": "Enter text notes",
|
||||||
"purchase_channel": "Purchase Channel",
|
"purchase_channel": "Purchase Channel",
|
||||||
"link": "Link",
|
"link": "Link",
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
"title": "标题",
|
"title": "标题",
|
||||||
"input_title": "输入订单标题",
|
"input_title": "输入订单标题",
|
||||||
"remarks": "备注",
|
"remarks": "备注",
|
||||||
|
"photo_remarks": "图片备注",
|
||||||
"remarks_text": "输入文字备注",
|
"remarks_text": "输入文字备注",
|
||||||
"purchase_channel": "采购途径",
|
"purchase_channel": "采购途径",
|
||||||
"link": "链接",
|
"link": "链接",
|
||||||
|
|||||||
@@ -15,11 +15,10 @@ const userStore = useUserStore();
|
|||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
import TomSelect from "tom-select";
|
|
||||||
import "tom-select/dist/css/tom-select.css";
|
import "tom-select/dist/css/tom-select.css";
|
||||||
|
import { my_network_func } from "@/my_network_func";
|
||||||
|
|
||||||
const textarea_maxlen = 256;
|
const textarea_maxlen = 256;
|
||||||
const textarea_len = ref(0);
|
|
||||||
|
|
||||||
const title_input_dom = ref();
|
const title_input_dom = ref();
|
||||||
|
|
||||||
@@ -75,6 +74,7 @@ const cost_sheet = reactive({
|
|||||||
type: "1",
|
type: "1",
|
||||||
int: 1,
|
int: 1,
|
||||||
cost: 0.0,
|
cost: 0.0,
|
||||||
|
cost_t: 0.0,
|
||||||
currency_type: "1",
|
currency_type: "1",
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -82,15 +82,16 @@ function del_cost(key) {
|
|||||||
cost_sheet_tab.splice(key, 1);
|
cost_sheet_tab.splice(key, 1);
|
||||||
}
|
}
|
||||||
function add_cost() {
|
function add_cost() {
|
||||||
|
// 四舍五入到2位小数
|
||||||
|
// const fixed = parseFloat(newVal).toFixed(2);
|
||||||
|
// if (parseFloat(fixed) !== newVal) {
|
||||||
|
// cost_sheet.cost = parseFloat(fixed);
|
||||||
|
// }
|
||||||
|
|
||||||
|
var t = parseFloat((cost_sheet.int * cost_sheet.cost).toFixed(2));
|
||||||
|
cost_sheet.cost_t = t;
|
||||||
|
|
||||||
cost_sheet_tab.push(JSON.parse(JSON.stringify(cost_sheet)));
|
cost_sheet_tab.push(JSON.parse(JSON.stringify(cost_sheet)));
|
||||||
// var t = {
|
|
||||||
// type: cost_type[cost_sheet.type],
|
|
||||||
// int: cost_sheet.int,
|
|
||||||
// cost: cost_sheet.cost,
|
|
||||||
// currency_type: currency_type[cost_sheet.currency_type],
|
|
||||||
// };
|
|
||||||
// cost_sheet_tab.push(t);
|
|
||||||
//console.log(t);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const submit_sheet = reactive({
|
const submit_sheet = reactive({
|
||||||
@@ -99,7 +100,7 @@ const submit_sheet = reactive({
|
|||||||
photos: [],
|
photos: [],
|
||||||
link: "",
|
link: "",
|
||||||
part_name: "",
|
part_name: "",
|
||||||
styles: [],
|
styles: "",
|
||||||
costs: [],
|
costs: [],
|
||||||
update_time: "",
|
update_time: "",
|
||||||
tracking_number: "",
|
tracking_number: "",
|
||||||
@@ -120,25 +121,22 @@ function submit_order() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//载入图片哈希列表
|
//载入图片哈希列表
|
||||||
|
submit_sheet.photos = [];
|
||||||
var photos = photos_hash.value.return_files();
|
var photos = photos_hash.value.return_files();
|
||||||
for (var i = 0; i < photos.length; i++) {
|
for (var i = 0; i < photos.length; i++) {
|
||||||
submit_sheet.photos.push(photos[i].hash);
|
submit_sheet.photos.push(photos[i].hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//载入价格表
|
||||||
|
submit_sheet.costs = [];
|
||||||
|
for (var i = 0; i < cost_sheet_tab.length; i++) {
|
||||||
|
submit_sheet.costs.push(cost_sheet_tab[i]);
|
||||||
|
}
|
||||||
|
|
||||||
console.log(submit_sheet);
|
console.log(submit_sheet);
|
||||||
}
|
my_network_func.postJson("/purchase/addorder", submit_sheet, (r) => {
|
||||||
|
console.log(r)
|
||||||
function textarea_change(a) {
|
});
|
||||||
//console.log(textarea_val.value.length)
|
|
||||||
|
|
||||||
textarea_len.value = submit_sheet.remark.length;
|
|
||||||
|
|
||||||
// if(a.inputType=="insertText"){
|
|
||||||
// textarea_len.value+=1;
|
|
||||||
// }
|
|
||||||
// if(a.inputType=="devareContentBackward"){
|
|
||||||
// textarea_len.value-=1;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function functionupdataTitle() {
|
function functionupdataTitle() {
|
||||||
@@ -212,7 +210,9 @@ watch(
|
|||||||
<label class="form-label"
|
<label class="form-label"
|
||||||
>{{ t("purchase_addorder.remarks") }}
|
>{{ t("purchase_addorder.remarks") }}
|
||||||
<span class="form-label-description"
|
<span class="form-label-description"
|
||||||
>{{ textarea_len }}/{{ textarea_maxlen }}</span
|
>{{ submit_sheet.remark.length }}/{{
|
||||||
|
textarea_maxlen
|
||||||
|
}}</span
|
||||||
></label
|
></label
|
||||||
>
|
>
|
||||||
<textarea
|
<textarea
|
||||||
@@ -221,15 +221,8 @@ watch(
|
|||||||
rows="6"
|
rows="6"
|
||||||
:placeholder="t('purchase_addorder.remarks_text')"
|
:placeholder="t('purchase_addorder.remarks_text')"
|
||||||
:maxlength="textarea_maxlen"
|
:maxlength="textarea_maxlen"
|
||||||
@input="textarea_change"
|
|
||||||
v-model="submit_sheet.remark"
|
v-model="submit_sheet.remark"
|
||||||
></textarea>
|
></textarea>
|
||||||
<useDropzone
|
|
||||||
acceptedFiles="image/*"
|
|
||||||
uploadURL="/api/files/upload/image"
|
|
||||||
maxFiles="10"
|
|
||||||
ref="photos_hash"
|
|
||||||
></useDropzone>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -247,7 +240,7 @@ watch(
|
|||||||
name="url"
|
name="url"
|
||||||
type="url"
|
type="url"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
placeholder="http"
|
placeholder="https"
|
||||||
v-model="submit_sheet.link"
|
v-model="submit_sheet.link"
|
||||||
></textarea>
|
></textarea>
|
||||||
<div class="mb-3 mt-3">
|
<div class="mb-3 mt-3">
|
||||||
@@ -269,7 +262,19 @@ watch(
|
|||||||
|
|
||||||
<tagadder
|
<tagadder
|
||||||
:placeholder="t('purchase_addorder.add_style')"
|
:placeholder="t('purchase_addorder.add_style')"
|
||||||
|
v-model="submit_sheet.styles"
|
||||||
></tagadder>
|
></tagadder>
|
||||||
|
|
||||||
|
<label class="form-label mt-3 mb-0">{{
|
||||||
|
t("purchase_addorder.photo_remarks")
|
||||||
|
}}</label>
|
||||||
|
|
||||||
|
<useDropzone
|
||||||
|
acceptedFiles="image/*"
|
||||||
|
uploadURL="/api/files/upload/image"
|
||||||
|
maxFiles="10"
|
||||||
|
ref="photos_hash"
|
||||||
|
></useDropzone>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
@@ -299,7 +304,7 @@ watch(
|
|||||||
<td class="text-secondary">{{ value.int }}</td>
|
<td class="text-secondary">{{ value.int }}</td>
|
||||||
<td class="text-secondary">{{ value.cost }}</td>
|
<td class="text-secondary">{{ value.cost }}</td>
|
||||||
<td class="text-secondary">
|
<td class="text-secondary">
|
||||||
{{ value.cost * value.int }}
|
{{ value.cost_t }}
|
||||||
</td>
|
</td>
|
||||||
<td class="text-secondary">
|
<td class="text-secondary">
|
||||||
{{ currency_type[value.currency_type] }}
|
{{ currency_type[value.currency_type] }}
|
||||||
@@ -404,7 +409,9 @@ watch(
|
|||||||
<label class="form-label required">{{
|
<label class="form-label required">{{
|
||||||
t("purchase_addorder.update_time")
|
t("purchase_addorder.update_time")
|
||||||
}}</label>
|
}}</label>
|
||||||
<dateTimePicker></dateTimePicker>
|
<dateTimePicker
|
||||||
|
v-model="submit_sheet.update_time"
|
||||||
|
></dateTimePicker>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xl-4">
|
<div class="col-xl-4">
|
||||||
<label class="form-label">{{
|
<label class="form-label">{{
|
||||||
|
|||||||
Reference in New Issue
Block a user