Эх сурвалжийг харах

Merge branch 'vue3_tmp' of https://gitee.com/huizhizao/yudao-mall-uniapp into master-vue3

# Conflicts:
#	pages.json
#	pages/goods/list.vue
#	pages/order/list.vue
#	sheep/api/order.js
#	sheep/api/trade/order.js
#	sheep/hooks/useGoods.js
YunaiV 1 жил өмнө
parent
commit
4e85f86529
46 өөрчлөгдсөн 4051 нэмэгдсэн , 3992 устгасан
  1. 1 1
      App.vue
  2. 545 504
      pages/app/sign.vue
  3. 306 328
      pages/coupon/detail.vue
  4. 12 18
      pages/coupon/list.vue
  5. 155 149
      pages/goods/components/detail/detail-tabbar.vue
  6. 39 103
      pages/goods/index.vue
  7. 331 362
      pages/goods/list.vue
  8. 193 213
      pages/index/cart.vue
  9. 30 31
      pages/index/user.vue
  10. 215 0
      pages/order/aftersale/eturn-delivery.vue
  11. 407 381
      pages/order/confirm.vue
  12. 124 54
      pages/pay/index.vue
  13. 256 238
      pages/pay/recharge.vue
  14. 59 61
      pages/pay/result.vue
  15. 8 1
      pages/user/address/edit.vue
  16. 61 40
      sheep/api/activity.js
  17. 3 5
      sheep/api/app.js
  18. 9 22
      sheep/api/cart.js
  19. 9 7
      sheep/api/category.js
  20. 4 14
      sheep/api/coupon.js
  21. 22 21
      sheep/api/data.js
  22. 75 79
      sheep/api/goods.js
  23. 12 12
      sheep/api/index2.js
  24. 52 26
      sheep/api/order.js
  25. 0 14
      sheep/api/pay/channel.js
  26. 0 22
      sheep/api/pay/order.js
  27. 14 15
      sheep/api/product/comment.js
  28. 11 11
      sheep/api/promotion/activity.js
  29. 57 59
      sheep/api/promotion/combination.js
  30. 0 13
      sheep/api/promotion/coupon.js
  31. 26 37
      sheep/api/promotion/seckill.js
  32. 42 33
      sheep/api/trade.js
  33. 0 47
      sheep/api/trade/cart.js
  34. 0 85
      sheep/api/trade/order.js
  35. 123 45
      sheep/api/user.js
  36. 102 98
      sheep/components/s-coupon-get/s-coupon-get.vue
  37. 6 2
      sheep/components/s-coupon-list/s-coupon-list.vue
  38. 7 17
      sheep/components/s-coupon-select/s-coupon-select.vue
  39. 1 2
      sheep/components/s-goods-item/s-goods-item.vue
  40. 169 173
      sheep/components/s-share-modal/s-share-modal.vue
  41. 33 99
      sheep/platform/pay.js
  42. 1 3
      sheep/request2/index.js
  43. 2 2
      sheep/store/app.js
  44. 54 49
      sheep/store/cart.js
  45. 473 492
      uni_modules/mp-html/components/mp-html/parser.js
  46. 2 4
      vite.config.js

+ 1 - 1
App.vue

@@ -33,7 +33,7 @@
 		// #endif
 
 		// #ifdef MP-WEIXIN
-		// 确认收货回调结果
+		// 确认收货回调结果 
 		console.log(options, 'options');
 		// #endif
 

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 545 - 504
pages/app/sign.vue


+ 306 - 328
pages/coupon/detail.vue

@@ -1,372 +1,350 @@
 <!-- 优惠券详情  -->
 <template>
-  <s-layout title="优惠券详情">
-    <view class="bg-white">
-      <!-- 详情卡片 -->
-      <view class="detail-wrap ss-p-20">
-        <view class="detail-box">
-          <view class="tag-box ss-flex ss-col-center ss-row-center">
-            <image
-              class="tag-image"
-              :src="sheep.$url.static('/static/img/shop/app/coupon_icon.png')"
-              mode="aspectFit"
-            ></image>
-          </view>
-          <view class="top ss-flex-col ss-col-center">
-            <view class="title ss-m-t-50 ss-m-b-20 ss-m-x-20">{{ state.list.name }}</view>
-            <view class="subtitle ss-m-b-50">{{ state.list.amount_text }}</view>
-            <button
-              class="ss-reset-button ss-m-b-30"
-              :class="
+	<s-layout title="优惠券详情">
+		<view class="bg-white">
+			<!-- 详情卡片 -->
+			<view class="detail-wrap ss-p-20">
+				<view class="detail-box">
+					<view class="tag-box ss-flex ss-col-center ss-row-center">
+						<image class="tag-image" :src="sheep.$url.static('/static/img/shop/app/coupon_icon.png')"
+							mode="aspectFit"></image>
+					</view>
+					<view class="top ss-flex-col ss-col-center">
+						<view class="title ss-m-t-50 ss-m-b-20 ss-m-x-20">{{ state.list.name }}</view>
+						<view class="subtitle ss-m-b-50">满{{ state.list.enough }}减{{ state.list.amount }}</view>
+						<!-- (state.list.get_status != 'can_get' && state.list.get_status != 'can_use') ||
+						 state.userCouponId -->
+						<button class="ss-reset-button ss-m-b-30" :class="
                 state.list.get_status == 'can_get' || state.list.get_status == 'can_use'
                   ? 'use-btn'
-                  : 'disable-btn'
-              "
-              :disabled="
-                (state.list.get_status != 'can_get' && state.list.get_status != 'can_use') ||
-                state.userCouponId
-              "
-              @click="getCoupon"
-            >
-              {{ state.list.get_status_text }}
-            </button>
-            <view
-              class="time ss-m-y-30"
-              v-if="
+                  : 'disable-btn' " :disabled="state.list.status_text=='已过期'" @click="getCoupon">
+							<!-- {{ state.list.get_status_text }} -->
+							立即使用
+						</button>
+						<view class="time ss-m-y-30" v-if="
                 state.list.get_status == 'can_get' ||
                 state.list.get_status == 'cannot_get' ||
                 state.list.get_status == 'get_over'
-              "
-            >
-              领取时间:{{ state.list.get_start_time }}至{{ state.list.get_end_time }}
-            </view>
-            <view class="time ss-m-y-30" v-else>
-              有效期:{{ state.list.use_start_time }}至{{ state.list.use_end_time }}
-            </view>
-            <view class="coupon-line ss-m-t-14"></view>
-          </view>
-          <view class="bottom">
-            <view class="type ss-flex ss-col-center ss-row-between ss-p-x-30">
-              <view>优惠券类型</view>
-              <view>{{ state.list.type_text }}</view>
-            </view>
-            <uni-collapse>
-              <uni-collapse-item title="优惠券说明" v-if="state.list.description">
-                <view class="content ss-p-b-20">
-                  <text class="des ss-p-l-30">{{ state.list.description }}</text>
-                </view>
-              </uni-collapse-item>
-            </uni-collapse>
-          </view>
-        </view>
-      </view>
-      <!-- 适用商品 -->
-      <view
-        class="all-user ss-flex ss-row-center ss-col-center"
-        v-if="state.list.use_scope == 'all_use'"
-      >
-        {{ state.list.use_scope_text }}
-      </view>
+              ">
+							领取时间:{{ state.list.get_start_time }}至{{ state.list.get_end_time }}
+						</view>
+						<view class="time ss-m-y-30" v-else>
+							有效期:{{ state.list.use_start_time }}至{{ state.list.use_end_time }}
+						</view>
+						<view class="coupon-line ss-m-t-14"></view>
+					</view>
+					<view class="bottom">
+						<view class="type ss-flex ss-col-center ss-row-between ss-p-x-30">
+							<view>优惠券类型</view>
+							<view>{{ state.list.type_text }}</view>
+						</view>
+						<uni-collapse>
+							<uni-collapse-item title="优惠券说明" v-if="state.list.description">
+								<view class="content ss-p-b-20">
+									<text class="des ss-p-l-30">{{ state.list.description }}</text>
+								</view>
+							</uni-collapse-item>
+						</uni-collapse>
+					</view>
+				</view>
+			</view>
+			<!-- 适用商品 -->
+			<view class="all-user ss-flex ss-row-center ss-col-center" v-if="state.list.use_scope == 'all_use'">
+				{{ state.list.use_scope_text }}
+			</view>
 
-      <su-sticky v-else bgColor="#fff">
-        <view class="goods-title ss-p-20">{{ state.list.use_scope_text }}</view>
-        <su-tabs
-          :scrollable="true"
-          :list="state.tabMaps"
-          @change="onTabsChange"
-          :current="state.currentTab"
-          v-if="state.list.use_scope == 'category'"
-        ></su-tabs>
-      </su-sticky>
-      <view v-if="state.list.use_scope == 'goods' || state.list.use_scope == 'disabled_goods'">
-        <view v-for="(item, index) in state.list.items_value" :key="index">
-          <s-goods-column
-            class="ss-m-20"
-            size="lg"
-            :data="item"
-            :titleColor="props.goodsFieldsStyle?.title?.color"
-            :subTitleColor="props.goodsFieldsStyle?.subtitle?.color"
-            @click="sheep.$router.go('/pages/goods/index', { id: item.id })"
-            :goodsFields="{
+			<su-sticky v-else bgColor="#fff">
+				<view class="goods-title ss-p-20">{{ state.list.use_scope_text }}</view>
+				<su-tabs :scrollable="true" :list="state.tabMaps" @change="onTabsChange" :current="state.currentTab"
+					v-if="state.list.use_scope == 'category'"></su-tabs>
+			</su-sticky>
+			<view v-if="state.list.use_scope == 'goods' || state.list.use_scope == 'disabled_goods'">
+				<view v-for="(item, index) in state.list.items_value" :key="index">
+					<s-goods-column class="ss-m-20" size="lg" :data="item"
+						:titleColor="props.goodsFieldsStyle?.title?.color"
+						:subTitleColor="props.goodsFieldsStyle?.subtitle?.color"
+						@click="sheep.$router.go('/pages/goods/index', { id: item.id })" :goodsFields="{
               title: { show: true },
               subtitle: { show: true },
               price: { show: true },
               original_price: { show: true },
               sales: { show: true },
               stock: { show: false },
-            }"
-            :buttonShow="state.list.use_scope != 'disabled_goods'"
-          ></s-goods-column>
-        </view>
-      </view>
-      <view v-if="state.list.use_scope == 'category'">
-        <view v-for="(item, index) in state.pagination.data" :key="index">
-          <s-goods-column
-            class="ss-m-20"
-            size="lg"
-            :data="item"
-            :titleColor="props.goodsFieldsStyle?.title?.color"
-            :subTitleColor="props.goodsFieldsStyle?.subtitle?.color"
-            @click="sheep.$router.go('/pages/goods/index', { id: item.id })"
-            :goodsFields="{
+            }" :buttonShow="state.list.use_scope != 'disabled_goods'"></s-goods-column>
+				</view>
+			</view>
+			<view v-if="state.list.use_scope == 'category'">
+				<view v-for="(item, index) in state.pagination.data" :key="index">
+					<s-goods-column class="ss-m-20" size="lg" :data="item"
+						:titleColor="props.goodsFieldsStyle?.title?.color"
+						:subTitleColor="props.goodsFieldsStyle?.subtitle?.color"
+						@click="sheep.$router.go('/pages/goods/index', { id: item.id })" :goodsFields="{
               title: { show: true },
               subtitle: { show: true },
               price: { show: true },
               original_price: { show: true },
               sales: { show: true },
               stock: { show: false },
-            }"
-            :buttonShow="state.list.use_scope != 'disabled_goods'"
-          ></s-goods-column>
-        </view>
-      </view>
-      <uni-load-more
-        v-if="state.pagination.total > 0 && state.list.use_scope == 'category'"
-        :status="state.loadStatus"
-        :content-text="{
+            }" :buttonShow="state.list.use_scope != 'disabled_goods'"></s-goods-column>
+				</view>
+			</view>
+			<uni-load-more v-if="state.pagination.total > 0 && state.list.use_scope == 'category'"
+				:status="state.loadStatus" :content-text="{
           contentdown: '上拉加载更多',
-        }"
-        @tap="loadmore"
-      />
-      <s-empty
-        v-if="state.list.use_scope == 'category' && state.pagination.total === 0"
-        paddingTop="0"
-        icon="/static/soldout-empty.png"
-        text="暂无商品"
-      >
-      </s-empty>
-    </view>
-  </s-layout>
+        }" @tap="loadmore" />
+			<s-empty v-if="state.list.use_scope == 'category' && state.pagination.total === 0" paddingTop="0"
+				icon="/static/soldout-empty.png" text="暂无商品">
+			</s-empty>
+		</view>
+	</s-layout>
 </template>
 
 <script setup>
-  import sheep from '@/sheep';
-  import { onLoad, onReachBottom } from '@dcloudio/uni-app';
-  import { reactive } from 'vue';
-  import _ from 'lodash';
+	import sheep from '@/sheep';
+	import {
+		onLoad,
+		onReachBottom
+	} from '@dcloudio/uni-app';
+	import {
+		reactive
+	} from 'vue';
+	import _ from 'lodash';
 
-  const pagination = {
-    data: [],
-    current_page: 1,
-    total: 1,
-    last_page: 1,
-  };
-  const state = reactive({
-    list: {},
-    couponId: 0,
-    userCouponId: 0,
-    pagination: {
-      data: [],
-      current_page: 1,
-      total: 1,
-      last_page: 1,
-    },
-    tabMaps: [],
-    loadStatus: '',
-    categoryId: 0,
-  });
+	const pagination = {
+		data: [],
+		current_page: 1,
+		total: 1,
+		last_page: 1,
+	};
+	const state = reactive({
+		list: {},
+		couponId: 0,
+		userCouponId: 0,
+		pagination: {
+			data: [],
+			current_page: 1,
+			total: 1,
+			last_page: 1,
+		},
+		tabMaps: [],
+		loadStatus: '',
+		categoryId: 0,
+	});
 
-  // 接收参数
-  const props = defineProps({
-    includes: {
-      type: Array,
-      default() {
-        return [];
-      },
-    },
-    list: {
-      type: Array,
-      default: () => [],
-    },
-    goodsFieldsStyle: {
-      type: Object,
-      default() {},
-    },
-    buyData: {
-      type: Object,
-      default() {},
-    },
-  });
+	// 接收参数
+	const props = defineProps({
+		includes: {
+			type: Array,
+			default () {
+				return [];
+			},
+		},
+		list: {
+			type: Array,
+			default: () => [],
+		},
+		goodsFieldsStyle: {
+			type: Object,
+			default () {},
+		},
+		buyData: {
+			type: Object,
+			default () {},
+		},
+	});
 
-  function onTabsChange(e) {
-    state.pagination = pagination;
-    state.currentTab = e.index;
-    state.categoryId = e.value;
-    getGoodsList(state.categoryId);
-  }
-  async function getGoodsList(categoryId, page = 1, list_rows = 5) {
-    state.loadStatus = 'loading';
-    const res = await sheep.$api.goods.list({
-      category_id: categoryId,
-      list_rows,
-      page,
-      is_category_deep: false,
-    });
-    if (res.error === 0) {
-      let couponlist = _.concat(state.pagination.data, res.data.data);
-      state.pagination = {
-        ...res.data,
-        data: couponlist,
-      };
-      if (state.pagination.current_page < state.pagination.last_page) {
-        state.loadStatus = 'more';
-      } else {
-        state.loadStatus = 'noMore';
-      }
-    }
-  }
-  async function getCoupon() {
-    const { error, msg } = await sheep.$api.coupon.get(state.couponId);
-    if (error === 0) {
-      uni.showToast({
-        title: msg,
-      });
-      setTimeout(() => {
-        getCouponContent(state.couponId, state.userCouponId);
-      }, 1000);
-    }
-  }
-  async function getCouponContent(id, c) {
-    const { data } = await sheep.$api.coupon.detail(id, c);
-    state.list = data;
-    data.items_value.forEach((i) => {
-      state.tabMaps.push({ name: i.name, value: i.id });
-    });
-    state.pagination = pagination;
-    if (state.list.use_scope == 'category') {
-      getGoodsList(state.tabMaps[0].value);
-    }
-  }
-  // 加载更多
-  function loadmore() {
-    if (state.loadStatus !== 'noMore') {
-      getGoodsList(state.categoryId, state.pagination.current_page + 1);
-    }
-  }
-  onLoad((options) => {
-    state.couponId = options.id;
-    state.userCouponId = options.user_coupon_id;
-    getCouponContent(state.couponId, state.userCouponId);
-  });
-  // 上拉加载更多
-  onReachBottom(() => {
-    loadmore();
-  });
+	function onTabsChange(e) {
+		state.pagination = pagination;
+		state.currentTab = e.index;
+		state.categoryId = e.value;
+		getGoodsList(state.categoryId);
+	}
+	async function getGoodsList(categoryId, page = 1, list_rows = 5) {
+		state.loadStatus = 'loading';
+		const res = await sheep.$api.goods.list({
+			category_id: categoryId,
+			list_rows,
+			page,
+			is_category_deep: false,
+		});
+		if (res.error === 0) {
+			let couponlist = _.concat(state.pagination.data, res.data.data);
+			state.pagination = {
+				...res.data,
+				data: couponlist,
+			};
+			if (state.pagination.current_page < state.pagination.last_page) {
+				state.loadStatus = 'more';
+			} else {
+				state.loadStatus = 'noMore';
+			}
+		}
+	}
+	async function getCoupon() {
+		const {
+			error,
+			msg
+		} = await sheep.$api.coupon.get(state.couponId);
+		if (error === 0) {
+			uni.showToast({
+				title: msg,
+			});
+			setTimeout(() => {
+				getCouponContent(state.couponId, state.userCouponId);
+			}, 1000);
+		}
+	}
+	async function getCouponContent(id, c) {
+		const {
+			data
+		} = await sheep.$api.coupon.detail(id, c);
+		state.list = data;
+		data.items_value.forEach((i) => {
+			state.tabMaps.push({
+				name: i.name,
+				value: i.id
+			});
+		});
+		state.pagination = pagination;
+		if (state.list.use_scope == 'category') {
+			getGoodsList(state.tabMaps[0].value);
+		}
+	}
+	// 加载更多
+	function loadmore() {
+		if (state.loadStatus !== 'noMore') {
+			getGoodsList(state.categoryId, state.pagination.current_page + 1);
+		}
+	}
+	onLoad((options) => {
+		if (options.data) {
+			let data = JSON.parse(options.data);
+			console.log(data);
+			state.list = data;
+			return;
+		}
+		state.couponId = options.id;
+		state.userCouponId = options.user_coupon_id;
+		getCouponContent(state.couponId, state.userCouponId);
+	});
+	// 上拉加载更多
+	onReachBottom(() => {
+		loadmore();
+	});
 </script>
 
 <style lang="scss" scoped>
-  .goods-title {
-    font-size: 34rpx;
-    font-weight: bold;
-    color: #333333;
-  }
+	.goods-title {
+		font-size: 34rpx;
+		font-weight: bold;
+		color: #333333;
+	}
 
