123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <template>
- <view>
- <view class="goodsList animated fadeInDown">
- <view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
- <view class="title">{{ item.shopName }}</view>
- <view class="state" @click.stop="del(item)"><text class="icon del"></text></view>
- <image src="../../../../static/news.jpg" mode="aspectFill" class="pic"></image>
- <view class="con">
- <view class="productName omit">{{ item.goodsName }}</view>
- <view class="desc omit">
- <text>{{ item.netWeight }}</text>
- <text>{{ item.tradeAreaName }}</text>
- </view>
- <view class="price">¥ {{ item.totalPrice }}</view>
- </view>
- <view class="clear"></view>
- <view class="op">
- <view class="date">{{ item.createTime }}</view>
- <view class="an btn" @click.stop="buy(item)">立即购买</view>
- </view>
- </view>
- <u-empty v-if="list.length == 0"></u-empty>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- list: []
- };
- },
- onLoad() {
- this.getData();
- },
- methods: {
- getData() {
- this.http.request({
- url: '/level-one-server/app/TbGoodsCart/getList',
- data: this.param,
- success: res => {
- this.list = res.data.data || [];
- }
- });
- },
- detail(item) {
- uni.navigateTo({ url: '/pages/market/one/detail?id=' + item.publishGoodsId });
- },
- // 立即购买
- buy(item) {
- this.http.request({
- url: '/level-one-server/app/TbGoodsTransit/purchaseLevelOntGoodsTransit',
- data: { goodsTransitId: item.publishGoodsId, goodsCartId: item.id },
- method: 'POST',
- contentType: 'application/json;charset=utf-8',
- success: res => {
- uni.redirectTo({ url: '/pages/market/one/leader/success' });
- }
- });
- },
- del(item) {
- let ids = item.id || this.list.map(i => i.id);
- uni.showModal({
- title: '提示',
- content: item.id ? '确定删除该购物车?' : '清空所有购物车',
- success: res => {
- if (res.confirm) {
- this.http.request({
- url: '/level-one-server/app/TbGoodsCart/cleanCart/' + ids,
- success: res => {
- uni.showToast({ title: '删除成功' });
- this.getData();
- }
- });
- }
- }
- });
- }
- },
- onNavigationBarButtonTap() {
- this.del({});
- }
- };
- </script>
- <style lang="scss">
- page {
- background-color: $pg;
- }
- .date {
- }
- .an {
- padding: 6px 15px;
- font-size: 14px;
- margin-top: 0px !important;
- font-weight: normal !important;
- }
- </style>
|