123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- <template>
- <view class="pages">
- <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
- <view class="product-wrap">
- <uni-swipe-action>
- <view v-for="(item,index) in productlist" :key="index" class="product-item">
-
- <view class="product-item-img-wrap" @click="productclick(item.pmsProduct.id)">
- <image class="product-item-img" :src="$getimg+item.pmsProduct.pic|miniImg(50)" mode="aspectFit"></image>
- </view>
- <view class="product-item-info" @click="productclick(item.pmsProduct.id)">
- <view class="product-item-til">{{item.productName}}</view>
- <view class="product-item-brand">{{item.productBrand}} <text class="postage" v-if="item.postage">包邮</text></view>
- <view class="product-item-addr">{{item.addr}}</view>
- <view class="product-item-company">{{item.companyName}}</view>
- <view class="product-item-price">
- <text class="rmb" v-if="item.pmsProduct.price">¥</text>
- <text class="price" :class="!item.price?'noprice':''">{{item.pmsProduct.price||"暂无价格"}}</text>
- <text v-if="item.pmsProduct.unit">/ {{item.pmsProduct.unit}}</text>
- </view>
- </view>
-
- </view>
- </uni-swipe-action>
- </view>
- </mescroll-body>
- </view>
- </template>
- <script>
-
- import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
-
- import MescrollBody from "@/components/mescroll-uni/mescroll-body.vue";
-
- import uniSwipeAction from '@/components/uni-swipe-action/uni-swipe-action.vue';
- import uniSwipeActionItem from '@/components/uni-swipe-action-item/uni-swipe-action-item.vue';
- export default {
- mixins: [MescrollMixin],
- components: {
- MescrollBody,
- uniSwipeAction,
- uniSwipeActionItem
- },
- data() {
- return {
- mescroll: null,
-
- downOption: {
-
- },
-
- upOption: {
- page: {
- size: 10
- },
- noMoreSize: 5,
- empty: {
- tip: '暂无相关数据'
- }
- },
- params:{
- tokenhead:'',
- token:'',
- },
- productlist:[
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ],
- swipeOptions:[
- {
- text: '删除',
- style: {
- backgroundColor: '#dd524d'
- }
- }
- ],
-
- }
- },
- onShow() {
- let serf = this;
-
-
-
-
- },
- onLoad() {
- let self = this;
- uni.getStorage({
- key:'token',
- success: function (res) {
- self.params.token = res.data;
-
- }
- });
- uni.getStorage({
- key:'tokenhead',
- success: function (res) {
- self.params.tokenhead = res.data;
-
- }
- });
- },
- methods: {
-
- mescrollInit(mescroll) {
- this.mescroll = mescroll;
- },
-
- downCallback(){
-
-
- this.mescroll.resetUpScroll();
- },
-
- upCallback(page) {
- let pageNum = page.num;
- let pageSize = page.size;
- this.params = Object.assign(this.params,{pageNO:pageNum,pageSize:pageSize});
- let thetoken = this.params.tokenhead + this.params.token;
- console.log('thetoken',thetoken);
- this.$api.http.get(this.config.apiBaseurl+'/pre/other',{params:this.params,header: {Authorization:thetoken}}).then(data => {
- console.log('1111111111',data);
- if(data.data.code=='1001'){
-
-
-
- };
- console.log('data',JSON.parse(JSON.stringify(data)));
-
- let curPageData = data.data.data.list;
-
-
- let curPageLen = curPageData.length;
-
- let totalPage =data.data.data.totalPage;
-
- let totalSize = data.data.data.total;
-
-
-
-
-
- if(page.num == 1) this.productlist = [];
- this.productlist = this.productlist.concat(curPageData);
-
- console.log('this.productlist',JSON.parse(JSON.stringify(this.productlist)));
-
-
- this.mescroll.endByPage(curPageLen, totalPage);
-
-
-
-
-
-
-
- }).catch(err => {
- this.mescroll.endErr()
- console.log(err)
-
- });
-
- },
-
- productclick(id){
- uni.navigateTo({
- url:`/pages/product/product?id=${id}`,
- })
- },
-
- changeSwipe(e){
- console.log(e)
-
- },
- delItem(id){
- console.log(id);
- }
- }
- }
- </script>
- <style scoped>
-
-
- </style>
|