Browse Source

'进入前后端本地联调'

hfll
hflllll 1 month ago
parent
commit
1ed09422ee
18 changed files with 350 additions and 185 deletions
  1. +6
    -0
      api/model/index.js
  2. +3
    -3
      api/model/login.js
  3. +50
    -0
      api/model/my.js
  4. +24
    -1
      api/model/order.js
  5. +18
    -7
      components/product/productItem.vue
  6. +2
    -2
      config.js
  7. +7
    -0
      mixins/list.js
  8. +72
    -58
      pages/index/cart.vue
  9. +1
    -4
      pages/index/category.vue
  10. +5
    -6
      pages/index/center.vue
  11. +12
    -3
      pages/index/order.vue
  12. +14
    -14
      pages_order/auth/wxUserInfo.vue
  13. +52
    -16
      pages_order/components/order/placeOrder.vue
  14. +9
    -8
      pages_order/mine/share.vue
  15. +42
    -31
      pages_order/mine/team.vue
  16. +17
    -17
      pages_order/mine/updateUser.vue
  17. +12
    -8
      pages_order/product/productDetail.vue
  18. +4
    -7
      store/store.js

+ 6
- 0
api/model/index.js View File

@ -13,6 +13,12 @@ const api = {
method: 'GET', method: 'GET',
limit: 500, limit: 500,
}, },
// 商品信息- 查询商品信息详情
queryGoodsById: {
url: '/teambuy/goods/queryGoodsById',
method: 'GET',
limit: 500,
},
} }
export default api export default api

+ 3
- 3
api/model/login.js View File

@ -14,8 +14,8 @@ const api = {
// auth: true, // auth: true,
}, },
// 修改个人信息接口 // 修改个人信息接口
updateInfo: {
url: '/info_common/updateInfo',
updateUser: {
url: '/teambuy/userInfo/updateUser',
method: 'POST', method: 'POST',
limit: 500, limit: 500,
showLoading: true, showLoading: true,
@ -23,7 +23,7 @@ const api = {
}, },
// 获取个人信息 // 获取个人信息
getInfo: { getInfo: {
url: '/info_common/getInfo',
url: '/teambuy/userInfo/queryUser',
method: 'GET', method: 'GET',
// auth: true, // auth: true,
}, },


+ 50
- 0
api/model/my.js View File

@ -7,6 +7,56 @@ const api = {
method: 'POST', method: 'POST',
limit: 500 limit: 500
}, },
// 我的-获取个人中心基础数据信息
getUserCenterData: {
url: '/teambuy/userInfo/getUserCenterData',
method: 'GET',
limit: 500
},
// 我的-查看个人信息
queryUser: {
url: '/teambuy/userInfo/queryUser',
method: 'GET',
limit: 500
},
// 我的-修改个人信息
// updateUser: {
// url: '/teambuy/userInfo/updateUser',
// method: 'POST'
// },
// 我的-团长申请
addLeader: {
url: '/teambuy/leader/addLeader',
method: 'POST',
limit: 500
},
// 我的- 解绑团长
deleteLeader: {
url: '/teambuy/leader/deleteLeader',
method: 'POST',
limit: 500
},
// 我的-查询团长列表
queryLeaderList: {
url: '/teambuy/leader/queryLeaderList',
method: 'POST',
limit: 500
},
// 我的-更换团长
updateLeader: {
url: '/teambuy/leader/updateLeader',
method: 'POST',
limit: '500'
},
} }
export default api export default api

+ 24
- 1
api/model/order.js View File

@ -7,6 +7,7 @@ const api = {
method: 'GET', method: 'GET',
limit: 500, limit: 500,
}, },
// 订单-查看优惠券列表-详情 // 订单-查看优惠券列表-详情
queryCouponList: { queryCouponList: {
url: '/teambuy/coupon/queryCouponList', url: '/teambuy/coupon/queryCouponList',
@ -19,19 +20,41 @@ const api = {
method: 'GET', method: 'GET',
limit: 500 limit: 500
}, },
// 订单-查看团员订单列表-详情 // 订单-查看团员订单列表-详情
queryMemberOrderList: { queryMemberOrderList: {
url: '/teambuy/order/queryMemberOrderList', url: '/teambuy/order/queryMemberOrderList',
method: 'GET', method: 'GET',
limit: 500 limit: 500
}, },
// 订单-查看购物车列表-详情 // 订单-查看购物车列表-详情
queryShopcarList: { queryShopcarList: {
url: '/teambuy/shopcar/queryShopcarList', url: '/teambuy/shopcar/queryShopcarList',
method: 'GET', method: 'GET',
limit: 500 limit: 500
},
// 订单-购物车-添加购物车
addShopcar: {
url: '/teambuy/shopcar/addShopcar',
method: 'POST',
limit: 500
},
// 订单-支付订单
payOrder: {
url: '/teambuy/order/payOrder',
method: 'POST',
limit: 500
},
// 订单- 创建订单
createOrder: {
url: '/teambuy/order/createOrder',
method: 'POST',
limit: 500
} }
} }
export default api export default api