-  .detail-wrap {
-    background: linear-gradient(
-      180deg,
-      var(--ui-BG-Main),
-      var(--ui-BG-Main-gradient),
-      var(--ui-BG-Main),
-      #fff
-    );
-  }
+	.detail-wrap {
+		background: linear-gradient(180deg,
+				var(--ui-BG-Main),
+				var(--ui-BG-Main-gradient),
+				var(--ui-BG-Main),
+				#fff);
+	}
 
-  .detail-box {
-    // background-color: var(--ui-BG);
-    border-radius: 6rpx;
-    position: relative;
-    margin-top: 100rpx;
-    .tag-box {
-      width: 140rpx;
-      height: 140rpx;
-      background: var(--ui-BG);
-      border-radius: 50%;
-      position: absolute;
-      top: -70rpx;
-      left: 50%;
-      z-index: 6;
-      transform: translateX(-50%);
+	.detail-box {
+		// background-color: var(--ui-BG);
+		border-radius: 6rpx;
+		position: relative;
+		margin-top: 100rpx;
 
-      .tag-image {
-        width: 104rpx;
-        height: 104rpx;
-        border-radius: 50%;
-      }
-    }
+		.tag-box {
+			width: 140rpx;
+			height: 140rpx;
+			background: var(--ui-BG);
+			border-radius: 50%;
+			position: absolute;
+			top: -70rpx;
+			left: 50%;
+			z-index: 6;
+			transform: translateX(-50%);
 
-    .top {
-      background-color: #fff;
-      border-radius: 20rpx 20rpx 0 0;
-      -webkit-mask: radial-gradient(circle at 16rpx 100%, #0000 16rpx, red 0) -16rpx;
-      padding: 110rpx 0 0 0;
-      position: relative;
-      z-index: 5;
+			.tag-image {
+				width: 104rpx;
+				height: 104rpx;
+				border-radius: 50%;
+			}
+		}
 
-      .title {
-        font-size: 40rpx;
-        color: #333;
-        font-weight: bold;
-      }
+		.top {
+			background-color: #fff;
+			border-radius: 20rpx 20rpx 0 0;
+			-webkit-mask: radial-gradient(circle at 16rpx 100%, #0000 16rpx, red 0) -16rpx;
+			padding: 110rpx 0 0 0;
+			position: relative;
+			z-index: 5;
 
-      .subtitle {
-        font-size: 28rpx;
-        color: #333333;
-      }
+			.title {
+				font-size: 40rpx;
+				color: #333;
+				font-weight: bold;
+			}
 
-      .use-btn {
-        width: 386rpx;
-        height: 80rpx;
-        line-height: 80rpx;
-        background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
-        border-radius: 40rpx;
-        color: $white;
-      }
+			.subtitle {
+				font-size: 28rpx;
+				color: #333333;
+			}
 
-      .disable-btn {
-        width: 386rpx;
-        height: 80rpx;
-        line-height: 80rpx;
-        background: #e5e5e5;
-        border-radius: 40rpx;
-        color: $white;
-      }
+			.use-btn {
+				width: 386rpx;
+				height: 80rpx;
+				line-height: 80rpx;
+				background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
+				border-radius: 40rpx;
+				color: $white;
+			}
 
-      .time {
-        font-size: 26rpx;
-        font-weight: 400;
-        color: #999999;
-      }
+			.disable-btn {
+				width: 386rpx;
+				height: 80rpx;
+				line-height: 80rpx;
+				background: #e5e5e5;
+				border-radius: 40rpx;
+				color: $white;
+			}
 
-      .coupon-line {
-        width: 95%;
-        border-bottom: 2rpx solid #eeeeee;
-      }
-    }
+			.time {
+				font-size: 26rpx;
+				font-weight: 400;
+				color: #999999;
+			}
 
-    .bottom {
-      background-color: #fff;
-      border-radius: 0 0 20rpx 20rpx;
-      -webkit-mask: radial-gradient(circle at 16rpx 0%, #0000 16rpx, red 0) -16rpx;
-      padding: 40rpx 30rpx;
+			.coupon-line {
+				width: 95%;
+				border-bottom: 2rpx solid #eeeeee;
+			}
+		}
 
-      .type {
-        height: 96rpx;
-        border-bottom: 2rpx solid #eeeeee;
-      }
-    }
+		.bottom {
+			background-color: #fff;
+			border-radius: 0 0 20rpx 20rpx;
+			-webkit-mask: radial-gradient(circle at 16rpx 0%, #0000 16rpx, red 0) -16rpx;
+			padding: 40rpx 30rpx;
 
-    .des {
-      font-size: 24rpx;
-      font-weight: 400;
-      color: #666666;
-    }
-  }
+			.type {
+				height: 96rpx;
+				border-bottom: 2rpx solid #eeeeee;
+			}
+		}
 
-  .all-user {
-    width: 100%;
-    height: 300rpx;
-    font-size: 34rpx;
-    font-weight: bold;
-    color: #333333;
-  }
-</style>
+		.des {
+			font-size: 24rpx;
+			font-weight: 400;
+			color: #666666;
+		}
+	}
+
+	.all-user {
+		width: 100%;
+		height: 300rpx;
+		font-size: 34rpx;
+		font-weight: bold;
+		color: #333333;
+	}
+</style>

+ 12 - 18
pages/coupon/list.vue

@@ -7,12 +7,11 @@
 		<s-empty v-if="state.pagination.total === 0" icon="/static/coupon-empty.png" text="暂无优惠券"></s-empty>
 		<template v-if="state.currentTab == '0'">
 			<view v-for="item in state.pagination.list" :key="item.id">
-				<s-coupon-list :data="item">
-					<!-- 	@tap="
-					  sheep.$router.go('/pages/coupon/detail', {
-					    id: item.id,
-					  })
-					" -->
+				<s-coupon-list :data="item" @tap="
+					            sheep.$router.go('/pages/coupon/detail', {
+					              data: JSON.stringify(item),
+					            })">
+
 					<template #default>
 						<button class="ss-reset-button card-btn ss-flex ss-row-center ss-col-center"
 							:class="item.get_status != 'can_get' ? 'border-btn' : ''" @click.stop="getBuy(item.id)"
@@ -26,12 +25,12 @@
 		</template>
 		<template v-else>
 			<view v-for="item in state.pagination.list" :key="item.id">
-				<s-coupon-list :data="item" type="user">
-					<!-- 	@tap="
+				<s-coupon-list :data="item" type="user" @tap="
 					            sheep.$router.go('/pages/coupon/detail', {
-					              id: item.id,
+					              data: JSON.stringify(item),
 					            })
-					          " -->
+					          ">
+
 					<template #default>
 						<button class="ss-reset-button card-btn ss-flex ss-row-center ss-col-center" :class="
                 item.status == 'can_get' || item.status == 'can_use'
@@ -148,19 +147,14 @@
 		});
 		if (res.code === 0) {
 			// 拦截修改数据
-			let obj2 = {
-				2: '折扣',
-				1: '满减'
-			}
 			let obj = {
 				1: '可用',
 				2: '已用',
 				3: '过期'
 			}
-			let obj3 = {
-				1: '已领取',
-				2: '已使用',
-				3: '已过期'
+			let obj2 = {
+				1: '满减',
+				2: '折扣'
 			}
 			res.data.list = res.data.list.map(item => {
 				return {

+ 155 - 149
pages/goods/components/detail/detail-tabbar.vue

@@ -1,165 +1,171 @@
 <template>
-	<su-fixed bottom placeholder bg="bg-white">
-		<view class="ui-tabbar-box">
-			<view class="ui-tabbar ss-flex ss-col-center ss-row-between">
-				<view v-if="collectIcon" class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
-					@tap="onFavorite">
-					<block v-if="modelValue.favorite">
-						<image class="item-icon" :src="sheep.$url.static('/static/img/shop/goods/collect_1.gif')"
-							mode="aspectFit"></image>
-						<view class="item-title">已收藏</view>
-					</block>
-					<block v-else>
-						<image class="item-icon" :src="sheep.$url.static('/static/img/shop/goods/collect_0.png')"
-							mode="aspectFit"></image>
-						<view class="item-title">收藏</view>
-					</block>
-				</view>
-				<view v-if="serviceIcon" class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
-					@tap="onChat">
-					<image class="item-icon" :src="sheep.$url.static('/static/img/shop/goods/message.png')"
-						mode="aspectFit"></image>
-					<view class="item-title">客服</view>
-				</view>
-				<view v-if="shareIcon" class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
-					@tap="showShareModal">
-					<image class="item-icon" :src="sheep.$url.static('/static/img/shop/goods/share.png')"
-						mode="aspectFit"></image>
-					<view class="item-title">分享</view>
-				</view>
-				<slot></slot>
-			</view>
-		</view>
-	</su-fixed>
+  <su-fixed bottom placeholder bg="bg-white">
+    <view class="ui-tabbar-box">
+      <view class="ui-tabbar ss-flex ss-col-center ss-row-between">
+        <view
+          v-if="collectIcon"
+          class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
+          @tap="onFavorite"
+        >
+          <block v-if="modelValue.favorite">
+            <image
+              class="item-icon"
+              :src="sheep.$url.static('/static/img/shop/goods/collect_1.gif')"
+              mode="aspectFit"
+            ></image>
+            <view class="item-title">已收藏</view>
+          </block>
+          <block v-else>
+            <image
+              class="item-icon"
+              :src="sheep.$url.static('/static/img/shop/goods/collect_0.png')"
+              mode="aspectFit"
+            ></image>
+            <view class="item-title">收藏</view>
+          </block>
+        </view>
+        <view
+          v-if="serviceIcon"
+          class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
+          @tap="onChat"
+        >
+          <image
+            class="item-icon"
+            :src="sheep.$url.static('/static/img/shop/goods/message.png')"
+            mode="aspectFit"
+          ></image>
+          <view class="item-title">客服</view>
+        </view>
+        <view
+          v-if="shareIcon"
+          class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
+          @tap="showShareModal"
+        >
+          <image
+            class="item-icon"
+            :src="sheep.$url.static('/static/img/shop/goods/share.png')"
+            mode="aspectFit"
+          ></image>
+          <view class="item-title">分享</view>
+        </view>
+        <slot></slot>
+      </view>
+    </view>
+  </su-fixed>
 </template>
 
 <script setup>
-	/**
-	 *
-	 * 底部导航
-	 *
-	 * @property {String} bg 			 			- 背景颜色Class
-	 * @property {String} ui 			 			- 自定义样式Class
-	 * @property {Boolean} noFixed 		 			- 是否定位
-	 * @property {Boolean} topRadius 		 		- 上圆角
-	 *
-	 *
-	 */
+  /**
+   *
+   * 底部导航
+   *
+   * @property {String} bg 			 			- 背景颜色Class
+   * @property {String} ui 			 			- 自定义样式Class
+   * @property {Boolean} noFixed 		 			- 是否定位
+   * @property {Boolean} topRadius 		 		- 上圆角
+   *
+   *
+   */
 
-	import {
-		computed,
-		reactive
-	} from 'vue';
-	import sheep from '@/sheep';
-	import {
-		showShareModal
-	} from '@/sheep/hooks/useModal';
+  import { computed, reactive } from 'vue';
+  import sheep from '@/sheep';
+  import { showShareModal } from '@/sheep/hooks/useModal';
 
-	// 数据
-	const state = reactive({});
+  // 数据
+  const state = reactive({});
 
-	// 接收参数
-	const props = defineProps({
-		modelValue: {
-			type: Object,
-			default () {},
-		},
-		bg: {
-			type: String,
-			default: 'bg-white',
-		},
-		bgStyles: {
-			type: Object,
-			default () {},
-		},
-		ui: {
-			type: String,
-			default: '',
-		},
+  // 接收参数
+  const props = defineProps({
+    modelValue: {
+      type: Object,
+      default() {},
+    },
+    bg: {
+      type: String,
+      default: 'bg-white',
+    },
+    bgStyles: {
+      type: Object,
+      default() {},
+    },
+    ui: {
+      type: String,
+      default: '',
+    },
 
-		noFixed: {
-			type: Boolean,
-			default: false,
-		},
-		topRadius: {
-			type: Number,
-			default: 0,
-		},
-		collectIcon: {
-			type: Boolean,
-			default: true,
-		},
-		serviceIcon: {
-			type: Boolean,
-			default: true,
-		},
-		shareIcon: {
-			type: Boolean,
-			default: true,
-		},
-	});
-	const elStyles = computed(() => {
-		return {
-			'border-top-left-radius': props.topRadius + 'rpx',
-			'border-top-right-radius': props.topRadius + 'rpx',
-			overflow: 'hidden',
-		};
-	});
+    noFixed: {
+      type: Boolean,
+      default: false,
+    },
+    topRadius: {
+      type: Number,
+      default: 0,
+    },
+    collectIcon: {
+      type: Boolean,
+      default: true,
+    },
+    serviceIcon: {
+      type: Boolean,
+      default: true,
+    },
+    shareIcon: {
+      type: Boolean,
+      default: true,
+    },
+  });
+  const elStyles = computed(() => {
+    return {
+      'border-top-left-radius': props.topRadius + 'rpx',
+      'border-top-right-radius': props.topRadius + 'rpx',
+      overflow: 'hidden',
+    };
+  });
 
-	const tabbarheight = (e) => {
-		uni.setStorageSync('tabbar', e);
-	};
-	async function onFavorite() {
-		// const { error } = await sheep.$api.user.favorite.do(props.modelValue.id);
-		// if (error === 0) {
-		//   if (props.modelValue.favorite) {
-		//     props.modelValue.favorite = 0;
-		//   } else {
-		//     props.modelValue.favorite = 1;
-		//   }
-		// }
-		let data;
-		if (props.modelValue.favorite) {
-			data = await sheep.$api.user.favorite.dos(props.modelValue.id);
-		} else {
-			data = await sheep.$api.user.favorite.do(props.modelValue.id);
-		}
-		if (data.data) {
-			props.modelValue.favorite = !props.modelValue.favorite;
-		}
-	}
+  const tabbarheight = (e) => {
+    uni.setStorageSync('tabbar', e);
+  };
+  async function onFavorite() {
+    const { error } = await sheep.$api.user.favorite.do(props.modelValue.id);
+    if (error === 0) {
+      if (props.modelValue.favorite) {
+        props.modelValue.favorite = 0;
+      } else {
+        props.modelValue.favorite = 1;
+      }
+    }
+  }
 
-	const onChat = () => {
-		sheep.$router.go('/pages/chat/index', {
-			id: props.modelValue.id,
-		});
-	};
+  const onChat = () => {
+    sheep.$router.go('/pages/chat/index', {
+      id: props.modelValue.id,
+    });
+  };
 </script>
 
 <style lang="scss" scoped>
-	.ui-tabbar-box {
-		box-shadow: 0px -6px 10px 0px rgba(51, 51, 51, 0.2);
-	}
+  .ui-tabbar-box {
+    box-shadow: 0px -6px 10px 0px rgba(51, 51, 51, 0.2);
+  }
+  .ui-tabbar {
+    display: flex;
+    height: 50px;
+    background: #fff;
 
-	.ui-tabbar {
-		display: flex;
-		height: 50px;
-		background: #fff;
+    .detail-tabbar-item {
+      width: 100rpx;
 
-		.detail-tabbar-item {
-			width: 100rpx;
+      .item-icon {
+        width: 40rpx;
+        height: 40rpx;
+      }
 
-			.item-icon {
-				width: 40rpx;
-				height: 40rpx;
-			}
-
-			.item-title {
-				font-size: 20rpx;
-				font-weight: 500;
-				line-height: 20rpx;
-				margin-top: 12rpx;
-			}
-		}
-	}
-</style>
+      .item-title {
+        font-size: 20rpx;
+        font-weight: 500;
+        line-height: 20rpx;
+        margin-top: 12rpx;
+      }
+    }
+  }
+</style>

+ 39 - 103
pages/goods/index.vue

@@ -12,7 +12,9 @@
 			<block v-else>
 				<view class="detail-swiper-selector">
 					<!-- 商品轮播图  -->
-					<su-swiper class="ss-m-b-14" isPreview :list="formatGoodsSwiper(state.goodsInfo.sliderPicUrls)" dotStyle="tag" imageMode="widthFix" dotCur="bg-mask-40" :seizeHeight="750" />
+					<su-swiper class="ss-m-b-14" isPreview :list="formatGoodsSwiper(state.goodsInfo.sliderPicUrls)"
+						dotStyle="tag" imageMode="widthFix" dotCur="bg-mask-40" :seizeHeight="750" />
+
 					<!-- 价格+标题 -->
 					<view class="title-card detail-card ss-p-y-40 ss-p-x-20">
 						<view class="ss-flex ss-row-between ss-col-center ss-m-b-26">
@@ -31,14 +33,14 @@
 						<view class="discounts-box ss-flex ss-row-between ss-m-b-28">
 							<!-- 满减送/限时折扣活动的提示 TODO 芋艿:promos 未写 -->
 							<div class="tag-content">
-              <!-- 满减送/限时折扣活动的提示 TODO 芋艿:promos 未写 -->
-              <div class="tag-content">
 								<view class="tag-box ss-flex">
-									<view class="tag ss-m-r-10" v-for="promos in state.goodsInfo.promos" :key="promos.id" @tap="onActivity">
+									<view class="tag ss-m-r-10" v-for="promos in state.goodsInfo.promos"
+										:key="promos.id" @tap="onActivity">
 										{{ promos.title }}
 									</view>
 								</view>
 							</div>
+
 							<!-- 优惠劵 -->
 							<view class="get-coupon-box ss-flex ss-col-center ss-m-l-20" @tap="state.showModel = true"
 								v-if="state.couponInfo.length">
@@ -61,7 +63,7 @@
 
 					<!-- 规格与数量弹框 -->
 					<s-select-sku :goodsInfo="state.goodsInfo" :show="state.showSelectSku" @addCart="onAddCart"
-                        @buy="onBuy" @change="onSkuChange" @close="state.showSelectSku = false" />
+						@buy="onBuy" @change="onSkuChange" @close="state.showSelectSku = false" />
 				</view>
 
 				<!-- 评价 -->
@@ -86,23 +88,28 @@
 						<button class="ss-reset-button disabled-btn" disabled> 已售罄 </button>
 					</view>
 				</detail-tabbar>
+
 				<!-- 优惠劵弹窗 -->
-				<s-coupon-get v-model="state.couponInfo" :show="state.showModel" @close="state.showModel = false" @get="onGet" />
+				<s-coupon-get v-model="state.couponInfo" :show="state.showModel" @close="state.showModel = false"
+					@get="onGet" />
 
 				<!-- 满减送/限时折扣活动弹窗 -->
-        		<!-- 优惠劵弹窗 -->
-				<s-coupon-get v-model="state.couponInfo" :show="state.showModel" @close="state.showModel = false" @get="onGet" />
-       			 <!-- 满减送/限时折扣活动弹窗 -->
 				<s-activity-pop v-model="state.activityInfo" :show="state.showActivityModel"
-                        @close="state.showActivityModel = false" />
+					@close="state.showActivityModel = false" />
 			</block>
 		</s-layout>
 	</view>
 </template>
 
 <script setup>
-	import { reactive, computed } from 'vue';
-	import { onLoad, onPageScroll } from '@dcloudio/uni-app';
+	import {
+		reactive,
+		computed
+	} from 'vue';
+	import {
+		onLoad,
+		onPageScroll
+	} from '@dcloudio/uni-app';
 	import sheep from '@/sheep';
 	import CouponApi from '@/sheep/api/promotion/coupon';
 	import ActivityApi from '@/sheep/api/promotion/activity';
@@ -111,9 +118,6 @@
 		formatGoodsSwiper,
 		fen2yuan,
 	} from '@/sheep/hooks/useGoods';
-    import CouponApi from '@/sheep/api/promotion/coupon';
-    import ActivityApi from '@/sheep/api/promotion/activity';
-    import { formatSales, formatGoodsSwiper, fen2yuan, } from '@/sheep/hooks/useGoods';
 	import detailNavbar from './components/detail/detail-navbar.vue';
 	import detailCellSku from './components/detail/detail-cell-sku.vue';
 	import detailCellService from './components/detail/detail-cell-service.vue';
@@ -123,7 +127,9 @@
 	import detailCommentCard from './components/detail/detail-comment-card.vue';
 	import detailContentCard from './components/detail/detail-content-card.vue';
 	import detailActivityTip from './components/detail/detail-activity-tip.vue';
-	import { isEmpty } from 'lodash';
+	import {
+		isEmpty
+	} from 'lodash';
 
 	onPageScroll(() => {});
 
@@ -138,7 +144,7 @@
 		showActivityModel: false, // 【满减送/限时折扣】是否展示 Activity 营销活动的弹窗
 		activityInfo: [], // 【满减送/限时折扣】可参与的 Activity 营销活动的列表
 		activityList: [], // 【秒杀/拼团/砍价】可参与的 Activity 营销活动的列表
- 	});
+	});
 
 	// 规格变更
 	function onSkuChange(e) {
@@ -147,7 +153,6 @@
 
 	// 添加购物车  TODO 芋艿:待测试
 	function onAddCart(e) {
-		console.log(e, '加入购物车');
 		sheep.$store('cart').add(e);
 	}
 
@@ -174,10 +179,10 @@
 	// 立即领取  TODO 芋艿:待测试
 	async function onGet(id) {
 		const {
-			code,
+			error,
 			msg
 		} = await sheep.$api.coupon.get(id);
-		if (code === 0) {
+		if (error === 0) {
 			uni.showToast({
 				title: msg,
 			});
@@ -187,8 +192,7 @@
 		}
 	}
 
-  //  TODO 芋艿:待测试
-
+	//  TODO 芋艿:待测试
 	const shareInfo = computed(() => {
 		if (isEmpty(state.goodsInfo)) return {};
 		return sheep.$platform.share.getShareInfo({
@@ -202,8 +206,9 @@
 		}, {
 			type: 'goods', // 商品海报
 			title: state.goodsInfo.name, // 商品标题
-			image: sheep.$url.cdn(state.goodsInfo.image), // 商品主图
-			price: state.goodsInfo.price[0], // 商品价格
+			// image: sheep.$url.cdn(state.goodsInfo.image), // 商品主图
+			image: sheep.$url.cdn(state.goodsInfo.picUrl), // 商品主图
+			price: state.goodsInfo.price, // 商品价格
 			original_price: state.goodsInfo.original_price, // 商品原价
 		}, );
 	});
@@ -216,7 +221,7 @@
 		}
 		state.goodsId = options.id;
 		// 1. 加载商品信息
-		sheep.$api.goods.detail(state.goodsId).then(async (res) => {
+		sheep.$api.goods.detail(state.goodsId).then((res) => {
 			// 未找到商品
 			if (res.code !== 0 || !res.data) {
 				state.goodsInfo = null;
@@ -224,60 +229,17 @@
 			}
 			// 加载到商品
 			state.skeletonLoading = false;
-			// 获取收藏信息
-			let dasa = await sheep.$api.goods.exits(options.id);
-			res.data.favorite = dasa.data;
 			state.goodsInfo = res.data;
-			console.log(state.goodsInfo, '商品信息');
-
-			// 此处调试默认弹出可以修改为点击弹出
-			// 2. 加载优惠劵信息
-			CouponApi.getCouponTemplateList({
-				price: state.goodsInfo.price,
-				spuIds: [state.goodsInfo.id],
-				skuIds: state.goodsInfo.skus.map(item => item.id),
-				// 先写死
-				categoryIds: [52]
-			}).then((res) => {
-				console.log(res, '优惠券信息进行对接')
-				if (res.code !== 0) {
-					return;
-				}
-				// 拦截修改数据
-				let obj2 = {
-					2: '折扣',
-					1: '满减'
-				}
-				let obj = {
-					1: '可用',
-					2: '已用',
-					3: '过期'
-				}
-				let obj3 = {
-					1: '已领取',
-					2: '已使用',
-					3: '已过期'
-				}
-				res.data = res.data.map(item => {
-					return {
-						...item,
-						enough: (item.usePrice / 100).toFixed(2),
-						amount: (item.discountPrice / 100).toFixed(2),
-						use_start_time: sheep.$helper.timeFormat(item
-							.validStartTime,
-							'yyyy-mm-dd hh:MM:ss'),
-						use_end_time: sheep.$helper.timeFormat(item.validEndTime,
-							'yyyy-mm-dd hh:MM:ss'),
-						status_text: obj[item.status],
-						type_text: obj2[item.discountType],
-						get_status_text: obj3[item.status],
-						type_text: obj2[item.discountType]
-					}
-				});
-				state.couponInfo = res.data;
-			});
 		});
-		// return;
+
+		// 2. 加载优惠劵信息
+		CouponApi.getCouponTemplateList(state.goodsId, 2, 10).then((res) => {
+			if (res.code !== 0) {
+				return;
+			}
+			state.couponInfo = res.data;
+		});
+
 		// 3. 加载营销活动信息
 		ActivityApi.getActivityListBySpuId(state.goodsId).then((res) => {
 			if (res.code !== 0) {
@@ -285,32 +247,6 @@
 			}
 			state.activityList = res.data;
 		});
-		sheep.$api.goods.detail(state.goodsId).then((res) => {
-      // 未找到商品
-      if (res.code !== 0 || !res.data) {
-        state.goodsInfo = null;
-        return;
-      }
-			// 加载到商品
-			state.skeletonLoading = false;
-      state.goodsInfo = res.data;
-		});
-
-    // 2. 加载优惠劵信息
-    CouponApi.getCouponTemplateList(state.goodsId,2, 10).then((res) => {
-      if (res.code !== 0) {
-        return;
-      }
-      state.couponInfo = res.data;
-    });
-
-    // 3. 加载营销活动信息
-    ActivityApi.getActivityListBySpuId(state.goodsId).then((res) => {
-      if (res.code !== 0) {
-        return;
-      }
-      state.activityList = res.data;
-    });
 	});
 </script>
 

+ 331 - 362
pages/goods/list.vue

@@ -1,383 +1,352 @@
 <template>
-  <s-layout
-    navbar="normal"
-    :leftWidth="0"
-    :rightWidth="0"
-    tools="search"
-    :defaultSearch="state.keyword"
-    @search="onSearch"
-  >
-    <!-- 筛选 -->
-    <su-sticky bgColor="#fff">
-      <view class="ss-flex">
-        <view class="ss-flex-1">
-          <su-tabs
-            :list="state.tabList"
-            :scrollable="false"
-            @change="onTabsChange"
-            :current="state.currentTab"
-          />
-        </view>
-        <view class="list-icon" @tap="state.iconStatus = !state.iconStatus">
-          <text v-if="state.iconStatus" class="sicon-goods-list"></text>
-          <text v-else class="sicon-goods-card"></text>
-        </view>
-      </view>
-    </su-sticky>
+	<s-layout navbar="normal" :leftWidth="0" :rightWidth="0" tools="search" :defaultSearch="state.keyword"
+		@search="onSearch">
+		<!-- 筛选 -->
+		<su-sticky bgColor="#fff">
+			<view class="ss-flex">
+				<view class="ss-flex-1">
+					<su-tabs :list="state.tabList" :scrollable="false" @change="onTabsChange"
+						:current="state.currentTab"></su-tabs>
+				</view>
+				<view class="list-icon" @tap="state.iconStatus = !state.iconStatus">
+					<text v-if="state.iconStatus" class="sicon-goods-list"></text>
+					<text v-else class="sicon-goods-card"></text>
+				</view>
+			</view>
+		</su-sticky>
 
-    <!-- 弹窗 -->
-    <su-popup
-      :show="state.showFilter"
-      type="top"
-      round="10"
-      :space="sys_navBar + 38"
-      backgroundColor="#F6F6F6"
-      :zIndex="10"
-      @close="state.showFilter = false"
-    >
-      <view class="filter-list-box">
-        <view
-          class="filter-item"
-          v-for="(item, index) in state.tabList[state.currentTab].list"
-          :key="item.value"
-          :class="[{ 'filter-item-active': index == state.curFilter }]"
-          @tap="onFilterItem(index)"
-        >
-          {{ item.label }}
-        </view>
-      </view>
-    </su-popup>
-    <view v-if="state.iconStatus && state.pagination.total > 0" class="goods-list ss-m-t-20">
-      <view
-        class="ss-p-l-20 ss-p-r-20 ss-m-b-20"
-        v-for="item in state.pagination.data"
-        :key="item.id"
-      >
-        <s-goods-column
-          class=""
-          size="lg"
-          :data="item"
-          :topRadius="10"
-          :bottomRadius="10"
-          @click="sheep.$router.go('/pages/goods/index', { id: item.id })"
-        ></s-goods-column>
-      </view>
-    </view>
-    <view
-      v-if="!state.iconStatus && state.pagination.total > 0"
-      class="ss-flex ss-flex-wrap ss-p-x-20 ss-m-t-20 ss-col-top"
-    >
-      <view class="goods-list-box">
-        <view class="left-list" v-for="item in state.leftGoodsList" :key="item.id">
-          <s-goods-column
-            class="goods-md-box"
-            size="md"
-            :data="item"
-            :topRadius="10"
-            :bottomRadius="10"
-            @click="sheep.$router.go('/pages/goods/index', { id: item.id })"
-            @getHeight="mountMasonry($event, 'left')"
-          >
-            <template v-slot:cart>
-              <button class="ss-reset-button cart-btn"> </button>
-            </template>
-          </s-goods-column>
-        </view>
-      </view>
-      <view class="goods-list-box">
-        <view class="right-list" v-for="item in state.rightGoodsList" :key="item.id">
-          <s-goods-column
-            class="goods-md-box"
-            size="md"
-            :topRadius="10"
-            :bottomRadius="10"
-            :data="item"
-            @click="sheep.$router.go('/pages/goods/index', { id: item.id })"
-            @getHeight="mountMasonry($event, 'right')"
-          >
-            <template v-slot:cart>
-              <button class="ss-reset-button cart-btn"> </button>
-            </template>
-          </s-goods-column>
-        </view>
-      </view>
-    </view>
-    <uni-load-more
-      v-if="state.pagination.total > 0"
-      :status="state.loadStatus"
-      :content-text="{
+		<!-- 弹窗 -->
+		<su-popup :show="state.showFilter" type="top" round="10" :space="sys_navBar + 38" backgroundColor="#F6F6F6"
+			:zIndex="10" @close="state.showFilter = false">
+			<view class="filter-list-box">
+				<view class="filter-item" v-for="(item, index) in state.tabList[state.currentTab].list"
+					:key="item.value" :class="[{ 'filter-item-active': index == state.curFilter }]"
+					@tap="onFilterItem(index)">
+					{{ item.label }}
+				</view>
+			</view>
+		</su-popup>
+		<view v-if="state.iconStatus && state.pagination.total > 0" class="goods-list ss-m-t-20">
+			<view class="ss-p-l-20 ss-p-r-20 ss-m-b-20" v-for="item in state.pagination.data" :key="item.id">
+				<s-goods-column class="" size="lg" :data="item" :topRadius="10" :bottomRadius="10"
+					@click="sheep.$router.go('/pages/goods/index', { id: item.id })"></s-goods-column>
+			</view>
+		</view>
+		<view v-if="!state.iconStatus && state.pagination.total > 0"
+			class="ss-flex ss-flex-wrap ss-p-x-20 ss-m-t-20 ss-col-top">
+			<view class="goods-list-box">
+				<view class="left-list" v-for="item in state.leftGoodsList" :key="item.id">
+					<s-goods-column class="goods-md-box" size="md" :data="item" :topRadius="10" :bottomRadius="10"
+						@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
+						@getHeight="mountMasonry($event, 'left')">
+						<template v-slot:cart>
+							<button class="ss-reset-button cart-btn"> </button>
+						</template>
+					</s-goods-column>
+				</view>
+			</view>
+			<view class="goods-list-box">
+				<view class="right-list" v-for="item in state.rightGoodsList" :key="item.id">
+					<s-goods-column class="goods-md-box" size="md" :topRadius="10" :bottomRadius="10" :data="item"
+						@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
+						@getHeight="mountMasonry($event, 'right')">
+						<template v-slot:cart>
+							<button class="ss-reset-button cart-btn"> </button>
+						</template>
+					</s-goods-column>
+				</view>
+			</view>
+		</view>
+		<uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{
         contentdown: '上拉加载更多',
-      }"
-      @tap="loadmore"
-    />
-    <s-empty v-if="state.pagination.total === 0" icon="/static/soldout-empty.png" text="暂无商品">
-    </s-empty>
-  </s-layout>
+      }" @tap="loadmore" />
+		<s-empty v-if="state.pagination.total === 0" icon="/static/soldout-empty.png" text="暂无商品">
+		</s-empty>
+	</s-layout>
 </template>
 
 <script setup>
-  import { reactive } from 'vue';
-  import { onLoad, onReachBottom } from '@dcloudio/uni-app';
-  import sheep from '@/sheep';
-  import _ from 'lodash';
+	import {
+		reactive
+	} from 'vue';
+	import {
+		onLoad,
+		onReachBottom
+	} from '@dcloudio/uni-app';
+	import sheep from '@/sheep';
+	import _ from 'lodash';
 
-  const sys_navBar = sheep.$platform.navbar;
-  const emits = defineEmits(['close', 'change']);
+	const sys_navBar = sheep.$platform.navbar;
+	const emits = defineEmits(['close', 'change']);
 
-  const pagination = {
-    data: [],
-    current_page: 1,
-    total: 1,
-    last_page: 1,
-  };
-  const state = reactive({
-    pagination: {
-      data: [],
-      current_page: 1,
-      total: 1,
-      last_page: 1,
-    },
-    // currentSort: 'weigh',
-    // currentOrder: 'desc',
-    currentTab: 0,
-    filterParams: {},
-    curFilter: 0,
-    showFilter: false,
-    iconStatus: false,
-    categoryId: 0,
-    tabList: [
-      {
-        name: '综合推荐',
-        // value: '',
-        list: [
-          {
-            label: '综合推荐',
-            // sort: '',
-            // order: true,
-          },
-          {
-            label: '价格升序',
-            sort: 'price',
-            order: true,
-          },
-          {
-            label: '价格降序',
-            sort: 'price',
-            order: false,
-          },
-        ],
-      },
-      {
-        name: '销量',
-        // value: 'salesCount',
-      },
-      {
-        name: '新品优先',
-        // value: 'create_time',
-      },
-    ],
-    loadStatus: '',
-    keyword: '',
-    leftGoodsList: [],
-    rightGoodsList: [],
-  });
+	const pagination = {
+		data: [],
+		current_page: 1,
+		total: 1,
+		last_page: 1,
+	};
+	const state = reactive({
+		pagination: {
+			data: [],
+			current_page: 1,
+			total: 1,
+			last_page: 1,
+		},
+		// currentSort: 'weigh',
+		// currentOrder: 'desc',
+		currentTab: 0,
+		filterParams: {},
+		curFilter: 0,
+		showFilter: false,
+		iconStatus: false,
+		categoryId: 0,
+		tabList: [{
+				name: '综合推荐',
+				// value: '',
+				list: [{
+						label: '综合推荐',
+						// sort: '',
+						// order: true,
+					},
+					{
+						label: '价格升序',
+						sort: 'price',
+						order: true,
+					},
+					{
+						label: '价格降序',
+						sort: 'price',
+						order: false,
+					},
+				],
+			},
+			{
+				name: '销量',
+				sort: 'salesCount',
+				order: false,
+				// value: 'salesCount',
+			},
+			{
+				name: '新品优先',
+				// value: 'create_time',
+			},
+		],
+		loadStatus: '',
+		keyword: '',
+		leftGoodsList: [],
+		rightGoodsList: [],
+	});
 
-  // 加载瀑布流
-  let count = 0;
-  let leftHeight = 0;
-  let rightHeight = 0;
+	// 加载瀑布流
+	let count = 0;
+	let leftHeight = 0;
+	let rightHeight = 0;
 
-  function mountMasonry(height = 0, where = 'left') {
-    if (!state.pagination.data[count]) return;
+	function mountMasonry(height = 0, where = 'left') {
+		if (!state.pagination.data[count]) return;
 
-    if (where === 'left') {
-      leftHeight += height;
-    } else {
-      rightHeight += height;
-    }
-    if (leftHeight <= rightHeight) {
-      state.leftGoodsList.push(state.pagination.data[count]);
-    } else {
-      state.rightGoodsList.push(state.pagination.data[count]);
-    }
-    count++;
-  }
+		if (where === 'left') {
+			leftHeight += height;
+		} else {
+			rightHeight += height;
+		}
+		if (leftHeight <= rightHeight) {
+			state.leftGoodsList.push(state.pagination.data[count]);
+		} else {
+			state.rightGoodsList.push(state.pagination.data[count]);
+		}
+		count++;
+	}
 
-  function emptyList() {
-    state.pagination = pagination
-    state.leftGoodsList = [];
-    state.rightGoodsList = [];
-    count = 0;
-    leftHeight = 0;
-    rightHeight = 0;
-  }
-  //搜索
-  function onSearch(e) {
-    state.keyword = e;
-    emptyList();
-    getList(state.currentSort, state.currentOrder, state.categoryId, e);
-  }
+	function emptyList() {
+		state.pagination = pagination
+		state.leftGoodsList = [];
+		state.rightGoodsList = [];
+		count = 0;
+		leftHeight = 0;
+		rightHeight = 0;
+	}
+	//搜索
+	function onSearch(e) {
+		state.keyword = e;
+		emptyList();
+		getList(state.currentSort, state.currentOrder, state.categoryId, e);
+	}
 
-  // 点击
-  function onTabsChange(e) {
-    if (state.tabList[e.index].list) {
-      state.currentTab = e.index;
-      state.showFilter = !state.showFilter;
-      return;
-    } else {
-      state.showFilter = false;
-    }
-    if (e.index === state.currentTab) {
-      return;
-    } else {
-      state.currentTab = e.index;
-    }
-    emptyList();
+	// 点击
+	function onTabsChange(e) {
+		if (state.tabList[e.index].list) {
+			state.currentTab = e.index;
+			state.showFilter = !state.showFilter;
+			return;
+		} else {
+			state.showFilter = false;
+		}
+		if (e.index === state.currentTab) {
+			return;
+		} else {
+			state.currentTab = e.index;
+		}
+		emptyList();
+		console.log(e, '6666')
+		getList(e.sort, e.order, state.categoryId, state.keyword);
+	}
 
-    getList(e.value, state.currentOrder, state.categoryId, state.keyword);
-  }
+	// 点击筛选项
+	const onFilterItem = (val) => {
+		console.log(val)
+		if (
+			state.currentSort === state.tabList[0].list[val].sort &&
+			state.currentOrder === state.tabList[0].list[val].order
+		) {
+			state.showFilter = false;
+			return;
+		}
+		state.curFilter = val;
+		state.tabList[0].name = state.tabList[0].list[val].label;
+		state.currentSort = state.tabList[0].list[val].sort;
+		state.currentOrder = state.tabList[0].list[val].order;
+		emptyList();
+		getList(state.currentSort, state.currentOrder, state.categoryId, state.keyword);
+		state.showFilter = false;
+	};
 
-  // 点击筛选项
-  const onFilterItem = (val) => {
-	  console.log(val)
-    if (
-      state.currentSort === state.tabList[0].list[val].sort &&
-      state.currentOrder === state.tabList[0].list[val].order
-    ) {
-      state.showFilter = false;
-      return;
-    }
-    state.curFilter = val;
-    state.tabList[0].name = state.tabList[0].list[val].label;
-    state.currentSort = state.tabList[0].list[val].sort;
-    state.currentOrder = state.tabList[0].list[val].order;
-    emptyList();
-    getList(state.currentSort, state.currentOrder, state.categoryId, state.keyword);
-    state.showFilter = false;
-  };
-
-  async function getList(Sort, Order, categoryId, keyword, page = 1, list_rows = 6) {
-    state.loadStatus = 'loading';
-    const res = await sheep.$api.goods.list({
-      sortField: Sort,
-      sortAsc: Order,
-      category_id: !keyword ? categoryId : '',
-      pageSize:list_rows,
-      keyword: keyword,
-      pageNo:page,
-    });
-    if (res.code === 0) {
-        let couponList = _.concat(state.pagination.data, res.data.list);
-        state.pagination = {
-          ...res.data,
-          data: couponList,
-        };
-      mountMasonry();
-      if (state.pagination.current_page < state.pagination.last_page) {
-        state.loadStatus = 'more';
-      } else {
-        state.loadStatus = 'noMore';
-      }
-    }
-  }
-  // 加载更多
-  function loadmore() {
-    if (state.loadStatus !== 'noMore') {
-      getList(
-        state.currentSort,
-        state.currentOrder,
-        state.categoryId,
-        state.keyword,
-        state.pagination.current_page + 1,
-      );
-    }
-  }
-  onLoad((options) => {
-    state.categoryId = options.categoryId;
-    state.keyword = options.keyword;
-    getList(state.currentSort, state.currentOrder, state.categoryId, state.keyword);
-  });
-  // 上拉加载更多
-  onReachBottom(() => {
-    loadmore();
-  });
+	async function getList(Sort, Order, categoryId, keyword, page = 1, list_rows = 6) {
+		state.loadStatus = 'loading';
+		const res = await sheep.$api.goods.list({
+			sortField: Sort,
+			sortAsc: Order,
+			category_id: !keyword ? categoryId : '',
+			pageSize: list_rows,
+			keyword: keyword,
+			pageNo: page,
+		});
+		if (res.code === 0) {
+			let couponList = _.concat(state.pagination.data, res.data.list);
+			state.pagination = {
+				...res.data,
+				data: couponList,
+			};
+			mountMasonry();
+			if (state.pagination.current_page < state.pagination.last_page) {
+				state.loadStatus = 'more';
+			} else {
+				state.loadStatus = 'noMore';
+			}
+		}
+	}
+	// 加载更多
+	function loadmore() {
+		if (state.loadStatus !== 'noMore') {
+			getList(
+				state.currentSort,
+				state.currentOrder,
+				state.categoryId,
+				state.keyword,
+				state.pagination.current_page + 1,
+			);
+		}
+	}
+	onLoad((options) => {
+		state.categoryId = options.categoryId;
+		state.keyword = options.keyword;
+		getList(state.currentSort, state.currentOrder, state.categoryId, state.keyword);
+	});
+	// 上拉加载更多
+	onReachBottom(() => {
+		loadmore();
+	});
 </script>
 
 <style lang="scss" scoped>
-  .goods-list-box {
-    width: 50%;
-    box-sizing: border-box;
-    .left-list {
-      margin-right: 10rpx;
-      margin-bottom: 20rpx;
-    }
-    .right-list {
-      margin-left: 10rpx;
-      margin-bottom: 20rpx;
-    }
-  }
-  .goods-box {
-    &:nth-last-of-type(1) {
-      margin-bottom: 0 !important;
-    }
-    &:nth-child(2n) {
-      margin-right: 0;
-    }
-  }
-  .list-icon {
-    width: 80rpx;
-    .sicon-goods-card {
-      font-size: 40rpx;
-    }
-    .sicon-goods-list {
-      font-size: 40rpx;
-    }
-  }
-  .goods-card {
-    margin-left: 20rpx;
-  }
-  .list-filter-tabs {
-    background-color: #fff;
-  }
-  .filter-list-box {
-    padding: 28rpx 52rpx;
-    .filter-item {
-      font-size: 28rpx;
-      font-weight: 500;
-      color: #333333;
-      line-height: normal;
-      margin-bottom: 24rpx;
-      &:nth-last-child(1) {
-        margin-bottom: 0;
-      }
-    }
-    .filter-item-active {
-      color: var(--ui-BG-Main);
-    }
-  }
-  .tab-item {
-    height: 50px;
-    position: relative;
-    z-index: 11;
+	.goods-list-box {
+		width: 50%;
+		box-sizing: border-box;
+
+		.left-list {
+			margin-right: 10rpx;
+			margin-bottom: 20rpx;
+		}
+
+		.right-list {
+			margin-left: 10rpx;
+			margin-bottom: 20rpx;
+		}
+	}
+
+	.goods-box {
+		&:nth-last-of-type(1) {
+			margin-bottom: 0 !important;
+		}
+
+		&:nth-child(2n) {
+			margin-right: 0;
+		}
+	}
+
+	.list-icon {
+		width: 80rpx;
+
+		.sicon-goods-card {
+			font-size: 40rpx;
+		}
+
+		.sicon-goods-list {
+			font-size: 40rpx;
+		}
+	}
+
+	.goods-card {
+		margin-left: 20rpx;
+	}
+
+	.list-filter-tabs {
+		background-color: #fff;
+	}
+
+	.filter-list-box {
+		padding: 28rpx 52rpx;
+
+		.filter-item {
+			font-size: 28rpx;
+			font-weight: 500;
+			color: #333333;
+			line-height: normal;
+			margin-bottom: 24rpx;
+
+			&:nth-last-child(1) {
+				margin-bottom: 0;
+			}
+		}
+
+		.filter-item-active {
+			color: var(--ui-BG-Main);
+		}
+	}
+
+	.tab-item {
+		height: 50px;
+		position: relative;
+		z-index: 11;
 
-    .tab-title {
-      font-size: 30rpx;
-    }
+		.tab-title {
+			font-size: 30rpx;
+		}
 
-    .cur-tab-title {
-      font-weight: $font-weight-bold;
-    }
+		.cur-tab-title {
+			font-weight: $font-weight-bold;
+		}
 
-    .tab-line {
-      width: 60rpx;
-      height: 6rpx;
-      border-radius: 6rpx;
-      position: absolute;
-      left: 50%;
-      transform: translateX(-50%);
-      bottom: 10rpx;
-      background-color: var(--ui-BG-Main);
-      z-index: 12;
-    }
-  }
-</style>
+		.tab-line {
+			width: 60rpx;
+			height: 6rpx;
+			border-radius: 6rpx;
+			position: absolute;
+			left: 50%;
+			transform: translateX(-50%);
+			bottom: 10rpx;
+			background-color: var(--ui-BG-Main);
+			z-index: 12;
+		}
+	}
+</style>

+ 193 - 213
pages/index/cart.vue

@@ -1,220 +1,200 @@
-<!-- 购物车界面 -->
 <template>
-  <s-layout title="购物车" tabbar="/pages/index/cart" :bgStyle="{ color: '#fff' }">
-    <s-empty
-      v-if="state.list.length === 0"
-      text="购物车空空如也,快去逛逛吧~"
-      icon="/static/cart-empty.png"
-    />
-
-    <!-- 头部 -->
-    <view class="cart-box ss-flex ss-flex-col ss-row-between" v-if="state.list.length">
-      <view class="cart-header ss-flex ss-col-center ss-row-between ss-p-x-30">
-        <view class="header-left ss-flex ss-col-center ss-font-26">
-          共
-          <text class="goods-number ui-TC-Main ss-flex">{{ state.list.length }}</text>
-          件商品
-        </view>
-        <view class="header-right">
-          <button v-if="state.editMode" class="ss-reset-button" @tap="state.editMode = false">
-            取消
-          </button>
-          <button v-else class="ss-reset-button ui-TC-Main" @tap="state.editMode = true">
-            编辑
-          </button>
-        </view>
-      </view>
-
-      <!-- 内容 -->
-      <view class="cart-content ss-flex-1 ss-p-x-30 ss-m-b-40">
-        <view class="goods-box ss-r-10 ss-m-b-14" v-for="item in state.list" :key="item.id">
-          <view class="ss-flex ss-col-center">
-            <label class="check-box ss-flex ss-col-center ss-p-l-10" @tap="onSelectSingle(item.id)">
-              <radio
-                :checked="state.selectedIds.includes(item.id)"
-                color="var(--ui-BG-Main)"
-                style="transform: scale(0.8)"
-                @tap.stop="onSelectSingle(item.id)"
-              />
-            </label>
-            <s-goods-item
-              :title="item.spu.name"
-              :img="item.sku.picUrl || item.spu.picUrl"
-              :price="fen2yuan(item.sku.price)"
-              :skuText="item.sku.properties.map((property) => property.valueName).join(' ')"
-              priceColor="#FF3000"
-              :titleWidth="400"
-            >
-              <template v-if="!state.editMode" v-slot:tool>
-                <su-number-box
-                  :min="0"
-                  :max="item.sku.stock"
-                  :step="1"
-                  v-model="item.count"
-                  @change="onNumberChange($event, item)"
-                />
-              </template>
-            </s-goods-item>
-          </view>
-        </view>
-      </view>
-
-      <!-- 底部 -->
-      <su-fixed bottom :val="48" placeholder v-if="state.list.length > 0" :isInset="false">
-        <view class="cart-footer ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom">
-          <view class="footer-left ss-flex ss-col-center">
-            <label class="check-box ss-flex ss-col-center ss-p-r-30" @tap="onSelectAll">
-              <radio
-                :checked="state.isAllSelected"
-                color="var(--ui-BG-Main)"
-                style="transform: scale(0.8)"
-                @tap.stop="onSelectAll"
-              />
-              <view class="ss-m-l-8"> 全选 </view>
-            </label>
-            <text>合计:</text>
-            <view class="text-price price-text">
-              {{ fen2yuan(state.totalPriceSelected) }}
-            </view>
-          </view>
-          <view class="footer-right">
-            <button
-              v-if="state.editMode"
-              class="ss-reset-button ui-BG-Main-Gradient pay-btn ui-Shadow-Main"
-              @tap="onDelete"
-            >
-              删除
-            </button>
-            <button
-              v-else
-              class="ss-reset-button ui-BG-Main-Gradient pay-btn ui-Shadow-Main"
-              @tap="onConfirm"
-            >
-              去结算
-              {{ state.selectedIds?.length ? `(${state.selectedIds.length})` : '' }}
-            </button>
-          </view>
-        </view>
-      </su-fixed>
-    </view>
-  </s-layout>
+	<s-layout title="购物车" tabbar="/pages/index/cart" :bgStyle="{ color: '#fff' }">
+		<s-empty v-if="state.list.length === 0" text="购物车空空如也,快去逛逛吧~" icon="/static/cart-empty.png" />
+
+		<!-- 头部 -->
+		<view class="cart-box ss-flex ss-flex-col ss-row-between" v-if="state.list.length">
+			<view class="cart-header ss-flex ss-col-center ss-row-between ss-p-x-30">
+				<view class="header-left ss-flex ss-col-center ss-font-26">
+					共
+					<text class="goods-number ui-TC-Main ss-flex">{{ state.list.length }}</text>
+					件商品
+				</view>
+				<view class="header-right">
+					<button v-if="state.editMode" class="ss-reset-button" @tap="state.editMode = false">
+						取消
+					</button>
+					<button v-else class="ss-reset-button ui-TC-Main" @tap="state.editMode = true">
+						编辑
+					</button>
+				</view>
+			</view>
+			<!-- 内容 -->
+			<view class="cart-content ss-flex-1 ss-p-x-30 ss-m-b-40">
+				<view class="goods-box ss-r-10 ss-m-b-14" v-for="item in state.list" :key="item.id">
+					<view class="ss-flex ss-col-center">
+						<label class="check-box ss-flex ss-col-center ss-p-l-10" @tap="onSelectSingle(item.id)">
+							<radio :checked="state.selectedIds.includes(item.id)" color="var(--ui-BG-Main)"
+								style="transform: scale(0.8)" @tap.stop="onSelectSingle(item.id)" />
+						</label>
+						<s-goods-item :title="item.spu.name" :img="item.spu.picUrl || item.goods.image"
+							:price="item.sku.price/100"
+							:skuText="item.sku.properties.length>1? item.sku.properties.reduce((items2,items)=>items2.valueName+' '+items.valueName):item.sku.properties[0].valueName"
+							priceColor="#FF3000" :titleWidth="400">
+							<template v-if="!state.editMode" v-slot:tool>
+								<su-number-box :min="0" :max="item.sku.stock" :step="1" v-model="item.count"
+									@change="onNumberChange($event, item)"></su-number-box>
+							</template>
+						</s-goods-item>
+					</view>
+				</view>
+			</view>
+			<!-- 底部 -->
+			<su-fixed bottom :val="48" placeholder v-if="state.list.length > 0" :isInset="false">
+				<view class="cart-footer ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom">
+					<view class="footer-left ss-flex ss-col-center">
+						<label class="check-box ss-flex ss-col-center ss-p-r-30" @tap="onSelectAll">
+							<radio :checked="state.isAllSelected" color="var(--ui-BG-Main)"
+								style="transform: scale(0.8)" @tap.stop="onSelectAll" />
+							<view class="ss-m-l-8"> 全选 </view>
+						</label>
+						<text>合计:</text>
+						<view class="text-price price-text">
+							{{ state.totalPriceSelected }}
+						</view>
+					</view>
+					<view class="footer-right">
+						<button v-if="state.editMode" class="ss-reset-button ui-BG-Main-Gradient pay-btn ui-Shadow-Main"
+							@tap="onDelete">
+							删除
+						</button>
+						<button v-else class="ss-reset-button ui-BG-Main-Gradient pay-btn ui-Shadow-Main"
+							@tap="onConfirm">
+							去结算
+							{{ state.selectedIds?.length ? `(${state.selectedIds.length})` : '' }}
+						</button>
+					</view>
+				</view>
+			</su-fixed>
+		</view>
+	</s-layout>
 </template>
 
 <script setup>
-  import sheep from '@/sheep';
-  import { computed, reactive } from 'vue';
-  import { fen2yuan } from '@/sheep/hooks/useGoods';
-  import { property } from 'lodash/util';
-
-  const sys_navBar = sheep.$platform.navbar;
-  const cart = sheep.$store('cart');
-
-  const state = reactive({
-    editMode: false,
-    list: computed(() => cart.list), // 购物车项的列表
-    selectedIds: computed(() => cart.selectedIds),
-    isAllSelected: computed(() => cart.isAllSelected),
-    totalPriceSelected: computed(() => cart.totalPriceSelected),
-  });
-
-  // 单选
-  function onSelectSingle(id) {
-    cart.selectSingle(id);
-  }
-
-  // 全选
-  function onSelectAll() {
-    cart.selectAll(!state.isAllSelected);
-  }
-
-  // 结算
-  function onConfirm() {
-    const items = state.list
-      .filter((item) => state.selectedIds.includes(item.id))
-      .map((item) => {
-        return {
-          skuId: item.sku.id,
-          count: item.count,
-          cartId: item.id,
-        };
-      });
-    if (items.length === 0) {
-      sheep.$helper.toast('请选择商品');
-      return;
-    }
-    sheep.$router.go('/pages/order/confirm', {
-      data: JSON.stringify({
-        items,
-        // order_type: 'goods',
-        // goods_list,
-        // from: 'cart',
-        deliveryType: 1,
-        pointStatus: false,
-      }),
-    });
-  }
-
-  // 更新数量
-  function onNumberChange(number, cartItem) {
-    if (number === 0) {
-      cart.delete([cartItem.id]);
-      return;
-    }
-    if (cartItem.goods_num === number) {
-      return;
-    }
-    cartItem.goods_num = number;
-    cart.update({
-      goods_id: cartItem.id,
-      goods_num: number,
-    });
-  }
-
-  // 删除
-  async function onDelete() {
-    cart.delete(state.selectedIds);
-  }
+	import sheep from '@/sheep';
+	import {
+		computed,
+		reactive,
+		unref
+	} from 'vue';
+
+	const sys_navBar = sheep.$platform.navbar;
+	const cart = sheep.$store('cart');
+
+	const state = reactive({
+		editMode: false,
+		list: computed(() => cart.list),
+		selectedList: [],
+		selectedIds: computed(() => cart.selectedIds),
+		isAllSelected: computed(() => cart.isAllSelected),
+		totalPriceSelected: computed(() => cart.totalPriceSelected),
+	});
+	// 单选选中
+	function onSelectSingle(id) {
+		console.log('单选')
+		cart.selectSingle(id);
+	}
+	// 全选
+	function onSelectAll() {
+		cart.selectAll(!state.isAllSelected);
+	}
+
+	// 结算
+	function onConfirm() {
+		let items = []
+		let goods_list = [];
+		state.selectedList = state.list.filter((item) => state.selectedIds.includes(item.id));
+		state.selectedList.map((item) => {
+			console.log(item, '便利');
+			// 此处前端做出修改
+			items.push({
+				skuId: item.sku.id,
+				count: item.count,
+				cartId: item.id,
+			})
+			goods_list.push({
+				// goods_id: item.goods_id,
+				goods_id: item.spu.id,
+				// goods_num: item.goods_num,
+				goods_num: item.count,
+				// 商品价格id真没有
+				// goods_sku_price_id: item.goods_sku_price_id,
+			});
+		});
+		// return;
+		if (goods_list.length === 0) {
+			sheep.$helper.toast('请选择商品');
+			return;
+		}
+		sheep.$router.go('/pages/order/confirm', {
+			data: JSON.stringify({
+				// order_type: 'goods',
+				// goods_list,
+				items,
+				// from: 'cart',
+				deliveryType: 1,
+				pointStatus: false,
+			}),
+		});
+	}
+
+	function onNumberChange(e, cartItem) {
+		if (e === 0) {
+			cart.delete(cartItem.id);
+			return;
+		}
+		if (cartItem.goods_num === e) return;
+		cartItem.goods_num = e;
+		cart.update({
+			goods_id: cartItem.id,
+			goods_num: e,
+			goods_sku_price_id: cartItem.goods_sku_price_id,
+		});
+	}
+	async function onDelete() {
+		cart.delete(state.selectedIds);
+	}
 </script>
 
 <style lang="scss" scoped>
-  :deep(.ui-fixed) {
-    height: 72rpx;
-  }
-
-  .cart-box {
-    width: 100%;
-
-    .cart-header {
-      height: 70rpx;
-      background-color: #f6f6f6;
-      width: 100%;
-      position: fixed;
-      left: 0;
-      top: v-bind('sys_navBar') rpx;
-      z-index: 1000;
-      box-sizing: border-box;
-    }
-
-    .cart-footer {
-      height: 100rpx;
-      background-color: #fff;
-
-      .pay-btn {
-        width: 180rpx;
-        height: 70rpx;
-        font-size: 28rpx;
-        line-height: 28rpx;
-        font-weight: 500;
-        border-radius: 40rpx;
-      }
-    }
-
-    .cart-content {
-      margin-top: 70rpx;
-
-      .goods-box {
-        background-color: #fff;
-      }
-    }
-  }
-</style>
+	:deep(.ui-fixed) {
+		height: 72rpx;
+	}
+
+	.cart-box {
+		width: 100%;
+
+		.cart-header {
+			height: 70rpx;
+			background-color: #f6f6f6;
+			width: 100%;
+			position: fixed;
+			left: 0;
+			top: v-bind('sys_navBar') rpx;
+			z-index: 1000;
+			box-sizing: border-box;
+		}
+
+		.cart-footer {
+			height: 100rpx;
+			background-color: #fff;
+
+			.pay-btn {
+				width: 180rpx;
+				height: 70rpx;
+				font-size: 28rpx;
+				line-height: 28rpx;
+				font-weight: 500;
+				border-radius: 40rpx;
+			}
+		}
+
+		.cart-content {
+			margin-top: 70rpx;
+
+			.goods-box {
+				background-color: #fff;
+			}
+		}
+	}
+</style>

+ 30 - 31
pages/index/user.vue

@@ -1,42 +1,41 @@
 <template>
-
-	<s-layout title="我的" tabbar="/pages/index/user" navbar="custom" :bgStyle="template.page"
-		:navbarStyle="template.style?.navbar" onShareAppMessage>
-		<s-block v-for="(item, index) in template.components" :key="index" :styles="item.property.style">
-			<s-block-item :type="item.id" :data="item.property" :styles="item.property.style" />
-		</s-block>
-	</s-layout>
+  <s-layout
+    title="我的"
+    tabbar="/pages/index/user"
+    navbar="custom"
+    :bgStyle="template.page"
+    :navbarStyle="template.style?.navbar"
+    onShareAppMessage
+  >
+    <s-block v-for="(item, index) in template.components" :key="index" :styles="item.property.style">
+      <s-block-item :type="item.id" :data="item.property" :styles="item.property.style" />
+    </s-block>
+  </s-layout>
 </template>
 
 <script setup>
-	import {
-		computed
-	} from 'vue';
-	import {
-		onShow,
-		onPageScroll,
-		onPullDownRefresh
-	} from '@dcloudio/uni-app';
-	import sheep from '@/sheep';
+  import { computed } from 'vue';
+  import { onShow, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
+  import sheep from '@/sheep';
 
-	// 隐藏原生tabBar
-	uni.hideTabBar();
+  // 隐藏原生tabBar
+  uni.hideTabBar();
 
-	const template = computed(() => sheep.$store('app').template.user);
-	const isLogin = computed(() => sheep.$store('user').isLogin);
+  const template = computed(() => sheep.$store('app').template.user);
+  const isLogin = computed(() => sheep.$store('user').isLogin);
 
-	onShow(() => {
-		sheep.$store('user').updateUserData();
-	});
+  onShow(() => {
+    sheep.$store('user').updateUserData();
+  });
 
-	onPullDownRefresh(() => {
-		sheep.$store('user').updateUserData();
-		setTimeout(function() {
-			uni.stopPullDownRefresh();
-		}, 800);
-	});
+  onPullDownRefresh(() => {
+    sheep.$store('user').updateUserData();
+    setTimeout(function () {
+      uni.stopPullDownRefresh();
+    }, 800);
+  });
 
-	onPageScroll(() => {});
+  onPageScroll(() => {});
 </script>
 
-<style></style>
+<style></style>

+ 215 - 0
pages/order/aftersale/eturn-delivery.vue

@@ -0,0 +1,215 @@
+<template>
+	<s-layout>
+		<!-- title='退货物流' -->
+		<!-- 不知为何加上页面就错误 -->
+		<view>
+			<form @submit="subRefund" report-submit='true'>
+				<view class='apply-return'>
+					<view class='list borRadius14'>
+						<view class='item acea-row row-between-wrapper' style="display: flex;align-items: center;">
+							<view>物流公司</view>
+							<picker mode='selector' class='num' @change="bindPickerChange" :value="state.expressIndex"
+								:range="state.expresses" range-key="name">
+								<view class="picker acea-row row-between-wrapper">
+									<view class='reason'>{{ state.expresses[state.expressIndex].name }}</view>
+									<text class='iconfont icon-jiantou'></text>
+								</view>
+							</picker>
+						</view>
+						<view class='item textarea acea-row row-between' style="display: flex;align-items: center;">
+							<view>物流单号</view>
+							<input placeholder='请填写物流单号' class='num' name="logisticsNo"
+								placeholder-class='placeholder' />
+						</view>
+						<button class='returnBnt bg-color ss-reset-button ui-BG-Main-Gradient sub-btn'
+							form-type="submit"
+							style="background: linear-gradient(90deg,var(--ui-BG-Main),var(--ui-BG-Main-gradient))!important">提交</button>
+					</view>
+				</view>
+			</form>
+		</view>
+	</s-layout>
+</template>
+
+<script setup>
+	import sheep from '@/sheep';
+	import {
+		onLoad,
+		onReachBottom,
+		onPullDownRefresh
+	} from '@dcloudio/uni-app';
+	import {
+		computed,
+		watch,
+		ref,
+		reactive,
+		unref
+	} from 'vue';
+	const state = reactive({
+		expressIndex: 0,
+		expresses: [{
+				"id": 1,
+				"name": "申通快递"
+			},
+			{
+				"id": 2,
+				"name": "顺丰速运"
+			},
+			{
+				"id": 3,
+				"name": "中通快递"
+			},
+			{
+				"id": 4,
+				"name": "韵达快递"
+			}
+		], //模拟物流公司数组
+	})
+
+	function bindPickerChange(e) {
+		state.expressIndex = e.detail.value;
+	}
+
+	function subRefund(e) {
+		const formData = e.detail.value;
+		console.log(formData, '表单数据');
+		console.log(state.expresses[state.expressIndex].id, '物流公司id');
+		return;
+		// 下面是参考逻辑
+		AfterSaleApi.deliveryAfterSale({
+			id: this.id,
+			logisticsId: this.expresses[this.expressIndex].id,
+			logisticsNo: formData.logisticsNo,
+		}).then(res => {
+			this.$util.Tips({
+				title: '填写退货成功',
+				icon: 'success'
+			}, {
+				tab: 5,
+				url: '/pages/users/user_return_detail/index?id=' + this.id
+			});
+		}).catch(err => {
+			return this.$util.Tips({
+				title: err
+			});
+		})
+	}
+
+	function getList() {
+
+	}
+	onLoad(() => {
+		// 拿退货编号
+	})
+</script>
+
+<style lang="scss" scoped>
+	.apply-return {
+		padding: 20rpx 30rpx 70rpx 30rpx;
+	}
+
+	.apply-return .list {
+		background-color: #fff;
+		margin-top: 18rpx;
+		padding: 0 24rpx 70rpx 24rpx;
+	}
+
+	.apply-return .list .item {
+		min-height: 90rpx;
+		border-bottom: 1rpx solid #eee;
+		font-size: 30rpx;
+		color: #333;
+	}
+
+	.apply-return .list .item .num {
+		color: #282828;
+		margin-left: 27rpx;
+		// width: 227rpx;
+		// text-align: right;
+	}
+
+	.apply-return .list .item .num .picker .reason {
+		width: 385rpx;
+	}
+
+	.apply-return .list .item .num .picker .iconfont {
+		color: #666;
+		font-size: 30rpx;
+		margin-top: 2rpx;
+	}
+
+	.apply-return .list .item.textarea {
+		padding: 24rpx 0;
+	}
+
+	.apply-return .list .item textarea {
+		height: 100rpx;
+		font-size: 30rpx;
+	}
+
+	.apply-return .list .item .placeholder {
+		color: #bbb;
+	}
+
+	.apply-return .list .item .title {
+		height: 95rpx;
+		width: 100%;
+	}
+
+	.apply-return .list .item .title .tip {
+		font-size: 30rpx;
+		color: #bbb;
+	}
+
+	.apply-return .list .item .upload {
+		padding-bottom: 36rpx;
+	}
+
+	.apply-return .list .item .upload .pictrue {
+		border-radius: 14rpx;
+		margin: 22rpx 23rpx 0 0;
+		width: 156rpx;
+		height: 156rpx;
+		position: relative;
+		font-size: 24rpx;
+		color: #bbb;
+	}
+
+	.apply-return .list .item .upload .pictrue:nth-of-type(4n) {
+		margin-right: 0;
+	}
+
+	.apply-return .list .item .upload .pictrue image {
+		width: 100%;
+		height: 100%;
+		border-radius: 14rpx;
+	}
+
+	.apply-return .list .item .upload .pictrue .icon-guanbi1 {
+		position: absolute;
+		font-size: 45rpx;
+		top: -10rpx;
+		right: -10rpx;
+	}
+
+	.apply-return .list .item .upload .pictrue .icon-icon25201 {
+		color: #bfbfbf;
+		font-size: 50rpx;
+	}
+
+	.apply-return .list .item .upload .pictrue:nth-last-child(1) {
+		border: 1rpx solid #ddd;
+		box-sizing: border-box;
+	}
+
+	.apply-return .returnBnt {
+		font-size: 32rpx;
+		color: #fff;
+		width: 100%;
+		height: 86rpx;
+		border-radius: 50rpx;
+		text-align: center;
+		line-height: 86rpx;
+		margin: 43rpx auto;
+	}
+</style>

+ 407 - 381
pages/order/confirm.vue

@@ -1,388 +1,414 @@
 <template>
-  <s-layout title="确认订单">
-    <!-- TODO:这个判断先删除 v-if="state.orderInfo.need_address === 1" -->
-    <view class="bg-white address-box ss-m-b-14 ss-r-b-10" @tap="onSelectAddress">
-      <s-address-item :item="state.addressInfo" :hasBorderBottom="false">
-        <view class="ss-rest-button">
-          <text class="_icon-forward" />
-        </view>
-      </s-address-item>
-    </view>
-
-    <!-- 商品信息 -->
-    <view class="order-card-box ss-m-b-14">
-      <s-goods-item
-        v-for="item in state.orderInfo.items"
-        :key="item.skuId"
-        :img="item.picUrl"
-        :title="item.spuName"
-        :skuText="item.properties.map((property) => property.valueName).join(' ')"
-        :price="item.price"
-        :num="item.count"
-        marginBottom="10"
-      />
-      <view class="order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10">
-        <view class="item-title">订单备注</view>
-        <view class="ss-flex ss-col-center">
-          <uni-easyinput
-            maxlength="20"
-            placeholder="建议留言前先与商家沟通"
-            v-model="state.orderPayload.remark"
-            :inputBorder="false"
-            :clearable="false"
-          />
-        </view>
-      </view>
-    </view>
-
-    <!-- 价格信息 -->
-    <view class="bg-white total-card-box ss-p-20 ss-m-b-14 ss-r-10">
-      <view class="total-box-content border-bottom">
-        <view class="order-item ss-flex ss-col-center ss-row-between">
-          <view class="item-title">商品金额</view>
-          <view class="ss-flex ss-col-center">
-            <text class="item-value ss-m-r-24">
-              ¥{{ fen2yuan(state.orderInfo.price.totalPrice) }}
-            </text>
-          </view>
-        </view>
-        <!-- TODO 芋艿:接入积分 -->
-        <view
-          class="order-item ss-flex ss-col-center ss-row-between"
-          v-if="state.orderPayload.order_type === 'score'"
-        >
-          <view class="item-title">扣除积分</view>
-          <view class="ss-flex ss-col-center">
-            <image
-              :src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
-              class="score-img"
-            />
-            <text class="item-value ss-m-r-24">{{ state.orderInfo.score_amount }}</text>
-          </view>
-        </view>
-        <view class="order-item ss-flex ss-col-center ss-row-between">
-          <view class="item-title">运费</view>
-          <view class="ss-flex ss-col-center">
-            <text class="item-value ss-m-r-24">
-              +¥{{ fen2yuan(state.orderInfo.price.deliveryPrice) }}
-            </text>
-          </view>
-        </view>
-        <!-- 优惠劵:只有 type = 0 普通订单(非拼团、秒杀、砍价),才可以使用优惠劵 -->
-        <view
-          class="order-item ss-flex ss-col-center ss-row-between"
-          v-if="state.orderInfo.type === 0"
-        >
-          <view class="item-title">优惠券</view>
-          <view class="ss-flex ss-col-center" @tap="state.showCoupon = true">
-            <text class="item-value text-red" v-if="state.orderPayload.couponId > 0">
-              -¥{{ fen2yuan(state.orderInfo.price.couponPrice) }}
-            </text>
-            <text
-              class="item-value"
-              :class="state.couponInfo.length > 0 ? 'text-red' : 'text-disabled'"
-              v-else
-            >
-              {{
-                state.couponInfo.length > 0 ? state.couponInfo.length + ' 张可用' : '暂无可用优惠券'
-              }}
-            </text>
-            <text class="_icon-forward item-icon" />
-          </view>
-        </view>
-        <view
-          class="order-item ss-flex ss-col-center ss-row-between"
-          v-if="state.orderInfo.price.discountPrice > 0"
-        >
-          <view class="item-title">活动优惠</view>
-          <view class="ss-flex ss-col-center">
-            <!--                @tap="state.showDiscount = true" TODO 芋艿:后续要把优惠信息打进去 -->
-            <text class="item-value text-red">
-              -¥{{ fen2yuan(state.orderInfo.price.discountPrice) }}
-            </text>
-            <text class="_icon-forward item-icon" />
-          </view>
-        </view>
-      </view>
-      <view class="total-box-footer ss-font-28 ss-flex ss-row-right ss-col-center ss-m-r-28">
-        <view class="total-num ss-m-r-20">
-          共{{ state.orderInfo.items.reduce((acc, item) => acc + item.count, 0) }}件
-        </view>
-        <view>合计:</view>
-        <view class="total-num text-red"> ¥{{ fen2yuan(state.orderInfo.price.payPrice) }} </view>
-      </view>
-    </view>
-
-    <!-- 选择优惠券弹框 -->
-    <s-coupon-select
-      v-model="state.couponInfo"
-      :show="state.showCoupon"
-      @confirm="onSelectCoupon"
-      @close="state.showCoupon = false"
-    />
-
-    <!-- 满额折扣弹框 TODO 芋艿:后续要把优惠信息打进去 -->
-    <s-discount-list
-      v-model="state.orderInfo"
-      :show="state.showDiscount"
-      @close="state.showDiscount = false"
-    />
-
-    <!-- 底部 -->
-    <su-fixed bottom :opacity="false" bg="bg-white" placeholder :noFixed="false" :index="200">
-      <view class="footer-box border-top ss-flex ss-row-between ss-p-x-20 ss-col-center">
-        <view class="total-box-footer ss-flex ss-col-center">
-          <view class="total-num ss-font-30 text-red">
-            ¥{{ fen2yuan(state.orderInfo.price.payPrice) }}
-          </view>
-        </view>
-        <button
-          class="ss-reset-button ui-BG-Main-Gradient ss-r-40 submit-btn ui-Shadow-Main"
-          @tap="onConfirm"
-        >
-          提交订单
-        </button>
-      </view>
-    </su-fixed>
-  </s-layout>
+	<s-layout title="确认订单">
+		<!-- v-if="state.orderInfo.need_address === 1" -->
+		<!-- 这个判断先删除 -->
+		<view class="bg-white address-box ss-m-b-14 ss-r-b-10" @tap="onSelectAddress">
+			<s-address-item :item="state.addressInfo" :hasBorderBottom="false">
+				<view class="ss-rest-button"><text class="_icon-forward"></text></view>
+			</s-address-item>
+		</view>
+		<view class="order-card-box ss-m-b-14">
+			<s-goods-item v-for="item in state.orderInfo.goods_list" :key="item.goods_id"
+				:img="item.current_sku_price.image || item.goods.image" :title="item.goods.title"
+				:skuText="item.current_sku_price?.goods_sku_text" :price="item.current_sku_price.price"
+				:num="item.goods_num" marginBottom="10">
+				<template #top>
+					<view class="order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white">
+						<view class="item-title">配送方式</view>
+						<view class="ss-flex ss-col-center">
+							<text class="item-value">{{ item.dispatch_type_text }}</text>
+						</view>
+					</view>
+				</template>
+			</s-goods-item>
+
+			<view class="order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10">
+				<view class="item-title">订单备注</view>
+				<view class="ss-flex ss-col-center">
+					<uni-easyinput maxlength="20" placeholder="建议留言前先与商家沟通" v-model="state.orderPayload.remark"
+						:inputBorder="false" :clearable="false"></uni-easyinput>
+				</view>
+			</view>
+		</view>
+		<!-- 合计 -->
+		<view class="bg-white total-card-box ss-p-20 ss-m-b-14 ss-r-10">
+			<view class="total-box-content border-bottom">
+				<view class="order-item ss-flex ss-col-center ss-row-between">
+					<view class="item-title">商品金额</view>
+					<view class="ss-flex ss-col-center">
+						<text class="item-value ss-m-r-24">¥{{ state.orderInfo.goods_amount }}</text>
+					</view>
+				</view>
+				<view class="order-item ss-flex ss-col-center ss-row-between"
+					v-if="state.orderPayload.order_type === 'score'">
+					<view class="item-title">扣除积分</view>
+					<view class="ss-flex ss-col-center">
+						<image :src="sheep.$url.static('/static/img/shop/goods/score1.svg')" class="score-img"></image>
+						<text class="item-value ss-m-r-24">{{ state.orderInfo.score_amount }}</text>
+					</view>
+				</view>
+				<view class="order-item ss-flex ss-col-center ss-row-between">
+					<view class="item-title">运费</view>
+					<view class="ss-flex ss-col-center">
+						<text class="item-value ss-m-r-24">+¥{{ state.orderInfo.dispatch_amount }}</text>
+					</view>
+				</view>
+				<view class="order-item ss-flex ss-col-center ss-row-between"
+					v-if="state.orderPayload.order_type != 'score'">
+					<!-- <view v-if="state.orderInfo.coupon_discount_fee > 0" class="order-item ss-flex ss-col-center ss-row-between"> -->
+					<view class="item-title">优惠券</view>
+					<view class="ss-flex ss-col-center" @tap="state.showCoupon = true">
+						<text class="item-value text-red"
+							v-if="state.orderPayload.coupon_id">-¥{{ state.orderInfo.coupon_discount_fee }}</text>
+						<text class="item-value"
+							:class="state.couponInfo.can_use?.length > 0 ? 'text-red' : 'text-disabled'" v-else>{{
+                state.couponInfo.can_use?.length > 0
+                  ? state.couponInfo.can_use?.length + '张可用'
+                  : '暂无可用优惠券'
+              }}</text>
+
+						<text class="_icon-forward item-icon"></text>
+					</view>
+				</view>
+				<view class="order-item ss-flex ss-col-center ss-row-between"
+					v-if="state.orderInfo.promo_infos?.length">
+					<!-- <view v-if="state.orderInfo.promo_discount_fee > 0" class="order-item ss-flex ss-col-center ss-row-between"> -->
+					<view class="item-title">活动优惠</view>
+					<view class="ss-flex ss-col-center" @tap="state.showDiscount = true">
+						<text class="item-value text-red"> -¥{{ state.orderInfo.promo_discount_fee }} </text>
+						<text class="_icon-forward item-icon"></text>
+					</view>
+				</view>
+			</view>
+			<view class="total-box-footer ss-font-28 ss-flex ss-row-right ss-col-center ss-m-r-28">
+				<view class="total-num ss-m-r-20">共{{ state.totalNumber }}件</view>
+				<view>合计:</view>
+				<view class="total-num text-red"> ¥{{ state.orderInfo.pay_fee }} </view>
+				<view class="ss-flex" v-if="state.orderPayload.order_type === 'score'">
+					<view class="total-num ss-font-30 text-red ss-m-l-4"> + </view>
+					<image :src="sheep.$url.static('/static/img/shop/goods/score1.svg')" class="score-img"></image>
+					<view class="total-num ss-font-30 text-red">{{ state.orderInfo.score_amount }}</view>
+				</view>
+			</view>
+		</view>
+		<!-- 发票 -->
+		<view class="bg-white ss-p-20 ss-r-20">
+			<view class="order-item ss-flex ss-col-center ss-row-between">
+				<view class="item-title">发票申请</view>
+				<view class="ss-flex ss-col-center" @tap="onSelectInvoice">
+					<text class="item-value">{{ state.invoiceInfo.name || '无需开具发票' }}</text>
+					<text class="_icon-forward item-icon"></text>
+				</view>
+			</view>
+		</view>
+		<!-- 选择优惠券弹框 -->
+		<s-coupon-select v-model="state.couponInfo" :show="state.showCoupon" @confirm="onSelectCoupon"
+			@close="state.showCoupon = false" />
+		<!-- 满额折扣弹框  -->
+		<s-discount-list v-model="state.orderInfo" :show="state.showDiscount" @close="state.showDiscount = false" />
+		<!-- 底部 -->
+		<su-fixed bottom :opacity="false" bg="bg-white" placeholder :noFixed="false" :index="200">
+			<view class="footer-box border-top ss-flex ss-row-between ss-p-x-20 ss-col-center">
+				<view class="total-box-footer ss-flex ss-col-center">
+					<view class="total-num ss-font-30 text-red"> ¥{{ state.orderInfo.pay_fee }} </view>
+					<view v-if="state.orderPayload.order_type === 'score'" class="ss-flex">
+						<view class="total-num ss-font-30 text-red ss-m-l-4">+</view>
+						<image :src="sheep.$url.static('/static/img/shop/goods/score1.svg')" class="score-img"></image>
+						<view class="total-num ss-font-30 text-red">{{ state.orderInfo.score_amount }}</view>
+					</view>
+				</view>
+
+				<button class="ss-reset-button ui-BG-Main-Gradient ss-r-40 submit-btn ui-Shadow-Main" @tap="onConfirm">
+					{{ exchangeNow ? '立即兑换' : '提交订单' }}
+				</button>
+			</view>
+		</su-fixed>
+	</s-layout>
 </template>
 
 <script setup>
-  import { reactive } from 'vue';
-  import { onLoad } from '@dcloudio/uni-app';
-  import sheep from '@/sheep';
-  import { isEmpty } from 'lodash';
-  import OrderApi from '@/sheep/api/trade/order';
-  import CouponApi from '@/sheep/api/promotion/coupon';
-  import { fen2yuan } from '@/sheep/hooks/useGoods';
-
-  const state = reactive({
-    orderPayload: {},
-    orderInfo: {
-      items: [], // 商品项列表
-      price: {}, // 价格信息
-    },
-    addressInfo: {}, // 选择的收货地址
-    showCoupon: false, // 是否展示优惠劵
-    couponInfo: [], // 优惠劵列表
-    showDiscount: false, // 是否展示营销活动
-  });
-
-  // 选择地址
-  function onSelectAddress() {
-    uni.$once('SELECT_ADDRESS', (e) => {
-      changeConsignee(e.addressInfo);
-    });
-    sheep.$router.go('/pages/user/address/list');
-  }
-
-  // 更改收货人地址&计算订单信息
-  async function changeConsignee(addressInfo = {}) {
-    if (!isEmpty(addressInfo)) {
-      state.addressInfo = addressInfo;
-    }
-    await getOrderInfo();
-  }
-
-  // 选择优惠券
-  async function onSelectCoupon(couponId) {
-    state.orderPayload.couponId = couponId || 0;
-    await getOrderInfo();
-    state.showCoupon = false;
-  }
-
-  // 提交订单
-  function onConfirm() {
-    if (!state.addressInfo.id) {
-      sheep.$helper.toast('请选择收货地址');
-      return;
-    }
-    submitOrder();
-  }
-
-  // 创建订单&跳转
-  async function submitOrder() {
-    const { code, data } = await OrderApi.createOrder({
-      items: state.orderPayload.items,
-      couponId: state.orderPayload.couponId,
-      addressId: state.addressInfo.id,
-      deliveryType: 1, // TODO 芋艿:需要支持【门店自提】
-      pointStatus: false, // TODO 芋艿:需要支持【积分选择】
-    });
-    if (code !== 0) {
-      return;
-    }
-    // 更新购物车列表,如果来自购物车
-    if (state.orderPayload.items[0].cartId > 0) {
-      sheep.$store('cart').getList();
-    }
-    // 跳转到支付页面
-    sheep.$router.redirect('/pages/pay/index', {
-      orderSN: data.payOrderId,
-    });
-  }
-
-  // 检查库存 & 计算订单价格
-  async function getOrderInfo() {
-    // 计算价格
-    const { data, code } = await OrderApi.settlementOrder({
-      items: state.orderPayload.items,
-      couponId: state.orderPayload.couponId,
-      addressId: state.addressInfo.id,
-      deliveryType: 1, // TODO 芋艿:需要支持【门店自提】
-      pointStatus: false, // TODO 芋艿:需要支持【积分选择】
-    });
-    if (code !== 0) {
-      return;
-    }
-    state.orderInfo = data;
-    // 设置收货地址
-    if (state.orderInfo.address) {
-      state.addressInfo = state.orderInfo.address;
-    }
-  }
-
-  // 获取可用优惠券
-  async function getCoupons() {
-    const { code, data } = await CouponApi.getMatchCouponList(
-      state.orderInfo.price.payPrice,
-      state.orderInfo.items.map((item) => item.spuId),
-      state.orderPayload.items.map((item) => item.skuId),
-      state.orderPayload.items.map((item) => item.categoryId),
-    );
-    if (code === 0) {
-      state.couponInfo = data;
-    }
-  }
-
-  onLoad(async (options) => {
-    if (!options.data) {
-      sheep.$helper.toast('参数不正确,请检查!');
-      return;
-    }
-    state.orderPayload = JSON.parse(options.data);
-    await getOrderInfo();
-    await getCoupons();
-  });
+	import {
+		reactive,
+		computed
+	} from 'vue';
+	import {
+		onLoad,
+		onPageScroll,
+		onShow
+	} from '@dcloudio/uni-app';
+	import sheep from '@/sheep';
+	import {
+		isEmpty
+	} from 'lodash';
+
+	const state = reactive({
+		orderPayload: {},
+		orderInfo: {},
+		addressInfo: {},
+		invoiceInfo: {},
+		totalNumber: 0,
+		showCoupon: false,
+		couponInfo: [],
+		showDiscount: false,
+	});
+
+	// 立即兑换(立即兑换无需跳转收银台)
+	const exchangeNow = computed(
+		() => state.orderPayload.order_type === 'score' && state.orderInfo.pay_fee == 0,
+	);
+
+	// 选择地址
+	function onSelectAddress() {
+		uni.$once('SELECT_ADDRESS', (e) => {
+			changeConsignee(e.addressInfo);
+		});
+		sheep.$router.go('/pages/user/address/list');
+	}
+
+	// 更改收货人地址&计算订单信息
+	async function changeConsignee(addressInfo = {}) {
+		if (isEmpty(addressInfo)) {
+			const {
+				code,
+				data
+			} = await sheep.$api.user.address.default();
+			console.log(data, '默认收货地址');
+			if (code === 0 && !isEmpty(data)) {
+				console.log('执行赋值')
+				addressInfo = data;
+			}
+		}
+		if (!isEmpty(addressInfo)) {
+			state.addressInfo = addressInfo;
+			state.orderPayload.address_id = state.addressInfo.id;
+		}
+		getOrderInfo();
+	}
+
+	// 选择优惠券
+	async function onSelectCoupon(e) {
+		state.orderPayload.coupon_id = e || 0;
+		getOrderInfo();
+		state.showCoupon = false;
+	}
+
+	// 选择发票信息
+	function onSelectInvoice() {
+		uni.$once('SELECT_INVOICE', (e) => {
+			state.invoiceInfo = e.invoiceInfo;
+			state.orderPayload.invoice_id = e.invoiceInfo.id || 0;
+		});
+		sheep.$router.go('/pages/user/invoice/list');
+	}
+
+	// 提交订单/立即兑换
+	function onConfirm() {
+		if (!state.orderPayload.address_id && state.orderInfo.need_address === 1) {
+			sheep.$helper.toast('请选择收货地址');
+			return;
+		}
+
+		if (exchangeNow.value) {
+			uni.showModal({
+				title: '提示',
+				content: '确定使用积分立即兑换?',
+				cancelText: '再想想',
+				success: async function(res) {
+					if (res.confirm) {
+						submitOrder();
+					}
+				},
+			});
+		} else {
+			submitOrder();
+		}
+	}
+
+	// 创建订单&跳转
+	async function submitOrder() {
+		const {
+			error,
+			data
+		} = await sheep.$api.order.create(state.orderPayload);
+		if (error === 0) {
+			// 更新购物车列表
+			if (state.orderPayload.from === 'cart') {
+				sheep.$store('cart').getList();
+			}
+			if (exchangeNow.value) {
+				sheep.$router.redirect('/pages/pay/result', {
+					orderSN: data.order_sn,
+				});
+			} else {
+				sheep.$router.redirect('/pages/pay/index', {
+					orderSN: data.order_sn,
+				});
+			}
+		}
+	}
+
+	// 检查库存&计算订单价格
+	async function getOrderInfo() {
+		console.log(state.orderPayload, '计算价格传参')
+		// let {code, data} = await sheep.$api.order.calc(state.orderPayload);
+		// let data = await sheep.$api.order.calc(state.orderPayload);
+		console.log(state.orderPayload.items)
+		let data = await sheep.$api.order.calc({
+			deliveryType: 1,
+			pointStatus: false,
+			items: state.orderPayload.items
+		});
+		console.log(data, '修改后的获取订单详细数据')
+		return;
+		if (error === 0) {
+			state.totalNumber = 0;
+			state.orderInfo = data;
+			state.orderInfo.goods_list.forEach((item) => {
+				state.totalNumber += item.goods_num;
+			});
+		}
+	}
+
+	// 获取可用优惠券
+	async function getCoupons() {
+		const {
+			error,
+			data
+		} = await sheep.$api.order.coupons(state.orderPayload);
+		if (error === 0) {
+			state.couponInfo = data;
+		}
+	}
+
+	onLoad(async (options) => {
+		console.log(options)
+		if (options.data) {
+			state.orderPayload = JSON.parse(options.data);
+			changeConsignee();
+			if (state.orderPayload.order_type !== 'score') {
+				getCoupons();
+			}
+		}
+	});
 </script>
 
 <style lang="scss" scoped>
-  :deep() {
-    .uni-input-wrapper {
-      width: 320rpx;
-    }
-
-    .uni-easyinput__content-input {
-      font-size: 28rpx;
-      height: 72rpx;
-      text-align: right !important;
-      padding-right: 0 !important;
-
-      .uni-input-input {
-        font-weight: 500;
-        color: #333333;
-        font-size: 26rpx;
-        height: 32rpx;
-        margin-top: 4rpx;
-      }
-    }
-
-    .uni-easyinput__content {
-      display: flex !important;
-      align-items: center !important;
-      justify-content: right !important;
-    }
-  }
-
-  .score-img {
-    width: 36rpx;
-    height: 36rpx;
-    margin: 0 4rpx;
-  }
-
-  .order-item {
-    height: 80rpx;
-
-    .item-title {
-      font-size: 28rpx;
-      font-weight: 400;
-    }
-
-    .item-value {
-      font-size: 28rpx;
-      font-weight: 500;
-      font-family: OPPOSANS;
-    }
-
-    .text-disabled {
-      color: #bbbbbb;
-    }
-
-    .item-icon {
-      color: $dark-9;
-    }
-
-    .remark-input {
-      text-align: right;
-    }
-
-    .item-placeholder {
-      color: $dark-9;
-      font-size: 26rpx;
-      text-align: right;
-    }
-  }
-
-  .total-box-footer {
-    height: 90rpx;
-
-    .total-num {
-      color: #333333;
-      font-family: OPPOSANS;
-    }
-  }
-
-  .footer-box {
-    height: 100rpx;
-
-    .submit-btn {
-      width: 240rpx;
-      height: 70rpx;
-      font-size: 28rpx;
-      font-weight: 500;
-
-      .goto-pay-text {
-        line-height: 28rpx;
-      }
-    }
-
-    .cancel-btn {
-      width: 240rpx;
-      height: 80rpx;
-      font-size: 26rpx;
-      background-color: #e5e5e5;
-      color: $dark-9;
-    }
-  }
-
-  .title {
-    font-size: 36rpx;
-    font-weight: bold;
-    color: #333333;
-  }
-
-  .subtitle {
-    font-size: 28rpx;
-    color: #999999;
-  }
-
-  .cicon-checkbox {
-    font-size: 36rpx;
-    color: var(--ui-BG-Main);
-  }
-
-  .cicon-box {
-    font-size: 36rpx;
-    color: #999999;
-  }
-</style>
+	:deep() {
+		.uni-input-wrapper {
+			width: 320rpx;
+		}
+
+		.uni-easyinput__content-input {
+			font-size: 28rpx;
+			height: 72rpx;
+			text-align: right !important;
+			padding-right: 0 !important;
+
+			.uni-input-input {
+				font-weight: 500;
+				color: #333333;
+				font-size: 26rpx;
+				height: 32rpx;
+				margin-top: 4rpx;
+			}
+		}
+
+		.uni-easyinput__content {
+			display: flex !important;
+			align-items: center !important;
+			justify-content: right !important;
+		}
+	}
+
+	.score-img {
+		width: 36rpx;
+		height: 36rpx;
+		margin: 0 4rpx;
+	}
+
+	.order-item {
+		height: 80rpx;
+
+		.item-title {
+			font-size: 28rpx;
+			font-weight: 400;
+		}
+
+		.item-value {
+			font-size: 28rpx;
+			font-weight: 500;
+			font-family: OPPOSANS;
+		}
+
+		.text-disabled {
+			color: #bbbbbb;
+		}
+
+		.item-icon {
+			color: $dark-9;
+		}
+
+		.remark-input {
+			text-align: right;
+		}
+
+		.item-placeholder {
+			color: $dark-9;
+			font-size: 26rpx;
+			text-align: right;
+		}
+	}
+
+	.total-box-footer {
+		height: 90rpx;
+
+		.total-num {
+			color: #333333;
+			font-family: OPPOSANS;
+		}
+	}
+
+	.footer-box {
+		height: 100rpx;
+
+		.submit-btn {
+			width: 240rpx;
+			height: 70rpx;
+			font-size: 28rpx;
+			font-weight: 500;
+
+			.goto-pay-text {
+				line-height: 28rpx;
+			}
+		}
+
+		.cancel-btn {
+			width: 240rpx;
+			height: 80rpx;
+			font-size: 26rpx;
+			background-color: #e5e5e5;
+			color: $dark-9;
+		}
+	}
+
+	.title {
+		font-size: 36rpx;
+		font-weight: bold;
+		color: #333333;
+	}
+
+	.subtitle {
+		font-size: 28rpx;
+		color: #999999;
+	}
+
+	.cicon-checkbox {
+		font-size: 36rpx;
+		color: var(--ui-BG-Main);
+	}
+
+	.cicon-box {
+		font-size: 36rpx;
+		color: #999999;
+	}
+</style>

+ 124 - 54
pages/pay/index.vue

@@ -2,17 +2,14 @@
 <template>
   <s-layout title="收银台">
     <view class="bg-white ss-modal-box ss-flex-col">
-      <!-- 订单信息 -->
       <view class="modal-header ss-flex-col ss-col-center ss-row-center">
         <view class="money-box ss-m-b-20">
-          <text class="money-text">{{ fen2yuan(state.orderInfo.price) }}</text>
+          <text class="money-text">{{ state.orderInfo.pay_fee }}</text>
         </view>
         <view class="time-text">
           <text>{{ payDescText }}</text>
         </view>
       </view>
-
-      <!-- 支付方式 -->
       <view class="modal-content ss-flex-1">
         <view class="pay-title ss-p-l-30 ss-m-y-30">选择支付方式</view>
         <radio-group @change="onTapPay">
@@ -20,6 +17,7 @@
             <view
               class="pay-item ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom"
               :class="{ 'disabled-pay-item': item.disabled }"
+              v-if="allowedPayment.includes(item.value)"
             >
               <view class="ss-flex ss-col-center">
                 <image
@@ -27,19 +25,25 @@
                   v-if="item.disabled"
                   :src="sheep.$url.static('/static/img/shop/pay/cod_disabled.png')"
                   mode="aspectFit"
-                />
+                ></image>
                 <image
                   class="pay-icon"
                   v-else
                   :src="sheep.$url.static(item.icon)"
                   mode="aspectFit"
-                />
+                ></image>
                 <text class="pay-title">{{ item.title }}</text>
               </view>
               <view class="check-box ss-flex ss-col-center ss-p-l-10">
-                <view class="userInfo-money ss-m-r-10" v-if="item.value === 'wallet'">
+                <view class="userInfo-money ss-m-r-10" v-if="item.value == 'money'">
                   余额: {{ userInfo.money }}元
                 </view>
+                <view
+                  class="userInfo-money ss-m-r-10"
+                  v-if="item.value == 'offline' && item.disabled"
+                >
+                  部分商品不支持
+                </view>
                 <radio
                   :value="item.value"
                   color="var(--ui-BG-Main)"
@@ -52,7 +56,6 @@
           </label>
         </radio-group>
       </view>
-
       <!-- 工具 -->
       <view class="modal-footer ss-flex ss-row-center ss-col-center ss-m-t-80 ss-m-b-40">
         <button v-if="state.payStatus === 0" class="ss-reset-button past-due-btn">
@@ -78,49 +81,95 @@
   import { computed, reactive } from 'vue';
   import { onLoad } from '@dcloudio/uni-app';
   import sheep from '@/sheep';
-  import { fen2yuan, useDurationTime } from '@/sheep/hooks/useGoods';
-  import PayOrderApi from '@/sheep/api/pay/order';
-  import PayChannelApi from '@/sheep/api/pay/channel';
-  import { getPayMethods } from '@/sheep/platform/pay';
+  import { useDurationTime } from '@/sheep/hooks/useGoods';
 
   const userInfo = computed(() => sheep.$store('user').userInfo);
 
   // 检测支付环境
   const state = reactive({
-    orderType: 'goods', // 订单类型; goods - 商品订单, recharge - 充值订单
-    orderInfo: {}, // 支付单信息
+    orderType: 'goods',
+    payment: '',
+    orderInfo: {},
     payStatus: 0, // 0=检测支付环境, -2=未查询到支付单信息, -1=支付已过期, 1=待支付,2=订单已支付
-    payMethods: [], // 可选的支付方式
-    payment: '', // 选中的支付方式
+    payMethods: [],
   });
 
+  const allowedPayment = computed(() => {
+    if(state.orderType === 'recharge') {
+      return sheep.$store('app').platform.recharge_payment
+    }
+    return sheep.$store('app').platform.payment
+    });
+
+  const payMethods = [
+    {
+      icon: '/static/img/shop/pay/wechat.png',
+      title: '微信支付',
+      value: 'wechat',
+      disabled: false,
+    },
+    {
+      icon: '/static/img/shop/pay/alipay.png',
+      title: '支付宝支付',
+      value: 'alipay',
+      disabled: false,
+    },
+    {
+      icon: '/static/img/shop/pay/wallet.png',
+      title: '余额支付',
+      value: 'money',
+      disabled: false,
+    },
+    {
+      icon: '/static/img/shop/pay/apple.png',
+      title: 'Apple Pay',
+      value: 'apple',
+      disabled: false,
+    },
+    {
+      icon: '/static/img/shop/pay/cod.png',
+      title: '货到付款',
+      value: 'offline',
+      disabled: false,
+    },
+  ];
+
   const onPay = () => {
     if (state.payment === '') {
       sheep.$helper.toast('请选择支付方式');
       return;
     }
-    if (state.payment === 'wallet') {
+    if (state.payment === 'money') {
       uni.showModal({
         title: '提示',
         content: '确定要支付吗?',
         success: function (res) {
           if (res.confirm) {
-            sheep.$platform.pay(state.payment, state.orderType, state.orderInfo.id);
+            sheep.$platform.pay(state.payment, state.orderType, state.orderInfo.order_sn);
+          }
+        },
+      });
+    } else if (state.payment === 'offline') {
+      uni.showModal({
+        title: '提示',
+        content: '确定要下单吗?',
+        success: function (res) {
+          if (res.confirm) {
+            sheep.$platform.pay(state.payment, state.orderType, state.orderInfo.order_sn);
           }
         },
       });
     } else {
-      sheep.$platform.pay(state.payment, state.orderType, state.orderInfo.id);
+      sheep.$platform.pay(state.payment, state.orderType, state.orderInfo.order_sn);
     }
   };
 
-  // 支付文案提示
   const payDescText = computed(() => {
     if (state.payStatus === 2) {
       return '该订单已支付';
     }
-    if (state.payStatus === 1) {
-      const time = useDurationTime(state.orderInfo.expireTime);
+    if (state.payStatus === 1 && state.orderInfo.ext.expired_time !== 0) {
+      const time = useDurationTime(state.orderInfo.ext.expired_time);
       if (time.ms <= 0) {
         state.payStatus = -1;
         return '';
@@ -130,65 +179,86 @@
     if (state.payStatus === -2) {
       return '未查询到支付单信息';
     }
+
     return '';
   });
 
-  // 状态转换:payOrder.status => payStatus
   function checkPayStatus() {
-    if (state.orderInfo.status === 10
-      || state.orderInfo.status === 20 ) { // 支付成功
-      state.payStatus = 2;
+    if (state.orderInfo.status === 'unpaid') {
+      state.payStatus = 1;
       return;
     }
-    if (state.orderInfo.status === 30) { // 支付关闭
+    if (state.orderInfo.status === 'closed') {
       state.payStatus = -1;
       return;
     }
-    state.payStatus = 1; // 待支付
+    state.payStatus = 2;
   }
 
-  // 切换支付方式
   function onTapPay(e) {
     state.payment = e.detail.value;
   }
 
-  // 设置支付订单信息
-  async function setOrder(id) {
-    // 获得支付订单信息
-    const { data, code } = await PayOrderApi.getOrder(id);
-    if (code !== 0 || !data) {
+  async function setRechargeOrder(id) {
+    const { data, error } = await sheep.$api.trade.order(id);
+    if (error === 0) {
+      state.orderInfo = data;
+      state.payMethods = payMethods;
+      checkPayStatus();
+    } else {
       state.payStatus = -2;
-      return;
     }
-    state.orderInfo = data;
-    // 获得支付方式
-    await setPayMethods();
-    // 设置支付状态
-    checkPayStatus();
   }
 
-  // 获得支付方式
-  async function setPayMethods() {
-    const { data, code } = await PayChannelApi.getEnableChannelCodeList(state.orderInfo.appId)
-    if (code !== 0) {
-      return
+  async function setGoodsOrder(id) {
+    const { data, error } = await sheep.$api.order.detail(id);
+    if (error === 0) {
+      state.orderInfo = data;
+      if (state.orderInfo.ext.offline_status === 'none') {
+        payMethods.forEach((item, index, array) => {
+          if (item.value === 'offline') {
+            array.splice(index, 1);
+          }
+        });
+      } else if (state.orderInfo.ext.offline_status === 'disabled') {
+        payMethods.forEach((item) => {
+          if (item.value === 'offline') {
+            item.disabled = true;
+          }
+        });
+      }
+      state.payMethods = payMethods;
+      checkPayStatus();
+    } else {
+      state.payStatus = -2;
     }
-    state.payMethods = getPayMethods(data)
   }
 
   onLoad((options) => {
-    if (sheep.$platform.name === 'WechatOfficialAccount'
-      && sheep.$platform.os === 'ios'
-      && !sheep.$platform.landingPage.includes('pages/pay/index')) {
+    if (
+      sheep.$platform.name === 'WechatOfficialAccount' &&
+      sheep.$platform.os === 'ios' &&
+      !sheep.$platform.landingPage.includes('pages/pay/index')
+    ) {
       location.reload();
       return;
     }
-    // 获得支付订单信息
-    let id = options.id;
-    if (options.orderType) {
-      state.orderType = options.orderType;
+    let id = '';
+    if (options.orderSN) {
+      id = options.orderSN;
+    }
+    if (options.id) {
+      id = options.id;
+    }
+    if (options.type === 'recharge') {
+      state.orderType = 'recharge';
+      // 充值订单
+      setRechargeOrder(id);
+    } else {
+      state.orderType = 'goods';
+      // 商品订单
+      setGoodsOrder(id);
     }
-    setOrder(id);
   });
 </script>
 

+ 256 - 238
pages/pay/recharge.vue

@@ -1,250 +1,268 @@
 <template>
-  <s-layout title="充值" class="withdraw-wrap" navbar="inner">
-    <view class="wallet-num-box ss-flex ss-col-center ss-row-between" :style="[
+	<s-layout title="充值" class="withdraw-wrap" navbar="inner">
+		<view class="wallet-num-box ss-flex ss-col-center ss-row-between" :style="[
       {
         marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
         paddingTop: Number(statusBarHeight + 108) + 'rpx',
       },
     ]">
-      <view class="">
-        <view class="num-title">当前余额(元)</view>
-        <view class="wallet-num">{{ userInfo.money }}</view>
-      </view>
-      <button class="ss-reset-button log-btn" @tap="sheep.$router.go('/pages/pay/recharge-log')">充值记录</button>
-    </view>
-    <view class="recharge-box">
-      <view class="recharge-card-box" v-if="state.data.status">
-        <view class="input-label ss-m-b-50">充值金额</view>
-        <view class="input-box ss-flex border-bottom ss-p-b-20" v-if="state.data.custom_status">
-          <view class="unit">¥</view>
-          <uni-easyinput v-model="state.recharge_money" type="digit" placeholder="请输入充值金额" :inputBorder="false">
-          </uni-easyinput>
-        </view>
-        <view class="face-value-box ss-flex ss-flex-wrap ss-m-y-40">
-          <button class="ss-reset-button face-value-btn" v-for="item in state.faceValueList" :key="item.money"
-            :class="[{ 'btn-active': state.recharge_money == parseFloat(item.money) }]" @tap="onCard(item.money)">
-            <text class="face-value-title">{{ item.money }}</text>
-            <view v-if="item.gift" class="face-value-tag">
-              送{{ item.gift }}{{ state.data.gift_type == 'money' ? '元' : '积分' }}</view>
-          </button>
-        </view>
-        <button class="ss-reset-button save-btn ui-BG-Main-Gradient ss-m-t-60 ui-Shadow-Main" @tap="onConfirm">
-          确认充值
-        </button>
-      </view>
-      <view class="" v-if="state.data.status === 0"> 关闭充值 </view>
-    </view>
-  </s-layout>
+			<view class="">
+				<view class="num-title">当前余额(元)</view>
+				<view class="wallet-num">{{ userInfo.money }}</view>
+			</view>
+			<button class="ss-reset-button log-btn" @tap="sheep.$router.go('/pages/pay/recharge-log')">充值记录</button>
+		</view>
+		<view class="recharge-box">
+			<view class="recharge-card-box" v-if="state.data.status">
+				<view class="input-label ss-m-b-50">充值金额</view>
+				<view class="input-box ss-flex border-bottom ss-p-b-20" v-if="state.data.custom_status">
+					<view class="unit">¥</view>
+					<uni-easyinput v-model="state.recharge_money" type="digit" placeholder="请输入充值金额"
+						:inputBorder="false">
+					</uni-easyinput>
+				</view>
+				<view class="face-value-box ss-flex ss-flex-wrap ss-m-y-40">
+					<button class="ss-reset-button face-value-btn" v-for="item in state.faceValueList" :key="item.money"
+						:class="[{ 'btn-active': state.recharge_money == parseFloat(item.money) }]"
+						@tap="onCard(item.payPrice/100)">
+						<text class="face-value-title">{{ item.payPrice/100 }}</text>
+						<view v-if="item.bonusPrice" class="face-value-tag">
+							送{{ item.bonusPrice/100 }}{{ state.data.gift_type == 'money' ? '元' : '积分' }}</view>
+					</button>
+				</view>
+				<button class="ss-reset-button save-btn ui-BG-Main-Gradient ss-m-t-60 ui-Shadow-Main" @tap="onConfirm">
+					确认充值
+				</button>
+			</view>
+			<view class="" v-if="state.data.status === 0"> 关闭充值 </view>
+		</view>
+	</s-layout>
 </template>
 
 <script setup>
-import { computed, reactive } from 'vue';
-import sheep from '@/sheep';
-import { onLoad } from '@dcloudio/uni-app';
-
-const userInfo = computed(() => sheep.$store('user').userInfo);
-const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
-const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
-
-const state = reactive({
-  recharge_money: '',
-  data: {},
-  faceValueList: [],
-});
-// 点击卡片
-
-function onCard(e) {
-  state.recharge_money = e;
-}
-async function getRechargeTabs() {
-  const res = await sheep.$api.trade.rechargeRules();
-  if (res.error === 0) {
-    state.data = res.data;
-    state.data.status = res.data.status;
-    state.faceValueList = res.data.quick_amounts;
-  }
-}
-
-function onChange(e) {
-  state.data.gift_type = e.detail.value;
-}
-
-async function onConfirm() {
-  const { error, data } = await sheep.$api.trade.recharge({
-    recharge_money: state.recharge_money,
-  });
-  if (error === 0) {
-    // #ifdef MP
-    sheep.$platform.useProvider('wechat').subscribeMessage('money_change');
-    // #endif
-    sheep.$router.go('/pages/pay/index', { orderSN: data.order_sn, type: 'recharge' });
-  }
-}
-onLoad(() => {
-  getRechargeTabs();
-});
+	import {
+		computed,
+		reactive
+	} from 'vue';
+	import sheep from '@/sheep';
+	import {
+		onLoad
+	} from '@dcloudio/uni-app';
+
+	const userInfo = computed(() => sheep.$store('user').userInfo);
+	const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
+	const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
+
+	const state = reactive({
+		recharge_money: '',
+		data: {},
+		faceValueList: [],
+	});
+	// 点击卡片
+
+	function onCard(e) {
+		state.recharge_money = e;
+	}
+	async function getRechargeTabs() {
+		const res = await sheep.$api.trade.rechargeRules();
+		const res2 = await sheep.$api.trade.rechargeRules2();
+		if (res.error === 0) {
+			state.data = res.data;
+			state.data.status = res.data.status;
+			console.log(res);
+			console.log(res2);
+			// state.faceValueList = res.data.quick_amounts;
+			state.faceValueList = res2.data;
+		}
+	}
+
+	function onChange(e) {
+		state.data.gift_type = e.detail.value;
+	}
+
+	async function onConfirm() {
+		const {
+			code,
+			data
+		} = await sheep.$api.trade.recharge({
+			packageId: 0,
+			payPrice: state.recharge_money * 100
+		});
+		if (code === 0) {
+			// #ifdef MP
+			sheep.$platform.useProvider('wechat').subscribeMessage('money_change');
+			// #endif
+			sheep.$router.go('/pages/pay/index', {
+				orderSN: data.order_sn,
+				type: 'recharge'
+			});
+		}
+	}
+	onLoad(() => {
+		getRechargeTabs();
+	});
 </script>
 
 <style lang="scss" scoped>
-:deep() {
-  .uni-input-input {
-    font-family: OPPOSANS !important;
-  }
-}
-
-.wallet-num-box {
-  padding: 0 40rpx 80rpx;
-  background: var(--ui-BG-Main) v-bind(headerBg) center/750rpx 100% no-repeat;
-  border-radius: 0 0 5% 5%;
-
-  .num-title {
-    font-size: 26rpx;
-    font-weight: 500;
-    color: $white;
-    margin-bottom: 20rpx;
-  }
-
-  .wallet-num {
-    font-size: 60rpx;
-    font-weight: 500;
-    color: $white;
-    font-family: OPPOSANS;
-  }
-
-  .log-btn {
-    width: 170rpx;
-    height: 60rpx;
-    line-height: 60rpx;
-    border: 1rpx solid $white;
-    border-radius: 30rpx;
-    padding: 0;
-    font-size: 26rpx;
-    font-weight: 500;
-    color: $white;
-  }
-}
-
-.recharge-box {
-  position: relative;
-  padding: 0 30rpx;
-  margin-top: -60rpx;
-}
-
-.save-btn {
-  width: 620rpx;
-  height: 86rpx;
-  border-radius: 44rpx;
-  font-size: 30rpx;
-}
-
-.recharge-card-box {
-  width: 690rpx;
-  background: var(--ui-BG);
-  border-radius: 20rpx;
-  padding: 30rpx;
-  box-sizing: border-box;
-
-  .input-label {
-    font-size: 30rpx;
-    font-weight: 500;
-    color: #333;
-  }
-
-  .unit {
-    display: flex;
-    align-items: center;
-    font-size: 48rpx;
-    font-weight: 500;
-  }
-
-  .uni-easyinput__placeholder-class {
-    font-size: 30rpx;
-    height: 60rpx;
-    display: flex;
-    align-items: center;
-  }
-
-  :deep(.uni-easyinput__content-input) {
-    font-size: 48rpx;
-  }
-
-  .face-value-btn {
-    width: 200rpx;
-    height: 144rpx;
-    border: 1px solid var(--ui-BG-Main);
-    border-radius: 10rpx;
-    position: relative;
-    z-index: 1;
-    margin-bottom: 15rpx;
-    margin-right: 15rpx;
-
-    &:nth-of-type(3n) {
-      margin-right: 0;
-    }
-
-    .face-value-title {
-      font-size: 36rpx;
-      font-weight: 500;
-      color: var(--ui-BG-Main);
-      font-family: OPPOSANS;
-
-      &::after {
-        content: '元';
-        font-size: 24rpx;
-        margin-left: 6rpx;
-      }
-    }
-
-    .face-value-tag {
-      position: absolute;
-      z-index: 2;
-      height: 40rpx;
-      line-height: 40rpx;
-      background: var(--ui-BG-Main);
-      opacity: 0.8;
-      border-radius: 10rpx 0 20rpx 0;
-      top: 0;
-      left: -2rpx;
-      padding: 0 16rpx;
-      font-size: 22rpx;
-      color: $white;
-      font-family: OPPOSANS;
-    }
-
-    &::before {
-      position: absolute;
-      content: ' ';
-      width: 100%;
-      height: 100%;
-      background: var(--ui-BG-Main);
-      opacity: 0.1;
-      z-index: 0;
-      left: 0;
-      top: 0;
-    }
-  }
-
-  .btn-active {
-    z-index: 1;
-
-    &::before {
-      content: '';
-      background: var(--ui-BG-Main);
-      opacity: 1;
-    }
-
-    .face-value-title {
-      color: $white;
-      position: relative;
-      z-index: 1;
-      font-family: OPPOSANS;
-    }
-
-    .face-value-tag {
-      background: $white;
-      color: var(--ui-BG-Main);
-      font-family: OPPOSANS;
-    }
-  }
-}
-</style>
+	:deep() {
+		.uni-input-input {
+			font-family: OPPOSANS !important;
+		}
+	}
+
+	.wallet-num-box {
+		padding: 0 40rpx 80rpx;
+		background: var(--ui-BG-Main) v-bind(headerBg) center/750rpx 100% no-repeat;
+		border-radius: 0 0 5% 5%;
+
+		.num-title {
+			font-size: 26rpx;
+			font-weight: 500;
+			color: $white;
+			margin-bottom: 20rpx;
+		}
+
+		.wallet-num {
+			font-size: 60rpx;
+			font-weight: 500;
+			color: $white;
+			font-family: OPPOSANS;
+		}
+
+		.log-btn {
+			width: 170rpx;
+			height: 60rpx;
+			line-height: 60rpx;
+			border: 1rpx solid $white;
+			border-radius: 30rpx;
+			padding: 0;
+			font-size: 26rpx;
+			font-weight: 500;
+			color: $white;
+		}
+	}
+
+	.recharge-box {
+		position: relative;
+		padding: 0 30rpx;
+		margin-top: -60rpx;
+	}
+
+	.save-btn {
+		width: 620rpx;
+		height: 86rpx;
+		border-radius: 44rpx;
+		font-size: 30rpx;
+	}
+
+	.recharge-card-box {
+		width: 690rpx;
+		background: var(--ui-BG);
+		border-radius: 20rpx;
+		padding: 30rpx;
+		box-sizing: border-box;
+
+		.input-label {
+			font-size: 30rpx;
+			font-weight: 500;
+			color: #333;
+		}
+
+		.unit {
+			display: flex;
+			align-items: center;
+			font-size: 48rpx;
+			font-weight: 500;
+		}
+
+		.uni-easyinput__placeholder-class {
+			font-size: 30rpx;
+			height: 60rpx;
+			display: flex;
+			align-items: center;
+		}
+
+		:deep(.uni-easyinput__content-input) {
+			font-size: 48rpx;
+		}
+
+		.face-value-btn {
+			width: 200rpx;
+			height: 144rpx;
+			border: 1px solid var(--ui-BG-Main);
+			border-radius: 10rpx;
+			position: relative;
+			z-index: 1;
+			margin-bottom: 15rpx;
+			margin-right: 15rpx;
+
+			&:nth-of-type(3n) {
+				margin-right: 0;
+			}
+
+			.face-value-title {
+				font-size: 36rpx;
+				font-weight: 500;
+				color: var(--ui-BG-Main);
+				font-family: OPPOSANS;
+
+				&::after {
+					content: '元';
+					font-size: 24rpx;
+					margin-left: 6rpx;
+				}
+			}
+
+			.face-value-tag {
+				position: absolute;
+				z-index: 2;
+				height: 40rpx;
+				line-height: 40rpx;
+				background: var(--ui-BG-Main);
+				opacity: 0.8;
+				border-radius: 10rpx 0 20rpx 0;
+				top: 0;
+				left: -2rpx;
+				padding: 0 16rpx;
+				font-size: 22rpx;
+				color: $white;
+				font-family: OPPOSANS;
+			}
+
+			&::before {
+				position: absolute;
+				content: ' ';
+				width: 100%;
+				height: 100%;
+				background: var(--ui-BG-Main);
+				opacity: 0.1;
+				z-index: 0;
+				left: 0;
+				top: 0;
+			}
+		}
+
+		.btn-active {
+			z-index: 1;
+
+			&::before {
+				content: '';
+				background: var(--ui-BG-Main);
+				opacity: 1;
+			}
+
+			.face-value-title {
+				color: $white;
+				position: relative;
+				z-index: 1;
+				font-family: OPPOSANS;
+			}
+
+			.face-value-tag {
+				background: $white;
+				color: var(--ui-BG-Main);
+				font-family: OPPOSANS;
+			}
+		}
+	}
+</style>

+ 59 - 61
pages/pay/result.vue

@@ -2,27 +2,34 @@
 <template>
   <s-layout title="支付结果" :bgStyle="{ color: '#FFF' }">
     <view class="pay-result-box ss-flex-col ss-row-center ss-col-center">
-      <!-- 信息展示 -->
-      <view class="pay-waiting ss-m-b-30" v-if="payResult === 'waiting'" />
+      <view class="pay-waiting ss-m-b-30" v-if="payResult === 'waiting'"> </view>
       <image
         class="pay-img ss-m-b-30"
         v-if="payResult === 'success'"
         :src="sheep.$url.static('/static/img/shop/order/order_pay_success.gif')"
-      />
+      ></image>
       <image
         class="pay-img ss-m-b-30"
         v-if="['failed', 'closed'].includes(payResult)"
         :src="sheep.$url.static('/static/img/shop/order/order_paty_fail.gif')"
-      />
-      <view class="tip-text ss-m-b-30" v-if="payResult === 'success'">支付成功</view>
-      <view class="tip-text ss-m-b-30" v-if="payResult === 'failed'">支付失败</view>
-      <view class="tip-text ss-m-b-30" v-if="payResult === 'closed'">该订单已关闭</view>
-      <view class="tip-text ss-m-b-30" v-if="payResult === 'waiting'">检测支付结果...</view>
+      ></image>
+      <view class="tip-text ss-m-b-30" v-if="payResult == 'success'">{{
+        state.orderInfo.pay_mode === 'offline' ? '下单成功' : '支付成功'
+      }}</view>
+      <view class="tip-text ss-m-b-30" v-if="payResult == 'failed'">支付失败</view>
+      <view class="tip-text ss-m-b-30" v-if="payResult == 'closed'">该订单已关闭</view>
+      <view class="tip-text ss-m-b-30" v-if="payResult == 'waiting'">检测支付结果...</view>
       <view class="pay-total-num ss-flex" v-if="payResult === 'success'">
-        <view>¥{{ fen2yuan(state.orderInfo.price) }}</view>
+        <view v-if="Number(state.orderInfo.pay_fee) > 0">¥{{ state.orderInfo.pay_fee }}</view>
+        <view v-if="state.orderInfo.score_amount && Number(state.orderInfo.pay_fee) > 0">+</view>
+        <view class="price-text ss-flex ss-col-center" v-if="state.orderInfo.score_amount">
+          <image
+            :src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
+            class="score-img"
+          ></image>
+          <view>{{ state.orderInfo.score_amount }}</view>
+        </view>
       </view>
-
-      <!-- 操作区 -->
       <view class="btn-box ss-flex ss-row-center ss-m-t-50">
         <button class="back-btn ss-reset-button" @tap="sheep.$router.go('/pages/index/index')">
           返回首页
@@ -30,29 +37,30 @@
         <button
           class="check-btn ss-reset-button"
           v-if="payResult === 'failed'"
-          @tap="
-            sheep.$router.redirect('/pages/pay/index', { id: state.id, orderType: state.orderType })
-          "
+          @tap="sheep.$router.redirect('/pages/pay/index', { orderSN: state.orderId })"
         >
           重新支付
         </button>
         <button class="check-btn ss-reset-button" v-if="payResult === 'success'" @tap="onOrder">
           查看订单
         </button>
-        <!-- TODO 芋艿:拼团接入 -->
         <button
           class="check-btn ss-reset-button"
-          v-if="payResult === 'success' && state.tradeOrder.type === 3"
+          v-if="
+            payResult === 'success' &&
+            ['groupon', 'groupon_ladder'].includes(state.orderInfo.activity_type)
+          "
           @tap="sheep.$router.redirect('/pages/activity/groupon/order')"
         >
           我的拼团
         </button>
       </view>
-
-      <!-- TODO 芋艿:订阅 -->
       <!-- #ifdef MP -->
       <view class="subscribe-box ss-flex ss-m-t-44">
-        <image class="subscribe-img" :src="sheep.$url.static('/static/img/shop/order/cargo.png')" />
+        <image
+          class="subscribe-img"
+          :src="sheep.$url.static('/static/img/shop/order/cargo.png')"
+        ></image>
         <view class="subscribe-title ss-m-r-48 ss-m-l-16">获取实时发货信息与订单状态</view>
         <view class="subscribe-start" @tap="subscribeMessage">立即订阅</view>
       </view>
@@ -66,20 +74,15 @@
   import { reactive, computed } from 'vue';
   import { isEmpty } from 'lodash';
   import sheep from '@/sheep';
-  import PayOrderApi from '@/sheep/api/pay/order';
-  import { fen2yuan } from '../../sheep/hooks/useGoods';
-  import OrderApi from '@/sheep/api/trade/order';
 
   const state = reactive({
-    id: 0, // 支付单号
-    orderType: 'goods', // 订单类型
+    orderId: 0,
+    orderType: 'goods',
     result: 'unpaid', // 支付状态
-    orderInfo: {}, // 支付订单信息
-    tradeOrder: {}, // 商品订单信息,只有在 orderType 为 goods 才会请求。目的:【我的拼团】按钮的展示
+    orderInfo: {}, // 订单详情
     counter: 0, // 获取结果次数
   });
 
-  // 支付结果 result => payResult
   const payResult = computed(() => {
     if (state.result === 'unpaid') {
       return 'waiting';
@@ -90,65 +93,57 @@
     if (state.result === 'failed') {
       return 'failed';
     }
+
     if (state.result === 'closed') {
       return 'closed';
     }
   });
-
-  // 获得订单信息
-  async function getOrderInfo(id) {
+  async function getOrderInfo(orderId) {
+    let checkPayResult;
     state.counter++;
-    // 1. 加载订单信息
-    const { data, code } = await PayOrderApi.getOrder(id);
-    if (code === 0) {
+    if (state.orderType === 'recharge') {
+      checkPayResult = sheep.$api.trade.order;
+    } else {
+      checkPayResult = sheep.$api.order.detail;
+    }
+    const { data, error } = await checkPayResult(orderId);
+    if (error === 0) {
       state.orderInfo = data;
-      if (!state.orderInfo || state.orderInfo.status === 30) {
-        // 支付关闭
+      if (state.orderInfo.status === 'closed') {
         state.result = 'closed';
         return;
       }
-      if (state.orderInfo.status !== 0) {
-        // 非待支付,可能是已支付,可能是已退款
+      if (state.orderInfo.status !== 'unpaid') {
         state.result = 'paid';
         // #ifdef MP
         subscribeMessage();
         // #endif
-        // 特殊:获得商品订单信息
-        if (state.orderType === 'goods') {
-          const { data, code } = await OrderApi.getOrder(state.orderInfo.merchantOrderId);
-          if (code === 0) {
-            state.tradeOrder = data;
-          }
-        }
         return;
       }
     }
-    // 2.1 情况三一:未支付,且轮询次数小于三次,则继续轮询
     if (state.counter < 3 && state.result === 'unpaid') {
       setTimeout(() => {
-        getOrderInfo(id);
+        getOrderInfo(orderId);
       }, 1500);
     }
-    // 2.2 情况二:超过三次检测才判断为支付失败
+    // 超过三次检测才判断为支付失败
     if (state.counter >= 3) {
       state.result = 'failed';
     }
   }
 
   function onOrder() {
-    // TODO 芋艿:待测试
-    if (state.orderType === 'recharge') {
+    if ((state.orderType === 'recharge')) {
       sheep.$router.redirect('/pages/pay/recharge-log');
     } else {
       sheep.$router.redirect('/pages/order/list');
     }
   }
 
-  // TODO 芋艿:待测试
   // #ifdef MP
   function subscribeMessage() {
     let event = ['order_dispatched'];
-    if (state.tradeOrder.type === 3) {
+    if (['groupon', 'groupon_ladder'].includes(state.orderInfo.activity_type)) {
       event.push('groupon_finish');
       event.push('groupon_fail');
     }
@@ -157,13 +152,18 @@
   // #endif
 
   onLoad(async (options) => {
+    let id = '';
     // 支付订单号
+    if (options.orderSN) {
+      id = options.orderSN;
+    }
     if (options.id) {
-      state.id = options.id;
+      id = options.id;
     }
-    // 订单类型
-    if (options.orderType) {
-      state.orderType = options.orderType;
+    state.orderId = id;
+
+    if (options.orderType === 'recharge') {
+      state.orderType = 'recharge';
     }
 
     // 支付结果传值过来是失败,则直接显示失败界面
@@ -171,16 +171,14 @@
       state.result = 'failed';
     } else {
       // 轮询三次检测订单支付结果
-      await getOrderInfo(state.id);
+      getOrderInfo(state.orderId);
     }
   });
 
   onShow(() => {
-    if (isEmpty(state.orderInfo)) {
-      return;
-    }
-    getOrderInfo(state.id);
-  });
+    if(isEmpty(state.orderInfo)) return;
+    getOrderInfo(state.orderId);
+  })
 
   onHide(() => {
     state.result = 'unpaid';

+ 8 - 1
pages/user/address/edit.vue

@@ -101,6 +101,7 @@
 		},
 	);
 	const onRegionConfirm = (e) => {
+		console.log(e);
 		state.model = {
 			...state.model,
 			...e,
@@ -186,7 +187,13 @@
 
 		if (options.data) {
 			let data = JSON.parse(options.data);
-			console.log(data)
+			const areaData = uni.getStorageSync('areaData');
+			let provinceArr = areaData.filter(item => item.name == data.province_name);
+			data.province_id = provinceArr[0].id;
+			let provinceArr2 = provinceArr[0].children.filter(item => item.name == data.city_name);
+			data.city_id = provinceArr2[0].id;
+			let provinceArr3 = provinceArr2[0].children.filter(item => item.name == data.district_name);
+			data.district_id = provinceArr3[0].id;
 			state.model = {
 				...state.model,
 				...data,

+ 61 - 40
sheep/api/activity.js

@@ -1,43 +1,64 @@
 import request from '@/sheep/request';
 
 export default {
-  myGroupon: (params) =>
-    request({
-      url: 'activity/groupon/myGroupons',
-      method: 'GET',
-      params,
-    }),
-  getGrouponList: (params) =>
-    request({
-      url: 'activity/groupon',
-      method: 'GET',
-      params,
-    }),
-  grouponDetail: (id) =>
-    request({
-      url: 'activity/groupon/' + id,
-      method: 'GET',
-    }),
-  signList: (params) =>
-    request({
-      url: 'activity/signin',
-      method: 'GET',
-      params,
-    }),
-  signAdd: () =>
-    request({
-      url: 'activity/signin',
-      method: 'POST',
-    }),
-  replenish: (data) =>
-    request({
-      url: 'activity/signin/replenish',
-      method: 'POST',
-      data,
-    }),
-  activity: (id) =>
-    request({
-      url: 'activity/activity/' + id,
-      method: 'GET',
-    }),
-};
+	myGroupon: (params) =>
+		request({
+			url: 'activity/groupon/myGroupons',
+			method: 'GET',
+			params,
+		}),
+	getGrouponList: (params) =>
+		request({
+			url: 'activity/groupon',
+			method: 'GET',
+			params,
+		}),
+	grouponDetail: (id) =>
+		request({
+			url: 'activity/groupon/' + id,
+			method: 'GET',
+		}),
+	signList: (params) =>
+		request({
+			url: 'activity/signin',
+			method: 'GET',
+			params,
+		}),
+	signAdd: () =>
+		request({
+			url: '/app-api/member/sign-in/record/create',
+			method: 'POST',
+		}),
+	configLise: () =>
+		request({
+			url: '/app-api/member/sign-in/config/list',
+			method: 'GET',
+		}),
+	recordPage: () =>
+		request({
+			url: '/app-api/member/sign-in/record/page',
+			method: 'GET',
+		}),
+	// signAdd: () =>
+	// 	request({
+	// 		url: 'activity/signin',
+	// 		method: 'POST',
+	// 	}),
+	replenish: (data) =>
+		request({
+			url: 'activity/signin/replenish',
+			method: 'POST',
+			data,
+		}),
+	activity: (id) =>
+		request({
+			url: 'activity/activity/' + id,
+			method: 'GET',
+		}),
+	getSummary: () =>
+		request({
+			url: '/app-api/member/sign-in/record/get-summary',
+			method: 'GET',
+		}),
+
+};

+ 3 - 5
sheep/api/app.js

@@ -115,14 +115,12 @@ export default {
         formData: {
           group,
         },
-        // TODO 芋艿:临时写死
         header: {
           // Accept: 'text/json',
           // Authorization: token,
-          Accept : '*/*',
-          'tenant-id' :'1',
-          'terminal': 20,
-          Authorization:  'Bearer test247',
+		  Accept : '*/*',
+		  'tenant-id' :'1',
+		  Authorization:  'Bearer test247',
         },
         success: (uploadFileRes) => {
           let result = JSON.parse(uploadFileRes.data);

+ 9 - 22
sheep/api/cart.js

@@ -1,9 +1,10 @@
 import request from '@/sheep/request';
+import request2 from '@/sheep/request2';
 
 export default {
 	list: (data) =>
-		request({
-			url: '/app-api/trade/cart/list',
+		request2({
+			url: 'trade/cart/list',
 			method: 'GET',
 			custom: {
 				showLoading: false,
@@ -12,40 +13,26 @@ export default {
 		}),
 	append: (data) =>
 		request({
-			url: '/app-api/trade/cart/add',
+			url: 'cart',
 			method: 'POST',
-      // TODO 芋艿:这里没提示
 			custom: {
 				showSuccess: true,
 				successMsg: '已添加到购物车~',
 			},
 			data: {
 				...data,
-				// type: 'inc',
+				type: 'inc',
 			},
 		}),
-	// append: (data) =>
-	// 	request({
-	// 		url: 'cart',
-	// 		method: 'POST',
-	// 		custom: {
-	// 			showSuccess: true,
-	// 			successMsg: '已添加到购物车~',
-	// 		},
-	// 		data: {
-	// 			...data,
-	// 			type: 'inc',
-	// 		},
-	// 	}),
 	// 删除购物车
 	delete: (ids) =>
-		request({
-			url: '/app-api/trade/cart/delete?ids=' + ids,
+		request2({
+			url: 'trade/cart/delete?ids=' + ids,
 			method: 'DELETE',
 		}),
 	update: (data) =>
-		request({
-			url: '/app-api/trade/cart/update-count',
+		request2({
+			url: 'trade/cart/update-count',
 			method: 'PUT',
 			data: {
 				...data,

+ 9 - 7
sheep/api/category.js

@@ -1,8 +1,10 @@
+import request2 from '@/sheep/request2';
+
 export default {
-	list: (params) =>
-		request({
-			url: '/app-api/product/category/list',
-			method: 'GET',
-			params,
-		}),
-};
+  list: (params) =>
+    request2({
+      url: 'product/category/list',
+      method: 'GET',
+      params,
+    }),
+};

+ 4 - 14
sheep/api/coupon.js

@@ -1,4 +1,5 @@
 import request from '@/sheep/request';
+import request2 from '@/sheep/request2';
 
 export default {
 	// 我的拼团
@@ -12,8 +13,8 @@ export default {
 			},
 		}),
 	userCoupon: (params) =>
-		request({
-			url: '/app-api/promotion/coupon/page',
+		request2({
+			url: 'promotion/coupon/page',
 			method: 'GET',
 			params,
 		}),
@@ -33,20 +34,9 @@ export default {
 		}),
 	get: (id) =>
 		request({
-			url: '/app-api/promotion/coupon/take',
+			url: 'coupon/get/' + id,
 			method: 'POST',
-			data: {
-				templateId: id
-			},
-			params: {
-				templateId: id
-			},
 		}),
-	// get: (id) =>
-	// 	request({
-	// 		url: 'coupon/get/' + id,
-	// 		method: 'POST',
-	// 	}),
 	listByGoods: (id) =>
 		request({
 			url: 'coupon/listByGoods/' + id,

+ 22 - 21
sheep/api/data.js

@@ -1,24 +1,25 @@
 import request from '@/sheep/request';
+import request2 from '@/sheep/request2';
 
 export default {
-	area: () =>
-		request({
-			url: '/app-api/system/area/tree',
-			method: 'GET',
-		}),
-	// area: () =>
-	//   request({
-	//     url: 'data/area',
-	//     method: 'GET',
-	//   }),
-	faq: () =>
-		request({
-			url: 'data/faq',
-			method: 'GET',
-		}),
-	richtext: (id) =>
-		request({
-			url: 'data/richtext/' + id,
-			method: 'GET',
-		}),
-};
+  area: () =>
+    request2({
+      url: 'system/area/tree',
+      method: 'GET',
+    }),
+  // area: () =>
+  //   request({
+  //     url: 'data/area',
+  //     method: 'GET',
+  //   }),
+  faq: () =>
+    request({
+      url: 'data/faq',
+      method: 'GET',
+    }),
+  richtext: (id) =>
+    request({
+      url: 'data/richtext/' + id,
+      method: 'GET',
+    }),
+};

+ 75 - 79
sheep/api/goods.js

@@ -1,84 +1,80 @@
 import request from '@/sheep/request';
+import request2 from '@/sheep/request2';
 
 export default {
-	// 商品详情
-	detail: (id, params = {}) =>
-		request({
-			url: '/app-api/product/spu/get-detail?id=' + id,
-			method: 'GET',
-			params,
-			custom: {
-				showLoading: false,
-				showError: false,
-			},
-		}),
+  // 商品详情
+  detail: (id, params = {}) =>
+    request2({
+      url: 'product/spu/get-detail?id=' + id,
+      method: 'GET',
+      params,
+      custom: {
+        showLoading: false,
+        showError: false,
+      },
+    }),
 
-	// 商品列表
-	list: (params) =>
-		request({
-			url: '/app-api/product/spu/page',
-			method: 'GET',
-			params,
-			custom: {
-				showLoading: false,
-				showError: false,
-			},
-		}),
+  // 商品列表
+  list: (params) =>
+    request2({
+      url: 'product/spu/page',
+      method: 'GET',
+      params,
+      custom: {
+        showLoading: false,
+        showError: false,
+      },
+    }),
 
-	// 商品查询
-	ids: (params = {}) =>
-		request({
-			url: 'goods/goods/ids',
-			method: 'GET',
-			params,
-			custom: {
-				showLoading: false,
-				showError: false,
-			},
-		}),
-	// 商品评价列表
-	comment: (id, params = {}) =>
-		request({
-			url: '/app-api/product/comment/list?spuId=' + id,
-			method: 'GET',
-			params,
-			custom: {
-				showLoading: false,
-				showError: false,
-			},
-		}),
-	// 商品评价类型
-	getType: (id) =>
-		request({
-			url: 'goods/comment/getType/' + id,
-			method: 'GET',
-			custom: {
-				showLoading: false,
-				showError: false,
-			},
-		}),
-	// 活动商品查询
-	// 商品查询
-	activity: (params = {}) =>
-		request({
-			url: 'goods/goods/activity',
-			method: 'GET',
-			params,
-			custom: {
-				showLoading: false,
-				showError: false,
-			},
-		}),
-	activityList: (params = {}) =>
-		request({
-			url: 'goods/goods/activityList',
-			method: 'GET',
-			params,
-		}),
-	// 检查是否收藏商品
-	exits: (id) =>
-		request({
-			url: '/app-api/product/favorite/exits?spuId=' + id,
-			method: 'GET',
-		}),
-};
+  // 商品查询
+  ids: (params = {}) =>
+    request({
+      url: 'goods/goods/ids',
+      method: 'GET',
+      params,
+      custom: {
+        showLoading: false,
+        showError: false,
+      },
+    }),
+
+  // 商品评价列表
+  comment: (id, params = {}) =>
+    request2({
+      url: 'product/comment/list?spuId=' + id,
+      method: 'GET',
+      params,
+      custom: {
+        showLoading: false,
+        showError: false,
+      },
+    }),
+  // 商品评价类型
+  getType: (id) =>
+    request({
+      url: 'goods/comment/getType/' + id,
+      method: 'GET',
+      custom: {
+        showLoading: false,
+        showError: false,
+      },
+    }),
+  // 活动商品查询
+  // 商品查询
+  activity: (params = {}) =>
+    request({
+      url: 'goods/goods/activity',
+      method: 'GET',
+      params,
+      custom: {
+        showLoading: false,
+        showError: false,
+      },
+    }),
+  activityList: (params = {}) =>
+    request({
+      url: 'goods/goods/activityList',
+      method: 'GET',
+      params,
+    }),
+};

+ 12 - 12
sheep/api/index2.js

@@ -1,14 +1,14 @@
-import request from '@/sheep/request';
+import request2 from '@/sheep/request2';
 
 export default {
-	decorate: () =>
-		request({
-			url: '/app-api/promotion/decorate/list?page=1',
-			method: 'GET',
-		}),
-	spids: () =>
-		request({
-			url: '/app-api/product/spu/page?recommendType=best&pageNo=1&pageSize=10',
-			method: 'GET',
-		}),
-};
+  decorate: () =>
+    request2({
+      url: 'promotion/decorate/list?page=1',
+      method: 'GET',
+    }),
+  spids: () =>
+    request2({
+      url: 'product/spu/page?recommendType=best&pageNo=1&pageSize=10',
+      method: 'GET',
+    }),
+};

+ 52 - 26
sheep/api/order.js

@@ -1,10 +1,11 @@
 import request from '@/sheep/request';
+import request2 from '@/sheep/request2';
 
 export default {
 	// 订单详情
 	detail: (id, params) =>
-		request({
-			url: '/app-api/trade/order/get-detail?id=' + id,
+		request2({
+			url: 'trade/order/get-detail?id=' + id,
 			method: 'GET',
 			params,
 		}),
@@ -37,7 +38,16 @@ export default {
 				showLoading: false,
 			},
 		}),
-
+	// 订单列表
+	list: (params) =>
+		request2({
+			url: 'trade/order/page',
+			method: 'GET',
+			params,
+			custom: {
+				showLoading: false,
+			},
+		}),
 	// list: (params) =>
 	//   request({
 	//     url: 'order/order',
@@ -55,27 +65,27 @@ export default {
 		// 解决 SpringMVC 接受 List<Item> 参数的问题
 		delete data2.items
 		for (let i = 0; i < data.items.length; i++) {
-			// 此处转码问题,待解决方案
-			data2[encodeURIComponent('items[' + i + '' + '].skuId')] = data.items[i].skuId + '';
-			data2[encodeURIComponent('items[' + i + '' + '].count')] = data.items[i].count + '';
-			data2[encodeURIComponent('items[' + i + '' + '].cartId')] = data.items[i].cartId + '';
-
-			// data2['items' + `[${i}]` + '.skuId'] = data.items[i].skuId + '';
-			// data2['items' + `[${i}]` + '.count'] = data.items[i].count + '';
-			// data2['items' + `[${i}]` + '.cartId'] = data.items[i].cartId + '';
-
-			// data2['items' + `%5B${i}%5D` + '.skuId'] = data.items[i].skuId + '';
-			// data2['items' + `%5B${i}%5D` + '.count'] = data.items[i].count + '';
-			// data2['items' + `%5B${i}%5D` + '.cartId'] = data.items[i].cartId + '';
+			// data2['items[' + i + '' + '].skuId'] = data.items[i].skuId + '';
+			// data2['items[' + i + '' + '].count'] = data.items[i].count + '';
+			// data2['items[' + i + '' + '].cartId'] = data.items[i].cartId + '';
+			data2['items' + `%5B${i}%5D` + '.skuId'] = data.items[i].skuId + '';
+			data2['items' + `%5B${i}%5D` + '.count'] = data.items[i].count + '';
+			data2['items' + `%5B${i}%5D` + '.cartId'] = data.items[i].cartId + '';
 		}
-		console.log(data2, '手动转码的参数')
-		return request({
-			url: '/app-api/trade/order/settlement',
+		console.log(data2, '对比数据')
+		return request2({
+			url: 'trade/order/settlement',
 			method: 'GET',
-			// data: data2,
+			// data,
 			params: data2
 		})
 	},
+	// calc: (data) =>
+	//   request({
+	//     url: 'order/order/calc',
+	//     method: 'POST',
+	//     data,
+	//   }),
 	// 创建订单
 	create: (data) =>
 		request({
@@ -98,8 +108,8 @@ export default {
 		}),
 	// 评价订单
 	comment: (data) =>
-		request({
-			url: '/app-api/trade/order/item/create-comment',
+		request2({
+			url: 'trade/order/item/create-comment',
 			method: 'POST',
 			data,
 		}),
@@ -129,15 +139,31 @@ export default {
 		}),
 	// 售后
 	aftersale: {
-		list: (params) =>
+		// 申请售后
+		apply: (data) =>
 			request({
-				url: '/app-api/trade/after-sale/page',
+				url: 'order/aftersale',
+				method: 'POST',
+				data,
+			}),
+		list: (params) =>
+			request2({
+				url: 'trade/after-sale/page',
 				method: 'GET',
 				params,
 				custom: {
 					showLoading: false,
 				},
 			}),
+		// list: (params) =>
+		// 	request({
+		// 		url: 'order/aftersale',
+		// 		method: 'GET',
+		// 		params,
+		// 		custom: {
+		// 			showLoading: false,
+		// 		},
+		// 	}),
 		//取消售后
 		cancel: (id) =>
 			request({
@@ -150,10 +176,10 @@ export default {
 				url: 'order/aftersale/' + id,
 				method: 'DELETE',
 			}),
-		// 售后详情 DONE
+		// 售后详情
 		detail: (id) =>
-			request({
-				url: '/app-api/trade/after-sale/get?id=' + id,
+			request2({
+				url: 'trade/after-sale/get?id=' + id,
 				method: 'GET',
 			}),
 	},

+ 0 - 14
sheep/api/pay/channel.js

@@ -1,14 +0,0 @@
-import request from '@/sheep/request';
-
-const PayChannelApi = {
-  // 获得指定应用的开启的支付渠道编码列表
-  getEnableChannelCodeList: (appId) => {
-    return request({
-      url: '/app-api/pay/channel/get-enable-code-list',
-      method: 'GET',
-      params: { appId }
-    });
-  },
-};
-
-export default PayChannelApi;

+ 0 - 22
sheep/api/pay/order.js

@@ -1,22 +0,0 @@
-import request from '@/sheep/request';
-
-const PayOrderApi = {
-  // 获得支付订单
-  getOrder: (id) => {
-    return request({
-      url: '/app-api/pay/order/get',
-      method: 'GET',
-      params: { id }
-    });
-  },
-  // 提交支付订单
-  submitOrder: (data) => {
-    return request({
-      url: '/app-api/pay/order/submit',
-      method: 'POST',
-      data
-    });
-  }
-};
-
-export default PayOrderApi;

+ 14 - 15
sheep/api/product/comment.js

@@ -1,19 +1,18 @@
 import request from '@/sheep/request';
 
 const CommentApi = {
-
-	// 获得商品评价分页
-	getCommentPage: (spuId, pageNo, pageSize, type) => {
-		return request({
-			url: '/app-api/product/comment/page',
-			method: 'GET',
-			params: {
-				spuId,
-				pageNo,
-				pageSize,
-				type
-			},
-		});
-	},
+  // 获得商品评价分页
+  getCommentPage: (spuId, pageNo, pageSize, type) => {
+    return request({
+      url: '/app-api/product/comment/page',
+      method: 'GET',
+      params: {
+        spuId,
+        pageNo,
+        pageSize,
+        type
+      },
+    });
+  },
 };
-export default CommentApi;
+export default CommentApi;

+ 11 - 11
sheep/api/promotion/activity.js

@@ -1,16 +1,16 @@
-import request from '@/sheep/request';
+import request2 from '@/sheep/request2';
 
 const ActivityApi = {
-	// 获得单个商品,近期参与的每个活动
-	getActivityListBySpuId: (spuId) => {
-		return request({
-			url: '/app-api/promotion/activity/list-by-spu-id',
-			method: 'GET',
-			params: {
-				spuId,
-			},
-		});
-	},
+  // 获得单个商品,近期参与的每个活动
+  getActivityListBySpuId: (spuId) => {
+    return request2({
+      url: '/app-api/promotion/activity/list-by-spu-id',
+      method: 'GET',
+      params: {
+        spuId,
+      },
+    });
+  },
 };
 
 export default ActivityApi;

+ 57 - 59
sheep/api/promotion/combination.js

@@ -1,69 +1,67 @@
-import request from "@/sheep/request";
+import request2 from "@/sheep/request2";
 
 // 拼团 API
 const CombinationApi = {
-	// 获得拼团活动列表
-	getCombinationActivityList: (count) => {
-		return request({
-			url: "/app-api/promotion/combination-activity/list",
-			method: 'GET',
-			params: {
-				count
-			}
-		});
-	},
+    // 获得拼团活动列表
+    getCombinationActivityList: (count) => {
+        return request2({
+            url: "promotion/combination-activity/list",
+            method: 'GET',
+            params: {count}
+        });
+    },
 
-	// 获得拼团活动分页
-	getCombinationActivityPage: (params) => {
-		return request({
-			url: "/app-api/promotion/combination-activity/page",
-			method: 'GET',
-			params
-		});
-	},
+    // 获得拼团活动分页
+    getCombinationActivityPage: (params) => {
+        return request2({
+            url: "promotion/combination-activity/page",
+            method: 'GET',
+            params
+        });
+    },
 
-	// 获得拼团活动明细
-	getCombinationActivity: (id) => {
-		return request({
-			url: "/app-api/promotion/combination-activity/get-detail",
-			method: 'GET',
-			params: {
-				id
-			}
-		});
-	},
+    // 获得拼团活动明细
+    getCombinationActivity: (id) => {
+        return request2({
+            url: "promotion/combination-activity/get-detail",
+            method: 'GET',
+            params: {
+                id
+            }
+        });
+    },
 
-	// 获得最近 n 条拼团记录(团长发起的)
-	getHeadCombinationRecordList: (activityId, status, count) => {
-		return request({
-			url: "/app-api/promotion/combination-record/get-head-list",
-			method: 'GET',
-			params: {
-				activityId,
-				status,
-				count
-			}
-		});
-	},
+    // 获得最近 n 条拼团记录(团长发起的)
+    getHeadCombinationRecordList: (activityId, status, count) => {
+        return request2({
+            url: "promotion/combination-record/get-head-list",
+            method: 'GET',
+            params: {
+                activityId,
+                status,
+                count
+            }
+        });
+    },
 
-	// 获得拼团记录明细
-	getCombinationRecordDetail: (id) => {
-		return request({
-			url: "/app-api/promotion/combination-record/get-detail",
-			method: 'GET',
-			params: {
-				id
-			}
-		});
-	},
+    // 获得拼团记录明细
+    getCombinationRecordDetail: (id) => {
+        return request2({
+            url: "promotion/combination-record/get-detail",
+            method: 'GET',
+            params: {
+                id
+            }
+        });
+    },
 
-	// 获得拼团记录的概要信息
-	getCombinationRecordSummary: () => {
-		return request({
-			url: "/app-api/promotion/combination-record/get-summary",
-			method: 'GET',
-		});
-	}
+    // 获得拼团记录的概要信息
+    getCombinationRecordSummary: () => {
+        return request2({
+            url: "promotion/combination-record/get-summary",
+            method: 'GET',
+        });
+    }
 }
 
-export default CombinationApi
+export default CombinationApi

+ 0 - 13
sheep/api/promotion/coupon.js

@@ -17,17 +17,4 @@ export default {
       params: { spuId, productScope, count },
     });
   },
-  // 获得匹配指定商品的优惠劵列表
-  getMatchCouponList: (price, spuIds, skuIds, categoryIds) => {
-    return request({
-      url: '/app-api/promotion/coupon/match-list',
-      method: 'GET',
-      params: {
-        price,
-        spuIds: spuIds.join(','),
-        skuIds: skuIds.join(','),
-        categoryIds: categoryIds.join(','),
-      },
-    });
-  }
 };

+ 26 - 37
sheep/api/promotion/seckill.js

@@ -1,44 +1,33 @@
-import request from "@/sheep/request";
+import request2 from "@/sheep/request2";
 
 const SeckillApi = {
-	// 获得秒杀时间段列表
-	getSeckillConfigList: () => {
-		return request({
-			url: '/app-api/promotion/seckill-config/list',
-			method: 'GET'
-		});
-	},
+  // 获得秒杀时间段列表
+  getSeckillConfigList: () => {
+    return request2({ url: 'promotion/seckill-config/list', method: 'GET' });
+  },
 
-	// 获得当前秒杀活动
-	getNowSeckillActivity: () => {
-		return request({
-			url: '/app-api/promotion/seckill-activity/get-now',
-			method: 'GET'
-		});
-	},
+  // 获得当前秒杀活动
+  getNowSeckillActivity: () => {
+    return request2({ url: 'promotion/seckill-activity/get-now', method: 'GET' });
+  },
 
-	// 获得秒杀活动分页
-	getSeckillActivityPage: () => {
-		return request({
-			url: '/app-api/promotion/seckill-activity/page',
-			method: 'GET'
-		});
-	},
+  // 获得秒杀活动分页
+  getSeckillActivityPage: () => {
+    return request2({ url: 'promotion/seckill-activity/page', method: 'GET' });
+  },
 
-	/**
-	 * 获得秒杀活动明细
-	 * @param {number} id 秒杀活动编号
-	 * @return {*}
-	 */
-	getSeckillActivity: (id) => {
-		return request({
-			url: '/app-api/promotion/seckill-activity/get-detail',
-			method: 'GET',
-			params: {
-				id
-			}
-		});
-	}
+  /**
+   * 获得秒杀活动明细
+   * @param {number} id 秒杀活动编号
+   * @return {*}
+   */
+  getSeckillActivity: (id) => {
+    return request2({
+      url: 'promotion/seckill-activity/get-detail',
+      method: 'GET',
+      params: { id }
+    });
+  }
 }
 
-export default SeckillApi;
+export default SeckillApi;

+ 42 - 33
sheep/api/trade.js

@@ -1,37 +1,46 @@
 import request from '@/sheep/request';
 
 export default {
-  order: (id) =>
-    request({
-      url: 'trade/order/' + id,
-      method: 'GET',
-      custom: {
-        showLoading: false,
-      },
-    }),
-  orderLog: (params) =>
-    request({
-      url: 'trade/order',
-      method: 'GET',
-      params,
-      custom: {
-        showLoading: false,
-      },
-    }),
+	order: (id) =>
+		request({
+			url: 'trade/order/' + id,
+			method: 'GET',
+			custom: {
+				showLoading: false,
+			},
+		}),
+	orderLog: (params) =>
+		request({
+			url: 'trade/order',
+			method: 'GET',
+			params,
+			custom: {
+				showLoading: false,
+			},
+		}),
 
-  rechargeRules: () =>
-    request({
-      url: 'trade/order/rechargeRules',
-      method: 'GET',
-      custom: {
-        showError: false,
-        showLoading: false,
-      },
-    }),
-  recharge: (data) =>
-    request({
-      url: 'trade/order/recharge',
-      method: 'POST',
-      data,
-    }),
-};
+	rechargeRules: () =>
+		request({
+			url: 'trade/order/rechargeRules',
+			method: 'GET',
+			custom: {
+				showError: false,
+				showLoading: false,
+			},
+		}),
+	rechargeRules2: () =>
+		request({
+			url: '/app-api/pay/wallet-recharge-package/list',
+			method: 'GET',
+			custom: {
+				showError: false,
+				showLoading: false,
+			},
+		}),
+	recharge: (data) =>
+		request({
+			url: '/app-api/pay/wallet-recharge/create',
+			method: 'POST',
+			data,
+		}),
+};

+ 0 - 47
sheep/api/trade/cart.js

@@ -1,47 +0,0 @@
-import request2 from '@/sheep/request2';
-
-const CartApi = {
-  addCart: (data) => {
-    return request2({
-      url: '/app-api/trade/cart/add',
-      method: 'POST',
-      data: data,
-      // TODO 芋艿:这里没提示
-      custom: {
-        showSuccess: true,
-        successMsg: '已添加到购物车~',
-      }
-    });
-  },
-  updateCartCount: (data) => {
-    return request2({
-      url: '/app-api/trade/cart/update-count',
-      method: 'PUT',
-      data: data
-    });
-  },
-  updateCartSelected: (data) => {
-    return request2({
-      url: '/app-api/trade/cart/update-selected',
-      method: 'PUT',
-      data: data
-    });
-  },
-  deleteCart: (ids) => {
-    return request2({
-      url: '/app-api/trade/cart/delete',
-      method: 'DELETE',
-      params: {
-        ids
-      }
-    });
-  },
-  getCartList: () => {
-    return request2({
-      url: '/app-api/trade/cart/list',
-      method: 'GET',
-    });
-  },
-};
-
-export default CartApi;

+ 0 - 85
sheep/api/trade/order.js

@@ -1,85 +0,0 @@
-import request2 from '@/sheep/request2';
-import request from '@/sheep/request';
-
-const OrderApi = {
-  // 计算订单信息
-  settlementOrder: (data) => {
-    const data2 = {
-      ...data,
-    };
-    // 移除多余字段
-    if (!(data.couponId > 0)) {
-      delete data2.couponId;
-    }
-    if (!(data.addressId > 0)) {
-      delete data2.addressId;
-    }
-    // 解决 SpringMVC 接受 List<Item> 参数的问题
-    delete data2.items;
-    for (let i = 0; i < data.items.length; i++) {
-      data2[encodeURIComponent('items[' + i + '' + '].skuId')] = data.items[i].skuId + '';
-      data2[encodeURIComponent('items[' + i + '' + '].count')] = data.items[i].count + '';
-      if (data.items[i].cartId) {
-        data2[encodeURIComponent('items[' + i + '' + '].cartId')] = data.items[i].cartId + '';
-      }
-    }
-    const queryString = Object.keys(data2)
-      .map((key) => key + '=' + data2[key])
-      .join('&');
-    return request2({
-      url: `trade/order/settlement?${queryString}`,
-      method: 'GET',
-    });
-  },
-  // 创建订单
-  createOrder: (data) => {
-    return request2({
-      url: `trade/order/create`,
-      method: 'POST',
-      data,
-    });
-  },
-  // 获得订单
-  getOrder: (id) => {
-    return request2({
-      url: `trade/order/get-detail`,
-      method: 'GET',
-      params: {
-        id,
-      },
-    });
-  },
-  // 订单列表
-  getOrderPage: (params) => {
-    return request({
-      url: '/app-api/trade/order/page',
-      method: 'GET',
-      params,
-      custom: {
-        showLoading: false,
-      },
-    });
-  },
-  // 确认收货
-  receiveOrder: (id) => {
-    return request2({
-      url: `/app-api/trade/order/receive`,
-      method: 'PUT',
-      params: {
-        id,
-      },
-    });
-  },
-  // 获得交易订单的物流轨迹
-  getOrderExpressTrackList: (id) => {
-    return request2({
-      url: `/app-api/trade/order/get-express-track-list`,
-      method: 'GET',
-      params: {
-        id,
-      },
-    });
-  }
-};
-
-export default OrderApi;

+ 123 - 45
sheep/api/user.js

@@ -1,10 +1,11 @@
 import request from '@/sheep/request';
+import request2 from '@/sheep/request2';
 import $platform from '@/sheep/platform';
 
 export default {
 	getUnused: () =>
-		request({
-			url: '/app-api/promotion/coupon/get-unused-count',
+		request2({
+			url: 'promotion/coupon/get-unused-count',
 			method: 'GET',
 			custom: {
 				showLoading: false,
@@ -12,8 +13,8 @@ export default {
 			},
 		}),
 	profile: () =>
-		request({
-			url: '/app-api/member/user/get',
+		request2({
+			url: 'member/user/get',
 			method: 'GET',
 			custom: {
 				showLoading: false,
@@ -21,7 +22,7 @@ export default {
 			},
 		}),
 	balance: () =>
-		request({
+		request2({
 			url: '/app-api/pay/wallet/get',
 			method: 'GET',
 			custom: {
@@ -29,9 +30,28 @@ export default {
 				auth: true,
 			},
 		}),
+	// profile: () =>
+	//   request({
+	//     url: '/user/api/user/profile',
+	//     method: 'GET',
+	//     custom: {
+	//       showLoading: false,
+	//       auth: true,
+	//     },
+	//   }),
+	// update: (data) =>
+	//   request({
+	//     url: '/user/api/user/update',
+	//     method: 'POST',
+	//     custom: {
+	//       showSuccess: true,
+	//       auth: true,
+	//     },
+	//     data,
+	//   }),
 	update: (data) =>
-		request({
-			url: '/app-api/member/user/update',
+		request2({
+			url: 'member/user/update',
 			method: 'PUT',
 			custom: {
 				showSuccess: true,
@@ -176,48 +196,90 @@ export default {
 		}),
 
 	address: {
+		// default: () =>
+		// 	request({
+		// 		url: 'user/address/default',
+		// 		method: 'GET',
+		// 		custom: {
+		// 			showError: false,
+		// 		},
+		// 	}),
 		default: () =>
-			request({
-				url: '/app-api/member/address/get-default',
+			request2({
+				url: 'member/address/get-default',
 				method: 'GET',
 				custom: {
 					showError: false,
 				},
 			}),
 		list: () =>
-			request({
-				url: '/app-api/member/address/list',
+			request2({
+				url: 'member/address/list',
 				method: 'GET',
 				custom: {},
 			}),
+		// list: () =>
+		//   request({
+		//     url: 'user/address',
+		//     method: 'GET',
+		//     custom: {},
+		//   }),
 		create: (data) =>
-			request({
-				url: '/app-api/member/address/create',
+			request2({
+				url: 'member/address/create',
 				method: 'POST',
 				data,
 				custom: {
 					showSuccess: true,
 				},
 			}),
+		// create: (data) =>
+		//   request({
+		//     url: 'user/address',
+		//     method: 'POST',
+		//     data,
+		//     custom: {
+		//       showSuccess: true,
+		//     },
+		//   }),
 		update: (data) =>
-			request({
-				url: '/app-api/member/address/update',
+			request2({
+				url: 'member/address/update',
 				method: 'PUT',
 				data,
 				custom: {
 					showSuccess: true,
 				},
 			}),
+		// update: (id, data) =>
+		// 	request({
+		// 		url: 'user/address/' + id,
+		// 		method: 'PUT',
+		// 		data,
+		// 		custom: {
+		// 			showSuccess: true,
+		// 		},
+		// 	}),
 		detail: (id) =>
-			request({
-				url: '/app-api/member/address/get?id=' + id,
+			request2({
+				url: 'member/address/get?id=' + id,
 				method: 'GET',
 			}),
+		// detail: (id) =>
+		//   request({
+		//     url: 'user/address/' + id,
+		//     method: 'GET',
+		//   }),
 		delete: (id) =>
-			request({
-				url: '/app-api/member/address/delete?id=' + id,
+			request2({
+				url: 'member/address/delete?id=' + id,
 				method: 'DELETE',
 			}),
+		// delete: (id) =>
+		// 	request({
+		// 		url: 'user/address/' + id,
+		// 		method: 'DELETE',
+		// 	}),
 	},
 	invoice: {
 		list: () =>
@@ -257,29 +319,17 @@ export default {
 	},
 	favorite: {
 		list: (params) =>
-			request({
-				url: '/app-api/product/favorite/page',
+			request2({
+				url: 'product/favorite/page',
 				method: 'GET',
 				params,
 			}),
 		do: (id) =>
 			request({
-				url: '/app-api/product/favorite/create',
+				url: 'user/goodsLog/favorite',
 				method: 'POST',
 				data: {
-					spuId: id,
-				},
-				custom: {
-					showSuccess: true,
-					auth: true,
-				},
-			}),
-		dos: (id) =>
-			request({
-				url: '/app-api/product/favorite/delete',
-				method: 'DELETE',
-				data: {
-					spuId: id,
+					goods_id: id,
 				},
 				custom: {
 					showSuccess: true,
@@ -288,8 +338,8 @@ export default {
 			}),
 		// 取消收藏
 		cancel: (id) =>
-			request({
-				url: '/app-api/product/favorite/delete-list',
+			request2({
+				url: 'product/favorite/delete-list',
 				method: 'DELETE',
 				data: {
 					spuIds: id.split(',').map(item => item * 1),
@@ -300,6 +350,18 @@ export default {
 					auth: true,
 				},
 			}),
+		// cancel: (id) =>
+		//   request({
+		//     url: 'user/goodsLog/favorite',
+		//     method: 'POST',
+		//     data: {
+		//       goods_ids: id,
+		//     },
+		//     custom: {
+		//       showSuccess: true,
+		//       auth: true,
+		//     },
+		//   }),
 	},
 	view: {
 		list: (params) =>
@@ -321,21 +383,28 @@ export default {
 	},
 	wallet: {
 		log: (params) =>
-			request({
+			request2({
 				// url: 'member/point/record/page',
-				url: '/app-api/pay/wallet-transaction/page',
+				url: 'pay/wallet-transaction/page',
 				method: 'GET',
 				params,
 				custom: {},
 			}),
 		log2: (params) =>
-			request({
-				url: '/app-api/member/point/record/page',
+			request2({
+				url: 'member/point/record/page',
 				// url: 'pay/wallet-transaction/page',
 				method: 'GET',
 				params,
 				custom: {},
 			}),
+		// log: (params) =>
+		// request({
+		// 	url: '/user/api/walletLog',
+		// 	method: 'GET',
+		// 	params,
+		// 	custom: {},
+		// }),
 	},
 	account: {
 		info: (params) =>
@@ -360,9 +429,18 @@ export default {
 			}),
 	},
 	//数量接口
+	// data: () =>
+	//   request({
+	//     url: 'user/user/data',
+	//     method: 'GET',
+	//     custom: {
+	//       showLoading: false,
+	//       auth: true,
+	//     },
+	//   }),
 	data: () =>
-		request({
-			url: '/app-api/trade/order/get-count',
+		request2({
+			url: 'trade/order/get-count',
 			method: 'GET',
 			custom: {
 				showLoading: false,
@@ -370,8 +448,8 @@ export default {
 			},
 		}),
 	data2: () =>
-		request({
-			url: '/app-api/trade/after-sale/get-applying-count',
+		request2({
+			url: 'trade/after-sale/get-applying-count',
 			method: 'GET',
 			custom: {
 				showLoading: false,

+ 102 - 98
sheep/components/s-coupon-get/s-coupon-get.vue

@@ -1,104 +1,108 @@
 <template>
-	<su-popup :show="show" type="bottom" round="20" @close="emits('close')" showClose backgroundColor="#f2f2f2">
-		<view class="model-box">
-			<view class="title ss-m-t-16 ss-m-l-20 ss-flex">优惠券</view>
-			<scroll-view class="model-content" scroll-y :scroll-with-animation="false" :enable-back-to-top="true">
-				<view class="subtitle ss-m-l-20">可使用优惠券</view>
-				<view v-for="item in state.couponInfo" :key="item.id">
-					<s-coupon-list :data="item">
-						<template #default>
-							<button class="ss-reset-button card-btn ss-flex ss-row-center ss-col-center" :class="
+  <su-popup
+    :show="show"
+    type="bottom"
+    round="20"
+    @close="emits('close')"
+    showClose
+    backgroundColor="#f2f2f2"
+  >
+    <view class="model-box">
+      <view class="title ss-m-t-16 ss-m-l-20 ss-flex">优惠券</view>
+      <scroll-view
+        class="model-content"
+        scroll-y
+        :scroll-with-animation="false"
+        :enable-back-to-top="true"
+      >
+        <view class="subtitle ss-m-l-20">可使用优惠券</view>
+        <view v-for="item in state.couponInfo" :key="item.id">
+          <s-coupon-list :data="item">
+            <template #default>
+              <button
+                class="ss-reset-button card-btn ss-flex ss-row-center ss-col-center"
+                :class="
                   item.get_status != 'can_get' && item.get_status != 'can_use' ? 'boder-btn' : ''
-                " @click.stop="getBuy(item.id)">
-								<!-- 此处对接领取优惠券先将限制解除 -->
-								<!-- :disabled="item.get_status != 'can_get' && item.get_status != 'can_use'" -->
-								{{ item.get_status_text }}
-							</button>
-						</template>
-					</s-coupon-list>
-				</view>
-			</scroll-view>
-		</view>
-	</su-popup>
+                "
+                @click.stop="getBuy(item.id)"
+                :disabled="item.get_status != 'can_get' && item.get_status != 'can_use'"
+              >
+                {{ item.get_status_text }}
+              </button>
+            </template>
+          </s-coupon-list>
+        </view>
+      </scroll-view>
+    </view>
+  </su-popup>
 </template>
 <script setup>
-	import {
-		computed,
-		reactive
-	} from 'vue';
-	const props = defineProps({
-		modelValue: {
-			type: Object,
-			default () {},
-		},
-		show: {
-			type: Boolean,
-			default: false,
-		},
-	});
-	const emits = defineEmits(['get', 'close']);
-	const state = reactive({
-		couponInfo: computed(() => props.modelValue),
-		currentValue: -1,
-		couponId: '',
-	});
-	const getBuy = (id) => {
-		console.log('应该是详情页领取优惠券')
-		emits('get', id);
-	};
-	//立即领取
+  import { computed, reactive } from 'vue';
+  const props = defineProps({
+    modelValue: {
+      type: Object,
+      default() {},
+    },
+    show: {
+      type: Boolean,
+      default: false,
+    },
+  });
+  const emits = defineEmits(['get', 'close']);
+  const state = reactive({
+    couponInfo: computed(() => props.modelValue),
+    currentValue: -1,
+    couponId: '',
+  });
+  const getBuy = (id) => {
+    emits('get', id);
+  };
+  //立即领取
 </script>
 <style lang="scss" scoped>
-	.model-box {
-		height: 60vh;
-
-		.title {
-			font-size: 36rpx;
-			height: 80rpx;
-			font-weight: bold;
-			color: #333333;
-		}
-
-		.subtitle {
-			font-size: 26rpx;
-			font-weight: 500;
-			color: #333333;
-		}
-	}
-
-	.model-content {
-		height: 54vh;
-	}
-
-	.modal-footer {
-		width: 100%;
-		height: 120rpx;
-		background: #fff;
-	}
-
-	.confirm-btn {
-		width: 710rpx;
-		margin-left: 20rpx;
-		height: 80rpx;
-		background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
-		border-radius: 40rpx;
-		color: #fff;
-	}
-
-	// 优惠券按钮
-	.card-btn {
-		// width: 144rpx;
-		padding: 0 16rpx;
-		height: 50rpx;
-		border-radius: 40rpx;
-		background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
-		color: #ffffff;
-		font-size: 24rpx;
-		font-weight: 400;
-	}
-
-	.boder-btn {
-		background: linear-gradient(90deg, var(--ui-BG-Main-opacity-4), var(--ui-BG-Main-light));
-		color: #fff !important;
-	}
-</style>
+  .model-box {
+    height: 60vh;
+    .title {
+      font-size: 36rpx;
+      height: 80rpx;
+      font-weight: bold;
+      color: #333333;
+    }
+    .subtitle {
+      font-size: 26rpx;
+      font-weight: 500;
+      color: #333333;
+    }
+  }
+  .model-content {
+    height: 54vh;
+  }
+  .modal-footer {
+    width: 100%;
+    height: 120rpx;
+    background: #fff;
+  }
+  .confirm-btn {
+    width: 710rpx;
+    margin-left: 20rpx;
+    height: 80rpx;
+    background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
+    border-radius: 40rpx;
+    color: #fff;
+  }
+  // 优惠券按钮
+  .card-btn {
+    // width: 144rpx;
+    padding: 0 16rpx;
+    height: 50rpx;
+    border-radius: 40rpx;
+    background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
+    color: #ffffff;
+    font-size: 24rpx;
+    font-weight: 400;
+  }
+  .boder-btn {
+    background: linear-gradient(90deg, var(--ui-BG-Main-opacity-4), var(--ui-BG-Main-light));
+    color: #fff !important;
+  }
+</style>

+ 6 - 2
sheep/components/s-coupon-list/s-coupon-list.vue

@@ -1,9 +1,13 @@
 <template>
 	<view class="ss-m-20" :style="{ opacity: disabled ? '0.5' : '1' }">
 		<view class="content">
-			<view class="tag ss-flex ss-row-center" :class="
+			<!--      <view
+        class="tag ss-flex ss-row-center"
+        :class="
           data.status == 'expired' || data.status == 'used' ? 'disabled-bg-color' : 'info-bg-color'
-        ">{{ data.type_text }}</view>
+        "
+        >{{ data.type_text }}</view
+      > -->
 			<view class="title ss-m-x-30 ss-p-t-18">
 				<view class="ss-flex ss-row-between">
 					<view class="value-text ss-flex-1 ss-m-r-10" :class="

+ 7 - 17
sheep/components/s-coupon-select/s-coupon-select.vue

@@ -1,4 +1,3 @@
-<!-- 订单确认的优惠劵选择弹窗 -->
 <template>
   <su-popup
     :show="show"
@@ -17,21 +16,20 @@
         :enable-back-to-top="true"
       >
         <view class="subtitle ss-m-l-20">可使用优惠券</view>
-        <view v-for="(item, index) in state.couponInfo" :key="index">
+        <view v-for="(item, index) in state.couponInfo.can_use" :key="index">
           <s-coupon-list :data="item" type="user" :disabled="false">
             <template #default>
               <label class="ss-flex ss-col-center" @tap="radioChange(item.id)">
                 <radio
                   color="var(--ui-BG-Main)"
                   style="transform: scale(0.8)"
-                  :checked="state.couponId === item.id"
+                  :checked="state.couponId == item.id"
                   @tap.stop="radioChange(item.id)"
                 />
               </label>
             </template>
           </s-coupon-list>
         </view>
-        <!-- TODO 芋艿:未来接口需要支持下
         <view class="subtitle ss-m-t-40 ss-m-l-20">不可使用优惠券</view>
         <view v-for="item in state.couponInfo.cannot_use" :key="item.id">
           <s-coupon-list :data="item" type="user" :disabled="true">
@@ -43,7 +41,6 @@
             </template>
           </s-coupon-list>
         </view>
-      -->
       </scroll-view>
     </view>
     <view class="modal-footer ss-flex">
@@ -53,9 +50,8 @@
 </template>
 <script setup>
   import { computed, reactive } from 'vue';
-
   const props = defineProps({
-    modelValue: { // 优惠劵列表
+    modelValue: {
       type: Object,
       default() {},
     },
@@ -64,27 +60,21 @@
       default: false,
     },
   });
-
   const emits = defineEmits(['confirm', 'close']);
-
   const state = reactive({
-    couponInfo: computed(() => props.modelValue), // 优惠劵列表
-    couponId: 0, // 选中的优惠劵编号
+    couponInfo: computed(() => props.modelValue),
+    couponId: 0,
   });
-
-  // 选中优惠劵
   function radioChange(couponId) {
-    if (state.couponId === couponId) {
+    if (state.couponId == couponId) {
       state.couponId = 0;
     } else {
       state.couponId = couponId;
     }
   }
-
-  // 确认优惠劵
   const onConfirm = () => {
     emits('confirm', state.couponId);
-  }
+  };
 </script>
 <style lang="scss" scoped>
   :deep() {

+ 1 - 2
sheep/components/s-goods-item/s-goods-item.vue

@@ -26,7 +26,7 @@
               :style="[{ color: priceColor }]"
               v-if="price && Number(price) > 0"
             >
-              ¥{{ fen2yuan(price) }}
+              ¥{{ price }}
             </view>
             <view v-if="score && Number(price) > 0">+</view>
             <view class="price-text ss-flex ss-col-center" v-if="score">
@@ -54,7 +54,6 @@
 <script setup>
   import sheep from '@/sheep';
   import { computed } from 'vue';
-  import { fen2yuan } from '../../hooks/useGoods';
   /**
    * 订单卡片
    *

+ 169 - 173
sheep/components/s-share-modal/s-share-modal.vue

@@ -1,19 +1,16 @@
 <template>
-  <!-- 分享弹框 -->
-  <view>
-    <su-popup :show="state.showShareGuide" :showClose="false" @close="onCloseGuide"></su-popup>
-    <view v-if="state.showShareGuide" class="guide-wrap">
-      <image
-        class="guide-image"
-        :src="sheep.$url.static('/static/img/shop/share/share_guide.png')"
-      ></image>
-    </view>
-
-    <su-popup :show="show" round="10" :showClose="false" @close="closeShareModal">
-      <!-- 分享tools -->
-      <view class="share-box">
-        <view class="share-list-box ss-flex">
-          <button
+	<!-- 分享弹框 -->
+	<view>
+		<su-popup :show="state.showShareGuide" :showClose="false" @close="onCloseGuide"></su-popup>
+		<view v-if="state.showShareGuide" class="guide-wrap">
+			<image class="guide-image" :src="sheep.$url.static('/static/img/shop/share/share_guide.png')"></image>
+		</view>
+
+		<su-popup :show="show" round="10" :showClose="false" @close="closeShareModal">
+			<!-- 分享tools -->
+			<view class="share-box">
+				<view class="share-list-box ss-flex">
+					<!--          <button
             v-if="shareConfig.methods.includes('forward')"
             class="share-item share-btn ss-flex-col ss-col-center"
             open-type="share"
@@ -25,20 +22,14 @@
               mode=""
             ></image>
             <text class="share-title">微信好友</text>
-          </button>
-          <button
-            v-if="shareConfig.methods.includes('poster')"
-            class="share-item share-btn ss-flex-col ss-col-center"
-            @tap="onShareByPoster"
-          >
-            <image
-              class="share-img"
-              :src="sheep.$url.static('/static/img/shop/share/share_poster.png')"
-              mode=""
-            ></image>
-            <text class="share-title">生成海报</text>
-          </button>
-
+          </button> -->
+					<button v-if="shareConfig.methods.includes('poster')"
+						class="share-item share-btn ss-flex-col ss-col-center" @tap="onShareByPoster">
+						<image class="share-img" :src="sheep.$url.static('/static/img/shop/share/share_poster.png')"
+							mode=""></image>
+						<text class="share-title">生成海报</text>
+					</button>
+					<!-- 
           <button
             v-if="shareConfig.methods.includes('link')"
             class="share-item share-btn ss-flex-col ss-col-center"
@@ -50,152 +41,157 @@
               mode=""
             ></image>
             <text class="share-title">复制链接</text>
-          </button>
-        </view>
-        <view class="share-foot ss-flex ss-row-center ss-col-center" @tap="closeShareModal">
-          取消
-        </view>
-      </view>
-    </su-popup>
-    <!-- 分享海报 -->
-    <canvas-poster
-      ref="SharePosterRef"
-      :show="state.showPosterModal"
-      :shareInfo="shareInfo"
-      @close="state.showPosterModal = false"
-    />
-  </view>
+          </button> -->
+				</view>
+				<view class="share-foot ss-flex ss-row-center ss-col-center" @tap="closeShareModal">
+					取消
+				</view>
+			</view>
+		</su-popup>
+		<!-- 分享海报 -->
+		<canvas-poster ref="SharePosterRef" :show="state.showPosterModal" :shareInfo="shareInfo"
+			@close="state.showPosterModal = false" />
+	</view>
 </template>
 <script setup>
-  /**
-   * 分享弹窗
-   */
-  import { ref, unref, reactive, computed } from 'vue';
-  import sheep from '@/sheep';
-  import canvasPoster from './canvas-poster/index.vue';
-  import { showShareModal, closeShareModal, showAuthModal } from '@/sheep/hooks/useModal';
-
-  const show = computed(() => sheep.$store('modal').share);
-  const shareConfig = computed(() => sheep.$store('app').platform.share);
-  const SharePosterRef = ref('');
-
-  const props = defineProps({
-    shareInfo: {
-      type: Object,
-      default() {},
-    },
-  });
-
-  const state = reactive({
-    showShareGuide: false, //H5的指引。
-    showPosterModal: false, //海报弹窗
-  });
-
-  // 生成海报分享
-  const onShareByPoster = () => {
-    closeShareModal();
-    if (!sheep.$store('user').isLogin) {
-      showAuthModal();
-      return;
-    }
-    unref(SharePosterRef).getPoster();
-    state.showPosterModal = true;
-  };
-
-  // 直接转发分享
-  const onShareByForward = () => {
-    closeShareModal();
-
-    // #ifdef H5
-    if (['WechatOfficialAccount', 'H5'].includes(sheep.$platform.name)) {
-      state.showShareGuide = true;
-      return;
-    }
-    // #endif
-
-    // #ifdef APP-PLUS
-    uni.share({
-      provider: 'weixin',
-      scene: 'WXSceneSession',
-      type: 0,
-      href: props.shareInfo.link,
-      title: props.shareInfo.title,
-      summary: props.shareInfo.desc,
-      imageUrl: props.shareInfo.image,
-      success: (res) => {
-        console.log('success:' + JSON.stringify(res));
-      },
-      fail: (err) => {
-        console.log('fail:' + JSON.stringify(err));
-      },
-    });
-    // #endif
-  };
-
-  // 复制链接分享
-  const onShareByCopyLink = () => {
-    sheep.$helper.copyText(props.shareInfo.link);
-    closeShareModal();
-  };
-
-  function onCloseGuide() {
-    state.showShareGuide = false;
-  }
+	/**
+	 * 分享弹窗
+	 */
+	import {
+		ref,
+		unref,
+		reactive,
+		computed
+	} from 'vue';
+	import sheep from '@/sheep';
+	import canvasPoster from './canvas-poster/index.vue';
+	import {
+		showShareModal,
+		closeShareModal,
+		showAuthModal
+	} from '@/sheep/hooks/useModal';
+
+	const show = computed(() => sheep.$store('modal').share);
+	const shareConfig = computed(() => sheep.$store('app').platform.share);
+	const SharePosterRef = ref('');
+
+	const props = defineProps({
+		shareInfo: {
+			type: Object,
+			default () {},
+		},
+	});
+
+	const state = reactive({
+		showShareGuide: false, //H5的指引。
+		showPosterModal: false, //海报弹窗
+	});
+
+	// 生成海报分享
+	const onShareByPoster = () => {
+		closeShareModal();
+		if (!sheep.$store('user').isLogin) {
+			showAuthModal();
+			return;
+		}
+		unref(SharePosterRef).getPoster();
+		state.showPosterModal = true;
+	};
+
+	// 直接转发分享
+	const onShareByForward = () => {
+		closeShareModal();
+
+		// #ifdef H5
+		if (['WechatOfficialAccount', 'H5'].includes(sheep.$platform.name)) {
+			state.showShareGuide = true;
+			return;
+		}
+		// #endif
+
+		// #ifdef APP-PLUS
+		uni.share({
+			provider: 'weixin',
+			scene: 'WXSceneSession',
+			type: 0,
+			href: props.shareInfo.link,
+			title: props.shareInfo.title,
+			summary: props.shareInfo.desc,
+			imageUrl: props.shareInfo.image,
+			success: (res) => {
+				console.log('success:' + JSON.stringify(res));
+			},
+			fail: (err) => {
+				console.log('fail:' + JSON.stringify(err));
+			},
+		});
+		// #endif
+	};
+
+	// 复制链接分享
+	const onShareByCopyLink = () => {
+		sheep.$helper.copyText(props.shareInfo.link);
+		closeShareModal();
+	};
+
+	function onCloseGuide() {
+		state.showShareGuide = false;
+	}
 </script>
 
 <style lang="scss" scoped>
-  .guide-image {
-    right: 30rpx;
-    top: 0;
-    position: fixed;
-    width: 580rpx;
-    height: 430rpx;
-    z-index: 10080;
-  }
-
-  // 分享tool
-  .share-box {
-    background: $white;
-    width: 750rpx;
-    border-radius: 30rpx 30rpx 0 0;
-    padding-top: 30rpx;
-
-    .share-foot {
-      font-size: 24rpx;
-      color: $gray-b;
-      height: 80rpx;
-      border-top: 1rpx solid $gray-e;
-    }
-
-    .share-list-box {
-      .share-btn {
-        background: none;
-        border: none;
-        line-height: 1;
-        padding: 0;
-
-        &::after {
-          border: none;
-        }
-      }
-
-      .share-item {
-        flex: 1;
-        padding-bottom: 20rpx;
-
-        .share-img {
-          width: 70rpx;
-          height: 70rpx;
-          background: $gray-f;
-          border-radius: 50%;
-          margin-bottom: 20rpx;
-        }
-
-        .share-title {
-          font-size: 24rpx;
-          color: $dark-6;
-        }
-      }
-    }
-  }
-</style>
+	.guide-image {
+		right: 30rpx;
+		top: 0;
+		position: fixed;
+		width: 580rpx;
+		height: 430rpx;
+		z-index: 10080;
+	}
+
+	// 分享tool
+	.share-box {
+		background: $white;
+		width: 750rpx;
+		border-radius: 30rpx 30rpx 0 0;
+		padding-top: 30rpx;
+
+		.share-foot {
+			font-size: 24rpx;
+			color: $gray-b;
+			height: 80rpx;
+			border-top: 1rpx solid $gray-e;
+		}
+
+		.share-list-box {
+			.share-btn {
+				background: none;
+				border: none;
+				line-height: 1;
+				padding: 0;
+
+				&::after {
+					border: none;
+				}
+			}
+
+			.share-item {
+				flex: 1;
+				padding-bottom: 20rpx;
+
+				.share-img {
+					width: 70rpx;
+					height: 70rpx;
+					background: $gray-f;
+					border-radius: 50%;
+					margin-bottom: 20rpx;
+				}
+
+				.share-title {
+					font-size: 24rpx;
+					color: $dark-6;
+				}
+			}
+		}
+	}
+</style>

+ 33 - 99
sheep/platform/pay.js

@@ -3,20 +3,19 @@ import sheep from '@/sheep';
 import $wxsdk from '@/sheep/libs/sdk-h5-weixin';
 // #endif
 import { getRootUrl } from '@/sheep/helper';
-import PayOrderApi from '@/sheep/api/pay/order';
 
 /**
  * 支付
  *
  * @param {String} payment = ['wechat','alipay','wallet','offline']  	- 支付方式
  * @param {String} orderType = ['goods','recharge','groupon']  	- 订单类型
- * @param {String} id					- 订单号
+ * @param {String} orderSN					- 订单号
  */
 
 export default class SheepPay {
-  constructor(payment, orderType, id) {
+  constructor(payment, orderType, orderSN) {
     this.payment = payment;
-    this.id = id;
+    this.orderSN = orderSN;
     this.orderType = orderType;
     this.payAction();
   }
@@ -30,8 +29,8 @@ export default class SheepPay {
         alipay: () => {
           this.redirectPay(); // 现在公众号可以直接跳转支付宝页面
         },
-        wallet: () => {
-          this.walletPay();
+        money: () => {
+          this.moneyPay();
         },
         offline: () => {
           this.offlinePay();
@@ -44,8 +43,8 @@ export default class SheepPay {
         alipay: () => {
           this.copyPayLink();
         },
-        wallet: () => {
-          this.walletPay();
+        money: () => {
+          this.moneyPay();
         },
         offline: () => {
           this.offlinePay();
@@ -58,8 +57,8 @@ export default class SheepPay {
         alipay: () => {
           this.alipay();
         },
-        wallet: () => {
-          this.walletPay();
+        money: () => {
+          this.moneyPay();
         },
         offline: () => {
           this.offlinePay();
@@ -72,8 +71,8 @@ export default class SheepPay {
         alipay: () => {
           this.redirectPay();
         },
-        wallet: () => {
-          this.walletPay();
+        money: () => {
+          this.moneyPay();
         },
         offline: () => {
           this.offlinePay();
@@ -84,21 +83,18 @@ export default class SheepPay {
   }
 
   // 预支付
-  prepay(channel) {
+  prepay() {
     return new Promise((resolve, reject) => {
       let data = {
-        id: this.id,
-        channelCode: channel,
-        channelExtras: {}
+        order_sn: this.orderSN,
+        payment: this.payment,
       };
       if (uni.getStorageSync('openid')) {
         data.openid = uni.getStorageSync('openid');
       }
-      PayOrderApi.submitOrder(data).then((res) => {
-        // 成功时
-        res.code === 0 && resolve(res);
-        // 失败时
-        if (res.code !== 0 && res.msg === 'miss_openid') {
+      sheep.$api.pay.prepay(data).then((res) => {
+        res.error === 0 && resolve(res);
+        if (res.error === -1 && res.msg === 'miss_openid') {
           uni.showModal({
             title: '微信支付',
             content: '请先绑定微信再使用微信支付',
@@ -113,7 +109,7 @@ export default class SheepPay {
     });
   }
   // #ifdef H5
-  // 微信公众号JSSDK支付 TODO 芋艿:待接入
+  // 微信公众号JSSDK支付
   async wechatOfficialAccountPay() {
     let that = this;
     let { error, data, msg } = await this.prepay();
@@ -134,21 +130,21 @@ export default class SheepPay {
     });
   }
 
-  //浏览器微信H5支付 TODO 芋艿:待接入
+  //浏览器微信H5支付
   async wechatWapPay() {
     const { error, data } = await this.prepay();
     if (error === 0) {
-      const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${this.payment
+      const redirect_url = `${getRootUrl()}pages/pay/result?orderSN=${this.orderSN}&payment=${this.payment
         }&orderType=${this.orderType}`;
       location.href = `${data.pay_data.h5_url}&redirect_url=${encodeURIComponent(redirect_url)}`;
     }
   }
 
-  // 支付链接  TODO 芋艿:待接入
+  // 支付链接
   async redirectPay() {
     let { error, data } = await this.prepay();
     if (error === 0) {
-      const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${this.payment
+      const redirect_url = `${getRootUrl()}pages/pay/result?orderSN=${this.orderSN}&payment=${this.payment
         }&orderType=${this.orderType}`;
       location.href = data.pay_data + encodeURIComponent(redirect_url);
     }
@@ -156,7 +152,7 @@ export default class SheepPay {
 
   // #endif
 
-  // 微信小程序支付  TODO 芋艿:待接入
+  // 微信小程序支付
   async wechatMiniProgramPay() {
     let that = this;
     let result = await this.prepay();
@@ -177,18 +173,18 @@ export default class SheepPay {
   }
 
   // 余额支付
-  async walletPay() {
-    const { code } = await this.prepay('wallet');
-    code === 0 && this.payResult('success');
+  async moneyPay() {
+    const { error } = await this.prepay();
+    error === 0 && this.payResult('success');
   }
 
-  // 货到付款  TODO 芋艿:待接入
+  // 货到付款
   async offlinePay() {
     const { error } = await this.prepay();
     error === 0 && this.payResult('success');
   }
 
-  // 支付宝复制链接支付  TODO 芋艿:待接入
+  // 支付宝复制链接支付
   async copyPayLink() {
     let that = this;
     let { error, data } = await this.prepay();
@@ -207,7 +203,7 @@ export default class SheepPay {
     }
   }
 
-  // 支付宝支付  TODO 芋艿:待接入
+  // 支付宝支付
   async alipay() {
     let that = this;
     const { error, data } = await this.prepay();
@@ -229,7 +225,7 @@ export default class SheepPay {
     }
   }
 
-  // 微信支付  TODO 芋艿:待接入
+  // 微信支付
   async wechatAppPay() {
     let that = this;
     let { error, data } = await this.prepay();
@@ -250,72 +246,10 @@ export default class SheepPay {
   // 支付结果跳转,success:成功,fail:失败
   payResult(resultType) {
     sheep.$router.redirect('/pages/pay/result', {
-      id: this.id,
+      orderSN: this.orderSN,
+      payment: this.payment, //重新支付的时候使用
+      payState: resultType,
       orderType: this.orderType,
-      payState: resultType
     });
   }
 }
-
-export function getPayMethods(channels) {
-  const payMethods = [
-    {
-      icon: '/static/img/shop/pay/wechat.png',
-      title: '微信支付',
-      value: 'wechat',
-      disabled: true,
-    },
-    {
-      icon: '/static/img/shop/pay/alipay.png',
-      title: '支付宝支付',
-      value: 'alipay',
-      disabled: true,
-    },
-    {
-      icon: '/static/img/shop/pay/wallet.png',
-      title: '余额支付',
-      value: 'wallet',
-      disabled: true,
-    },
-    {
-      icon: '/static/img/shop/pay/apple.png',
-      title: 'Apple Pay',
-      value: 'apple',
-      disabled: true,
-    },
-    {
-      icon: '/static/img/shop/pay/wallet.png',
-      title: '模拟支付',
-      value: 'mock',
-      disabled: true,
-    }
-  ];
-  const platform = sheep.$platform.name
-
-  // 1. 处理【微信支付】
-  const wechatMethod = payMethods[0];
-  if ((platform === 'WechatOfficialAccount' && channels.includes('wx_pub'))
-    || platform === 'WechatMiniProgram' && channels.includes('wx_lite')
-    || platform === 'App' && channels.includes('wx_app')) {
-    wechatMethod.disabled = false;
-  }
-  // 2. 处理【支付宝支付】
-  const alipayMethod = payMethods[1];
-  if ((platform === 'WechatOfficialAccount' && channels.includes('alipay_wap'))
-    || platform === 'WechatMiniProgram' && channels.includes('alipay_wap')
-    || platform === 'App' && channels.includes('alipay_app')) {
-    alipayMethod.disabled = false;
-  }
-  // 3. 处理【余额支付】
-  const walletMethod = payMethods[2];
-  if (channels.includes('wallet')) {
-    walletMethod.disabled = false;
-  }
-  // 4. 处理【苹果支付】TODO 芋艿:未来接入
-  // 5. 处理【模拟支付】
-  const mockMethod = payMethods[4];
-  if (channels.includes('mock')) {
-    mockMethod.disabled = false;
-  }
-  return payMethods;
-}

+ 1 - 3
sheep/request2/index.js

@@ -55,8 +55,7 @@ const http = new Request({
 	method: 'GET',
 	header: {
 		Accept: 'text/json',
-		'Content-Type': 'application/json',
-		// ;charset=UTF-8
+		'Content-Type': 'application/json;charset=UTF-8',
 		platform: $platform.name,
 	},
 	// #ifdef APP-PLUS
@@ -99,7 +98,6 @@ http.interceptors.request.use(
       config.header['terminal'] = '20';
       config.header['Authorization'] = 'Bearer test247';
 		}
-		// console.log(config, '看参数')
 		return config;
 	},
 	(error) => {

+ 2 - 2
sheep/store/app.js

@@ -23,8 +23,8 @@ const app = defineStore({
       copytime: '', // 版权信息 II
     },
     platform: {
-      payment: [], // 支持的支付方式 TODO 芋艿:可删除
-      recharge_payment: [], // 支持的充值支付方式 TODO 芋艿:可删除
+      payment: [], // 支持的支付方式
+      recharge_payment: [], // 支持的充值支付方式
       share: {
         methods: [], // 支持的分享方式
         forwardInfo: {}, // 默认转发信息

+ 54 - 49
sheep/store/cart.js

@@ -1,93 +1,98 @@
 import { defineStore } from 'pinia';
-import CartApi from '@/sheep/api/trade/cart';
+import cartApi from '@/sheep/api/cart';
 
 const cart = defineStore({
   id: 'cart',
   state: () => ({
     list: [], // 购物车列表
     selectedIds: [], // 已选列表
-    isAllSelected: false, // 是否全选
-    totalPriceSelected: 0, // 选中项总金额
+    isAllSelected: false, //是否全选
+    cartSelectedTotalPrice: '0.00', // 选中项总金额
   }),
+  getters: {
+    totalPriceSelected: (state) => {
+      let price = 0;
+      if (!state.selectedIds.length) return price.toFixed(2);
+      state.list.forEach((item) => {
+        price += state.selectedIds.includes(item.id)
+          ? Number(item.sku.price/100) * item.count
+          : 0;
+      });
+      return price.toFixed(2);
+    },
+  },
   actions: {
     // 获取购物车列表
     async getList() {
-      const { data, code } = await CartApi.getCartList();
+      const { data, code } = await cartApi.list();
       if (code === 0) {
         this.list = data.validList;
-
-        // 计算各种关联属性
-        this.selectedIds = [];
-        this.isAllSelected = true;
-        this.totalPriceSelected = 0;
-        this.list.forEach((item) => {
-          if (item.selected) {
-            this.selectedIds.push(item.id);
-            this.totalPriceSelected += item.count * item.sku.price;
-          } else {
-            this.isAllSelected = false;
-          }
-        });
       }
     },
-
     // 添加购物车
     async add(goodsInfo) {
-      // 添加购物项
-      const { code } = await CartApi.addCart({
-        skuId: goodsInfo.id,
-        count: goodsInfo.goods_num,
+      const { error } = await cartApi.append({
+        goods_id: goodsInfo.goods_id,
+        goods_num: goodsInfo.goods_num,
+        goods_sku_price_id: goodsInfo.id,
       });
-      // 刷新购物车列表
-      if (code === 0) {
-        await this.getList();
+      if (error === 0) {
+        this.getList();
       }
     },
 
     // 更新购物车
     async update(goodsInfo) {
-      const { code } = await CartApi.updateCartCount({
+      const { error } = await cartApi.update({
         id: goodsInfo.goods_id,
         count: goodsInfo.goods_num,
+        goods_sku_price_id: goodsInfo.goods_sku_price_id,
       });
-      if (code === 0) {
-        await this.getList();
+      if (error === 0) {
+        // this.getList();
       }
     },
 
     // 移除购物车
     async delete(ids) {
-      const { code } = await CartApi.deleteCart(ids.join(','));
+      if (typeof ids === 'array') {
+        ids = ids.join(',');
+      }
+      const { code } = await cartApi.delete(ids);
       if (code === 0) {
-        await this.getList();
+        this.selectAll(false);
+        this.getList();
       }
     },
 
-    // 单选购物车商品
-    async selectSingle(goodsId) {
-      const { code } = await CartApi.updateCartSelected({
-        ids: [goodsId],
-        selected: !this.selectedIds.includes(goodsId), // 取反
-      });
-      if (code === 0) {
-        await this.getList();
+    // 选择购物车商品
+    selectSingle(goodsId) {
+      if (!this.selectedIds.includes(goodsId)) {
+        this.selectedIds.push(goodsId);
+      } else {
+        this.selectedIds.splice(this.selectedIds.indexOf(goodsId), 1);
       }
+      this.isAllSelected = this.selectedIds.length === this.list.length;
     },
 
-    // 全选购物车商品
-    async selectAll(flag) {
-      const { code } = await CartApi.updateCartSelected({
-        ids: this.list.map((item) => item.id),
-        selected: flag
-      });
-      if (code === 0) {
-        await this.getList();
+    // 全选
+    selectAll(flag) {
+      this.isAllSelected = flag;
+      if (!flag) {
+        this.selectedIds = [];
+      } else {
+        this.list.forEach((item) => {
+          this.selectedIds.push(item.id);
+        });
       }
     },
 
     // 清空购物车
-    async emptyList() {
-      await this.delete(this.list.map((item) => item.id));
+    emptyList() {
+      this.list = [];
+      this.selectedIds = [];
+      this.isAllSelected = false;
+      this.cartSelectedTotalPrice = '0.00';
     },
   },
   persist: {
@@ -100,4 +105,4 @@ const cart = defineStore({
   },
 });
 
-export default cart;
+export default cart;

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 473 - 492
uni_modules/mp-html/components/mp-html/parser.js


+ 2 - 4
vite.config.js

@@ -1,6 +1,4 @@
-import {
-	loadEnv
-} from 'vite';
+import { loadEnv } from 'vite';
 import uni from '@dcloudio/vite-plugin-uni';
 import path from 'path';
 // import viteCompression from 'vite-plugin-compression';
@@ -33,4 +31,4 @@ export default (command, mode) => {
 			},
 		},
 	};
-};
+};

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно