[fix]版本更新

main
huyuanxiang 2 years ago
parent e9fc2bafb8
commit 8c8d55a4d7

1
.gitignore vendored

@ -9,6 +9,7 @@
# Local History for Visual Studio Code
.history/
unpackage/
node_modules/
*.app
.snapshots/*

@ -10,6 +10,8 @@ export const addOrder = (params) => request('/erp/order/add', params, 'post')
export const editOrder = (params) => request('/erp/order/edit', params, 'post')
export const getStatusList = (params) => request('/erp/order/queryState', params, 'get')
export const getStoreList = (params) => request('/erp/storeInfo/list', params, 'get')
export const getAddrList = (params) => request('/erp/addrManager/list', params, 'get')
export const addAddr = (params) => request('/erp/addrManager/add', params, 'post')
export const editAddr = (params) => request('/erp/addrManager/edit', params, 'post')

@ -1,6 +1,9 @@
const isPro = true
const BASE_API_URL = isPro ?
'http://store-admin.nhet.cloud:8080/jeecg-boot' :
'http://47.100.35.222:8080/jeecg-boot';
export default {
imgUrl: 'http://store-admin.nhet.cloud:8080/jeecg-boot/sys/common/static/',
apiUrl: isPro ? 'http://store-admin.nhet.cloud:8080/jeecg-boot' : 'http://store-admin.nhet.cloud:8080/jeecg-boot',
imgUrl: BASE_API_URL + '/sys/common/static/',
apiUrl: BASE_API_URL,
isPro
}

@ -3,30 +3,36 @@ export const ORDER_NAVS = [
name: '全部',
icon: 'icon-daifukuan',
url: '',
id: -1
id: -2
},
{
name: '待确认',
icon: 'icon-liebiao',
url: '',
id: 6
},
{
name: '待支付',
icon: 'icon-daifukuan',
url: '',
id: 0
}, {
name: '待货',
name: '待货',
icon: 'icon-daifahuo',
url: '',
id: 1
}, {
name: '待收货',
name: '已提货',
icon: 'icon-daishouhuo1',
url: '',
id: 2
},
{
name: '已收货',
icon: 'icon-daipingjia',
url: '',
id: 3
},
// {
// name: '已收货',
// icon: 'icon-daipingjia',
// url: '',
// id: 3
// },
{
name: '已取消',
icon: 'icon-erji',

@ -3,10 +3,10 @@ import App from './App';
import nodata from "./pages/commponent/public/nodata";
import request from 'utils/request.js' //引入异步请求函数
import {toast} from './utils/util'
// import './utils/noprint.js'
import json from './json' //测试用数据
import signature from '@jensonhui/signature-h5'
import '@jensonhui/signature-h5/lib/signatureH5.css';
Vue.use(signature)
Vue.prototype.request = request.request //挂载到全局
Vue.prototype.$toast = toast //挂载到全局
Vue.component("nodata", nodata);

@ -1,6 +1,19 @@
{
"dependencies": {
"@jensonhui/signature-h5": "^1.0.5"
},
"devDependencies": {
}
"devDependencies": {},
"name": "nherp-shop",
"description": "t",
"version": "1.0.0",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://gitea.nhet.cloud/huyuanxiang/nherp-shop.git"
},
"author": "",
"license": "ISC"
}

@ -71,6 +71,12 @@
"navigationBarTitleText": "设置"
}
},
{
"path": "pages/views/poster/signature",
"style": {
"navigationBarTitleText": "签名"
}
},
{
"path": "pages/views/home/classList",
"style": {
@ -147,7 +153,7 @@
{
"path": "pages/views/user/myaddress",
"style": {
"navigationBarTitleText": "货地址",
"navigationBarTitleText": "货地址",
"navigationBarBackgroundColor": "#F8F8F8",
"app-plus": {
"bounce": "none"

@ -1,6 +1,6 @@
<template>
<view class="my_order">
<list-cell icons="icon-order" linkUrl="/pages/views/order/orderList" :colors="colors">全部订单</list-cell>
<list-cell icons="icon-order" linkUrl="/pages/views/order/orderList?tabIndex=0" :colors="colors">全部订单</list-cell>
<view class="order_btnbox">
<view v-for="(item, index) in orderText" :key="index" class="order_btns" @tap="jumpOrder(item,index)">
<view>
@ -33,15 +33,9 @@ export default {
},
methods: {
jumpOrder(item,index) {
if(item.url !== ''){
uni.navigateTo({
url: item.url
});
}else{
uni.navigateTo({
url: '/pages/views/order/orderList?tabIndex=' + (index + 1)
});
}
uni.navigateTo({
url: '/pages/views/order/orderList?tabIndex=' + (index + 1)
});
}
}
};

@ -17,14 +17,14 @@
<block v-if="address">
<view class="center">
<view class="name">
<text class="text1">{{address.recipient}}</text>
<text class="phones">{{address.telephone}}</text>
<text class="text1">{{address.name}}</text>
<text class="phones">{{address.phone}}</text>
</view>
<view class="address_name">{{address.detail}}</view>
<view class="address_name">{{address.addr}}</view>
</view>
</block>
<view class="noaddress" v-else>
添加收货地址
就近选择提货地址
</view>
</view>
</view>
@ -125,7 +125,7 @@ export default {
return {
couponshow: false,
modes: '物流寄送',
modes: '现场提货',
tapIndex: 0,
goodsList:getGoodsData(),
couponIndex: 0,
@ -241,28 +241,26 @@ export default {
}
const cartList = getCart()
const goodsIds = this.goodsList.map(v => v.id)
const newCartList = cartList.filter(v => !goodsIds.includes(v.id))
const userInfo = getUserInfo()
const params = {
"recipient": this.address.recipient,
"addr": this.address.detail,
"mobile": this.address.telephone,
"orderDetailList": this.goodsList.map(v => {
return {
goodsId: v.id,
goodsName: v.goodsName,
goodsNo: v.number,
price: v.price
}
}),
state: 0,
"remark": this.remark,
"totalAmount": this.sumprice,
"userId": getUserInfo().id
}
storeId: this.address.id,
"recipient": userInfo.realname,
"addr": this.address.addr,
"mobile": userInfo.phone,
"orderDetailList": this.goodsList.map(v => {
return {
goodsId: v.id,
goodsName: v.goodsName,
goodsNo: v.number,
price: v.price
}
}),
state: 6,
"remark": this.remark,
"totalAmount": this.sumprice,
"userId": userInfo.id
}
if (this.isConfirm) return
this.isConfirm = true
uni.showLoading({

@ -11,10 +11,10 @@
<block>
<view class="center">
<view class="name">
<text class="text1">{{ goods.recipient }}</text>
<text class="phones">{{ goods.mobile }}</text>
<text class="text1">{{ goods.storeName }}</text>
<text class="phones">{{ goods.storePhone }}</text>
</view>
<view class="address_name">{{ goods.addr.split(',')[0] }}{{ goods.addr.split(',')[1] }}</view>
<view class="address_name">{{ goods.storeAddr }}</view>
</view>
</block>
</view>
@ -48,7 +48,7 @@
</view> -->
</view>
<!-- 单商品操作按钮 在订单状态为待评价时才会显示-->
<view class="goods_btns" v-if="goods.state === 3">
<view class="goods_btns" v-if="goods.state === 2 || goods.state === 3">
<view class="btns" style="margin-right: 40upx;" @click="onafterSale(item)">
申请售后
</view>
@ -109,8 +109,14 @@
{{ goods.createTime }}
</view>
</view>
<view class="tips margin0" v-if="goods.dispacherRemark || goods.financeRemark">
<view class="tips margin0" v-if="goods.dispacherRemark || goods.financeRemark || goods.materialRemark">
<view class="tips_name">退单原因</view>
<view class="textarea_box" v-if="goods.materialRemark">
<textarea disabled="true" placeholder-class="font-size: 24upx" maxlength="-1"
v-model="goods.materialRemark">
</textarea>
</view>
<view class="textarea_box" v-if="goods.dispacherRemark">
<textarea disabled="true" placeholder-class="font-size: 24upx" maxlength="-1"
v-model="goods.dispacherRemark">
@ -132,8 +138,12 @@
</view>
</view>
<view class="bottom_btn" >
<block v-if="goods.state == 0">
<view class="bottom_btn" v-if="goods.state == 0
|| goods.state == 6
|| goods.state == 1
">
<block v-if="goods.state == 0
|| goods.state == 6">
<view class="moneys">
合计: <text >{{goods.totalAmount}}</text>
</view>
@ -150,17 +160,16 @@
申请退款
</view>
</block> -->
<block v-if="goods.state == 2">
<block v-if="goods.state == 1">
<!-- <view class="btns" :style="'color:' + colors + ';border:1upx solid ' + colors + ';margin-right:20upx'" @tap="onRefund">
申请退款
</view> -->
<view class="btns"
@tap="changeOrderStatus(goods.state, 'ok')"
:style="'background:' + colors + ';'">
@tap="changeOrderStatus(goods.state, 'ok')">
确认收货
</view>
</block>
<block v-if="goods.state == 3">
<block v-if="goods.state == 2 || goods.state == 3">
<!-- <view class="btns shouhou" @click="jumpSale">退/</view> -->
<!-- <view class="btns" :style="'background:' + colors + ';margin-left:20upx;'">再次购买</view> -->
<view class="btns shouhou" @tap="onafterSale">退/</view>
@ -344,6 +353,7 @@ export default {
},
changeOrderStatus(state, type = 'ok') {
console.log(state)
const stateObj = {
0: {
okState: 1,
@ -351,9 +361,15 @@ export default {
cancelText: '是否取消该订单吗?',
cancelState: 5,
},
2: {
6: {
okState: 1,
okText: '',
cancelText: '是否取消该订单吗?',
cancelState: 5,
},
1: {
okText: '是否确认收货?',
okState: 3,
okState: 2,
cancelText: '',
}

@ -12,55 +12,68 @@
</view>
<!-- 占位 -->
<view :style="{height: 35+statusBarHeight+toBarHeight+'px'}"></view>
<view class="list_box">
<view v-for="(item, index) in orderList" :key="index" class="lists">
<view class="type">
<text class="order_id">订单编号:{{item.id}}</text>
<text class="order_type">
{{ item.state | setStatus }}
</text>
</view>
<view v-for="(row, index2) in item.orderDetailList" :key="index2" class="top"
@tap="jumpDetails(item)">
<image :src="row.url" mode="aspectFill"></image>
<view class="top_right">
<view class="order_name">{{row.goodsName}}</view>
<view class="sku">规格{{row.specs || '暂无规格'}}</view>
<view class="price">
<view class="t1">{{row.price}}</view>
<view class="t3">
x{{row.goodsNo}}
<scroll-view scroll-y="true" style="height: calc(100vh - 90px)"
@scrolltolower="handleLoadMore">
<view class="list_box">
<view v-for="(item, index) in orderList" :key="index" class="lists">
<view class="type">
<text class="order_id" @tap="jumpDetails(item)">:{{item.id}}</text>
<view class="flex flex-direction">
<text class="order_type">
{{ item.state | setStatus }}
</text>
<text class="order-time" v-if="item.time != 0">{{ item.time }}</text>
</view>
</view>
<view>
</view>
<view v-for="(row, index2) in item.orderDetailList" :key="index2" class="top"
@tap="jumpDetails(item)">
<image :src="row.url" mode="aspectFill"></image>
<view class="top_right">
<view class="order_name">{{row.goodsName}}</view>
<view class="sku">规格{{row.specs || '暂无规格'}}</view>
<view class="price">
<view class="t1">{{row.price}}</view>
<view class="t3">
x{{row.goodsNo}}
</view>
</view>
</view>
</view>
</view>
<view class="bottom">
<view class="address">总计<text style="color: #FF1929;font-size: 36upx;">{{item.totalAmount}}</text> </view>
<!-- <view class="address">店铺地址北京市海淀区苏家坨乡前沙涧村</view> -->
<view class="btns">
<block v-if="item.state == 0">
<!-- <view class="pay" :style="'color:#fff;background:' + colors+ ';border-color:' + colors" @tap="jumpDetails(item)"></view> -->
<view class="pay shouhou" @tap="cencalOrder(item)"></view>
</block>
<block v-if="item.state == 1">
<!-- <view class="pay shouhou" @tap="onRefund(item)"></view> -->
</block>
<block v-if="item.state == 2">
<view class="pay" @tap="onConfirmOrder(item)" :style="'color:#fff;background:' + colors+ ';border-color:' + colors">确认收货</view>
<!-- <view class="pay shouhou" @tap="onRefund(item)">退</view> -->
</block>
<block v-if="item.state == 3">
<view class="pay shouhou" @tap="jumpDetails(item)"></view>
<view class="pay shouhou" @tap="jumpDetails(item)"></view>
</block>
<!-- <view class="pay shouhou" v-if="item.state == 4" @click="delOrder(item)"></view> -->
<view class="bottom">
<view class="address">总计<text style="color: #FF1929;font-size: 36upx;">{{item.totalAmount}}</text> </view>
<!-- <view class="address">店铺地址北京市海淀区苏家坨乡前沙涧村</view> -->
<view class="btns">
<block v-if="item.state == 0 || item.state == 6">
<!-- <view class="pay" :style="'color:#fff;background:' + colors+ ';border-color:' + colors" @tap="jumpDetails(item)"></view> -->
<view class="pay shouhou" @tap="cencalOrder(item)"></view>
</block>
<block v-if="item.state == 1">
<!-- <view class="pay shouhou" @tap="onRefund(item)"></view> -->
<view class="pay shouhou" @tap="onConfirmOrder(item)" >确认提货</view>
</block>
<block v-if="item.state == 2">
<!-- <view class="pay" @tap="onConfirmOrder(item)" :style="'color:#fff;background:' + colors+ ';border-color:' + colors">确认收货</view> -->
<!-- <view class="pay shouhou" @tap="onRefund(item)">退</view> -->
<view class="pay shouhou" @tap="jumpDetails(item)"></view>
<view class="pay shouhou" @tap="jumpDetails(item)"></view>
</block>
<block v-if="item.state == 3">
<view class="pay shouhou" @tap="jumpDetails(item)"></view>
<view class="pay shouhou" @tap="jumpDetails(item)"></view>
</block>
<!-- <view class="pay shouhou" v-if="item.state == 4" @click="delOrder(item)"></view> -->
</view>
</view>
</view>
<view class="nodata" v-if="isNoMore"> </view>
<nodata :colors="colors" title="暂无订单信息" v-if="orderList.length == 0"></nodata>
</view>
<view class="nodata" v-if="orderList.length >= 3"> </view>
<nodata :colors="colors" title="暂无订单信息" v-if="orderList.length == 0"></nodata>
</view>
</scroll-view>
</view>
<loading v-if="isShow == true"></loading>
</view>
@ -75,6 +88,7 @@
import { ORDER_NAVS } from '@/config/order.js'
import { getUserInfo, setSalesGoods } from '@/utils/auth';
const app = getApp();
let timer = null
export default {
data() {
return {
@ -85,26 +99,24 @@ import { getUserInfo, setSalesGoods } from '@/utils/auth';
orderList: [],
isShow: true,
colors: "",
themeObj: app.globalData.themeObj
themeObj: app.globalData.themeObj,
pageNo: 1,
pageSize: 10,
isNoMore: false
};
},
filters: {
setStatus(value) {
if (value == 0) {
return '待付款'
} else if (value == 1) {
return '待发货'
} else if (value == 2) {
return '待收货'
} else if (value == 3) {
return '已收货'
}
else if (value == 4) {
return '退换'
}
else if (value == 5) {
return '已取消'
const textObj = {
6: '待确认',
0: '待付款',
1: '待提货',
2: '已提货',
3: '已提货',
4: '退换货',
5: '已取消'
}
return textObj[value] || '未知'
}
},
components: {
@ -118,15 +130,11 @@ import { getUserInfo, setSalesGoods } from '@/utils/auth';
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
if (options.tabIndex) {
this.setData({
active: Number(options.tabIndex)
});
this.active = Number(options.tabIndex)
this.getOrderList(ORDER_NAVS[this.active].id)
}
this.setData({
colors: app.globalData.newColor
});
setTimeout(() => {
this.setData({
isShow: false
@ -144,7 +152,8 @@ import { getUserInfo, setSalesGoods } from '@/utils/auth';
* 生命周期函数--监听页面显示
*/
onShow: function() {
this.getOrderList(ORDER_NAVS[this.active].id)
// this.getOrderList(ORDER_NAVS[this.active].id)
},
/**
@ -172,18 +181,26 @@ import { getUserInfo, setSalesGoods } from '@/utils/auth';
*/
onShareAppMessage: function() {},
methods: {
handleLoadMore() {
if (this.isNoMore) return
this.pageNo++
this.getOrderList(ORDER_NAVS[this.active].id)
},
onConfirmOrder(item) {
uni.showModal({
title:'是否确认收货?',
confirmColor:this.colors,
title:'是否确认货?',
confirmColor: this.themeObj.color,
success: (res) => {
if(res.confirm){
item.state = 3
item.state = 2
editOrder(item).then(res => {
uni.showToast({
icon: 'none',
title: '操作成功'
})
this.orderList = []
this.isNoMore = false
this.pageNo = 1
this.getOrderList(ORDER_NAVS[this.active].id)
})
@ -191,45 +208,97 @@ import { getUserInfo, setSalesGoods } from '@/utils/auth';
}
})
},
// 0 1 2 3 4 退 . -1
getOrderList(val = -1) {
// 0 -1 1 2 3 4 退 . -1
getOrderList(val = -2) {
let s = [
{
"rule": "eq",
"type": "int",
"type": "string",
"dictCode": "",
"val": getUserInfo().id,
"field": "userId"
}
]
s = val !== -1 ? [...s, {
"rule": "eq",
"type": "string",
"dictCode": "",
"val": val,
"field": "state"
}] : s
const stateQuery = {
"rule": "eq",
"type": "int",
"dictCode": "orderState",
"val": val,
"field": "state"
}
if (val !== -2) {
stateQuery.val = val === 2 ? '2,3,4' : val
stateQuery.rule = val === 2 ? 'in' : 'eq'
s = [...s, stateQuery]
}
const params = {
pageNo:1,
pageSize: 100,
pageNo: this.pageNo,
pageSize: this.pageSize,
superQueryParams: s,
superQueryMatchType: 'and',
"column": "createTime",
order: "desc",
}
uni.showLoading()
params.superQueryParams = encodeURI(JSON.stringify(s))
clearInterval(timer)
getOrderList(params).then(res => {
const result = res.result.records
this.orderList = result
const result = [...this.orderList, ...res.result.records]
this.isNoMore = res.result.records.length < this.pageSize
if (val == 0 || val == -2) {
this.time(result)
} else {
this.orderList = Object.freeze(result)
uni.hideLoading()
}
}).catch(() => {
uni.hideLoading()
})
},
time (arr) {
var self = this;
timer = setInterval(() => {
const list = arr.map((v, i) => {
if (v.state !== 0) {
v.time = 0
return v
}
var nowDate = new Date();
const endTime = new Date(v.createTime).getTime() + 48 * 60 * 60 * 1000
var seconds = parseInt((endTime - nowDate) / 1000);
if (seconds <= 0) {
this.handlerCancelOrder(v, 'time')
return v;
}
var hours = Math.floor(seconds / (60 * 60));
if (hours < 10) hours = "0" + hours;
seconds = seconds % (60 * 60);
var mins = Math.floor(seconds / 60);
if (mins < 10) mins = "0" + mins;
seconds = seconds % 60;
if (seconds < 10) seconds = "0" + seconds;
v.time = hours + ":" + mins + ":" + seconds
return v
})
this.orderList = Object.freeze(list)
}, 1000);
uni.hideLoading()
},
setTabs(item, index) {
this.setData({
active: index
});
this.orderList = []
this.isNoMore = false
this.pageNo = 1
this.getOrderList(item.id)
},
@ -239,6 +308,21 @@ import { getUserInfo, setSalesGoods } from '@/utils/auth';
url: '/pages/views/order/orderDetails?status='+ 3
});
},
handlerCancelOrder(item, type = 'init') {
item.state = 5
editOrder(item).then(res => {
if (type === 'init') {
uni.showToast({
icon: 'none',
title: '操作成功'
})
}
this.orderList = []
this.isNoMore = false
this.pageNo = 1
this.getOrderList(ORDER_NAVS[this.active].id)
})
},
cencalOrder(item) {
//
uni.showModal({
@ -246,15 +330,7 @@ import { getUserInfo, setSalesGoods } from '@/utils/auth';
confirmColor:this.colors,
success: (res) => {
if(res.confirm){
item.state = 5
editOrder(item).then(res => {
uni.showToast({
icon: 'none',
title: '操作成功'
})
this.getOrderList(ORDER_NAVS[this.active].id)
})
console.log('取消成功')
this.handlerCancelOrder(item)
}
}
})
@ -323,7 +399,7 @@ import { getUserInfo, setSalesGoods } from '@/utils/auth';
.type {
height: 50upx;
font-size: 26upx;
line-height: 50upx;
// line-height: 50upx;
font-weight: bold;
text-align: right;
display: flex;
@ -335,6 +411,10 @@ import { getUserInfo, setSalesGoods } from '@/utils/auth';
color: #999;
font-size: 24upx;
}
.type .order-time {
color: brown;
font-size: 24upx;
}
.lists .top {
display: flex;

@ -0,0 +1,62 @@
<template>
<signatureH5
:options="options" >
<template v-slot:default="{ signatrue }">
<div class="btn-box flex-row">
<span class="del-btn" @click="clearHandle(signatrue)"></span>
<span class="sure-btn" @click="confirmHandle(signatrue)"></span>
</div>
</template>
</signatureH5>
</template>
<script>
import { rotateBase64Img } from '@/utils/util.js'
export default {
data() {
return {
options: {
// minWidth: 5,
// maxWidth: 10,
penColor: "rgb(66, 133, 244)"
}
}
},
onShow() {
},
methods: {
confirm(data) {
console.log(data)
},
clearHandle(canvasNode) {
if (canvasNode) {
canvasNode.clear()
}
},
confirmHandle(canvasNode) {
if (!canvasNode) {
return
}
//
if (canvasNode.isEmpty()) {
console.warn('您还没有签名');
this.$toast('您还没有签名')
return false
}
//
const _boxWidth = window.innerWidth
const _boxHeight = window.innerHeight
const _signImg = canvasNode.toDataURL('image/png', 0.6) || null
if (_boxWidth < _boxHeight) {
rotateBase64Img(_signImg, -90, (imgUrlRes) => {
console.log(imgUrlRes)
})
}
}
}
}
</script>
<style>
</style>

@ -87,13 +87,15 @@ export default {
url: '/pages/views/user/mycollection',
id: 1,
elseUrl: ''
}, {
name: '地址管理',
icon: 'icon-dizhi',
url: '/pages/views/user/myaddress',
id: 2,
elseUrl: ''
},{
},
// {
// name: '',
// icon: 'icon-dizhi',
// url: '/pages/views/user/myaddress',
// id: 2,
// elseUrl: ''
// },
{
name: '分销中心',
icon: 'icon-fenxiao',
url: '/pages/views/user/mydistribution',
@ -206,15 +208,16 @@ export default {
getStatusList({userId: getUserInfo().id}).then(res => {
const result = res.result
const obj = {
'state6': result.unconfirmed,
state0: result.unpaid,
state1: result.notSend,
state2: result.send,
// state2: result.send,
// state3: result.complete,
// state4: result.other,
// state5: result.cancel,
}
const navs = ORDER_NAVS.slice(1).map((v, index) => {
v._num = obj['state' + v.id] || 0
v._num = obj['state' + (v.id + '')] || 0
return v
})
this.orderText = navs

@ -9,33 +9,33 @@
<view @click="onsetAddress(item)">
<view class="center">
<!-- v-if="item.isDefault == 1" -->
<view class="moren">
<!-- <view class="moren">
<text class="iconfont icon-moren"></text>
</view>
</view> -->
<view class="name">
<text class="text1">{{item.recipient}}</text>
<text class="phones">{{item.telephone}}</text>
<text class="text1">{{item.contacts}}</text>
<text class="phones">{{item.phone}}</text>
</view>
<view class="address_name">{{item.detail.split(',').join('')}}</view>
<view class="address_name">{{item.addr}}</view>
</view>
</view>
<view class="caozuo">
<view class="del" @tap="delAddress(item,index)">
<!-- <view class="del" @tap="delAddress(item,index)">
<text class="iconfont icon-shanchu"></text>
删除
</view>
<view class="edit" @tap="editAddress(item)">
<text class="iconfont icon-bianji"></text>
编辑
</view>
</view> -->
</view>
</view>
</view>
<nodata :colors="colors" title="暂无货地址" v-if="addressList.length == 0"></nodata>
<nodata :colors="colors" title="暂无货地址" v-if="addressList.length == 0"></nodata>
</view>
<view class="save">
<view class="btn" @tap="addAddress"></view>
<!-- <view class="btn" @tap="addAddress"></view> -->
</view>
<loading v-if="isShow == true"></loading>
</view>
@ -43,7 +43,7 @@
<script>
import { getAddrList, delAddr } from '@/api/index.js'
import { getAddrList, delAddr, getStoreList } from '@/api/index.js'
import loading from "../../commponent/public/loading";
import {
getUserInfo,
@ -122,22 +122,24 @@
methods: {
getAddrList() {
const s = [
{
"rule": "eq",
"type": "string",
"dictCode": "",
"val": getUserInfo().id,
"field": "userId"
}
// {
// "rule": "eq",
// "type": "string",
// "dictCode": "",
// "val": getUserInfo().id,
// "field": "userId"
// }
]
const params = {
pageNo:1,
pageSize: 10,
pageSize: 100,
superQueryParams: encodeURI(JSON.stringify(s)),
superQueryMatchType: 'and'
}
getAddrList(params).then(res => {
uni.showLoading()
getStoreList(params).then(res => {
this.addressList = res.result.records
uni.hideLoading()
})
},

@ -33,6 +33,8 @@ async function request(method, params, type = 'GET') {
};
return new Promise((resolve, reject) => {
uni.request(http).then(res => {
uni.hideLoading()
console.log(res)
let newData = res[1].data; // if (newdata.code == 403) {
if (newData == -1) {
//如果错误码为 -1 提示
@ -41,8 +43,30 @@ async function request(method, params, type = 'GET') {
icon: 'none'
});
}
resolve(res[1].data);
if (newData.code !== 200) {
if (newData.code === 401) {
uni.showToast({
title: newData.message,
icon: 'none'
});
uni.removeStorageSync('userinfo')
uni.removeStorageSync('token')
setTimeout(() => {
uni.redirectTo({
url: '/pages/login/index1'
})
}, 500)
} else {
uni.showToast({
title: newData.message,
icon: 'none'
});
}
reject(newData);
}
resolve(newData);
}).catch(err => {
uni.hideLoading()
if (err.statusCode === 401) {
uni.redirectTo({
url: '/pages/login/index1?status=' + 1

@ -63,4 +63,104 @@ export const debounce = (() => {
timer&&clearTimeout(timer)
timer = setTimeout(callback, wait)
}
})();
})();
// 图片旋转处理 => output(base64)
export const rotateBase64Img = (src, edg, callback) => {
try {
const canvas = document.createElement('canvas')
const ctx = canvas.getContext('2d')
let imgW = 0 // 图片宽度
let imgH = 0 // 图片高度
let size = 0 // canvas初始大小
if (edg % 90 !== 0) {
throw new Error('旋转角度必须是90的倍数!')
}
(edg < 0) && (edg = (edg % 360) + 360)
const quadrant = (edg / 90) % 4 // 旋转象限
const cutCoor = { sx: 0, sy: 0, ex: 0, ey: 0 } // 裁剪坐标
const image = new Image()
image.src = src
image.crossOrigin = 'anonymous'
image.onload = function () {
imgW = image.width
imgH = image.height
size = imgW > imgH ? imgW : imgH
canvas.width = size * 2
canvas.height = size * 2
switch (quadrant) {
case 0:
cutCoor.sx = size
cutCoor.sy = size
cutCoor.ex = size + imgW
cutCoor.ey = size + imgH
break
case 1:
cutCoor.sx = size - imgH
cutCoor.sy = size
cutCoor.ex = size
cutCoor.ey = size + imgW
break
case 2:
cutCoor.sx = size - imgW
cutCoor.sy = size - imgH
cutCoor.ex = size
cutCoor.ey = size
break
case 3:
cutCoor.sx = size
cutCoor.sy = size - imgW
cutCoor.ex = size + imgH
cutCoor.ey = size + imgW
break
}
ctx.translate(size, size)
ctx.rotate(edg * Math.PI / 180)
ctx.drawImage(image, 0, 0)
const imgData = ctx.getImageData(cutCoor.sx, cutCoor.sy, cutCoor.ex, cutCoor.ey)
if (quadrant % 2 === 0) {
canvas.width = imgW
canvas.height = imgH
} else {
canvas.width = imgH
canvas.height = imgW
}
ctx.putImageData(imgData, 0, 0)
if (typeof callback === 'function') {
const blob = base64ImgtoFile(canvas.toDataURL('image/png', 0.7))
const blobUrl = window.URL.createObjectURL(blob);
callback(blobUrl)
}
}
} catch (e) {
console.log(e)
}
}
function base64ImgtoFile (dataurl, filename = 'file') {
//将base64格式分割['data:image/png;base64','XXXX']
const arr = dataurl.split(',')
// .* 表示匹配任意字符到下一个符合条件的字符 刚好匹配到:
// image/png
const mime = arr[0].match(/:(.*?);/)[1] //image/png
//[image,png] 获取图片类型后缀
const suffix = mime.split('/')[1] //png
const bstr = atob(arr[1]) //atob() 方法用于解码使用 base-64 编码的字符串
let n = bstr.length
const u8arr = new Uint8Array(n)
while (n--) {
u8arr[n] = bstr.charCodeAt(n)
}
return new File([u8arr], `${filename}.${suffix}`, {
type: mime
})
}
Loading…
Cancel
Save