+ 18
- 7
components/product/productItem.vue View File

@ -5,7 +5,7 @@
<!-- <image :src="item.image && <!-- <image :src="item.image &&
item.image.split(',')[0]" mode="aspectFill"> item.image.split(',')[0]" mode="aspectFill">
</image> --> </image> -->
<image src="@/static/image/红烧肉.webp" mode="aspectFill" class="item-image-img">
<image :src="item.image" mode="aspectFill" class="item-image-img">
</image> </image>
</view> </view>
@ -13,7 +13,7 @@
<view class="info"> <view class="info">
<!-- 商品标题 --> <!-- 商品标题 -->
<view class="title"> <view class="title">
<!-- {{ item.title }} -->豆角炒鸡蛋
{{ item.title }}
</view> </view>
<!-- 价格 --> <!-- 价格 -->
@ -98,13 +98,13 @@
</view> </view>
<view class="sales-volume-number"> <view class="sales-volume-number">
已售出{{ item.payNum }}
已售出{{ item.sales }}
</view> </view>
</view> </view>
<!-- 价格 --> <!-- 价格 -->
<view :style="{ color: '#FF2A2A'}"> <view :style="{ color: '#FF2A2A'}">
<text style="font-size: 18rpx;"></text><text style="font-size: 30rpx;">9.9</text>
<text style="font-size: 18rpx;"></text><text style="font-size: 30rpx;">{{ item.price }}</text>
</view> </view>
<!-- 购买按钮 --> <!-- 购买按钮 -->
@ -140,6 +140,9 @@
return { return {
} }
}, },
mounted() {
console.log('商品项数据:', this.item);
},
methods: { methods: {
// () // ()
purchase(id) { purchase(id) {
@ -157,14 +160,19 @@
}, },
// //
addCart(item){ addCart(item){
this.$api('addCart', {
shopId : item.id,
uni.showLoading({
title: '加载中...'
})
this.$api('addShopcar', {
goodsId : item.id,
num : 1, num : 1,
}, res => { }, res => {
uni.hideLoading()
if(res.code == 200){ if(res.code == 200){
uni.showToast({ uni.showToast({
title: '加入购物车成功', title: '加入购物车成功',
icon: 'none'
icon: 'none',
duration: 1000
}) })
} }
}) })
@ -177,6 +185,9 @@
return price >= 0 ? price : item.price return price >= 0 ? price : item.price
} }
},
onload() {
console.log(props.item);
} }
} }
</script> </script>


+ 2
- 2
config.js View File

