邓雄飞 4 years ago
parent
commit
c0792529c3
5 changed files with 63 additions and 14 deletions
  1. 9
      apis/commonApi.js
  2. 6
      pages.json
  3. 7
      pages/order-make/index.vue
  4. 49
      pages/paper-details/index.vue
  5. 6
      pages/store/index.vue

9
apis/commonApi.js

@ -37,6 +37,15 @@ function syncStore(res) {
mobile: res.mobile, mobile: res.mobile,
avatar: null avatar: null
}) })
} else {
if (res) {
store.commit('setUserInfo', {
name: '',
userId: res.userId,
mobile: res.mobile,
avatar: null
})
}
} }
} }

6
pages.json

@ -5,7 +5,8 @@
"style": { "style": {
"navigationBarTitleText": "店铺首页", "navigationBarTitleText": "店铺首页",
"navigationStyle": "custom" "navigationStyle": "custom"
}
},
"h5": { "titleNView": false }
}, },
{ {
"path": "pages/cart/index", "path": "pages/cart/index",
@ -160,8 +161,7 @@
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app", "navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8", "navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8",
"app-plus": { "titleNView": false }
"backgroundColor": "#F8F8F8"
}, },
"tabBar": { "tabBar": {
"color": "#888", "color": "#888",

7
pages/order-make/index.vue

@ -198,6 +198,13 @@ export default {
if (this.loading) { if (this.loading) {
return return
} }
if (!this.deliveryAddress.addressId) {
uni.showToast({
title: '请选择收货地址',
icon: 'none'
})
return
}
this.loading = true this.loading = true
let itemsRemarkList = [] let itemsRemarkList = []
// //

49
pages/paper-details/index.vue

@ -58,15 +58,15 @@
<qn-footer fixed height="100rpx"> <qn-footer fixed height="100rpx">
<view class="footer-row"> <view class="footer-row">
<view class="left"> <view class="left">
<view class="">
<view @click="storeTap">
<image class="icon" src="/static/imgs/paperDetails/shop-icon.png"></image> <image class="icon" src="/static/imgs/paperDetails/shop-icon.png"></image>
<view class="label" @tap="storeTap">店铺</view>
<view class="label">店铺</view>
</view> </view>
<view class="">
<view @click="shoppingCartTap">
<image class="icon" src="/static/imgs/paperDetails/shopping-trolley.png"></image> <image class="icon" src="/static/imgs/paperDetails/shopping-trolley.png"></image>
<view class="label" @tap="shoppingCartTap">购物车</view>
<view class="label">购物车</view>
</view> </view>
<view class="" @tap="addShoppingTap(1)">
<view @click="addShoppingTap(1)">
<image class="icon" src="/static/imgs/paperDetails/add-shopping-trolley.png"></image> <image class="icon" src="/static/imgs/paperDetails/add-shopping-trolley.png"></image>
<view class="label">加购物车</view> <view class="label">加购物车</view>
</view> </view>
@ -227,14 +227,35 @@ export default {
} }
}, },
onLoad(option) { onLoad(option) {
this.params.productId = option.paperId
this.queryData()
if (option.paperId) {
this.params.productId = option.paperId
if (this.hasLogin) {
this.queryData()
} else {
this.$store.commit('setNextPage', { name: 'paper-detail', data: { paperId: option.paperId } })
go2('login')
}
} else {
uni.showToast({
title: '参数错误',
icon: 'fail',
success: () => {
back()
}
})
}
}, },
computed: { computed: {
buyTon() { buyTon() {
let num = 0 let num = 0
num = round(this.buyPaperDto.gramWeight * this.buyPaperDto.width * this.buyPaperDto.length * this.buyPaperDto.pieceQuantity * 1e-12, 4) num = round(this.buyPaperDto.gramWeight * this.buyPaperDto.width * this.buyPaperDto.length * this.buyPaperDto.pieceQuantity * 1e-12, 4)
return num return num
},
hasCompany() {
return this.$store.state.companyInfo.id != null
},
hasLogin() {
return this.$store.state.qnToken != ''
} }
}, },
watch: { watch: {
@ -266,6 +287,13 @@ export default {
}, },
// //
addShoppingTap(type) { addShoppingTap(type) {
if (!this.hasCompany) {
uni.showToast({
title: '请先完善公司信息',
icon: 'none'
})
return
}
this.shoppingCarType = type this.shoppingCarType = type
this.buyPaperDto = { this.buyPaperDto = {
buyTon: 0, buyTon: 0,
@ -283,6 +311,13 @@ export default {
// //
inquiryTap() { inquiryTap() {
if (!this.hasCompany) {
uni.showToast({
title: '请先完善公司信息',
icon: 'none'
})
return
}
go2('for-comparison', { id: this.info.supplierId, productImg: this.info.imgList[0] }) go2('for-comparison', { id: this.info.supplierId, productImg: this.info.imgList[0] })
}, },
closeTap() { closeTap() {

6
pages/store/index.vue

@ -30,8 +30,8 @@
/> />
</view> </view>
<scroll-list ref="list" :option="option" @load="upCallback" @refresh="downCallback" style="background-color: #ffffff"> <scroll-list ref="list" :option="option" @load="upCallback" @refresh="downCallback" style="background-color: #ffffff">
<view class="content">
<view class="box" v-for="(item, index) in list" :key="index" @tap="seeDetailsTap(item)">
<view class="content flex-row-start-start">
<view class="box" v-for="(item, index) in list" :key="index" @tap="seeDetailsTap(item)" :style="{ marginRight: index % 2 != 0 ? '0' : '20rpx' }">
<view class="image-box"> <view class="image-box">
<view class=""><image class="special-img" :src="item.isPromoting ? '/static/imgs/store/special-offe.png' : ''" mode=""></image></view> <view class=""><image class="special-img" :src="item.isPromoting ? '/static/imgs/store/special-offe.png' : ''" mode=""></image></view>
<image <image
@ -278,8 +278,6 @@ export default {
} }
.content { .content {
display: flex; display: flex;
flex-direction: row;
justify-content: space-between;
flex-wrap: wrap; flex-wrap: wrap;
padding: 0rpx 32rpx 20rpx 32rpx; padding: 0rpx 32rpx 20rpx 32rpx;
.box { .box {

Loading…
Cancel
Save