Browse Source

调整

master
梁欣 1 year ago
parent
commit
f8edfd8492
  1. 4
      api/category/index.js
  2. 17
      api/shop/navCategory/index.js
  3. 247
      components/page/diyComponents/navBar/index.vue
  4. 3
      components/page/index.vue
  5. 2
      components/shortcut/index.vue
  6. 7
      pages.json
  7. 21
      pages/checkout/index.vue
  8. 1089
      pages/goods/detail.vue
  9. 26
      pages/goods/list.vue
  10. 1815
      pages/index/index.vue
  11. 1647
      pages/order/detail.vue
  12. 1131
      pages/order/extract/check.vue
  13. 244
      pages/shop/list.vue
  14. 8
      pages/user/index.vue
  15. 24
      pages/user/shop/addgoods.vue
  16. 3440
      pages/user/shop/goodsdetail.vue

4
api/category/index.js

@ -12,6 +12,6 @@ export function list(param) {
}
export function shoplist() {
return request.get(api.shoplist)
export function shoplist(param) {
return request.get(api.shoplist, param)
}

17
api/shop/navCategory/index.js

@ -0,0 +1,17 @@
import request from '@/utils/request'
// api地址
const api = {
list: 'shop.navCategory/list',
detail: 'shop.navCategory/detail',
}
// 页面数据
export function list() {
return request.get(api.list)
}
// 页面数据
export function detail(categoryId) {
return request.get(api.detail, {categoryId})
}

247
components/page/diyComponents/navBar/index.vue

@ -1,55 +1,64 @@
<template>
<!-- 导航组 -->
<!-- <view class="diy-navBar" :style="{ background: itemStyle.background, color: itemStyle.textColor }">
<view class="data-list" :class="[`avg-sm-${itemStyle.rowsNum}`]">
<view class="item-nav" v-for="(dataItem, index) in dataList" :key="index">
<view class="nav-to" @click="onLink(dataItem.link)">
<view class="item-image">
<image class="image" mode="widthFix" :src="dataItem.imgUrl"></image>
<!-- 导航组 -->
<!-- <view class="diy-navBar" :style="{ background: itemStyle.background, color: itemStyle.textColor }">
<view class="data-list" :class="[`avg-sm-${itemStyle.rowsNum}`]">
<view class="item-nav" v-for="(dataItem, index) in dataList" :key="index">
<view class="nav-to" @click="onLink(dataItem.link)">
<view class="item-image">
<image class="image" mode="widthFix" :src="dataItem.imgUrl"></image>
</view>
<view class="item-text oneline-hide">{{ dataItem.text }}</view>
</view>
</view>
<view class="item-text oneline-hide">{{ dataItem.text }}</view>
</view>
</view>
</view> -->
<view style="width: 750rpx;">
<uv-scroll-list indicatorColor="#fff0f0" indicatorActiveColor="#7B0373">
<view class="scroll-list">
<view class="scroll-list__line" v-for="(item, index) in dataList" :key="index">
<view class="scroll-list__line__item" @click="onLink(item1.link)" style="width: 120rpx;"
v-for="(item1, index1) in item" :key="index1"
:class="[(index1 === item.length - 1) && 'scroll-list__line__item--no-margin-right']">
<view class="item-image" style="display: flex;justify-content: center;align-items: center;"
:style="{background: showBg ? 'white' : 'transparent' }">
<image class="image" mode="widthFix" :src="item1.imgUrl" :style="{width: size, height: size}"></image>
</view>
<view class="item-text oneline-hide" style="text-align: center;">{{ item1.text }}</view>
</view>
</view>
</view>
</uv-scroll-list>
</view>
</view> -->
<view style="width: 750rpx;">
<uv-scroll-list indicatorColor="#fff0f0" indicatorActiveColor="#7B0373">
<view class="scroll-list">
<view class="scroll-list__line" v-for="(item, index) in dataList" :key="index">
<view class="scroll-list__line__item" @click="onLink(item1.link)" style="width: 120rpx;"
v-for="(item1, index1) in item" :key="index1"
:class="[(index1 === item.length - 1) && 'scroll-list__line__item--no-margin-right']">
<view class="item-image" style="display: flex;justify-content: center;align-items: center;">
<image class="image" mode="widthFix" :src="item1.imgUrl"></image>
</view>
<view class="item-text oneline-hide" style="text-align: center;">{{ item1.text }}</view>
</view>
</view>
</view>
</uv-scroll-list>
</view>
</template>
<script>
import mixin from '../mixin'
import mixin from '../mixin'
export default {
export default {
name: "NavBar",
/**
* 组件的属性列表
* 用于组件自定义设置
*/
props: {
itemIndex: String,
itemStyle: Object,
params: Object,
dataList: Array
itemIndex: String,
itemStyle: Object,
params: Object,
dataList: Array,
showBg: {
type: Boolean,
default: false
},
size: {
type: String,
default: '88rpx'
},
},
mixins: [mixin],
@ -58,90 +67,92 @@
* 组件的方法列表
* 更新属性和数据的方法与更新页面数据的方法类似
*/
methods: {
methods: {}
}
}
}
</script>
<style lang="scss">
@import '@/common/demo.scss';
@import '@/uni_modules/uv-ui-tools/libs/css/color.scss';
.item-text {
font-size: 26rpx;
font-weight: 900;
}
.item-image {
margin-bottom: 4px;
font-size: 0;
}
.item-image .image {
width: 88rpx;
height: 88rpx;
}
.scroll-list {
&__goods-item {
margin-right: 20px;
&__image {
width: 60px;
height: 60px;
border-radius: 4px;
}
&__text {
color: #f56c6c;
text-align: center;
font-size: 12px;
margin-top: 5px;
}
}
&__show-more {
background-color: #fff0f0;
border-radius: 3px;
padding: 3px 6px;
@include flex(column);
align-items: center;
&__text {
font-size: 12px;
width: 12px;
color: #f56c6c;
line-height: 16px;
}
}
&__line {
@include flex;
margin-top: 10px;
&__item {
margin-right: 15px;
&__image {
width: 61px;
height: 48px;
}
&__text {
margin-top: 5px;
color: $uv-content-color;
font-size: 12px;
text-align: center;
}
&--no-margin-right {
margin-right: 0;
}
}
}
}
@import '@/common/demo.scss';
@import '@/uni_modules/uv-ui-tools/libs/css/color.scss';
.item-text {
font-size: 26rpx;
font-weight: 900;
}
.item-image {
font-size: 0;
width: 100rpx;
height: 100rpx;
background-color: white;
border-radius: 999px;
margin: 5px;
}
.item-image .image {
width: 88rpx;
height: 88rpx;
}
.scroll-list {
&__goods-item {
margin-right: 20px;
&__image {
width: 60px;
height: 60px;
border-radius: 4px;
}
&__text {
color: #f56c6c;
text-align: center;
font-size: 12px;
margin-top: 5px;
}
}
&__show-more {
background-color: #fff0f0;
border-radius: 3px;
padding: 3px 6px;
@include flex(column);
align-items: center;
&__text {
font-size: 12px;
width: 12px;
color: #f56c6c;
line-height: 16px;
}
}
&__line {
@include flex;
margin-top: 10px;
&__item {
margin-right: 15px;
&__image {
width: 61px;
height: 48px;
}
&__text {
margin-top: 5px;
color: $uv-content-color;
font-size: 12px;
text-align: center;
}
&--no-margin-right {
margin-right: 0;
}
}
}
}
</style>

3
components/page/index.vue

@ -31,7 +31,8 @@
</block>
<!-- 导航 -->
<block v-if="item.type === 'navBar'">
<NavBar :itemStyle="item.style" :params="item.params" :dataList="item.data" />
<NavBar :itemStyle="item.style" :params="item.params" :dataList="item.data"
:show-bg="index === 0" :size="index === 0 ? '70rpx' : '88rpx'"/>
</block>
<!-- 商品 -->
<block v-if="item.type === 'goods'">

2
components/shortcut/index.vue

@ -24,7 +24,7 @@
default: 20
},
bottom: {
type: Number,
type: Number | String,
default: 100
}
},

