diff --git a/components/addressAdd.vue b/components/addressAdd.vue
index ec68b5b..d3183a5 100644
--- a/components/addressAdd.vue
+++ b/components/addressAdd.vue
@@ -113,7 +113,7 @@
let that = this
that.Post({}, '/api/areas/getAll').then(res => {
- if (res.code === 1) {
+ if (res.code === 200) {
var data = res.data;
var result = {};
for (var i = 0; i < data.length; i++) {
diff --git a/components/cartData.vue b/components/cartData.vue
index 062505f..7018eb6 100644
--- a/components/cartData.vue
+++ b/components/cartData.vue
@@ -27,7 +27,7 @@
-
+
{{ item.good_name }}
@@ -50,6 +50,7 @@
+
@@ -138,8 +139,13 @@
this.setAllSelect()
} else {
this.Post({noForceLogin: true},'/api/shopping/getShoppingList').then(res => {
- if (res) {
- this.cartData = (res.data || []).map(v=>{return {...v, isSelected:selectedData.includes(v.specifications_id)}})
+ if (res && res.data) {
+ let tempData = new Array();
+ (res.data.merchant||[]).forEach(v=>{
+ tempData = tempData.concat(v.data || [])
+ })
+
+ this.cartData = tempData.map(v=>{return {...v, isSelected:selectedData.includes(v.specifications_id)}})
this.setAllSelect()
}
})
@@ -226,11 +232,20 @@
icon:'none',
})
return
- }
+ }
+ let merchant_ids = this.cartData.filter(v=>v.isSelected).map(v=>v.merchant_id)
+ if (merchant_ids.some(v=>v!=merchant_ids[0])) {
+ uni.showToast({
+ title:'购物车只可下单同一供应商的产品',
+ icon:'none',
+ })
+ return
+ }
+
let orderData = this.cartData.filter(v=>v.isSelected).map(v=>{
return {
goodsInfo: {
- image: v.Specifications_image,
+ image: v.specifications_image,
title:v.good_name,
merchant_name: v.merchant_name,
},
@@ -275,7 +290,6 @@
flex-direction: column;
background-color: white;
height: 933rpx;
- padding-bottom: 184rpx;
border-radius: 20rpx 20rpx 0rpx 0rpx;
display: flex;
flex-direction: column;
diff --git a/pages/login/login.vue b/pages/login/login.vue
index 1de3eb8..4201eb9 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -98,6 +98,14 @@ export default {
uni.getUserInfo({
withCredentials: true,
success: (res) => {
+ this.Post({
+ mobile: '18639595995',
+ captcha: '123456'
+ }, '/api/user/mobilelogin').then(res=>{
+ this.$store.commit('changeUserInfo', res.data.userinfo);
+ this.navigateBasedOnPath();
+ })
+ return
this.Post({
code: loginRes.code,
userInfo: res.userInfo,
diff --git a/static/js/request.js b/static/js/request.js
index 18894b6..d03b51f 100644
--- a/static/js/request.js
+++ b/static/js/request.js
@@ -20,6 +20,13 @@ const getToken = () => {
// 定义错误处理函数 noForceLogin 不强制登录
const handleError = (res, reject, noForceLogin) => {
+ if (res.data?.code === 401) {
+ if (noForceLogin) {
+ reject(res)
+ return
+ }
+ store.commit('changeLoginPath');
+ }
setTimeout(() => {
uni.showToast({
title: res.data?.msg || res.msg,
@@ -27,10 +34,6 @@ const handleError = (res, reject, noForceLogin) => {
});
reject(res);
}, 0);
- if (res.data?.code === 401) {
- if (noForceLogin) { return }
- store.commit('changeLoginPath');
- }
};
// 挂载到 Vue 原型上
diff --git a/subPackages/techan/detail.vue b/subPackages/techan/detail.vue
index 1c91b9e..1181e5c 100644
--- a/subPackages/techan/detail.vue
+++ b/subPackages/techan/detail.vue
@@ -48,9 +48,9 @@
-
+
购买须知
-
+
商品须知
@@ -81,8 +81,9 @@
+ :custom-style="{background:'#D90F01',color:'#ffffff',border:'1px solid #ffffff'}">
+
购物车
@@ -747,7 +748,7 @@
background: #FFFFFF;
border-radius: 20rpx;
.sku-item{
- border-radius: 20rpx;
+ // border-radius: 20rpx;
width: 100%;
padding: 14rpx;
display: flex;
diff --git a/subPackages/techan/index.vue b/subPackages/techan/index.vue
index 7d9da9e..6497f66 100644
--- a/subPackages/techan/index.vue
+++ b/subPackages/techan/index.vue
@@ -4,7 +4,7 @@
-
+
@@ -45,17 +45,17 @@
-
+
-
+
暂无搜索结果
+ text-align: center;margin-top: 67rpx;padding-bottom: 300rpx;">暂无搜索结果
-
+
-
+
{{item.goods.title}}
@@ -72,7 +72,7 @@
-
+
{{item.goods.title}}
@@ -376,16 +376,38 @@
//搜索
- search () {
- this.searchFinish = false
- this.searchList = []
- // todo 请求
- this.searchList = [...this.list,...this.list,...this.list,...this.list]
+ search (isMore) {
+ if (this.searchText.trim().length<=0) {
+ uni.showToast({
+ title:'请输入搜索关键字',
+ icon:'none'
+ })
+ return
+ }
+ if (!isMore) {
+ this.searchList = []
+ this.searchFinish = false
+ }
+ this.Post({
+ name: this.searchText.trim(),
+ offset: this.searchList.length,
+ // type: 'pgoods',
+ limit: 10,
+ }, '/api/search/search').then(res => {
+ let resData = (res.data || []).map(v=> {return {id: v.id, goods: v.search_data}})
+ console.log(resData)
+ this.searchList = [...this.searchList, ...resData];
+ this.searchFinish = false
+ console.log(resData, this.searchList)
+ if (res.data.length<10) {
+ this.searchFinish = true
+ }
+ })
},
},
onReachBottom() {
if (!this.searchFinish) {
- this.search()
+ this.search(true)
}
console.log(1)
}
diff --git a/subPackages/techan/order.vue b/subPackages/techan/order.vue
index 1bde981..a560f95 100644
--- a/subPackages/techan/order.vue
+++ b/subPackages/techan/order.vue
@@ -30,7 +30,7 @@
{{ contacts.province_text + contacts.city_text + contacts.district_text + contacts.detail_addr }}
-
+
添加
@@ -182,7 +182,7 @@
{{ item.province_text + item.city_text + item.district_text + item.detail_addr }}
-
+
@@ -266,7 +266,7 @@ export default {
console.log(this.isPost)
},
onShow() {
- this.coupon = this.$store.state.user.coupon
+ // this.coupon = this.$store.state.user.coupon
this.getAllAddressList();
// 更新自提点
@@ -402,7 +402,7 @@ export default {
this.Post({}, '/api/user/consigneeList').then(res => {
let oldId = (this.contacts || {}).id
console.log(this.contacts)
- if (res.code === 1) this.addressList = res.data || [];
+ if (res.code == 200) this.addressList = res.data || [];
if (this.addressList.some(v=>v.id==oldId)) {
this.contacts = this.addressList.find(v=>v.id==oldId)
this.getPost();
@@ -446,7 +446,7 @@ export default {
// 保存地址
async saveAddress () {
let res = await this.$refs.addressAddVueRef.postSave()
- if (res && res.code == 1) {
+ if (res && (res.code == 1 || res.code==200)) {
this.contacts = res.data
this.getAllAddressList();
this.changeAddressAddPopup('close')
@@ -560,7 +560,7 @@ export default {
).then(res => {
uni.removeStorageSync('teChanOrder')
uni.removeStorageSync('teChanInfo')
- if (res.code == 1) {
+ if (res.code == 1 || res.code==200) {
this.Post(
{
order_id: res.data.order_id,