wangfukang 3 years ago
parent
commit
c89b5b83de
  1. 273
      package1/AI/AIHangOrderList.vue
  2. 24
      package1/AI/AIInventoryList.vue
  3. 384
      package1/AI/AIPicture.vue
  4. 8
      package1/AI/AiChat.vue
  5. BIN
      package1/cropper/.DS_Store
  6. 309
      package1/cropper/cropper.vue
  7. 4
      package1/inventory/addGoods.vue
  8. 7
      package1/inventory/inventoryConfirm.vue

273
package1/AI/AIHangOrderList.vue

@ -81,7 +81,7 @@
</view>
<view class="shop-list" v-for="(items,index1) in item.saleDetailDTOList" :key="index1">
<view class="order-name">
<text style="float: left;">{{items.productName}}({{items.productSn}})单价:{{items.discountAmount}}</text>
<text style="float: left;"><text style="width: 80%;">{{items.productName}}({{items.productSn}})</text>单价:{{items.discountAmount || items.wholesalePrice}}</text>
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/6b5ab32ff93a4c51b90e562e0b22e850.png" @tap.stop="largeImg(items.productPicture)" alt="">
</view>
<view class="specs-name" v-for="(itemss,index2) in items.stockLogList1" :key="index2">
@ -229,7 +229,7 @@
components: {},
data() {
return {
Name:{},
khName:[],
regList:[],
pageNumber: 1,
recordState: false,
@ -277,20 +277,20 @@
onPullDownRefresh(){
this.getRegList()
},
onShow() {
this.getRegList()
this.Name = JSON.parse(JSON.stringify(this.khName)) || ''
onShow() {
this.khName = JSON.parse(JSON.stringify(this.khName)) || ''
if(uni.getStorageSync('hangOrderType') == 'scanCode'){
this.addReg()
uni.removeStorageSync('hangOrderType')
return;
}
if(this.Name != ''){
this.khName = []
if(this.khName != ''){
uni.navigateTo({
url: '/package1/AI/AiChat?khName='+ JSON.stringify(this.Name)
url: '/package1/AI/AiChat?khName='+ JSON.stringify(this.khName)
})
}
}
this.khName = []
this.getRegList()
},
onLoad() {
this.shopName = uni.getStorageSync('shopName')
@ -321,14 +321,14 @@
},
addReg() {
this.tui.request("/app/sale/saveOrder", "POST", {
userId:this.Name.id,
userName:this.Name.name,
userId:this.khName.id,
userName:this.khName.name,
aiFlag:0,
status: 7,
area:this.Name.area,
city:this.Name.city,
province:this.Name.province,
receiveAddress:this.Name.address
area:this.khName.area,
city:this.khName.city,
province:this.khName.province,
receiveAddress:this.khName.address
}, false, false).then((res) => {
if (res.code == 200) {
this.getRegList()
@ -486,12 +486,13 @@
value.push(value1)
evalue.push(name)
}
console.log(jishuqi)
// if (jishuqi == 0) {
// this.oldTemList = []
// }
if (this.temporaryList.length == 0) {
// if (this.temporaryList.length == 0) {
if (jishuqi == this.goodsList.length) {
console.log(jishuqi)
for (var i = 0; i < value.length; i++) {
this.attributeList = {
attributeList: value[i],
@ -503,55 +504,56 @@
this.temporaryList.push(this.attributeList);
}
}
} else {
let newProductCount = 0;
for (var i = 0; i < value.length; i++) {
for (var m = 0; m < this.temporaryList.length; m++) {
if (this.temporaryList[m].attributeList == value[i]) {
newProductCount = this.temporaryList[m].productCount
}
}
this.attributeList = {
attributeList: value[i],
productCount: newProductCount,
productNum: this.productNum,
name: evalue[i],
price: this.purchasePrice
}
this.$forceUpdate()
// } else {
// let newProductCount = 0;
// for (var i = 0; i < value.length; i++) {
// for (var m = 0; m < this.temporaryList.length; m++) {
// if (this.temporaryList[m].attributeList == value[i]) {
// newProductCount = this.temporaryList[m].productCount
// }
// }
// this.attributeList = {
// attributeList: value[i],
// productCount: newProductCount,
// productNum: this.productNum,
// name: evalue[i],
// price: this.purchasePrice
// }
this.newTemList.push(this.attributeList);
newProductCount = 0;
}
for (var i = 0; i < this.oldTemList.length; i++) {
let oldAttributeList = '';
let oldProductCount = '';
let notChcek = true;
for (var m = 0; m < this.newTemList.length; m++) {
if (this.oldTemList[i].attributeList == this.newTemList[m].attributeList) {
this.newTemList[m].productCount = this.oldTemList[i].productCount
notChcek = false;
}
}
if (this.newTemList.length > 0 && notChcek) {
this.newTemList.push(this.oldTemList[i]);
}
}
// this.newTemList.push(this.attributeList);
// newProductCount = 0;
// }
// for (var i = 0; i < this.oldTemList.length; i++) {
// let oldAttributeList = '';
// let oldProductCount = '';
// let notChcek = true;
// for (var m = 0; m < this.newTemList.length; m++) {
// if (this.oldTemList[i].attributeList == this.newTemList[m].attributeList) {
// this.newTemList[m].productCount = this.oldTemList[i].productCount
// notChcek = false;
// }
// }
// if (this.newTemList.length > 0 && notChcek) {
// this.newTemList.push(this.oldTemList[i]);
// }
// }
for (var i = 0; i < this.pageOldTemList.length; i++) {
let oldAttributeList = '';
let oldProductCount = '';
let notChcek = true;
for (var m = 0; m < this.newTemList.length; m++) {
if (this.pageOldTemList[i].attributeList == this.newTemList[m].attributeList) {
this.newTemList[m].productCount = this.pageOldTemList[i].productCount
notChcek = false;
}
}
if (this.newTemList.length > 0 && notChcek) {
this.newTemList.push(this.pageOldTemList[i]);
}
}
}
// for (var i = 0; i < this.pageOldTemList.length; i++) {
// let oldAttributeList = '';
// let oldProductCount = '';
// let notChcek = true;
// for (var m = 0; m < this.newTemList.length; m++) {
// if (this.pageOldTemList[i].attributeList == this.newTemList[m].attributeList) {
// this.newTemList[m].productCount = this.pageOldTemList[i].productCount
// notChcek = false;
// }
// }
// if (this.newTemList.length > 0 && notChcek) {
// this.newTemList.push(this.pageOldTemList[i]);
// }
// }
// }
this.$nextTick(() => {
for (var i = 0; i < this.temporaryList.length; i++) {
for (var m = 0; m < this.pecsList.length; m++) {
@ -561,17 +563,17 @@
}
}
})
if (jishuqi != this.goodsList.length) {
if (this.oldTemList.length == 0 && this.pageOldTemList.length == 0) {
this.newTemList = []
this.temporaryList = []
}
}
if (this.newTemList.length != 0 && jishuqi == this.goodsList.length) {
this.temporaryList = this.newTemList;
this.oldTemList = []
this.newTemList = []
}
// if (jishuqi != this.goodsList.length) {
// if (this.oldTemList.length == 0 && this.pageOldTemList.length == 0) {
// this.newTemList = []
// this.temporaryList = []
// }
// }
// if (this.newTemList.length != 0 && jishuqi == this.goodsList.length) {
// this.temporaryList = this.newTemList;
// this.oldTemList = []
// this.newTemList = []
// }
},
temporaryChange(val) {
@ -592,6 +594,7 @@
for (var i = 0; i < this.temporaryList.length; i++) {
if(this.temporaryList[i].productCount <= 0){
this.tui.toast("商品数量不能为零!")
return
}
}
let data = {
@ -641,6 +644,7 @@
toggle(type, id) {
this.type = type
if (type == 'bottom') {
this.allChangeNum = 0
this.getById(id);
} else {
wx.vibrateShort()
@ -697,50 +701,55 @@
//带参数跳转到开单页
goSaleGoods(item) {
let dataList = []
if(item.saleDetailDTOList){
for (let i = 0; i < item.saleDetailDTOList.length; i++) {
if(item.aiNotRecognition != ''){
this.tui.toast(item.aiNotRecognition)
}
setTimeout(res => {
if(item.saleDetailDTOList){
for (let i = 0; i < item.saleDetailDTOList.length; i++) {
let obj = {}
obj.saleDetailQueryDTO = item.saleDetailDTOList[i].stockLogList1
obj.num = 0
obj.id = item.saleDetailDTOList[i].productId
obj.price = item.saleDetailDTOList[i].price
obj.lsprice = item.saleDetailDTOList[i].price
obj.zPrice = item.saleDetailDTOList[i].discountAmount
obj.unitPrice = item.saleDetailDTOList[i].discountAmount
obj.productName = item.saleDetailDTOList[i].productName
obj.productPicture = item.saleDetailDTOList[i].productPicture+'?time='+new Date().getTime()
obj.productSn = item.saleDetailDTOList[i].productSn
obj.wholesalePrice = item.saleDetailDTOList[i].wholesalePrice
obj.saleId = item.id
obj.remark = item.remark
obj.xsyId = item.createBy
obj.createByName = item.createByName
dataList.push(obj)
}
}else{
let obj = {}
obj.saleDetailQueryDTO = item.saleDetailDTOList[i].stockLogList1
obj.num = 0
obj.id = item.saleDetailDTOList[i].productId
obj.price = 0
obj.lsprice = item.saleDetailDTOList[i].price
obj.zPrice = item.saleDetailDTOList[i].discountAmount
obj.unitPrice = item.saleDetailDTOList[i].discountAmount
obj.productName = item.saleDetailDTOList[i].productName
obj.productPicture = item.saleDetailDTOList[i].productPicture+'?time='+new Date().getTime()
obj.productSn = item.saleDetailDTOList[i].productSn
obj.wholesalePrice = item.saleDetailDTOList[i].wholesalePrice
obj.saleId = item.id
obj.remark = item.remark
obj.xsyId = item.createBy
obj.createByName = item.createByName
dataList.push(obj)
}
}else{
let obj = {}
obj.num = 0
obj.price = 0
obj.saleId = item.id
obj.remark = item.remark
obj.xsyId = item.createBy
obj.createByName = item.createByName
dataList.push(obj)
}
let khName = {
name:item.userName,
id:item.userId,
area:item.area,
city:item.city,
address:item.receiveAddress,
province:item.province,
}
uni.setStorageSync('carList1', JSON.stringify(dataList))
uni.setStorageSync('khName', JSON.stringify(khName))
uni.switchTab({
url: '/pages/inventory/goodsList1'
})
let khName = {
name:item.userName,
id:item.userId,
area:item.area,
city:item.city,
address:item.receiveAddress,
province:item.province,
}
uni.setStorageSync('carList1', JSON.stringify(dataList))
uni.setStorageSync('khName', JSON.stringify(khName))
uni.setStorageSync('hangOrder', true)
uni.switchTab({
url: '/pages/inventory/goodsList1'
})
}, 1000)
},
//点击切换折叠状态
clickCollapse(item) {
@ -795,6 +804,7 @@
categoryId: this.goodsDetail.categoryId
}, false, true).then((res1) => {
if (res1.code == 200) {
this.goodsList = []
this.$refs.shopPopup.open('bottom')
if (typeof(res1.result) == 'string') {
let newObj = JSON.parse(res1.result)
@ -904,6 +914,49 @@
//清空语音输入的文字
clearText(){
this.voiceText = ''
},
//删除整条商品
delGoods(item, productId) {
let that = this;
this.hangId = item.id;
uni.showModal({
title: "提示",
content: "确定删除此条商品吗?",
success: function(res) {
if (res.confirm) {
for (let i = 0; i < item.saleDetailDTOList.length; i++) {
if (item.saleDetailDTOList[i].productId == productId) {
item.saleDetailDTOList.splice(item.saleDetailDTOList[i], 1)
}
}
that.carList = item.saleDetailDTOList
that.setSaleDetail();
}
}
})
},
//选商品的时候能删除规格
delCarData(index) {
this.temporaryList.splice(index, 1);
this.temporaryChange()
},
//删除商品下的单条规格
delGoodsPrecs(item, index, index1) {
let that = this;
this.hangId = item.id;
uni.showModal({
title: "提示",
content: "确定删除此条规格吗?",
success: function(res) {
if (res.confirm) {
item.saleDetailDTOList[index].stockLogList1.splice(item.saleDetailDTOList[index]
.stockLogList1[index1], 1)
that.carList = item.saleDetailDTOList
that.setSaleDetail();
}
}
})
},
}
}

24
package1/AI/AIInventoryList.vue

@ -23,7 +23,11 @@
</view>
</view>
<view class="content">
<view style="height: 80rpx;line-height: 80rpx;font-size: 32rpx;font-weight: bold;padding-left: 30rpx;">入库列表
<view style="height: 80rpx;line-height: 80rpx;font-size: 32rpx;font-weight: bold;padding-left: 30rpx;position: relative;">
入库列表
<view @tap="goAiPicture" style="position: absolute;top: 0;right: 20rpx;">
<uni-icons type="plusempty" size="26"></uni-icons>
</view>
</view>
<view class="content-list" v-for="(item,index) in aiList" :key="index">
<view class="image-box">
@ -42,10 +46,6 @@
</view>
</view>
</view>
<view class="bottom" @tap="goAiPicture">
<view class="btn-x bottom-btn"></view>
<view class="btn-y bottom-btn"></view>
</view>
</view>
</template>
@ -112,16 +112,17 @@
for(let i=0;i<this.purchaseDetails.length;i++){
let data = {
id: this.purchaseDetails[i].id,
// price: ,
num: this.purchaseDetails[i].productCount,
wholesalePrice: 0,
purchasePrice:this.purchaseDetails[i].price,
price: this.purchaseDetails[i].price,
productCount: 0,
categoryId:this.purchaseDetails[i].categoryId,
wholesalePrice: this.purchaseDetails[i].wholesalePrice,
purchasePrice:this.purchaseDetails[i].purchasePrice,
isNew: this.purchaseDetails[i].productId==null?true:false,
productId:this.purchaseDetails[i].productId,
productName: this.purchaseDetails[i].productName,
productSn: this.purchaseDetails[i].productSn,
productPicture: '',
supplierName: '',
productPicture: this.purchaseDetails[i].productPicture,
supplierName: this.purchaseDetails[i].supplierName,
saleDetailQueryDTO: []
}
for(let m=0;m<this.purchaseDetails[i].stockLogList1.length;m++){
@ -132,6 +133,7 @@
name: this.sliceMsg(this.purchaseDetails[i].stockLogList1[m].attributeList),
price: this.purchaseDetails[i].stockLogList1[m].purchasePrice
}
data.productCount += this.purchaseDetails[i].stockLogList1[m].productCount
data.saleDetailQueryDTO.push(list)
}
this.carList1.push(data)

384
package1/AI/AIPicture.vue

@ -21,7 +21,8 @@
<text>欢迎使用Ai助手,为了提高图片识别准确率,建议您按照以下要求上传图片:</text>
<text>1.每张图片建议您裁剪到20个规格或以下</text>
<text>2.确保最后一款商品规格截取完整</text>
<text>3.每张图片输入对应的规格数量</text>
<text>3.每张图片输入对应的规格数量</text>
<text>4.如果拍照后找不到所拍照片,打开微信的设置-通用-照片、视频里面的照片,点击开启后重启微信即可</text>
</view>
<view class="prompt-title-img">
<view class="img" v-for="(item,index) in imgList" :key="index">
@ -29,15 +30,17 @@
</view>
</view>
</view>
<view @tap="upLoadImg()"
<view @tap="toggle"
style="height: 98rpx;line-height: 98rpx;font-size: 34rpx;font-weight: bold;padding-left: 30rpx;position: relative;">
上传图片
<view class="title-line"></view>
<view class="icon-upload">
<uni-icons type="cloud-upload" color="#00BFFF" size="30"></uni-icons>
<uni-icons type="cloud-upload" color="#00BFFF" size="30"></uni-icons>
<text style="font-size: 24rpx;float: left;font-weight: normal;">(←点击此处添加主图)</text>
</view>
</view>
<view v-for="(item,index) in purchaseOcrPictureList" :key="index" style="display: flex;width: 100%;overflow: scroll;">
<view v-for="(item,index) in purchaseOcrPictureList" :key="index"
style="display: flex;width: 100%;overflow: scroll;">
<view class="content-list-img">
<view class="del-icon" @tap="delImage(index)">
<uni-icons type="trash" color="#00BFFF" size="20"></uni-icons>
@ -45,26 +48,38 @@
<image show-menu-by-longpress :src="item.ocrPicture" @tap="showImage(item.ocrPicture)"></image>
<uni-easyinput type='number' prefixIcon="compose" v-model='item.count'
placeholder="请输入规格数量"></uni-easyinput>
</view>
<view v-for="(items,indexs) in item.children" :key="indexs" style="width: 200rpx;height: 280rpx;position: relative;background: #fff;margin-left: 20rpx;border-radius: 10px;">
<view class="del-icon" @tap="delImage(index)">
<uni-icons type="trash" color="#00BFFF" size="20"></uni-icons>
</view>
<image show-menu-by-longpress :src="items.ocrPicture" @tap="showImage(items.ocrPicture)" style="width: 200rpx;height: 200rpx;padding: 5px;"></image>
<uni-easyinput type='number' v-model='items.count' placeholder="子图规格数量"></uni-easyinput>
</view>
<view @tap="addSonImg(item.id)" style="width: 200rpx;height: 219rpx;background: rgba(255,255,255,0.4);margin: 0 20rpx;border-radius: 10px;font-size: 24rpx;color: #777;text-align: center;">
<uni-icons type="plusempty" color="#777" size="80"></uni-icons>
<view style="height: 30rpx;line-height: 30rpx;">点击添加子图</view>
</view>
</view>
<view v-for="(items,indexs) in item.children" :key="indexs"
style="width: 200rpx;height: 280rpx;position: relative;background: #fff;margin-left: 20rpx;border-radius: 10px;">
<view class="del-icon" @tap="delSonImage(index,indexs)">
<uni-icons type="trash" color="#00BFFF" size="20"></uni-icons>
</view>
<image show-menu-by-longpress :src="items.ocrPicture" @tap="showImage(items.ocrPicture)"
style="width: 200rpx;height: 200rpx;padding: 5px;"></image>
<uni-easyinput type='number' v-model='items.count' placeholder="子图规格数量"></uni-easyinput>
</view>
<view @tap="addSonImg(item.id)"
style="width: 200rpx;height: 219rpx;background: rgba(255,255,255,0.4);margin: 0 20rpx;border-radius: 10px;font-size: 24rpx;color: #777;text-align: center;">
<uni-icons type="plusempty" color="#777" size="80"></uni-icons>
<view style="height: 30rpx;line-height: 30rpx;">点击添加子图</view>
</view>
</view>
<view style="height:200rpx;"></view>
</view>
<view class="bottom" @tap="identify">
<view class="bottom-box" @tap="identify">
<view class="run-line"></view>
<img class="bottom-img"
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/27e2655fe19f454d93970f968d91fbef.png" alt="" />
<view class="bottom-btn">Ai识别</view>
</view>
</view>
<!-- 弹出层 -->
<uni-popup ref="popup" background-color="#fff">
<view style="height:340rpx;">
<view @tap="upLoadImg('pai')" class="popup-photo">拍照</view>
<view @tap="upLoadImg('xuan')" class="popup-photo">从相册选择</view>
<view @tap="$refs.popup.close()" class="popup-photo" style="border-bottom:0;border-top:10px solid #eee;">取消</view>
</view>
</uni-popup>
</view>
</template>
@ -79,103 +94,75 @@
'https://jewel-shop.oss-cn-beijing.aliyuncs.com/44e7ccc2fae74db593bd1a10f538e2de.jpg',
'https://jewel-shop.oss-cn-beijing.aliyuncs.com/2a55142e562b4ea480ce553c8b84d092.jpg'
],
purchaseOcrPictureList: [],
parentPicturePath:'',
parentId:'',
newSubmit:[]
purchaseOcrPictureList: [],
parentPicturePath: '',
parentId: '',
newSubmit: []
}
},
onShow() {
if (this.uploadUrl && this.uploadNum == 1) {
if(this.parentId !=''){
for(let i=0;i<this.purchaseOcrPictureList.length;i++){
if(this.purchaseOcrPictureList[i].id == this.parentId){
let data = {
ocrPicture: this.uploadUrl,
count: '',
}
this.purchaseOcrPictureList[i].children.push(data)
}
}
this.parentId = ''
}else{
let data = {
ocrPicture: this.uploadUrl,
count: '',
id:this.splitData(this.uploadUrl),
children:[]
}
this.purchaseOcrPictureList.push(data)
}
console.log('查看图片',this.purchaseOcrPictureList)
this.uploadUrl = ''
this.uploadNum = ''
this.parentPicturePath = ''
}
},
onLoad() {
},
methods: {
addSonImg(id){
this.parentId = id
this.upLoadImg()
},
splitData(str){
return str.split('/')[3].split('.')[0]
methods: {
addSonImg(id) {
this.parentId = id
this.toggle()
},
identify() {
this.newSubmit = []
if(this.purchaseOcrPictureList.length == 0){
this.tui.toast("请选择要上传的图片")
return
}
for(let i=0;i<this.purchaseOcrPictureList.length;i++){
if(this.purchaseOcrPictureList[i].count == 0 || this.purchaseOcrPictureList[i].count == ''){
this.tui.toast("请输入数量")
return
}else{
let data = {
ocrPicture: this.purchaseOcrPictureList[i].ocrPicture,
count: this.purchaseOcrPictureList[i].count,
parentPicturePath:''
}
this.newSubmit.push(data)
if(this.purchaseOcrPictureList[i].children.length > 0){
for(let m=0;m<this.purchaseOcrPictureList[i].children.length;m++){
if(this.purchaseOcrPictureList[i].children[m].count == 0 || this.purchaseOcrPictureList[i].children[m].count == ''){
this.tui.toast("请输入子图片的规格数量")
return
}else{
let data = {
ocrPicture: this.purchaseOcrPictureList[i].children[m].ocrPicture,
count: this.purchaseOcrPictureList[i].children[m].count,
parentPicturePath:this.purchaseOcrPictureList[i].ocrPicture
}
this.newSubmit.push(data)
}
}
}
}
}
console.log(this.newSubmit)
this.tui.request("/purchaseOcrPicture/batchSave", "POST", {
orderId: "",
purchaseOcrPictureList: this.newSubmit
}, false, false).then((res) => {
if (res.code == 200) {
this.tui.toast("识别中,请等待...")
setTimeout(res => {
uni.navigateBack({
delta: 1
})
}, 2000)
} else {
this.tui.toast(res.message)
}
splitData(str) {
return str.split('/')[3].split('.')[0]
},
identify() {
this.newSubmit = []
if (this.purchaseOcrPictureList.length == 0) {
this.tui.toast("请选择要上传的图片")
return
}
for (let i = 0; i < this.purchaseOcrPictureList.length; i++) {
if (this.purchaseOcrPictureList[i].count == 0 || this.purchaseOcrPictureList[i].count == '') {
this.tui.toast("请输入数量")
return
} else {
let data = {
ocrPicture: this.purchaseOcrPictureList[i].ocrPicture,
count: this.purchaseOcrPictureList[i].count,
parentPicturePath: ''
}
this.newSubmit.push(data)
if (this.purchaseOcrPictureList[i].children.length > 0) {
for (let m = 0; m < this.purchaseOcrPictureList[i].children.length; m++) {
if (this.purchaseOcrPictureList[i].children[m].count == 0 || this.purchaseOcrPictureList[i]
.children[m].count == '') {
this.tui.toast("请输入子图片的规格数量")
return
} else {
let data = {
ocrPicture: this.purchaseOcrPictureList[i].children[m].ocrPicture,
count: this.purchaseOcrPictureList[i].children[m].count,
parentPicturePath: this.purchaseOcrPictureList[i].ocrPicture
}
this.newSubmit.push(data)
}
}
}
}
}
console.log(this.newSubmit)
this.tui.request("/purchaseOcrPicture/batchSave", "POST", {
orderId: "",
purchaseOcrPictureList: this.newSubmit
}, false, false).then((res) => {
if (res.code == 200) {
uni.navigateBack({
delta: 1
})
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
backPage() {
@ -189,20 +176,109 @@
urls: [img],
current: img
})
},
toggle(){
let that = this;
uni.getSystemInfo({
success: function (res) {
if(res.osName == 'ios'){
that.upLoadImg('ios')
}else if(res.osName == 'android'){
that.$refs.popup.open('bottom')
}
}
});
},
upLoadImg() {
let that = this;
uni.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['album', 'camera'],
camera: 'back',
success(res) {
uni.navigateTo({
url: '/package1/cropper/cropper?imgSrc='+res.tempFiles[0].tempFilePath
})
}
})
upLoadImg(type) {
let that = this;
if(type == 'ios'){
uni.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['camera','album'],
camera: 'back',
success(res) {
that.upLoadFile(res.tempFiles[0].tempFilePath)
}
})
}else if(type == 'pai'){
uni.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['camera'],
camera: 'back',
success(res) {
uni.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['album'],
success(res1) {
that.upLoadFile(res1.tempFiles[0].tempFilePath)
}
})
}
})
}else if(type == 'xuan'){
uni.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['album'],
success(res1) {
that.upLoadFile(res1.tempFiles[0].tempFilePath)
}
})
}
this.$refs.popup.close()
},
upLoadFile(path){
let that = this;
let hiver_token = uni.getStorageSync("hiver_token")
uni.uploadFile({
url: 'https://dev.xenjoyou.com/hiver/upload/file',
filePath: path,
name: 'file',
header: {
"content-type": "multipart/form-data",
'accessToken': hiver_token
},
formData: {},
success: (uploadFileRes) => {
let path = JSON.parse(uploadFileRes.data)
if (that.parentId != '') {
for (let i = 0; i < that.purchaseOcrPictureList
.length; i++) {
if (that.purchaseOcrPictureList[i].id ==
that.parentId) {
let data = {
ocrPicture: path.result,
count: '',
}
that.purchaseOcrPictureList[i].children
.push(data)
}
}
that.parentId = ''
} else {
let data = {
ocrPicture: path.result,
count: '',
id: that.splitData(path.result),
children: []
}
that.purchaseOcrPictureList.push(data)
}
console.log('查看图片', that.purchaseOcrPictureList)
},
fail: (err) => {
uni.showToast({
title: JSON.stringify(err),
icon: 'none'
})
}
});
},
delImage(index) {
let that = this;
@ -215,6 +291,19 @@
}
}
})
},
delSonImage(index,indexs) {
let that = this;
console.log(that.purchaseOcrPictureList)
uni.showModal({
title: "提示",
content: "确定删除该子图吗?",
success: function(res) {
if (res.confirm) {
that.purchaseOcrPictureList[index].children.splice(indexs, 1);
}
}
})
}
}
}
@ -353,7 +442,7 @@
animation: blinking 1s infinite;
}
.bottom {
.bottom-box {
position: fixed;
bottom: 100rpx;
right: 0;
@ -463,31 +552,38 @@
height: 80%;
padding: 10px;
}
}
.uni-easyinput {
width: 100%;
height: 20%;
font-size: 36rpx;
line-height: 40rpx;
background: #F8FAFF;
text-align: center;
display: block;
border:none;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
.del-icon {
width: 50rpx;
height: 50rpx;
position: absolute;
top: 0;
right: 0;
.uni-easyinput {
width: 100%;
height: 20%;
font-size: 36rpx;
line-height: 40rpx;
background: #F8FAFF;
text-align: center;
display: block;
border: none;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
.del-icon {
width: 50rpx;
height: 50rpx;
position: absolute;
top: 0;
right: 0;
}
.icon-upload {
position: absolute;
top: 0;
left: 190rpx;
height: 100%;
height: 100%;
uni-icons{
float: left;
}
}
.title-line {
@ -531,5 +627,13 @@
100% {
transform: rotate(360deg);
}
}
.popup-photo{
height: 110rpx;
line-height: 110rpx;
text-align: center;
font-size: 36rpx;
font-weight: 800;
border-bottom: 1px solid #eee;
}
</style>

8
package1/AI/AiChat.vue

@ -103,7 +103,8 @@
this.height = wx.getSystemInfoSync().windowHeight
this.khName = JSON.parse(option.khName)
console.log(this.khName)
console.log(this.khName)
this.initRecord();
},
methods: {
switchChat(type){
@ -153,6 +154,7 @@
manager.stop()
// 识别结束事件
manager.onStop = (res) => {
console.log(res)
if (res.result == '') {
uni.showToast({
title: "请重新说一遍",
@ -180,6 +182,10 @@
}
},
addReg() {
if(this.msgList.length <= 0){
this.tui.toast("小助手没有检测到可识别的内容哦~")
return
}
this.tui.request("/app/sale/saveOrder", "POST", {
userId:this.khName.id,
userName:this.khName.name,

BIN
package1/cropper/.DS_Store

Binary file not shown.

309
package1/cropper/cropper.vue

@ -1,309 +0,0 @@
<template>
<view>
<view style="width:100%;height:500rpx;">
<image-cropper id="image-cropper" @load="cropperload" @imageload="loadimage" @tapcut="clickcut" limit_move="{{limit_move}}" disable_rotate="{{disable_rotate}}" width="{{width}}" height="{{height}}" imgSrc="{{src}}" angle="{{angle}}" disable_width="{{disable_width}}" max_width="{{max_width}}" max_height="{{max_height}}" disable_height="{{disable_height}}" disable_ratio="{{disable_ratio}}">
</image-cropper>
</view>
<text class="hint">点击中间裁剪框可查看裁剪后的图片</text>
<view class='bottom'>
<button @tap='submit'>确定</button>
<!-- <button class="button" @touchstart='rotate' @touchend='end' data-type="rotate">旋转</button> -->
<button class="button" @tap='upload'>上传</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
src: '',
width: 250, //宽度
height: 250, //高度
max_width: 1080,
max_height: 1920,
disable_rotate: true, //是否禁用旋转
disable_ratio: false, //锁定比例
limit_move: true, //是否限制移动
}
},
onLoad(options) {
let that = this;
this.cropper = this.selectComponent("#image-cropper");
this.src= options.imgSrc
if(!options.imgSrc){
this.cropper.upload(); //上传图片
}
},
methods: {
cropperload(e) {
console.log('cropper加载完成');
},
loadimage(e) {
wx.hideLoading();
console.log('图片');
// this.cropper.imgReset();
this.cropper.setCutSize()
this.cropper.setCutCenter()
},
clickcut(e) {
console.log(e.detail);
//图片预览
wx.previewImage({
current: e.detail.url, // 当前显示图片的http链接
urls: [e.detail.url] // 需要预览的图片http链接列表
})
},
upload() {
let that = this;
wx.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success(res) {
wx.showLoading({
title: '加载中',
})
const tempFilePaths = res.tempFilePaths[0];
//重置图片角度、缩放、位置
that.cropper.imgReset();
that.src= tempFilePaths
}
})
},
setWidth(e) {
this.width= e.detail.value < 10 ? 10 : e.detail.value
this.cut_left= this.cropper.data.cut_left
},
setHeight(e) {
this.height= e.detail.value < 10 ? 10 : e.detail.value
this.cut_top= this.cropper.data.cut_top
},
switchChangeDisableRatio(e) {
//设置宽度之后使剪裁框居中
this.disable_ratio= e.detail.value
},
setCutTop(e) {
this.cut_top= e.detail.value
this.cut_top= this.cropper.data.cut_top
},
setCutLeft(e) {
this.cut_left= e.detail.value
this.cut_left= this.cropper.data.cut_left
},
switchChangeDisableRotate(e) {
//开启旋转的同时不限制移动
if (!e.detail.value) {
this.limit_move= false,
this.disable_rotate= e.detail.value
} else {
this.disable_rotate= e.detail.value
}
},
switchChangeLimitMove(e) {
//限制移动的同时锁定旋转
if (e.detail.value) {
this.disable_rotate= true
}
this.cropper.setLimitMove(e.detail.value);
},
switchChangeDisableWidth(e) {
this.disable_width= e.detail.value
},
switchChangeDisableHeight(e) {
this.disable_height= e.detail.value
},
submit() {
let that = this;
let hiver_token = uni.getStorageSync("hiver_token")
this.cropper.getImg((obj) => {
console.log(obj.url)
console.log(that.tui.getToken())
uni.uploadFile({
url: 'https://dev.xenjoyou.com/hiver/upload/file',
filePath: obj.url,
name: 'file',
header: {
"content-type": "multipart/form-data",
'accessToken': hiver_token
},
formData: {},
success: (uploadFileRes) => {
let path = JSON.parse(uploadFileRes.data)
console.log(path)
// let data = {
// url:path.result,
// specNum:''
// }
// that.productPicture.push(data)
let pages = getCurrentPages();
let prevPage = pages[pages.length - 2];
prevPage.$vm.uploadUrl = path.result
prevPage.$vm.uploadNum = 1
//后端返回的地址,存入图片地址
wx.navigateBack({
delta: 1
})
},fail: (err) =>{
uni.showToast({
title: JSON.stringify(err),
icon: 'none'
})
}
});
});
},
rotate() {
//在用户旋转的基础上旋转90°
this.cropper.setAngle(this.cropper.data.angle += 90);
},
top() {
this.data.top = setInterval(() => {
this.cropper.setTransform({
y: -3
});
}, 1000 / 60)
},
bottom() {
this.data.bottom = setInterval(() => {
this.cropper.setTransform({
y: 3
});
}, 1000 / 60)
},
left() {
this.data.left = setInterval(() => {
this.cropper.setTransform({
x: -3
});
}, 1000 / 60)
},
right() {
this.data.right = setInterval(() => {
this.cropper.setTransform({
x: 3
});
}, 1000 / 60)
},
narrow() {
this.data.narrow = setInterval(() => {
this.cropper.setTransform({
scale: -0.02
});
}, 1000 / 60)
},
enlarge() {
this.data.enlarge = setInterval(() => {
this.cropper.setTransform({
scale: 0.02
});
}, 1000 / 60)
},
end(e) {
clearInterval(this.data[e.currentTarget.dataset.type]);
},
}
}
</script>
<style>
.top {
position: absolute;
width: 100%;
top: 10rpx;
display: flex;
flex-flow: wrap;
z-index: 10;
color: white;
justify-content: space-around;
}
.hint {
position: absolute;
top: 10rpx;
width: 100%;
font-size: 33rpx;
text-align: center;
color: white;
z-index: 10;
}
page {
background: white;
}
view {
font-size: 30rpx;
}
.bottom {
position: absolute;
width: 100%;
bottom: 50rpx;
display: flex;
z-index: 10;
justify-content: center;
align-items: center;
flex-wrap: wrap;
height: 210rpx;
}
button {
font-size: 27rpx;
z-index: 2;
padding: 0 20rpx;
height: 60rpx;
min-width: 70rpx;
margin: 0 4rpx;
}
.input {
display: flex;
height: 50rpx;
width: 50%;
}
.input>.label {
min-width: 150rpx;
font-size: 30rpx;
height: 50rpx;
line-height: 50rpx;
}
.input>input {
margin-left: 10rpx;
text-align: center;
max-width: 160rpx;
border: 1px solid rgb(255, 255, 255);
height: 50rpx;
line-height: 50rpx;
min-height: 50rpx;
box-sizing: border-box;
}
</style>

4
package1/inventory/addGoods.vue

@ -72,7 +72,7 @@
price: '',
productSn: '',
wholesalePrice: '',
productPicture: [],
productPicture: '',
productIntro: '',
categoryId: '',
salesWeek: '',
@ -192,7 +192,7 @@
return new Promise((resolve, reject) => {
let a = uni.uploadFile({
url: 'https://storage.xenjoyou.com/hiver/upload/file',
url: 'https://dev.xenjoyou.com/hiver/upload/file',
filePath: url,
name: 'file',
header: {

7
package1/inventory/inventoryConfirm.vue

@ -63,7 +63,7 @@
</view>
</view>
<view class="tui-tabbar">
<view class="tui-btn-mr" @click="batchPrint">批量打印</view>
<view class="tui-btn-mr" @click="batchPrint" v-if="aiinventory !=1">批量打印</view>
<view class="tui-btn-mr" @click="inventorySubmit">确认提交</view>
</view>
</view>
@ -75,7 +75,7 @@
return {
purchase:'',
purchaseDetails:'',
aiinventory:0
aiinventory:0 //1是AI入库 0是普通入库
}
},
filters: {
@ -131,7 +131,7 @@
uni.navigateTo({
url: "/package1/inventory/batchPrint?purchase=" + JSON.stringify(this.purchase) + '&purchaseDetails=' + JSON.stringify(this.purchaseDetails)
})
}
},
},
}
</script>
@ -278,6 +278,7 @@
line-height: 140rpx;
color: #777;
background: #eee;
margin: 15px 0 0 15px;
}
.uni-tooltip {
display: flex !important;

Loading…
Cancel
Save