7
pages.json

@ -343,6 +343,13 @@
"navigationStyle": "custom"
}
},
{
"path": "pages/shop/list",
"style": {
"navigationBarTitleText": "门店列表",
"navigationStyle": "custom"
}
},
{
"path": "pages/dealer/index",
"style": {

21
pages/checkout/index.vue

@ -107,9 +107,11 @@
<gui-modal ref="guimodal" width="660rpx" :isCloseBtn="false" :title="Articles.title"
:canCloseByShade='false' v-if="Articles">
<template v-slot:content>
<scroll-view scroll-y :style="{height:contentHeight+'px'}" class="gui-bg-gray gui-dark-bg-level-2">
<mp-html :content="Articles.content" />
</scroll-view>
<view style="padding: 0 20rpx" class="gui-bg-gray">
<scroll-view scroll-y :style="{height:contentHeight+'px'}" class="gui-bg-gray gui-dark-bg-level-2">
<mp-html :content="Articles.content" />
</scroll-view>
</view>
</template>
<template v-slot:btns>
<view class="gui-flex gui-row gui-space-between">
@ -310,9 +312,8 @@
options: {},
//
isShowTab: false,
DeliveryTypeEnum,
curDelivery: null,
contentHeight: 300,
contentHeight: 400,
//
selectedShopId: 0, // ID
linkman: '', //
@ -337,8 +338,6 @@
goodsList: [],
//
couponList: [],
//
existAddress: false,
//
address: null,
//
@ -357,7 +356,7 @@
fwxydetail: '',
yszcdetail: '',
Articles: '',
radiochecked: false
radiochecked: true
}
},
@ -366,6 +365,8 @@
*/
onLoad(options) {
this.options = options
const {screenHeight} = uni.getSystemInfoSync()
this.contentHeight = screenHeight * 0.65;
// :
uni.$on('syncSelectedId', selectedId => {
this.selectedShopId = selectedId
@ -388,10 +389,6 @@
//
this.getOrderData()
},
mounted: function() {
var systemInfo = graceJS.system();
this.contentHeight = systemInfo.windowHeight * 0.65;
},
methods: {
radioChange() {
this.radiochecked = !this.radiochecked

1089
pages/goods/detail.vue

File diff suppressed because it is too large

26
pages/goods/list.vue

@ -32,7 +32,7 @@
</view>
</view>
</view>
<scroll-view scroll-x>
<scroll-view scroll-x v-if="childCategoryList.length > 1">
<view class="cate-filter">
<u-tag text="全部分类" shape="circle"
@click="changeCategory('all')"
@ -188,7 +188,7 @@ export default {
//
upOption: {
//
auto: true,
auto: false,
// ; 10
page: {
size: pageSize
@ -211,6 +211,7 @@ export default {
// options
this.options = options
await this.getChildCategory(options.categoryId)
this.list.data = []
//
this.setShowView()
@ -227,6 +228,7 @@ export default {
}).then(res => {
this.childCategoryList = res.data.list
this.selectedCategoryList = this.childCategoryList.map(item => parseInt(item.category_id))
console.log(1)
resolve()
})
})
@ -240,13 +242,16 @@ export default {
upCallback(page) {
const app = this
//
app.getGoodsList(page.num)
.then(list => {
const curPageLen = list.data.length
const totalSize = list.data.total
app.mescroll.endBySize(curPageLen, totalSize)
})
.catch(() => app.mescroll.endErr())
console.log(2)
if (this.selectedCategoryList.length > 0) {
app.getGoodsList(page.num)
.then(list => {
const curPageLen = list.data.length
const totalSize = list.data.total
app.mescroll.endBySize(curPageLen, totalSize)
})
.catch(() => app.mescroll.endErr())
}
},
//
@ -303,6 +308,9 @@ export default {
//
const newList = result.data.list
app.list.data = getMoreListData(newList, app.list, pageNo)
const curPageLen = newList.data.length
const totalSize = result.data.total
app.mescroll.endBySize(curPageLen, totalSize)
resolve(newList)
})
.catch(reject)

1815
pages/index/index.vue

File diff suppressed because it is too large

1647
pages/order/detail.vue

File diff suppressed because it is too large

1131
pages/order/extract/check.vue

File diff suppressed because it is too large

244
pages/shop/list.vue

@ -0,0 +1,244 @@
<template>
<view class="container" :style="appThemeStyle">
<mescroll-body ref="mescrollRef" :sticky="true" :down="{ native: true }" :up="upOption">
<!-- 页面头部 -->
<view class="header">
<u-search class="search" v-model="keyword" :placeholder="options.search ? options.search : '搜索店铺'"
@search="getShopList" @custom="getShopList" @clear="getShopList"/>
</view>
<scroll-view scroll-x v-if="cateList.length > 1">
<view class="cate-filter">
<u-tag text="全部分类" shape="circle"
@click="changeCategory('all')"
:bgColor="selectedCategoryList.length === cateList.length ? '#9e1a91' : 'transparent'"
:color="selectedCategoryList.length === cateList.length ? 'white' : '#9e1a91'"
borderColor="#9e1a91"/>
<u-tag :text="item.name" shape="circle" plain v-for="(item, index) in cateList"
:key="index"
@click="changeCategory(item.category_id)"
:bgColor="(selectedCategoryList.length === 1 && selectedCategoryList[0] === item.category_id) ? '#9e1a91' : 'transparent'"
:color="(selectedCategoryList.length === 1 && selectedCategoryList[0] === item.category_id) ? 'white' : '#9e1a91'"
borderColor="#9e1a91"/>
</view>
</scroll-view>
<view class="shop-item" v-for="(item, index) in list.data" :key="index" @click="toDetail(item.shop_id)">
<image :src="item.logo_url" mode="aspectFill"/>
<view class="content">
<text class="title">{{ item.shop_name }}</text>
<view class="cate">
<text class="tips">{{ item.category.name }}</text>
<text class="tips">营业时间:{{ item.shop_hours }}</text>
</view>
<view class="score">
<u-rate size="25" active-color="#f4a213" :current="item.score" :disabled="true"/>
<view style="font-size: 25rpx;">{{ item.comment_count }}人评价</view>
</view>
<view class="address">
<text class="tips">{{ item.full_address }}</text>
<view class="sales-wrap">
<text>销量: {{ item.goods_sales }}</text>
<text>距离: {{ item.distance }}km</text>
</view>
</view>
</view>
</view>
</mescroll-body>
</view>
</template>
<script>
import * as CategoryApi from '@/api/shop/navCategory/index'
import * as ShopApi from '@/api/shop'
import MescrollBody from '@/components/mescroll-uni/mescroll-body.vue'
import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins'
import Search from '@/components/search'
import {
getEmptyPaginateObj,
getMoreListData
} from '@/core/app'
const pageSize = 15
export default {
name: "list",
components: {
MescrollBody,
Search,
},
mixins: [MescrollMixin],
data() {
return {
cateList: [],
selectedCategoryList: [],
upOption: {
//
auto: true,
// ; 10
page: {
size: pageSize
},
// 4
noMoreSize: 4,
},
list: getEmptyPaginateObj(),
keyword: '',
latitude: '',
longitude: '',
}
},
async onLoad(options) {
this.options = options
// await this.getLocation()
await this.getChildCategory(options.shopId)
await this.getShopList(1)
},
methods: {
async getChildCategory(categoryId) {
const {data: {detail}} = await CategoryApi.detail(categoryId)
this.cateList = JSON.parse(detail.shop_category_list)
this.selectedCategoryList = this.cateList.map(item => parseInt(item.category_id))
},
getShopList() {
const app = this
ShopApi.list({
category_list: this.selectedCategoryList.join(),
keyword: this.keyword,
latitude: this.latitude,
longitude: this.longitude,
}).then(result => {
app.list.data = result.data.list
console.log(app.list.data)
app.mescroll.endBySize(app.list.data.length, app.list.data.length)
})
.catch(() => this.mescroll.endErr())
},
upCallback(page) {
const app = this
//
ShopApi.list({
category_list: this.selectedCategoryList.join()
}).then(list => {
app.mescroll.endBySize(app.list.data.length, app.list.data.length)
})
.catch(() => this.mescroll.endErr())
},
handleSearch() {
},
changeCategory(cateId) {
if (cateId === 'all') this.selectedCategoryList = this.cateList.map(item => parseInt(item.category_id))
else this.selectedCategoryList = [parseInt(cateId)]
this.getShopList()
},
toDetail(shopId) {
this.$navTo('pages/shop/detail', {
shopId
})
},
getLocation() {
const _this = this
return new Promise((resolve, reject) => {
uni.getLocation({
type: 'wgs84',
success: (res) => {
resolve(res)
},
fail() {
reject()
_this.$toast('获取定位失败,请点击右下角按钮重新尝试定位')
},
complete: res => {
console.log(res)
}
})
})
},
}
}
</script>
<style scoped lang="scss">
.header {
padding: 20rpx;
}
.cate-filter {
padding: 20rpx 8rpx;
display: flex;
align-items: center;
justify-content: flex-start;
* {
margin-right: 10rpx;
flex-shrink: 0;
}
}
.shop-item {
background-color: white;
border-radius: 30rpx;
padding: 20rpx;
display: flex;
align-items: center;
justify-content: flex-start;
margin: 20rpx;
image {
width: 140rpx;
height: 140rpx;
border-radius: 20rpx;
margin-right: 15rpx;
flex-shrink: 0;
}
.content {
display: flex;
align-items: flex-start;
justify-content: flex-start;
flex-direction: column;
.title {
font-size: 30rpx;
font-weight: bold;
}
.tips {
font-size: 25rpx;
color: gray;
margin: 5rpx 0;
}
.score {
display: flex;
align-items: center;
justify-content: flex-start;
}
.cate {
display: flex;
align-items: center;
justify-content: flex-start;
:first-child {
margin-right: 15rpx;
}
}
.address {
display: flex;
align-items: center;
justify-content: space-between;
.sales-wrap {
display: flex;
align-items: flex-start;
justify-content: flex-end;
flex-direction: column;
margin-left: 15rpx;
font-size: 25rpx;
flex-shrink: 0;
color: #ef0021;
}
}
}
}
</style>

8
pages/user/index.vue

@ -120,10 +120,10 @@
</view>
<view v-if="isLogin" @click="handleLogout()"
style="font-size: 18px;width: 90%;text-align: center;padding: 20rpx 0;text-align: center;background: linear-gradient(to top, #0E001F, #7B0373 );margin: 200rpx auto 0 ;color: #fff;border-radius: 40rpx;">
退出登录
</view>
<!-- <view v-if="isLogin" @click="handleLogout()"-->
<!-- style="font-size: 18px;width: 90%;text-align: center;padding: 20rpx 0;text-align: center;background: linear-gradient(to top, #0E001F, #7B0373 );margin: 200rpx auto 0 ;color: #fff;border-radius: 40rpx;">-->
<!-- 退出登录-->
<!-- </view>-->
</view>
<view slot="gFooter" class="gui-flex gui-rows gui-nowrap gui-space-between gui-align-items-end"
style="background: linear-gradient(to top, #0E001F, #7B0373 );padding-bottom: 100rpx;">

24
pages/user/shop/addgoods.vue

@ -239,12 +239,12 @@
<mp-html :content="spxq" />
</view>
<view class="gui-margin-top" style="padding: 0 120rpx;">
<gui-radio @change="radioChange" :checked="radiochecked">
<text class="gui-text " style="color: #9e9e9e;">我已阅读并同意<text style="color: #b53190;"
@click="onagreement">商家入驻协议</text></text>
</gui-radio>
</view>
<!-- <view class="gui-margin-top" style="padding: 0 120rpx;">-->
<!-- <gui-radio @change="radioChange" :checked="radiochecked">-->
<!-- <text class="gui-text " style="color: #9e9e9e;">我已阅读并同意<text style="color: #b53190;"-->
<!-- @click="onagreement">商家入驻协议</text></text>-->
<!-- </gui-radio>-->
<!-- </view>-->
<view class=" gui-flex gui-rows gui-nowrap gui-justify-content-end">
<button type="default" class="gui-button gui-bg-blue"
style="width: 90%;text-align: center;padding: 0rpx 0;text-align: center;background: linear-gradient(to bottom, #90178b, #590b6e);margin: 80rpx auto 0;color: #fff;border-radius: 40rpx;"
@ -454,7 +454,7 @@
let _this = this
CategoryApi.shoplist()
.then(result => {
_this.dataSource = result.data.list
_this.dataSource = result.data.list.filter(item => item.parent_id === 0)
_this.getAllClassify()
})
@ -465,7 +465,7 @@
for (let i = 0; i < dataLen; i++) {
// push childArr
this.childArr.push(this.dataSource[i].children)
this.childArr.push(this.dataSource[i].children)
};
//
@ -837,10 +837,10 @@
app.$toast('请编辑商品详情')
return false
}
if (!app.radiochecked) {
app.$toast('请阅读协议')
return false
}
// if (!app.radiochecked) {
// app.$toast('')
// return false
// }
const imagesLength = app.getImagesLength()
if (imagesLength == 0) {
app.$toast('请上传商品图片')

3440
pages/user/shop/goodsdetail.vue

File diff suppressed because it is too large
Loading…
Cancel
Save