123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <template>
- <view class="goods main-bg">
- <view class="header font-color2 font-thirty" @click="goto">添加商品</view>
- <view class="title font-color3 font-thirty-two" v-if="list.length > 0">当前主营商品</view>
- <view class="list" v-if="list.length > 0">
- <view class="item" v-for="item in list" @click="handleGoods(item)">
- <image class="img" :src="image(item.goodsPic)"></image>
- <view class="name font-color3 font-twenty ellipsis">{{ item.goodsName }}</view>
- <view class="jia ellipsis">
- <span class="yuan font-color2 font-twenty">¥{{ item.goodsRatePrice }}</span>
- <!-- <span class="hui font-color5 font-twenty-four">惠军价: ¥{{ item.goodsPrice }}</span> -->
- </view>
- </view>
- </view>
- <view class="empty" v-else>
- <u-empty text="暂无商品" mode="list"></u-empty>
- </view>
- <u-tabbar :list="tabBarList" :active-color="activeColor" :inactive-color="inactiveColor"
- :border-top="borderTop"></u-tabbar>
- </view>
- </template>
- <script>
- import server from "@/api/index";
- import { mapGetters } from 'vuex'
- import http from '@/common/http.js'
- export default {
- data() {
- return {
- borderTop: false,
- inactiveColor: '#ccc',
- activeColor: '#2E4F1C',
- list:[],
- userInfo: {}
- }
- },
- computed: {
- ...mapGetters([
- 'tabBarList',
- 'role'
- ])
- },
- onLoad() {
- setTimeout(function () {
- }, 1000);
- uni.startPullDownRefresh();
- },
- onPullDownRefresh() {
- this.userInfo = uni.getStorageSync('userInfo');
- this.getListFn(this.userInfo.nickName);
- setTimeout(function () {
- uni.stopPullDownRefresh();
- }, 1000);
- },
- onShow() {
- this.userInfo = uni.getStorageSync('userInfo');
- this.getListFn(this.userInfo.nickName);
- },
- methods:{
- handleGoods(item){
- uni.navigateTo({
- url: '/pages/merchant/goods/add?id='+ item.goodsId
- })
- },
- image(e) {
- return http.webUrl + e
- },
- getListFn(id){
- server.getGoodsInfo({shopsId: id, goodsStatus :'2'}).then(res =>{
- this.list = [];
- if(res){
- this.list = res
- }
- })
- },
- goto(){
- uni.navigateTo({
- url: '/pages/merchant/goods/add'
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .goods{
- width: 100%;
- height: auto;
- min-height: 100vh;
- padding: 30rpx;
- .header{
- width: 100%;
- height: 96rpx;
- line-height: 96rpx;
- border-radius: 48rpx;
- text-align: center;
- border: 1rpx solid #2E4F1C;
- font-weight: 600;
- }
- .title{
- height: 115rpx;
- line-height: 115rpx;
- }
- .empty{
- padding-top: 200rpx;
- }
- .list{
- width: 100%;
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- .item{
- width: calc(50% - 15rpx);
- height: 370rpx;
- margin-bottom: 30rpx;
- background: #FFFFFF;
- .img{
- width: 100%;
- height: 228rpx;
- }
- .name{
- width: calc(100% - 30rpx);
- padding-left: 30rpx;
- height: 85rpx;
- line-height: 85rpx;
- }
- .jia{
- width: calc(100% - 30rpx);
- padding-left: 20rpx;
- }
- .hui{
- padding-left: 20rpx;
- }
- }
- }
- }
- </style>
|