Browse Source

4.5次的联调

hfll
hflllll 4 weeks ago
parent
commit
52972fbe93
11 changed files with 68 additions and 115 deletions
  1. +0
    -1
      App.vue
  2. +9
    -9
      components/order/OrderItem.vue
  3. +0
    -11
      components/product/productItem.vue
  4. +0
    -2
      mixins/list.js
  5. +12
    -49
      pages/index/cart.vue
  6. +15
    -14
      pages/index/category.vue
  7. +1
    -1
      pages_order/components/order/placeOrder.vue
  8. +2
    -2
      pages_order/mine/share.vue
  9. +3
    -3
      pages_order/order/newOrderDetail.vue
  10. +15
    -21
      pages_order/product/productDetail.vue
  11. +11
    -2
      store/store.js

+ 0
- 1
App.vue View File

@ -2,7 +2,6 @@
export default { export default {
onLaunch: function() { onLaunch: function() {
this.$store.commit('initConfig') this.$store.commit('initConfig')
this.$store.commit('getCategoryList')
// token访 // token访
// if(uni.getStorageSync('token')){ // if(uni.getStorageSync('token')){


+ 9
- 9
components/order/OrderItem.vue View File

@ -33,23 +33,23 @@
<view class="order-actions"> <view class="order-actions">
<view <view
class="order-toast" class="order-toast"
v-if="order.status === 'shipping' || order.status === 'delivered'"
:style="{ backgroundColor: order.status === 'shipping' ? '#ECFEF4' : '#FFDBDB', color: order.status === 'shipping' ? '#019245' : '#FF2A2A' }">
<uv-icon name="info-circle" size="34" :color="order.status === 'shipping' ? '#019245' : '#FF2A2A'"></uv-icon>
<text v-show="order.status === 'shipping'">全力奔跑中请耐心等待哦</text>
<text v-show="order.status === 'delivered'">您的餐点已送到取餐点请尽快取餐</text>
v-if="order.status === '2' || order.status === '3'"
:style="{ backgroundColor: order.status === '2' ? '#ECFEF4' : '#FFDBDB', color: order.status === '2' ? '#019245' : '#FF2A2A' }">
<uv-icon name="info-circle" size="34" :color="order.status === '2' ? '#019245' : '#FF2A2A'"></uv-icon>
<text v-show="order.status === '2'">全力奔跑中请耐心等待哦</text>
<text v-show="order.status === '3'">您的餐点已送到取餐点请尽快取餐</text>
</view> </view>
<view class="action-btn cancel" v-show="order.status === 'pending'" @click.stop="cancelOrder">
<view class="action-btn cancel" v-show="order.status === '0'" @click.stop="cancelOrder">
取消订单 取消订单
</view> </view>
<view class="action-btn confirm" v-show="order.status === 'pending'" @click.stop="payOrder">
<view class="action-btn confirm" v-show="order.status === '0'" @click.stop="payOrder">
立即下单 立即下单
</view> </view>
<view class="action-btn confirm" v-show="order.status === 'processing' || order.status === 'shipping'"
<view class="action-btn confirm" v-show="order.status === '1' || order.status === '2'"
@click.stop="clickOrder"> @click.stop="clickOrder">
查看订单 查看订单
</view> </view>
<view class="action-btn confirm" v-show="order.status === 'completed'" @click.stop="gotoSale">
<view class="action-btn confirm" v-show="order.status === '4'" @click.stop="gotoSale">
订单售后 订单售后
</view> </view>
<view class="action-btn confirm" v-show="order.status_dictText === '待取餐'" @click.stop="pickOrder"> <view class="action-btn confirm" v-show="order.status_dictText === '待取餐'" @click.stop="pickOrder">


+ 0
- 11
components/product/productItem.vue View File

@ -143,17 +143,6 @@
methods: { methods: {
// () // ()
purchase() { purchase() {
// this.$api('createOrder', {
// id
// }, res => {
// if (res.code == 200) {
// res.result.num = 1
// this.$store.commit('setPayOrderProduct', [
// res.result
// ])
// this.$utils.navigateTo('/pages_order/order/createOrder')
// }
// })
this.$emit('purchase') this.$emit('purchase')
}, },
// //


+ 0
- 2
mixins/list.js View File

@ -64,8 +64,6 @@ export default {
success(res.result) success(res.result)
// 更新列表数据 // 更新列表数据
this[this.mixinsListKey || 'list'] = res.result.records || res.result this[this.mixinsListKey || 'list'] = res.result.records || res.result
// 输出获得的分类列表
console.log('这是你获得的分类商品',this.list);
// 更新总数 // 更新总数
this.total = res.result.total || res.result.length this.total = res.result.total || res.result.length


+ 12
- 49
pages/index/cart.vue View File

@ -4,7 +4,7 @@
<text class="control-text" @tap="isManaged = !isManaged">{{ isManaged ? '退出管理' : '管理' }}</text> <text class="control-text" @tap="isManaged = !isManaged">{{ isManaged ? '退出管理' : '管理' }}</text>
<view class="cart-items"> <view class="cart-items">
<uv-checkbox-group shape="circle" v-model="checkboxValue" @change="toggleSelect">
<uv-checkbox-group shape="circle" v-model="checkboxValue">
<view v-for="(item, index) in cartData.records" :key="item.id" class="cart-item"> <view v-for="(item, index) in cartData.records" :key="item.id" class="cart-item">
<view class="checkbox"> <view class="checkbox">
<uv-checkbox :key="index" :name="item.id" size="40rpx" iconSize="35rpx" activeColor="#019245" /> <uv-checkbox :key="index" :name="item.id" size="40rpx" iconSize="35rpx" activeColor="#019245" />
@ -70,8 +70,8 @@
<script> <script>
import tabber from '@/components/base/tabbar.vue' import tabber from '@/components/base/tabbar.vue'
import { mockCartData } from '@/static/js/mockCartData.js'
import navbar from '@/components/base/navbar.vue' import navbar from '@/components/base/navbar.vue'
import { mapActions } from 'vuex'
export default { export default {
components: { components: {
@ -85,7 +85,6 @@ export default {
}, },
checkboxValue: [], checkboxValue: [],
isManaged: false, isManaged: false,
} }
}, },
computed: { computed: {
@ -106,6 +105,7 @@ export default {
} }
}, },
methods: { methods: {
...mapActions(['setCartData']),
// //
getCartData(){ getCartData(){
this.$api('queryShopcarList', {}, res => { this.$api('queryShopcarList', {}, res => {
@ -114,6 +114,7 @@ export default {
} }
}) })
}, },
//
modifyCart(item){ modifyCart(item){
this.$api('addShopcar', { this.$api('addShopcar', {
goodsId: item.goodsId, goodsId: item.goodsId,
@ -123,12 +124,7 @@ export default {
console.log(res); console.log(res);
}) })
}, },
// toggleSelect(item) {
// this.updateCart();
// },
toggleSelectAll() { toggleSelectAll() {
console.log(111);
if (this.allSelected){ if (this.allSelected){
this.checkboxValue = [] this.checkboxValue = []
}else{ }else{
@ -146,32 +142,23 @@ export default {
item.num -= 1; item.num -= 1;
this.modifyCart(item) this.modifyCart(item)
} }
},
updateCart() {
// //
// this.cartData.selectedCount = this.checkboxValue.length;
// //
// this.cartData.totalPrice = this.cartData.items.reduce((total, item) => {
// if (this.checkboxValue.includes(item.id)){
// total += item.price * item.quantity
// }
// return total
// }, 0)
}, },
// //
checkout() { checkout() {
// const selectedItems = this.cartData.items.filter(item => item.selected);
if (this.checkboxValue.length === 0) { if (this.checkboxValue.length === 0) {
uni.showToast({ uni.showToast({
title: '请选择商品', title: '请选择商品',
icon: 'none'
icon: 'error'
}); });
return; return;
} }
const sendData = this.cartData.records.filter(item => this.checkboxValue.includes(item.id))
this.$store.commit('setCartData', sendData )
// //
uni.navigateTo({
url: '/pages_order/order/newOrderDetail?status=pending'
this.$utils.navigateTo({
url: '/pages_order/order/newOrderDetail?status=cart'
}); });
}, },
// //
@ -193,31 +180,7 @@ export default {
}) })
// //
}, 800) }, 800)
},
//
// deleteCart(){
// if (!this.checkboxValue.length) {
// uni.showToast({
// title: '',
// icon: 'none'
// });
// return;
// }
// uni.showLoading({
// title: '...'
// })
// setTimeout(() => {
// uni.hideLoading()
// uni.showToast({
// title: '',
// })
// this.cartData.items = this.cartData.items.filter(item => !this.checkboxValue.includes(item.id))
// this.checkboxValue = []
// this.updateCart()
// //
// }, 800)
// }
}
}, },
onShow(){ onShow(){
this.getCartData() this.getCartData()


+ 15
- 14
pages/index/category.vue View File

@ -110,6 +110,17 @@ export default {
computed: { computed: {
...mapState(['category']), ...mapState(['category']),
}, },
onLoad() {
if(this.category[this.currentChildren]){
this.queryParams.categoryId = this.category[this.currentChildren].id
}else{
this.$store.commit('getCategoryList', data => {
this.queryParams.categoryId = data[this.currentChildren].id
this.mixinsListApi = 'queryGoodsList'
this.getData()
})
}
},
methods: { methods: {
change(e) { change(e) {
this.currentChildren = e this.currentChildren = e
@ -118,26 +129,16 @@ export default {
this.getData() this.getData()
}, },
search() { search() {
for (let i = 0; i < 10; i++) {
delete this.queryParams[i]
}
this.queryParams.pageSize = 10
// for (let i = 0; i < 10; i++) {
// delete this.queryParams[i]
// }
// this.queryParams.pageSize = 10
this.getData() this.getData()
}, },
navigateToDetail(id, open) { navigateToDetail(id, open) {
// console.log('open?:', open);
this.$utils.navigateTo(`/pages_order/product/productDetail?id=${id}&open=${open}`); this.$utils.navigateTo(`/pages_order/product/productDetail?id=${id}&open=${open}`);
} }
}, },
onShow() {
this.mixinsListApi = 'queryGoodsList'
this.queryParams.categoryId = this.category[this.currentChildren].id
this.getData()
},
onHide() {
this.mixinsListApi = ''
}
} }
</script> </script>


+ 1
- 1
pages_order/components/order/placeOrder.vue View File

@ -89,7 +89,7 @@
<!-- 购物车与支付 --> <!-- 购物车与支付 -->
<view class="cart-pay"> <view class="cart-pay">
<view class="cart">
<view class="cart" @click="$emit('addCart')">
<uv-icon name="shopping-cart-fill" size="60rpx" color="#019245" label="加入购物车" labelPos="bottom" <uv-icon name="shopping-cart-fill" size="60rpx" color="#019245" label="加入购物车" labelPos="bottom"
labelSize="25rpx" /> labelSize="25rpx" />
</view> </view>


+ 2
- 2
pages_order/mine/share.vue View File

@ -64,7 +64,7 @@ export default {
this.$api('getInviteCode', {}, res => { this.$api('getInviteCode', {}, res => {
if(res.code == 200){ if(res.code == 200){
console.log('获取邀请二维码', res); console.log('获取邀请二维码', res);
this.shareData = res.data
this.shareData = res.result
} }
}) })
}, },
@ -136,7 +136,7 @@ export default {
return { return {
title: `邀请您使用敢为人鲜小程序,邀请码: 666`, title: `邀请您使用敢为人鲜小程序,邀请码: 666`,
path: `/pages/index/index?inviteCode=666`, path: `/pages/index/index?inviteCode=666`,
imageUrl: this.shareData.qrCodeImage,
imageUrl: this.shareData.url,
success: () => { success: () => {
uni.showToast({ uni.showToast({
title: '分享成功', title: '分享成功',


+ 3
- 3
pages_order/order/newOrderDetail.vue View File

@ -98,12 +98,12 @@
<uv-radio-group v-model="payMethod" v-if="orderDetail.status_dictText === '待支付'"> <uv-radio-group v-model="payMethod" v-if="orderDetail.status_dictText === '待支付'">
<view class="payment-methods"> <view class="payment-methods">
<view class="payment-item"> <view class="payment-item">
<uv-icon name="weixin-circle-fill" size="70rpx" color="#019245"></uv-icon>
<uv-icon name="weixin-circle-fill" size="70rpx" color="#019245" />
<text class="payment-name">微信支付</text> <text class="payment-name">微信支付</text>
<uv-radio activeColor="#019245" size="40rpx" name="weixin"></uv-radio>
<uv-radio activeColor="#019245" size="40rpx" name="weixin" />
</view> </view>
<view class="payment-item"> <view class="payment-item">
<uv-icon name="red-packet" size="70rpx" color="#019245"></uv-icon>
<uv-icon name="red-packet" size="70rpx" color="#019245" />
<text class="payment-name">账户余额<text class="balance-text">(余额: {{ userInfo.balance }})</text></text> <text class="payment-name">账户余额<text class="balance-text">(余额: {{ userInfo.balance }})</text></text>
<uv-radio activeColor="#019245" size="40rpx" name="account" /> <uv-radio activeColor="#019245" size="40rpx" name="account" />
</view> </view>


+ 15
- 21
pages_order/product/productDetail.vue View File

@ -120,7 +120,7 @@
<!-- 联系客服 --> <!-- 联系客服 -->
<customerServicePopup ref="customerServicePopup" /> <customerServicePopup ref="customerServicePopup" />
<newCouponPopup ref="newCouponPopup" /> <newCouponPopup ref="newCouponPopup" />
<placeOrder ref="placeOrder" :item="productDetail" />
<placeOrder ref="placeOrder" :item="productDetail" @addCart="addCart" />
<uv-safe-bottom /> <uv-safe-bottom />
</view> </view>
</template> </template>
@ -152,8 +152,7 @@
onLoad(args) { onLoad(args) {
this.id = args.id this.id = args.id
this.getGoodsDetail() this.getGoodsDetail()
if (args.open === 'true')
this.submit()
if (args.open === 'true') this.submit()
}, },
onShow() { onShow() {
}, },
@ -164,29 +163,24 @@
}, },
// //
addCart(){ addCart(){
this.$api('addCart', {
shopId : this.id,
num : 1,
},
res => {
if(res.code == 200){
uni.showLoading({
title: '加载中...'
})
this.$api('addShopcar', {
goodsId: this.id,
num: 1,
}, res => {
uni.hideLoading()
if (res.code == 200) {
uni.showToast({ uni.showToast({
title: '加入购物车成功', title: '加入购物车成功',
icon: 'success'
})
}else{
uni.showToast({
title: '加入购物车失败',
icon: 'error'
icon: 'success',
duration: 1000
}) })
} }
},
error => {
uni.showToast({
title: '加入购物车失败',
icon: 'error'
})
}) })
}, },
// //
submit() { submit() {


+ 11
- 2
store/store.js View File

@ -12,6 +12,7 @@ const store = new Vuex.Store({
configList: {}, //配置列表 configList: {}, //配置列表
userInfo: {}, //用户信息 userInfo: {}, //用户信息
levelInfo: {}, //团员等级信息 levelInfo: {}, //团员等级信息
cartData: [], //购物车数据
riceInfo: {}, //用户相关信息 riceInfo: {}, //用户相关信息
category: [], //分类信息 category: [], //分类信息
payOrderProduct: [], //支付订单中的商品 payOrderProduct: [], //支付订单中的商品
@ -187,10 +188,14 @@ const store = new Vuex.Store({
}) })
}, },
// 查询分类接口 // 查询分类接口
getCategoryList(state) {
api('queryCategoryList', { }, res => {
getCategoryList(state, fn) {
api('queryCategoryList', {
pageNo: 1,
pageSize: 9999,
}, res => {
if (res.code == 200) { if (res.code == 200) {
state.category = res.result.records state.category = res.result.records
fn && fn(state.category)
} }
}) })
}, },
@ -201,6 +206,10 @@ const store = new Vuex.Store({
setPromotionUrl(state, data){ setPromotionUrl(state, data){
state.promotionUrl = data state.promotionUrl = data
}, },
// 设置购物车数据
setCartData(state, data){
state.cartData = data
},
}, },
actions: {}, actions: {},
}) })


Loading…
Cancel
Save