Browse Source

1.9 开始读文档

hfll
hflllll 1 month ago
parent
commit
385863ded1
12 changed files with 78 additions and 59 deletions
  1. +9
    -5
      components/order/OrderItem.vue
  2. +6
    -2
      manifest.json
  3. +2
    -1
      pages.json
  4. +4
    -5
      pages/index/cart.vue
  5. +11
    -2
      pages/index/category.vue
  6. +31
    -7
      pages/index/order.vue
  7. +6
    -34
      pages_order/mine/share.vue
  8. +2
    -1
      pages_order/mine/updateUser.vue
  9. +3
    -0
      store/store.js
  10. +3
    -0
      utils/authorize.js
  11. +0
    -1
      utils/index.js
  12. +1
    -1
      utils/pay.js

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

@ -39,20 +39,20 @@
<text v-show="order.status === 'shipping'">全力奔跑中请耐心等待哦</text> <text v-show="order.status === 'shipping'">全力奔跑中请耐心等待哦</text>
<text v-show="order.status === 'delivered'">您的餐点已送到取餐点请尽快取餐</text> <text v-show="order.status === 'delivered'">您的餐点已送到取餐点请尽快取餐</text>
</view> </view>
<view class="action-btn cancel" v-show="order.status === 'pending'" @click="cancelOrder">
<view class="action-btn cancel" v-show="order.status === 'pending'" @click.stop="cancelOrder">
取消订单 取消订单
</view> </view>
<view class="action-btn confirm" v-show="order.status === 'pending'" @click="payOrder">
<view class="action-btn confirm" v-show="order.status === 'pending'" @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 === 'processing' || order.status === 'shipping'"
@click="payOrder">
@click.stop="clickOrder">
查看订单 查看订单
</view> </view>
<view class="action-btn confirm" v-show="order.status === 'completed'" @click="gotoSale">
<view class="action-btn confirm" v-show="order.status === 'completed'" @click.stop="gotoSale">
订单售后 订单售后
</view> </view>
<view class="action-btn confirm" v-show="order.status === 'delivered'" @click="payOrder">
<view class="action-btn confirm" v-show="order.status === 'delivered'" @click.stop="pickOrder">
取餐完成 取餐完成
</view> </view>
</view> </view>
@ -101,6 +101,10 @@ export default {
this.$utils.navigateTo({ this.$utils.navigateTo({
url: '/pages_order/order/afterSale?id=' + this.order.id url: '/pages_order/order/afterSale?id=' + this.order.id
}) })
},
//
pickOrder() {
this.$emit('pick', this.order)
} }
} }
} }


+ 6
- 2
manifest.json View File

