123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- <template>
- <view :style="{ minHeight: sys.windowHeight + 'px' }" :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
- <tm-menubars title="分类列表" :shadow="0" :showback="true"></tm-menubars>
- <div class="zhuti">
- <tm-sheet class="kuang" style="padding-bottom: 30px !important;" >
- <view style="width: 94%;margin:0 auto;" class="remen">
- <view v-for="(item,index) in listdata" class="round-5 contone black mt-20" :class="index%2==0?'fl':'fr'" @click="goDetail(item)">
- <image class="logo" :src="item.image" mode="widthFix"></image>
- <view class="pa-15 text-size-s">
- <view class="text-overflow-2">
- <text class="text-size-lg">{{item.goods_name}}</text>
- <view class="text-gray mt-6">销量:{{item.sale_num}}</view>
- </view>
- <view class="mt-2 flex-between flex-center">
- <view class="touxiang mt-30">
- <text class="text-white text-size-m text-weight-b">¥ {{item.sale_price}}</text>
- </view>
- <view >
- <image @click.stop="jiarufuFun(item)" class="remenzan" src="/static/img/86.png" mode="widthFix"></image>
- </view>
- </view>
- </view>
- </view>
- <tm-empty v-if="listdata.length ==0" label="暂无数据" color="white" icon="icon-paperplane-fill"></tm-empty>
- <view style="clear: both;"></view>
- <view style="clear: both;" class="more ma-40 pt-40" @click="gengmore()" v-if="listdata.length<total" >
- <image src="/static/img/30.png" mode="widthFix"></image>
- <text class="text-size-s">下拉加载更多~</text>
- </view>
- </view>
-
- </tm-sheet>
- <view style="height:60px"></view>
- </div>
- <!-- 弹出层消息 -->
- <tm-message ref="toast"></tm-message>
- </view>
- </template>
- <script>
- import{myRequest} from '@/api/request.js'
- export default {
- data() {
- return {
- typeclick:1,
- listdata:{},
- soId:'',
- page:1,
- pagesize:8,
- total:0
- };
- },
- onLoad(op) {
- console.log(op);
- this.soId=op.id
- },
- created() {
- if (!uni.getStorageSync("token")) {
- uni.navigateTo({
- url: "/pages/login/index",
- })
- }
- this.sys = uni.getSystemInfoSync();
- // this.randouh()
- this.getSort()
- },
- methods: {
- // 加载更多
- gengmore(){
- if(this.listdata.length<this.total){
- this.page++;
- this.getSort();
- }else{
- }
- },
- // 加入购物车
- jiarufuFun(data){
- let that=this;
- myRequest({
- url: "/api/ShopCart/addShopCart",
- method:'post',
- data:{
- goods_id:data.id,
- goods_name:data.goods_name,
- goods_image:data.image,
- goods_price:data.sale_price,
- goods_num:1
- }
- }).then(res => {
- if (res.data.code == 200) {
- that.$refs.toast.show({model:'success',label:res.data.msg})
- }else{
- that.$refs.toast.show({model:'error',label:res.data.msg})
- }
- })
- // console.log(data)
- // this.gouwuche.push(data)
- },
- // 获取列表数据
- getSort(){
- let that=this;
- myRequest({
- url:'/api/ShopGoods/childrenClassificationList',
- method:'post',
- data:{id:that.soId,page:that.page,pagesize:that.pagesize}
- }).then(res=>{
- if(res.data.code==200){
- if(res.data.data.length!=0){
- console.log(res.data.data,'liebiao');
- that.total=res.data.data.total;
- that.listdata=res.data.data.data;
- }else{
- that.listdata=[]
- }
- }else{
- that.listdata=[]
- that.$refs.toast.show({
- model: 'error',
- label: res.data.msg
- })
- }
- })
- },
- goindex(){
- uni.navigateBack();
- },
- // 去详情
- goDetail(data){
- uni.navigateTo({
- url:'/pages/shopdetail/index?cartId='+data.id+'&classId='+data.category_id
- })
- },
- change(e){
- console.log(e)
- },
- sosoFun(){
- }
- },
- }
- </script>
- <style lang="scss">
- /deep/ .tm-menubars .body{
- background-color: #1b1b1b !important;
- }
- /deep/ .zhuti{padding: 10px 10px;}
- /deep/ .kuang{margin:0 !important;padding: 0px !important;}
- /deep/ .icon-search{
- font-size: 23px !important;
- color: #8E8E93 !important;
- }
- /deep/ .tm-search{
- width: 66%;
- background-color: #414141 !important;
- border-radius: 10px;
- }
- /deep/ .tm-search .grey-darken-5{
- background-color: #414141 !important;
- }
- .dingwei{width: 21%;margin-top:3%;}
- .shuruk{width: 77%;}
- .sousuo{width:94%;margin:0 auto;}
- .quxiao{color: #707070;line-height: 47px;}
- .contone{width: 48%;}
- .logo{width: 100%;}
- .remenzan{width: 18px !important;margin-top: 10px;}
- .more{text-align: center;}
- .more image{margin-right: 10px;vertical-align: middle;width: 30px;}
- </style>
|