@ -6,13 +6,13 @@ import uvUI from '@/uni_modules/uv-ui-tools'
Vue.use(uvUI); Vue.use(uvUI);
// 当前环境 // 当前环境
const type = 'test'
const type = 'local'
// 环境配置 // 环境配置
const config = { const config = {
local : { local : {
baseUrl: 'http://127.0.0.1:8001/jewelry-admin',
baseUrl: 'http://augcl.natapp1.cc/teambuy-api',
}, },
dev: { dev: {
baseUrl: 'http://h5.xzaiyp.top/jewelry-admin', baseUrl: 'http://h5.xzaiyp.top/jewelry-admin',


+ 7
- 0
mixins/list.js View File

@ -50,13 +50,20 @@ export default {
if(!this.mixinsListApi){ if(!this.mixinsListApi){
return console.error('mixinsListApi 缺失'); return console.error('mixinsListApi 缺失');
} }
uni.showLoading({
title: '加载中...'
})
this.$api(this.mixinsListApi, this.$api(this.mixinsListApi,
query(this, queryParams), res => { query(this, queryParams), res => {
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
uni.hideLoading()
if(res.code == 200){ if(res.code == 200){
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
// 调用数据加载完成的回调 // 调用数据加载完成的回调


+ 72
- 58
pages/index/cart.vue View File

@ -5,28 +5,28 @@
<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" @change="toggleSelect">
<view v-for="(item, index) in cartData.items" :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" />
</view> </view>
<view class="item-content"> <view class="item-content">
<image class="food-image" :src="item.image" mode="aspectFill" />
<image class="food-image" :src="item.goods.image" mode="aspectFill" />
<view class="food-info"> <view class="food-info">
<text class="food-name">{{ item.name }}</text>
<text class="food-name">{{ item.goods.title }}</text>
<view class="food-sold"> <view class="food-sold">
<uv-icon name="checkmark-circle" color="#ccc" size="24rpx"></uv-icon> <uv-icon name="checkmark-circle" color="#ccc" size="24rpx"></uv-icon>
<text>已售出 {{ item.sold }}</text>
<text>已售出 {{ item.goods.sales }}</text>
</view> </view>
<view class="food-price-row"> <view class="food-price-row">
<text class="food-price"> <text class="food-price">
<text style="font-size: 22rpx; margin-right: 6rpx;">¥</text> <text style="font-size: 22rpx; margin-right: 6rpx;">¥</text>
{{ item.price.toFixed(1) }}
{{ item.goods.price }}
</text> </text>
<view class="number-box"> <view class="number-box">
<view class="number-btn minus" @tap="decreaseQuantity(item)"> <view class="number-btn minus" @tap="decreaseQuantity(item)">
<text>-</text> <text>-</text>
</view> </view>
<text class="number-value">{{ item.quantity }}</text>
<text class="number-value">{{ item.num }}</text>
<view class="number-btn plus" @tap="increaseQuantity(item)"> <view class="number-btn plus" @tap="increaseQuantity(item)">
<text>+</text> <text>+</text>
</view> </view>
@ -36,7 +36,7 @@
</view> </view>
</view> </view>
</uv-checkbox-group> </uv-checkbox-group>
<uv-empty mode="car" style="padding-top: 300rpx;" v-if="!cartData.items.length"
<uv-empty mode="car" style="padding-top: 300rpx;" v-if="!cartData.records || !cartData.records.length"
text="购物车空空如也~" /> text="购物车空空如也~" />
</view> </view>
@ -80,14 +80,16 @@ export default {
}, },
data() { data() {
return { return {
cartData: mockCartData,
cartData: {
records: []
},
checkboxValue: [], checkboxValue: [],
isManaged: false isManaged: false
} }
}, },
computed: { computed: {
allSelected() { allSelected() {
return this.cartData.items.every(item => this.checkboxValue.includes(item.id))
return this.cartData.records.every(item => this.checkboxValue.includes(item.id))
}, },
// //
allCheckbox(){ allCheckbox(){
@ -99,41 +101,53 @@ export default {
getCartData(){ getCartData(){
this.$api('queryShopcarList', {}, res => { this.$api('queryShopcarList', {}, res => {
if (res.code == 200){ if (res.code == 200){
console.log(res);
this.cartData = res.result
console.log(this.cartData);
} }
}) })
}, },
toggleSelect(item) {
this.updateCart();
},
toggleSelectAll() {
if (this.allSelected){
this.checkboxValue = []
}else{
this.checkboxValue = this.cartData.items.map(item => item.id)
}
this.updateCart();
},
modifyCart(item){
this.$api('addShopcar', {
goodsId: item.goodsId,
id: item.id,
num: item.num
}, res => {
console.log(res);
})
},
// toggleSelect(item) {
// this.updateCart();
// },
// toggleSelectAll() {
// if (this.allSelected){
// this.checkboxValue = []
// }else{
// this.checkboxValue = this.cartData.items.map(item => item.id)
// }
// this.updateCart();
// },
increaseQuantity(item) { increaseQuantity(item) {
item.quantity += 1;
this.updateCart();
item.num += 1;
this.modifyCart(item)
// this.updateCart();
}, },
decreaseQuantity(item) { decreaseQuantity(item) {
if (item.quantity > 1) {
item.quantity -= 1;
this.updateCart();
if (item.num > 1) {
item.num -= 1;
this.modifyCart(item)
} }
}, },
updateCart() { 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)
// //
// 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() {
@ -172,29 +186,29 @@ export default {
}, 800) }, 800)
}, },
// //
deleteCart(){
if (!this.checkboxValue.length) {
uni.showToast({
title: '请选择商品',
icon: 'none'
});
// 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)
}
// 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)
// }
}, },
onLoad(){ onLoad(){
this.getCartData() this.getCartData()
@ -355,7 +369,7 @@ export default {
.control-text{ .control-text{
position: absolute; position: absolute;
right: 150rpx; right: 150rpx;
top: calc(env(safe-area-inset-bottom) + 60rpx);
top: calc(env(safe-area-inset-bottom) + 40rpx);
font-size: 26rpx; font-size: 26rpx;
color: #fff; color: #fff;
z-index: 10000; z-index: 10000;


+ 1
- 4
pages/index/category.vue View File

@ -60,10 +60,10 @@
</scroll-view> </scroll-view>
<uv-empty v-if="list.length == 0" text="还没有呢" />
</view> </view>
</uv-vtabs-item> </uv-vtabs-item>
</uv-vtabs> </uv-vtabs>
<!-- <uv-empty v-if="list.length == 0" text="还没有呢" /> -->
</view> </view>
<!-- tabbar --> <!-- tabbar -->
@ -112,9 +112,6 @@ export default {
change(e) { change(e) {
// this.queryParams.classId = this.category[e].id // this.queryParams.classId = this.category[e].id
this.currentChildren = e this.currentChildren = e
console.log(this.currentChildren);
console.log(this.category[e].id);
// //
this.getData({ categoryId: this.category[e].id }) this.getData({ categoryId: this.category[e].id })
}, },


+ 5
- 6
pages/index/center.vue View File

@ -4,10 +4,10 @@
<view class="header" :style="{ 'background-image': 'url(/static/image/红烧肉.webp)' }"> <view class="header" :style="{ 'background-image': 'url(/static/image/红烧肉.webp)' }">
<view class="user-info"> <view class="user-info">
<image class="avatar" :src="userInfo.avatarUrl" mode="aspectFill"></image>
<image class="avatar" :src="userInfo.headImage" mode="aspectFill"></image>
<view class="user-name-id"> <view class="user-name-id">
<text class="user-name">{{ userInfo.nickName }}</text> <text class="user-name">{{ userInfo.nickName }}</text>
<text class="user-id">ID:{{ userInfo.userId }}</text>
<text class="user-id">ID:{{ userInfo.id }}</text>
</view> </view>
</view> </view>
@ -182,7 +182,7 @@
<script> <script>
import tabber from '@/components/base/tabbar.vue' import tabber from '@/components/base/tabbar.vue'
import { mockUserInfo } from '@/static/js/mockUserInfo.js'
// import { mockUserInfo } from '@/static/js/mockUserInfo.js'
// import { unix } from 'dayjs' // import { unix } from 'dayjs'
@ -192,7 +192,7 @@ export default {
}, },
data() { data() {
return { return {
userInfo: mockUserInfo,
// userInfo: mockUserInfo,
identity: 0 identity: 0
} }
}, },
@ -231,8 +231,7 @@ export default {
}, },
onLoad (){ onLoad (){
// //
//
// this.$store.commit('getUserInfo')
this.$store.commit('getUserInfo')
uni.setStorageSync('identity', 0) // uni.setStorageSync('identity', 0) //
this.identity = uni.getStorageSync('identity') // this.identity = uni.getStorageSync('identity') //
} }


+ 12
- 3
pages/index/order.vue View File

@ -240,6 +240,8 @@
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
// API // API
uni.showToast({ uni.showToast({
title: '订单已取消', title: '订单已取消',
icon: 'success' icon: 'success'
@ -270,9 +272,16 @@
setTimeout(() => { setTimeout(() => {
uni.hideToast() uni.hideToast()
uni.showToast({
title: '支付成功',
icon: 'success'
this.$api('payOrder', {
orderId: orderId,
payType: 0
}, res => {
if (res.code == 200) {
uni.showToast({
title: '支付成功',
icon: 'success'
})
}
}) })
// //


+ 14
- 14
pages_order/auth/wxUserInfo.vue View File

@ -137,21 +137,21 @@
// //
// self.$api('updateInfo', {
// avatarUrl : self.userInfoForm.headImage,
// nickName : self.userInfoForm.nickName,
// phone : self.userInfoForm.phone,
// }, res => {
// if (res.code == 200) {
// uni.reLaunch({
// url:'/pages/index/category'
// })
// }
// })
uni.reLaunch({
url:'/pages/index/category'
self.$api('updateUser', {
headImage : self.userInfoForm.headImage,
nickName : self.userInfoForm.nickName,
phone : self.userInfoForm.phone,
}, res => {
if (res.code == 200) {
uni.reLaunch({
url:'/pages/index/category'
})
}
}) })
// uni.reLaunch({
// url:'/pages/index/category'
// })
}) })
}, },


+ 52
- 16
pages_order/components/order/placeOrder.vue View File

@ -4,8 +4,8 @@
<view class="place-order-content"> <view class="place-order-content">
<view class="place-order-title"> <view class="place-order-title">
<image src="@/static/image/多人下单.webp" mode="aspectFit" class="place-order-title-image"></image>
<text class="number">2563</text><text>人下单</text>
<image src="@/static/image/多人下单.webp" mode="aspectFit" class="place-order-title-image" />
<text class="number">{{ item.orderNum }}</text><text>人下单</text>
<view class="place-order-title-close" @click="close"> <view class="place-order-title-close" @click="close">
<uv-icon name="close" size="40rpx"></uv-icon> <uv-icon name="close" size="40rpx"></uv-icon>
</view> </view>
@ -35,10 +35,10 @@
<!-- 货品信息 --> <!-- 货品信息 -->
<view class="item"> <view class="item">
<image src="@/static/image/红烧肉.webp" mode="aspectFill" class="item-image"></image>
<image :src="item.image" mode="aspectFill" class="item-image"></image>
<view style="font-size: 36rpx;"> <view style="font-size: 36rpx;">
<view>豆角炒鸡蛋</view>
<view style="color: red; ">9.9</view>
<view>{{ item.name }}</view>
<view style="color: red; ">{{ item.price }}</view>
<view style="margin-top: 30rpx;"> <view style="margin-top: 30rpx;">
<uv-number-box v-model="value" button-size="36"></uv-number-box> <uv-number-box v-model="value" button-size="36"></uv-number-box>
</view> </view>
@ -47,13 +47,13 @@
<!-- 选项框 --> <!-- 选项框 -->
<uv-radio-group v-model="payMethod"> <uv-radio-group v-model="payMethod">
<view class="option-box">
<view class="option-box" >
<view class="option-box-item"> <view class="option-box-item">
<uv-icon name="weixin-circle-fill" size="70rpx" color="#019245" /> <uv-icon name="weixin-circle-fill" size="70rpx" color="#019245" />
<text style="flex: 1;"> <text style="flex: 1;">
微信支付 微信支付
</text> </text>
<uv-radio activeColor="#019245" size="40rpx" name="weixin" />
<uv-radio activeColor="#019245" size="40rpx" name="0" />
</view> </view>
<view class="option-box-item"> <view class="option-box-item">
<uv-icon name="red-packet" size="70rpx" color="#019245" /> <uv-icon name="red-packet" size="70rpx" color="#019245" />
@ -62,7 +62,7 @@
<text style="color: gray; margin-left: 20rpx;">(余额: 0) <text style="color: gray; margin-left: 20rpx;">(余额: 0)
</text> </text>
</text> </text>
<uv-radio activeColor="#019245" size="40rpx" name="account" />
<uv-radio activeColor="#019245" size="40rpx" name="1" />
</view> </view>
</view> </view>
</uv-radio-group> </uv-radio-group>
@ -84,7 +84,7 @@
<!-- 备注 --> <!-- 备注 -->
<view class="remark"> <view class="remark">
<text style="align-self: start;">备注</text> <text style="align-self: start;">备注</text>
<textarea class="remark-textarea" placeholder="请输入您需要备注的内容" />
<textarea class="remark-textarea" placeholder="请输入您需要备注的内容" v-model="remark" />
</view> </view>
<!-- 购物车与支付 --> <!-- 购物车与支付 -->
@ -93,7 +93,7 @@
<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>
<view class="pay">
<view class="pay" @tap="createOrder">
立即支付 立即支付
</view> </view>
</view> </view>
@ -108,11 +108,24 @@ export default {
data() { data() {
return { return {
value: 1, value: 1,
payMethod: 'weixin',
pickupPoint: null
payMethod: '0',
pickupPoint: null,
remark: '',
}
},
props: {
item: {
type: Object,
default: () => {}
}
},
computed: {
priceAll(){
return this.item.price * this.value
} }
}, },
methods: { methods: {
// open // open
open() { open() {
this.$refs.popup.open(); this.$refs.popup.open();
@ -129,9 +142,6 @@ export default {
// //
gotoPickupPoint() { gotoPickupPoint() {
this.$utils.navigateTo('/pages_order/location/pickupPoint') this.$utils.navigateTo('/pages_order/location/pickupPoint')
// uni.navigateTo({
// url: '/pages_order/location/pickupPoint'
// });
}, },
// //
@ -143,10 +153,36 @@ export default {
uni.$on('updatePickupPoint', (point) => { uni.$on('updatePickupPoint', (point) => {
this.pickupPoint = point; this.pickupPoint = point;
}) })
},
//
createOrder(){
this.$api('createOrder', {
priceAll: this.priceAll,
pricePay: this.priceAll - 0,
pricePreferential: 0,
payType: this.payMethod,
}, res => {
if (res.code === 200) {
uni.requestPaymentWxPay(res)
.then(e => {
uni.showToast({
title: '下单成功',
icon: 'none'
})
// this.paySuccess(res)
}).catch(n => {
setTimeout(uni.redirectTo, 700, {
url: '/pages/index/order'
})
})
}
})
} }
}, },
mounted(){ mounted(){
// this.open();
this.listenPickupPoint(); this.listenPickupPoint();
}, },
beforeDestroy() { beforeDestroy() {


+ 9
- 8
pages_order/mine/share.vue View File

@ -7,23 +7,24 @@
<view class="card-container"> <view class="card-container">
<!-- 用户头像 - 放在卡片容器外使其一半在卡片之上 --> <!-- 用户头像 - 放在卡片容器外使其一半在卡片之上 -->
<view class="avatar-container"> <view class="avatar-container">
<image :src="shareData.userInfo.avatar" class="avatar" mode="aspectFill" />
<image :src="userInfo.headImage" class="avatar" mode="aspectFill" />
</view> </view>
<view class="share-card"> <view class="share-card">
<!-- 用户信息 --> <!-- 用户信息 -->
<view class="user-info"> <view class="user-info">
<view class="nickname">{{ shareData.userInfo.nickname }} {{ shareData.userInfo.role }}</view>
<view class="nickname">{{ userInfo.nickName }} 团长</view>
</view> </view>
<!-- 小程序码 --> <!-- 小程序码 -->
<view class="qrcode-container"> <view class="qrcode-container">
<image :src="shareData.qrCodeImage" class="qrcode-image" mode="aspectFit" />
<image :src="shareData.url" class="qrcode-image" mode="aspectFit" />
</view> </view>
<!-- 邀请码 --> <!-- 邀请码 -->
<view class="invite-code"> <view class="invite-code">
邀请码{{ shareData.inviteCode }}
<!-- 邀请码{{ shareData.inviteCode }} -->
邀请码66666
</view> </view>
</view> </view>
</view> </view>
@ -54,7 +55,7 @@ export default {
} }
}, },
onLoad() { onLoad() {
this.shareData = shareData
// this.shareData = shareData
this.getCode() this.getCode()
}, },
methods: { methods: {
@ -63,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
} }
}) })
}, },
@ -133,8 +134,8 @@ export default {
// //
onShareAppMessage() { onShareAppMessage() {
return { return {
title: `邀请您使用敢为人鲜小程序,邀请码: ${this.shareData.inviteCode}`,
path: `/pages/index/index?inviteCode=${this.shareData.inviteCode}`,
title: `邀请您使用敢为人鲜小程序,邀请码: 666`,
path: `/pages/index/index?inviteCode=666`,
imageUrl: this.shareData.qrCodeImage, imageUrl: this.shareData.qrCodeImage,
success: () => { success: () => {
uni.showToast({ uni.showToast({


+ 42
- 31
pages_order/mine/team.vue View File

@ -14,11 +14,11 @@
<view class="section-title">送餐点照片</view> <view class="section-title">送餐点照片</view>
<view class="section-block"> <view class="section-block">
<view class="upload-container"> <view class="upload-container">
<view class="upload-area" @tap="chooseImage" v-if="!formData.locationImage">
<view class="upload-area" @tap="chooseImage" v-if="!formData.spotImage">
<view class="plus">+</view> <view class="plus">+</view>
<view class="upload-text">添加图片</view> <view class="upload-text">添加图片</view>
</view> </view>
<image v-else :src="formData.locationImage" mode="aspectFill" class="upload-area"
<image v-else :src="formData.spotImage" mode="aspectFill" class="upload-area"
@tap="chooseImage" /> @tap="chooseImage" />
</view> </view>
</view> </view>
@ -29,17 +29,17 @@
<view class="form-item"> <view class="form-item">
<text class="label">送餐点名称</text> <text class="label">送餐点名称</text>
<input class="input" type="text" v-model="formData.name" placeholder="请输入送餐点名称"
<input class="input" type="text" v-model="formData.spotName" placeholder="请输入送餐点名称"
placeholder-class="placeholder" /> placeholder-class="placeholder" />
</view> </view>
<view class="form-item"> <view class="form-item">
<text class="label">您的姓名</text> <text class="label">您的姓名</text>
<input class="input" type="nickname" v-model="formData.contactName" placeholder="请输入您的姓名"
<input class="input" type="nickname" v-model="formData.name" placeholder="请输入您的姓名"
placeholder-class="placeholder" /> placeholder-class="placeholder" />
</view> </view>
<view class="form-item"> <view class="form-item">
<text class="label">联系手机号</text> <text class="label">联系手机号</text>
<input class="input" type="number" v-model="formData.contactPhone" placeholder="请输入您的手机号"
<input class="input" type="number" v-model="formData.phone" placeholder="请输入您的手机号"
placeholder-class="placeholder" /> placeholder-class="placeholder" />
</view> </view>
@ -47,7 +47,7 @@
<text class="label">所在地区</text> <text class="label">所在地区</text>
<picker mode="region" @change="regionSelect"> <picker mode="region" @change="regionSelect">
<text style="font-size: 30rpx;">{{ formData.region || '请选择' }}</text>
<text style="font-size: 30rpx;">{{ formData.area || '请选择' }}</text>
</picker> </picker>
<uv-icon name="arrow-right" color="#000" style="margin-left: 2rpx;"/> <uv-icon name="arrow-right" color="#000" style="margin-left: 2rpx;"/>
</view> </view>
@ -83,11 +83,11 @@ export default {
data() { data() {
return { return {
formData: { formData: {
locationImage: '', //
name: '', //
contactName: '', //
contactPhone: '', //
region: '', //
spotImage: '', //
spotName: '', //
name: '', //
phone: '', //
area: '', //
address: '' // address: '' //
}, },
identity: uni.getStorageSync('identity'), identity: uni.getStorageSync('identity'),
@ -104,55 +104,55 @@ export default {
success: (res) => { success: (res) => {
// //
// //
this.formData.locationImage = res.tempFilePaths[0]
this.formData.spotImage = res.tempFilePaths[0]
} }
}) })
}, },
// //
regionSelect(e) { regionSelect(e) {
this.formData.region = e.detail.value[1] + e.detail.value[2]
this.formData.area = e.detail.value[1] + e.detail.value[2]
}, },
// //
submitApplication() { submitApplication() {
// //
if (!this.formData.locationImage) {
if (!this.formData.spotImage) {
return uni.showToast({ return uni.showToast({
title: '请上传送餐点照片', title: '请上传送餐点照片',
icon: 'none' icon: 'none'
}) })
} }
if (!this.formData.name) {
if (!this.formData.spotName) {
return uni.showToast({ return uni.showToast({
title: '请输入送餐点名称', title: '请输入送餐点名称',
icon: 'none' icon: 'none'
}) })
} }
if (!this.formData.contactName) {
if (!this.formData.name) {
return uni.showToast({ return uni.showToast({
title: '请输入您的姓名', title: '请输入您的姓名',
icon: 'none' icon: 'none'
}) })
} }
if (!this.formData.contactPhone) {
if (!this.formData.phone) {
return uni.showToast({ return uni.showToast({
title: '请输入联系手机号', title: '请输入联系手机号',
icon: 'none' icon: 'none'
}) })
} }
if (!this.$utils.verificationPhone(this.formData.contactPhone)) {
if (!this.$utils.verificationPhone(this.formData.phone)) {
return uni.showToast({ return uni.showToast({
title: '请输入正确的手机号', title: '请输入正确的手机号',
icon: 'none' icon: 'none'
}) })
} }
if (!this.formData.region) {
if (!this.formData.area) {
return uni.showToast({ return uni.showToast({
title: '请选择所在地区', title: '请选择所在地区',
icon: 'none' icon: 'none'
@ -181,20 +181,31 @@ export default {
return return
} }
uni.showModal({
title: '提交成功!',
content: '我们的工作人员会及时与您联系,\n请保持电话畅通!',
showCancel: false,
confirmColor: '#019245',
success: (res) => {
if (res.confirm) {
//
setTimeout(() => {
this.$utils.navigateBack()
}, 500)
}
console.log(this.formData);
//
this.$api('addLeader', {
...this.formData,
}, res => {
if (res.code == 200) {
uni.showModal({
title: '提交成功!',
content: '我们的工作人员会及时与您联系,\n请保持电话畅通!',
showCancel: false,
confirmColor: '#019245',
success: (res) => {
if (res.confirm) {
//
setTimeout(() => {
this.$utils.navigateBack()
}, 500)
}
}
})
} }
}) })
}, 1000) }, 1000)
}, },


+ 17
- 17
pages_order/mine/updateUser.vue View File

@ -81,9 +81,9 @@ export default {
}, },
getUserInfo() { getUserInfo() {
// 使mock // 使mock
this.form.headImage = mockUserInfo.avatarUrl || this.form.headImage
this.form.nickName = mockUserInfo.nickName || this.form.nickName
this.form.phone = '13800138000' //
this.form.headImage = this.userInfo.headImage || this.form.headImage
this.form.nickName = this.userInfo.nickName || this.form.nickName
this.form.phone = this.userInfo.phone || this.form.phone
}, },
submit() { submit() {
let self = this let self = this
@ -114,22 +114,22 @@ export default {
return return
} }
uni.showLoading({
title: '保存中...'
this.$api('updateUser', {
...this.form,
}, res => {
if (res.code == 200) {
uni.showToast({
title: '保存成功',
icon: 'success'
})
this.$store.commit('getUserInfo')
//
setTimeout(() => {
this.$utils.navigateBack()
}, 1500)
}
}) })
setTimeout(() => {
uni.hideLoading()
uni.showToast({
title: '保存成功',
icon: 'success'
})
//
setTimeout(() => {
this.$utils.navigateBack()
}, 1500)
}, 1000)
}) })
} }
} }


+ 12
- 8
pages_order/product/productDetail.vue View File

@ -28,10 +28,10 @@
<!-- 商品标题 --> <!-- 商品标题 -->
<view class="info"> <view class="info">
<view class="new-price"> <view class="new-price">
<text></text><text :style="{fontSize:'50rpx'}">9.9</text>
<text></text><text :style="{fontSize:'50rpx'}">{{ productDetail.price }}</text>
</view> </view>
<view class="title"> <view class="title">
<!-- {{ productDetail.title }} -->豆角炒鸡蛋
{{ productDetail.title }}
</view> </view>
<!-- <view class="price"> <!-- <view class="price">
@ -112,7 +112,7 @@
<view class="label">商品详情</view> <view class="label">商品详情</view>
</view> </view>
<uv-parse :content="productDetail.details"></uv-parse>
<uv-parse :content="productDetail.details" />
<!-- 分享和购买按钮 --> <!-- 分享和购买按钮 -->
<submit @service="service" @toSend="toSend" @submit="submit" @addCart="addCart" :detail="productDetail" /> <submit @service="service" @toSend="toSend" @submit="submit" @addCart="addCart" :detail="productDetail" />
@ -120,7 +120,7 @@
<!-- 联系客服 --> <!-- 联系客服 -->
<customerServicePopup ref="customerServicePopup" /> <customerServicePopup ref="customerServicePopup" />
<newCouponPopup ref="newCouponPopup" /> <newCouponPopup ref="newCouponPopup" />
<placeOrder ref="placeOrder" />
<placeOrder ref="placeOrder" :item="productDetail" />
<uv-safe-bottom /> <uv-safe-bottom />
</view> </view>
</template> </template>
@ -151,9 +151,10 @@
}, },
onLoad(args) { onLoad(args) {
this.id = args.id this.id = args.id
// this.getRiceProductDetail()
this.getGoodsDetail()
}, },
onShow() { onShow() {
this.getRiceProductDetail()
}, },
methods: { methods: {
// //
@ -204,12 +205,15 @@
this.$utils.navigateTo('/pages_order/order/createOrder?type=give') this.$utils.navigateTo('/pages_order/order/createOrder?type=give')
}, },
// //
getRiceProductDetail() {
this.$api('getRiceProductDetail', {
getGoodsDetail() {
uni.showLoading({
title: '加载中...'
})
this.$api('queryGoodsById', {
id: this.id id: this.id
}, res => { }, res => {
uni.hideLoading()
if (res.code == 200) { if (res.code == 200) {
res.result.num = 1
this.productDetail = res.result this.productDetail = res.result
} }
}) })


+ 4
- 7
store/store.js View File

@ -105,10 +105,10 @@ const store = new Vuex.Store({
}) })
}, },
getUserInfo(state) { getUserInfo(state) {
api('getInfo', res => {
api('getUserCenterData', res => {
if (res.code == 200) { if (res.code == 200) {
state.userInfo = res.result
state.userInfo = res.result.member
console.log('state.userInfo', state.userInfo);
if (!state.userInfo.nickName || if (!state.userInfo.nickName ||
!state.userInfo.headImage || !state.userInfo.headImage ||
!state.userInfo.phone !state.userInfo.phone
@ -182,10 +182,7 @@ const store = new Vuex.Store({
}, },
// 查询分类接口 // 查询分类接口
getCategoryList(state) { getCategoryList(state) {
api('queryCategoryList', {
pageNo : 1,
pageSize : 99999,
}, res => {
api('queryCategoryList', { }, res => {
if (res.code == 200) { if (res.code == 200) {
state.category = res.result.records state.category = res.result.records
} }


Loading…
Cancel
Save