@ -1,6 +1,6 @@
{ {
"name" : "unapp模板", "name" : "unapp模板",
"appid" : "__UNI__197A38F",
"appid" : "__UNI__098D831",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : "100", "versionCode" : "100",
@ -57,7 +57,11 @@
"urlCheck" : false "urlCheck" : false
}, },
"usingComponents" : true, "usingComponents" : true,
"permission" : {},
"permission" : {
"scope.userLocation" : {
"desc" : "你的位置信息将用于小程序位置接口的效果展示" //
}
},
"requiredPrivateInfos" : [ "chooseLocation" ], "requiredPrivateInfos" : [ "chooseLocation" ],
"unipush" : { "unipush" : {
"enable" : true "enable" : true


+ 2
- 1
pages.json View File

@ -42,7 +42,8 @@
}, },
"subPackages": [{ "subPackages": [{
"root": "pages_order", "root": "pages_order",
"pages": [{
"pages": [
{
"path": "mine/partner" "path": "mine/partner"
}, },
{ {


+ 4
- 5
pages/index/cart.vue View File

@ -286,8 +286,7 @@ export default {
} }
.cart-footer { .cart-footer {
position: fixed; position: fixed;
bottom: 120rpx;
// bottom: calc(120rpx + env(safe-area-inset-bottom));
bottom: calc(120rpx + env(safe-area-inset-bottom));
left: 0; left: 0;
width: 100%; width: 100%;
height: 100rpx; height: 100rpx;
@ -317,7 +316,7 @@ export default {
margin-right: 20rpx; margin-right: 20rpx;
// background-color: red; // background-color: red;
.total-price { .total-price {
color: #ff0000;
color: $uni-color-second;
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
margin-left: 10rpx; margin-left: 10rpx;
@ -334,7 +333,7 @@ export default {
font-size: 28rpx; font-size: 28rpx;
} }
.checkbox-primary{ .checkbox-primary{
background-color: #019245;
background-color: $uni-color;
color: #fff; color: #fff;
} }
.checkbox-collect{ .checkbox-collect{
@ -345,7 +344,7 @@ export default {
.control-text{ .control-text{
position: absolute; position: absolute;
right: 150rpx; right: 150rpx;
top: 60rpx;
top: calc(env(safe-area-inset-bottom) + 60rpx);
font-size: 26rpx; font-size: 26rpx;
color: #fff; color: #fff;
z-index: 10000; z-index: 10000;


+ 11
- 2
pages/index/category.vue View File

@ -5,11 +5,11 @@
<!-- 搜索栏 --> <!-- 搜索栏 -->
<view class="search"> <view class="search">
<image src="/static/image/logo.png" mode="aspectFill" class="search-img"></image>
<image src="/static/image/logo.png" mode="aspectFill" class="search-img" @tap="testUtiles" />
<view style="position: relative;"> <view style="position: relative;">
<uv-search placeholder="陕西苹果" bgColor="#fff" @search="search" @change="search" @custom="search" <uv-search placeholder="陕西苹果" bgColor="#fff" @search="search" @change="search" @custom="search"
:searchIconSize="40" v-model="queryParams.title" height="75rpx" :showAction="false" :searchIconSize="40" v-model="queryParams.title" height="75rpx" :showAction="false"
actionText=" "></uv-search>
actionText=" " />
<text class="search-text" @tap="search">搜索</text> <text class="search-text" @tap="search">搜索</text>
</view> </view>
</view> </view>
@ -114,6 +114,7 @@ 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
}, },
clickTabs({ index }) { clickTabs({ index }) {
this.current = index this.current = index
@ -132,6 +133,14 @@ export default {
// url: `/pages_order/product/productDetail?id=${id}` // url: `/pages_order/product/productDetail?id=${id}`
// }) // })
this.$utils.navigateTo(`/pages_order/product/productDetail?id=${id}`); this.$utils.navigateTo(`/pages_order/product/productDetail?id=${id}`);
},
testUtiles() {
try{
this.$authorize('scope.userLocation')
}catch(error){
console.log(error);
}
} }
} }
} }


+ 31
- 7
pages/index/order.vue View File

@ -4,17 +4,17 @@
<navbar title=" " bgColor="#019245" color="#fff" /> <navbar title=" " bgColor="#019245" color="#fff" />
<!-- 搜索框 --> <!-- 搜索框 -->
<view class="search-box" style="background-color: #fff; padding: 12rpx 20rpx 0rpx; ">
<view style="background-color: #fff; padding: 12rpx 20rpx 0rpx; ">
<uv-search placeholder="搜索商品名" v-model="keyword" :showAction="false" actionText="" height="80rpx" animation <uv-search placeholder="搜索商品名" v-model="keyword" :showAction="false" actionText="" height="80rpx" animation
bgColor="#F5F5F5" inputAlign="center" color="#000" placeholderColor="#979797"
searchIconSize="50rpx"></uv-search>
bgColor="#F5F5F5" inputAlign="center" color="#000" placeholderColor="#979797"
searchIconSize="50rpx"></uv-search>
</view> </view>
<!-- 订单筛选 --> <!-- 订单筛选 -->
<view class="tabs"> <view class="tabs">
<uv-tabs :list="tabs" :activeStyle="{ color: '#019245'}" lineColor="#019245" :scrollable="false" <uv-tabs :list="tabs" :activeStyle="{ color: '#019245'}" lineColor="#019245" :scrollable="false"
:inactiveStyle="{color: 'black'}" lineHeight="6rpx" lineWidth="55rpx" :current="current"
@tap="clickTabs" />
:inactiveStyle="{color: 'black'}" lineHeight="6rpx" lineWidth="55rpx" :current="current"
@click="clickTabs" />
</view> </view>
<!-- 团餐列表 --> <!-- 团餐列表 -->
@ -31,7 +31,8 @@
<!-- 订单列表 --> <!-- 订单列表 -->
<view class="order-list" v-else> <view class="order-list" v-else>
<OrderItem v-for="(order, index) in orderList" :key="order.id" :order="order" @cancel="handleCancelOrder" <OrderItem v-for="(order, index) in orderList" :key="order.id" :order="order" @cancel="handleCancelOrder"
@pay="handlePayOrder" @tap="goToOrderDetail(order)" />
@pick="handlePickOrder"
@pay="handlePayOrder" @click="goToOrderDetail" />
<view style="margin-top: 200rpx; min-width: 700rpx;"> <view style="margin-top: 200rpx; min-width: 700rpx;">
<uv-empty mode="order" v-if="orderList.length == 0"></uv-empty> <uv-empty mode="order" v-if="orderList.length == 0"></uv-empty>
</view> </view>
@ -191,6 +192,7 @@
} }
// //
// this.getData() // this.getData()
console.log('点击了tab栏', index);
// //
this.filterOrdersByStatus(index) this.filterOrdersByStatus(index)
@ -234,6 +236,7 @@
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确定要取消订单吗?', content: '确定要取消订单吗?',
confirmColor: '#019245',
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
// API // API
@ -283,6 +286,27 @@
} }
} }
}, 1500) }, 1500)
},
//
handlePickOrder(order) {
uni.showModal( {
title: '提示',
content: '确定取餐完成?',
confirmColor: '#019245',
success: (res) => {
if (res.confirm) {
order.status = 'completed',
this.clickTabs({
index: 3
})
uni.showToast({
title: '取餐完成',
icon: 'success',
duration: 2000
})
}
}
})
} }
} }
} }


+ 6
- 34
pages_order/mine/share.vue View File

@ -72,40 +72,12 @@ export default {
// //
saveToLocal() { saveToLocal() {
// //
uni.getSetting({
success: (res) => {
if (!res.authSetting['scope.writePhotosAlbum']) {
uni.authorize({
scope: 'scope.writePhotosAlbum', //
success: () => {
this.saveImage()
},
fail: () => {
//
uni.showModal({
title: '提示',
content: '需要您授权保存图片',
confirmText: '去设置',
confirmColor: '#019245',
success: (res) => {
if (res.confirm) {
uni.openSetting()
}
},
fail: () => {
uni.showToast({
title: '授权失败',
icon: 'none'
})
}
})
}
})
} else {
this.saveImage()
}
}
})
try{
this.$authorize('scope.writePhotosAlbum')
this.saveImage()
} catch (error) {
}
}, },
// //


+ 2
- 1
pages_order/mine/updateUser.vue View File

@ -14,7 +14,8 @@
<!-- 头像选择区域 --> <!-- 头像选择区域 -->
<view class="avatar-section"> <view class="avatar-section">
<button class="chooseAvatar" open-type="chooseAvatar" @chooseavatar="onChooseAvatar"> <button class="chooseAvatar" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<image class="avatar-img" :src="form.headImage" mode="aspectFill"></image>
<image class="avatar-img" :src="form.headImage" mode="aspectFill" />
<!-- <image class="avatar-img" src="https://img.yzcdn.cn/vant/ipad.png" mode="aspectFill"></image> -->
</button> </button>
<text class="avatar-hint">点击更换头像</text> <text class="avatar-hint">点击更换头像</text>
</view> </view>


+ 3
- 0
store/store.js View File

@ -29,6 +29,8 @@ const store = new Vuex.Store({
configList[n.keyName] = n.keyContent; configList[n.keyName] = n.keyContent;
configList[n.keyName + '_keyValue'] = n.keyValue; configList[n.keyName + '_keyValue'] = n.keyValue;
}); });
console.log(configList);
} }
state.configList = configList state.configList = configList
uni.$emit('initConfig', state.configList) uni.$emit('initConfig', state.configList)
@ -57,6 +59,7 @@ const store = new Vuex.Store({
code: res.code, code: res.code,
} }
// 如果通过分享者链接进入小程序时,会将分享者ID存储在本地
if (uni.getStorageSync('shareId')) { if (uni.getStorageSync('shareId')) {
data.shareId = uni.getStorageSync('shareId') data.shareId = uni.getStorageSync('shareId')
} }


+ 3
- 0
utils/authorize.js View File

@ -9,6 +9,7 @@ function authorize(scope){
success, success,
complete(res) { complete(res) {
/* 判断如果没有授权就打开设置选项让用户重新授权 */ /* 判断如果没有授权就打开设置选项让用户重新授权 */
// 获取授权信息
uni.getSetting({ uni.getSetting({
success(res) { success(res) {
if (!res.authSetting[scope]) { if (!res.authSetting[scope]) {
@ -24,10 +25,12 @@ function authorize(scope){
title: '当前操作未授权,请授权!', title: '当前操作未授权,请授权!',
content: '拒绝授权将影响本小程序部分功能的使用', content: '拒绝授权将影响本小程序部分功能的使用',
confirmText: '授权', confirmText: '授权',
confirmColor: '#019245',
success(e) { success(e) {
if(!e.confirm){ if(!e.confirm){
return error() return error()
} }
// 打开小程序设置页 手动设置
uni.openSetting({ uni.openSetting({
success(res) { success(res) {
if (!res.authSetting[scope]) { if (!res.authSetting[scope]) {


+ 0
- 1
utils/index.js View File

@ -1,4 +1,3 @@
import Vue from 'vue' import Vue from 'vue'
import util from './utils.js' import util from './utils.js'


+ 1
- 1
utils/pay.js View File

@ -2,7 +2,7 @@
// #ifdef H5 // #ifdef H5
import jWeixin from './lib/jweixin-module.js' import jWeixin from './lib/jweixin-module.js'
// #endif // #endif
// 这部分是H5端的微信支付!!!!!!
/** /**
* 调用微信支付 * 调用微信支付
* @param {Object} res - 支付参数对象包含appIdtimeStampnonceStr等必要信息 * @param {Object} res - 支付参数对象包含appIdtimeStampnonceStr等必要信息


Loading…
Cancel
Save