Explorar el Código

Merge branch 'master' of https://git.citupro.com/zhengnaiwen_citu/menduner-mall-uniapp

lifanagju_citu hace 6 meses
padre
commit
ac550f9ff9

+ 23 - 3
pages.json

@@ -297,17 +297,27 @@
 					}
 				},
 				{
-					"path": "address/list",
+					"path": "prize/index",
 					"style": {
-						"navigationBarTitleText": "收货地址"
+						"navigationBarTitleText": "我的奖品"
 					},
 					"meta": {
 						"auth": true,
 						"sync": true,
-						"title": "地址管理",
+						"title": "我的奖品",
 						"group": "用户中心"
 					}
 				},
+				{
+					"path": "prize/receive",
+					"style": {
+						"navigationBarTitleText": "奖品领取"
+					},
+					"meta": {
+						"auth": true,
+						"title": "奖品领取"
+					}
+				},
 				{
 					"path": "address/edit",
 					"style": {
@@ -318,6 +328,16 @@
 						"title": "编辑地址"
 					}
 				},
+				{
+					"path": "address/list",
+					"style": {
+						"navigationBarTitleText": "收货地址"
+					},
+					"meta": {
+						"auth": true,
+						"title": "收货地址"
+					}
+				},
                 {
                   "path": "goods_details_store/index",
                   "style": {

+ 27 - 37
pages/order/detail.vue

@@ -77,43 +77,26 @@
             :skuText="item.properties.map((property) => property.valueName).join(' ')"
             :price="item.price"
             :num="item.count"
+            :lottery="state.orderInfo.lottery"
           >
             <template #tool>
               <view class="ss-flex">
-                <button
-                  class="ss-reset-button apply-btn"
-                  v-if="[10, 20, 30].includes(state.orderInfo.status) && item.afterSaleStatus === 0"
-                  @tap.stop="
-                    sheep.$router.go('/pages/order/aftersale/apply', {
-                      orderId: state.orderInfo.id,
-                      itemId: item.id,
-                    })
-                  "
-                >
-                  申请售后
-                </button>
-                <button
-                  class="ss-reset-button apply-btn"
-                  v-if="item.afterSaleStatus === 10"
-                  @tap.stop="
-                    sheep.$router.go('/pages/order/aftersale/detail', {
-                      id: item.afterSaleId,
-                    })
-                  "
-                >
-                  退款中
-                </button>
-                <button
-                  class="ss-reset-button apply-btn"
+                <button class="ss-reset-button apply-btn"
+                  v-if="[10, 20, 30].includes(state.orderInfo.status) && item.afterSaleStatus === 0 && item.spuType === '0'"
+                  @tap.stop="sheep.$router.go('/pages/order/aftersale/apply', {orderId: state.orderInfo.id,itemId: item.id,})">申请售后</button>
+
+                <button class="ss-reset-button apply-btn" v-if="item.afterSaleStatus === 10"
+                  @tap.stop="sheep.$router.go('/pages/order/aftersale/detail', { id: item.afterSaleId })">退款中</button>
+
+                <button class="ss-reset-button apply-btn"
                   v-if="item.afterSaleStatus === 20"
-                  @tap.stop="
-                    sheep.$router.go('/pages/order/aftersale/detail', {
-                      id: item.afterSaleId,
-                    })
-                  "
-                >
-                  退款成功
-                </button>
+                  @tap.stop="sheep.$router.go('/pages/order/aftersale/detail', {id: item.afterSaleId,})">退款成功</button>
+                
+                <button 
+                  class="ss-reset-button apply-btn" 
+                  @tap.stop="preview(item.extend?.fileUrls[0])"
+                  v-if="[10, 20, 30].includes(state.orderInfo?.status) && item.spuType === '99' && item.extend?.fileUrls && item.extend?.fileUrls.length"
+                >预览/下载</button>
               </view>
             </template>
             <template #priceSuffix>
@@ -225,7 +208,7 @@
         >
           继续支付
         </button>
-        <button
+        <!-- <button
           class="ss-reset-button cancel-btn"
           v-if="state.orderInfo.buttons?.includes('combination')"
           @tap="
@@ -235,7 +218,7 @@
           "
         >
           拼团详情
-        </button>
+        </button> -->
         <button
           class="ss-reset-button cancel-btn"
           v-if="state.orderInfo.buttons?.includes('express')"
@@ -250,13 +233,13 @@
         >
           确认收货
         </button>
-        <button
+        <!-- <button
           class="ss-reset-button cancel-btn"
           v-if="state.orderInfo.buttons?.includes('comment')"
           @tap="onComment(state.orderInfo.id)"
         >
           评价
-        </button>
+        </button> -->
       </view>
     </su-fixed>
   </s-layout>
@@ -276,6 +259,7 @@
   import OrderApi from '@/sheep/api/trade/order';
   import DeliveryApi from '@/sheep/api/trade/delivery';
   import PickUpVerify from '@/pages/order/pickUpVerify.vue';
+  import { preview } from '@/sheep/util/preview'
 
   const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
   const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
@@ -417,8 +401,14 @@
     } else {
       res = await OrderApi.getOrderDetail(id);
     }
+
+    // 中奖信息
+    const result = await OrderApi.getLuckLotteryRecordByOrderId(id)
+
     if (res.code === 0) {
       state.orderInfo = res.data;
+      console.log(state.orderInfo, '订单详情')
+      state.orderInfo.lottery = result.data
       handleOrderButtons(state.orderInfo);
       // 配送方式:门店自提
       if (res.data.pickUpStoreId) {

+ 40 - 61
pages/order/list.vue

@@ -30,6 +30,7 @@
             :skuText="item.properties.map((property) => property.valueName).join(' ')"
             :price="item.price"
             :num="item.count"
+			      :lottery="order?.lottery"
           />
         </view>
         <view class="pay-box ss-m-t-30 ss-flex ss-row-right ss-p-r-20">
@@ -45,62 +46,22 @@
           :class="order.buttons.length > 3 ? 'ss-row-between' : 'ss-row-right'"
         >
           <view class="ss-flex ss-col-center">
-            <button
-              v-if="order.buttons.includes('combination')"
-              class="tool-btn ss-reset-button"
-              @tap.stop="onOrderGroupon(order)"
-            >
-              拼团详情
-            </button>
-            <button
-              v-if="order.buttons.length === 0"
-              class="tool-btn ss-reset-button"
-              @tap.stop="onOrderDetail(order.id)"
-            >
-              查看详情
-            </button>
-            <button
-              v-if="order.buttons.includes('confirm')"
-              class="tool-btn ss-reset-button"
-              @tap.stop="onConfirm(order)"
-            >
-              确认收货
-            </button>
-            <button
-              v-if="order.buttons.includes('express')"
-              class="tool-btn ss-reset-button"
-              @tap.stop="onExpress(order.id)"
-            >
-              查看物流
-            </button>
-            <button
-              v-if="order.buttons.includes('cancel')"
-              class="tool-btn ss-reset-button"
-              @tap.stop="onCancel(order.id)"
-            >
-              取消订单
-            </button>
-            <button
-              v-if="order.buttons.includes('comment')"
-              class="tool-btn ss-reset-button"
-              @tap.stop="onComment(order.id)"
-            >
-              评价
-            </button>
-            <button
-              v-if="order.buttons.includes('delete')"
-              class="delete-btn ss-reset-button"
-              @tap.stop="onDelete(order.id)"
-            >
-              删除订单
-            </button>
-            <button
-              v-if="order.buttons.includes('pay')"
-              class="tool-btn ss-reset-button ui-BG-Main-Gradient"
-              @tap.stop="onPay(order.payOrderId)"
-            >
-              继续支付
-            </button>
+            <!-- <button v-if="order.buttons.includes('combination')" class="tool-btn ss-reset-button" @tap.stop="onOrderGroupon(order)">拼团详情</button> -->
+            <button class="tool-btn ss-reset-button" @tap.stop="onOrderDetail(order.id)">查看详情</button>
+            <button class="tool-btn ss-reset-button" @tap.stop="preview(order.items[0].extend?.fileUrls[0])"
+              v-if="
+                [10, 20, 30].includes(order.status) && 
+                order.items.every(e => e.spuType !== '0' && 
+                e.extend  && 
+                e.extend.fileUrls && e.extend.fileUrls.length)
+              "
+            >预览/下载</button>
+            <button v-if="order.buttons.includes('confirm')" class="tool-btn ss-reset-button" @tap.stop="onConfirm(order)">确认收货</button>
+            <button v-if="order.buttons.includes('express')" class="tool-btn ss-reset-button" @tap.stop="onExpress(order.id)">查看物流</button>
+            <button v-if="order.buttons.includes('cancel')" class="tool-btn ss-reset-button" @tap.stop="onCancel(order.id)">取消订单</button>
+            <!-- <button v-if="order.buttons.includes('comment')" class="tool-btn ss-reset-button" @tap.stop="onComment(order.id)">评价</button> -->
+            <button v-if="order.buttons.includes('delete')" class="delete-btn ss-reset-button" @tap.stop="onDelete(order.id)">删除订单</button>
+            <button v-if="order.buttons.includes('pay')" class="tool-btn ss-reset-button ui-BG-Main-Gradient" @tap.stop="onPay(order.payOrderId)">继续支付</button>
           </view>
         </view>
       </view>
@@ -131,7 +92,8 @@
   import _ from 'lodash-es';
   import { isEmpty } from 'lodash-es';
   import OrderApi from '@/sheep/api/trade/order';
-  import { resetPagination } from '@/sheep/util';
+  import { resetPagination } from '@/sheep/util'
+  import { preview } from '@/sheep/util/preview'
 
   // 数据
   const state = reactive({
@@ -161,10 +123,18 @@
       name: '已发货',
       value: 20,
     },
-    {
-      name: '待评价',
-      value: 30,
-    },
+	{
+		name: '已完成',
+		value: 30
+	},
+	{
+		name: '已取消',
+		value: 40
+	}
+    // {
+    //   name: '待评价',
+    //   value: 30,
+    // },
   ];
 
   // 切换选项卡
@@ -330,6 +300,15 @@
     if (code !== 0) {
       return;
     }
+	
+	// 中奖信息
+	const orderIds = data.list.map(e => e.id).join(',')
+	const result = await OrderApi.getLuckLotteryRecordByOrderIds(orderIds)
+	for (let i in result.data) {
+	  const obj = data.list.find(e => e.id === Number(i))
+	  obj.lottery = result.data[i]
+	}
+	
     data.list.forEach((order) => handleOrderButtons(order));
     state.pagination.list = _.concat(state.pagination.list, data.list);
     state.pagination.total = data.total;

+ 196 - 0
pages/user/prize/index.vue

@@ -0,0 +1,196 @@
+<!-- 我的奖品 -->
+<template>
+  <s-layout title="我的奖品">
+    <view class="ss-m-t-20">
+			<view
+				class="ss-order-card-warp bg-white"
+				style="border-radius: 10rpx; margin-bottom: 20rpx;"
+				v-for="val in state.pagination.list" :key="val.record.id"
+			>
+				<view class="ss-flex ss-col-stretch ss-row-between border-bottom ss-p-b-20">
+					<view class="img-box ss-m-r-24">
+						<image class="order-img" :src="sheep.$url.cdn(val.prize.image)" mode="aspectFill"></image>
+					</view>
+					<view class="box-right ss-flex-col ss-row-between">
+						<view class="title-text ss-line-2">{{ val.prize.name }}</view>
+						<view class="ss-flex">
+							<view class="ss-flex ss-col-center">
+								<view class="price-text ss-flex ss-col-center">
+									{{ val.prize.extend.provinceName + ' ' + (val.prize.extend.cityName ? val.prize.extend.cityName : '') + '  ' + (val.prize.extend.districtName ? val.prize.extend.districtName : '') }}
+								</view>
+							</view>
+						</view>
+						<view class="spec-text">中奖时间: {{ val.record.createTime }}</view>
+            <view v-if="orderReceiveInfo(val)" class="spec-text">收货信息:{{ orderReceiveInfo(val) }}</view>
+            <view class="spec-text" v-if="val.record.deliverInfo">
+              发货信息:{{ val.record.deliverInfo ? JSON.parse(val.record.deliverInfo).name + '-' + JSON.parse(val.record.deliverInfo).no  : ''}}
+            </view>
+					</view>
+				</view>
+				<view class="tool-box">
+          <view v-if="!val.record.isReceive && !val.record.receiveInfo" class="ss-flex">
+            <button class="tool-btn ss-reset-button"  @tap.stop="handleReceive(val.record.id)">领取</button>
+            <button class="tool-btn ss-reset-button" @tap.stop="handleGiveUp(val)" style="color: #ff3000">放弃</button>
+          </view>
+					<view style="color: #00897B" class="ss-m-x-20" v-else-if="val.record.deliverInfo">已发货</view>
+					<view style="color: #fb8c00" class="ss-m-x-20" v-else>等待发货</view>
+				</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.list.length" text="暂无奖品" icon="/static/collect-empty.png" />
+  </s-layout>
+</template>
+
+<script setup>
+import sheep from '@/sheep';
+import { reactive, computed } from 'vue';
+import { onShow, onReachBottom } from '@dcloudio/uni-app';
+import _ from 'lodash-es';
+import PrizeApi from '@/sheep/api/prizeDraw/index';
+
+const state = reactive({
+  pagination: {
+    list: [],
+    total: 0,
+    pageNo: 1,
+    pageSize: 6,
+  },
+  loadStatus: '',
+});
+
+async function getData() {
+  state.loadStatus = 'loading';
+  const { code, data } = await PrizeApi.getLuckLotteryRecordPage({
+    pageNo: state.pagination.pageNo,
+    pageSize: state.pagination.pageSize,
+  });
+  if (code !== 0) {
+    return;
+  }
+  state.pagination.list = _.concat(state.pagination.list, data.list);
+  state.pagination.total = data.total;
+  state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
+}
+
+// 加载更多
+function loadMore() {
+  if (state.loadStatus === 'noMore') {
+    return;
+  }
+  state.pagination.pageNo++;
+  getData();
+}
+
+// 收货信息
+const orderReceiveInfo = computed(() => (item) => {
+  const info = item.record.receiveInfo ? JSON.parse(item.record.receiveInfo) : {}
+  if (!info || !Object.keys(info).length) return ''
+  return `${info.name},${info.mobile},${info.areaName} ${info.detailAddress}`
+})
+
+// 领取
+const handleReceive = (id) => {
+	sheep.$router.go('/pages/user/prize/receive', { id });
+}
+
+// 放弃
+async function handleGiveUp (item) {
+  await PrizeApi.luckyLotteryRecordGiveUp(item.record.id)
+  uni.showToast({
+    title: '操作成功',
+    icon: 'none',
+    duration: 2000
+  })
+  getData()
+}
+
+onReachBottom(() => {
+  loadMore();
+});
+
+onShow(() => {
+  getData();
+});
+</script>
+
+<style lang="scss" scoped>
+.tool-btn {
+    width: 160rpx;
+    height: 60rpx;
+    background: #f6f6f6;
+    font-size: 26rpx;
+    border-radius: 30rpx;
+    margin-right: 10rpx;
+
+    &:last-of-type {
+      margin-right: 0;
+    }
+  }
+  .point-img {
+    width: 36rpx;
+    height: 36rpx;
+    margin: 0 4rpx;
+  }
+  .ss-order-card-warp {
+    padding: 20rpx;
+
+    .img-box {
+      width: 164rpx;
+      height: 164rpx;
+      border-radius: 10rpx;
+      overflow: hidden;
+      .order-img {
+        width: 164rpx;
+        height: 164rpx;
+      }
+    }
+    .box-right {
+      flex: 1;
+    }
+
+    .title-text {
+      font-size: 28rpx;
+      font-weight: 500;
+      line-height: 40rpx;
+    }
+
+    .spec-text {
+      font-size: 24rpx;
+      font-weight: 400;
+      color: $dark-9;
+      min-width: 0;
+      overflow: hidden;
+      text-overflow: ellipsis;
+      display: -webkit-box;
+      -webkit-line-clamp: 1;
+      -webkit-box-orient: vertical;
+    }
+
+    .price-text {
+      font-size: 24rpx;
+      font-weight: 500;
+      font-family: OPPOSANS;
+    }
+
+    .total-text {
+      font-size: 24rpx;
+      font-weight: 400;
+      line-height: 24rpx;
+      color: $dark-9;
+      margin-left: 8rpx;
+    }
+  }
+	.tool-box {
+    display: flex;
+    justify-content: flex-end;
+    margin-top: 10px;
+  }
+</style>

+ 221 - 0
pages/user/prize/receive copy.vue

@@ -0,0 +1,221 @@
+<!-- 奖品领取 -->
+<template>
+  <s-layout title="奖品领取">
+		<uni-data-checkbox v-model="state.radio" :wrap="true" :localdata="state.addressList"></uni-data-checkbox>
+    <uni-forms
+			v-if="state.radio === 9999"
+      ref="addressFormRef"
+      v-model="state.model"
+      :rules="rules"
+      validateTrigger="bind"
+      labelWidth="160"
+      labelAlign="left"
+      border
+      :labelStyle="{ fontWeight: 'bold' }"
+    >
+      <view class="bg-white form-box ss-p-x-30">
+        <uni-forms-item name="name" label="收货人" class="form-item">
+          <uni-easyinput v-model="state.model.name" placeholder="请填写收货人姓名" :inputBorder="false" placeholderStyle="color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal"/>
+        </uni-forms-item>
+
+        <uni-forms-item name="mobile" label="手机号" class="form-item">
+          <uni-easyinput v-model="state.model.mobile" type="number" placeholder="请输入手机号" :inputBorder="false" placeholderStyle="color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal"/>
+        </uni-forms-item>
+
+        <uni-forms-item name="areaName" label="省市区" @tap="state.showRegion = true" class="form-item">
+          <uni-easyinput v-model="state.model.areaName" disabled :inputBorder="false"
+            :styles="{ disableColor: '#fff', color: '#333' }" placeholderStyle="color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal" placeholder="请选择省市区">
+            <template v-slot:right>
+              <uni-icons type="right" />
+            </template>
+          </uni-easyinput>
+        </uni-forms-item>
+
+        <uni-forms-item name="detailAddress" label="详细地址" :formItemStyle="{ alignItems: 'flex-start' }" :labelStyle="{ lineHeight: '5em' }" class="textarea-item">
+          <uni-easyinput :inputBorder="false" type="textarea" v-model="state.model.detailAddress" placeholderStyle="color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal" placeholder="请输入详细地址" clearable/>
+        </uni-forms-item>
+      </view>
+    </uni-forms>
+    <su-fixed bottom :opacity="false" bg="" placeholder :noFixed="false" :index="10">
+      <view class="footer-box ss-flex-col ss-row-between ss-p-20">
+        <view class="ss-m-b-20">
+          <button class="ss-reset-button save-btn ui-Shadow-Main" @tap="onSave">领取</button>
+        </view>
+      </view>
+    </su-fixed>
+
+    <!-- 省市区弹窗 -->
+    <su-region-picker :show="state.showRegion"  @cancel="state.showRegion = false" @confirm="onRegionConfirm"/>
+  </s-layout>
+</template>
+
+<script setup>
+  import { ref, reactive, unref } from 'vue';
+  import sheep from '@/sheep';
+  import { onLoad } from '@dcloudio/uni-app';
+  import _ from 'lodash-es';
+  import { mobile } from '@/sheep/validate/form';
+  import AreaApi from '@/sheep/api/system/area';
+  import AddressApi from '@/sheep/api/member/address';
+
+  const addressFormRef = ref(null);
+  const state = reactive({
+    showRegion: false,
+    model: {
+      name: '',
+      mobile: '',
+      detailAddress: '',
+      defaultStatus: false,
+      areaName: '',
+    },
+    rules: {},
+		radio: 0,
+		addressList: [],
+  });
+
+  const rules = {
+    name: {
+      rules: [{ required: true, errorMessage: '请输入收货人姓名' }]
+    },
+    mobile,
+    detailAddress: {
+      rules: [{ required: true, errorMessage: '请输入详细地址' }]
+    },
+    areaName: {
+      rules: [{ required: true, errorMessage: '请选择您的位置' }]
+    }
+  }
+
+  // 确认选择地区
+  const onRegionConfirm = (e) => {
+    state.model.areaName = `${e.province_name} ${e.city_name} ${e.district_name}`;
+    state.model.areaId = e.district_id;
+    state.showRegion = false;
+  };
+
+  // 获得地区数据
+  const getAreaData = () => {
+    if (_.isEmpty(uni.getStorageSync('areaData'))) {
+      AreaApi.getAreaTree().then((res) => {
+        if (res.code === 0) {
+          uni.setStorageSync('areaData', res.data);
+        }
+      });
+    }
+  };
+
+	// 获取收货地址
+	const getAddressList = async () => {
+		const list = (await AddressApi.getAddressList()).data;
+    state.addressList = list.map(e => {
+      return { text: e.areaName, value: e.id, ...e }
+    })
+	  // state.addressList.push({ value: 9999, text: '使用新地址' })
+    console.log(list, '收货地址列表', state.addressList)
+	}
+
+  // 保存收货地址
+  const onSave = async () => {
+    // 参数校验
+    const validate = await unref(addressFormRef)
+      .validate()
+      .catch((error) => {
+        console.log('error: ', error);
+      });
+    if (!validate) {
+      return;
+    }
+
+    // // 提交请求
+    // const formData = {
+    //   ...state.model,
+    // };
+    // const { code } =
+    //   state.model.id > 0
+    //     ? await AddressApi.updateAddress(formData)
+    //     : await AddressApi.createAddress(formData);
+    // if (code === 0) {
+    //   sheep.$router.back();
+    // }
+  };
+
+	const receiveId = ref()
+  onLoad(async (options) => {
+    // 获得地区数据
+    getAreaData()
+		// 获取收货地址列表
+		await getAddressList()
+
+		console.log(options, 'receive')
+		receiveId.value = options.id
+  });
+</script>
+
+<style lang="scss">
+  :deep() {
+    .uni-forms-item__label .label-text {
+      font-size: 28rpx !important;
+      color: #333333 !important;
+      line-height: normal !important;
+    }
+
+    .uni-easyinput__content-input {
+      font-size: 28rpx !important;
+      color: #333333 !important;
+      line-height: normal !important;
+      padding-left: 0 !important;
+    }
+
+    .uni-easyinput__content-textarea {
+      font-size: 28rpx !important;
+      color: #333333 !important;
+      line-height: normal !important;
+      margin-top: 8rpx !important;
+    }
+
+    .uni-icons {
+      font-size: 40rpx !important;
+    }
+
+    .is-textarea-icon {
+      margin-top: 22rpx;
+    }
+
+    .is-disabled {
+      color: #333333;
+    }
+
+    .uni-data-checklist .checklist-group {
+      display: block !important;
+    }
+  }
+
+  .default-box {
+    width: 100%;
+    box-sizing: border-box;
+    height: 100rpx;
+
+    .default-box-title {
+      font-size: 28rpx;
+      color: #333333;
+      line-height: normal;
+    }
+  }
+
+  .footer-box {
+    .save-btn {
+      width: 710rpx;
+      height: 80rpx;
+      border-radius: 40rpx;
+      background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
+      color: $white;
+    }
+
+    .cancel-btn {
+      width: 710rpx;
+      height: 80rpx;
+      border-radius: 40rpx;
+      background: var(--ui-BG);
+    }
+  }
+</style>

+ 199 - 0
pages/user/prize/receive.vue

@@ -0,0 +1,199 @@
+<!-- 奖品领取 -->
+<template>
+  <s-layout title="奖品领取">
+    <view class="ss-flex" style="justify-content: flex-end;">
+      <button class="refresh-btn ss-reset-button" type="warn" plain="true" @tap.stop="getAddressList">
+        <uni-icons type="reload" color="#ff3404" size="30"></uni-icons>
+        刷 新
+      </button>
+    </view>
+    <view v-if="state.addressList.length">
+      <view class="address-item ss-flex ss-row-between ss-col-center border-bottom"
+        v-for="(item, index) in state.addressList"
+        :key="item.id"
+        @tap.stop="state.selectedIndex = index"
+      >
+        <view class="item-left">
+          <view class="area-text ss-flex ss-col-center">{{ item.areaName }}</view>
+          <view class="address-text">{{ item.detailAddress }}</view>
+          <view class="person-text"> {{ item.name }} {{ item.mobile }} </view>
+        </view>
+        <view>
+          <uni-icons 
+            :type="index === state.selectedIndex ? 'checkbox-filled' : 'circle'" 
+            :color="index === state.selectedIndex ? '#ff3404' : '#000000'" 
+            size="28"
+          ></uni-icons>
+        </view>
+      </view>
+    </view>
+
+    <su-fixed bottom :opacity="false" bg="" placeholder :noFixed="false" :index="10">
+      <view class="footer-box ss-flex-col ss-row-between">
+        <view class="ss-m-b-20 ss-flex">
+          <button
+            class="save-btn ss-reset-button ui-Shadow-Main"
+            @tap="sheep.$router.go('/pages/user/address/edit')"
+            >
+            新增收货地址
+          </button>
+          <button class="ss-reset-button save-btn ui-Shadow-Main" @tap.stop="onSave">领取</button>
+        </view>
+      </view>
+    </su-fixed>
+  </s-layout>
+</template>
+
+<script setup>
+  import { ref, reactive } from 'vue';
+  import sheep from '@/sheep';
+  import { onLoad, onShow } from '@dcloudio/uni-app';
+  import _ from 'lodash-es';
+  import AddressApi from '@/sheep/api/member/address';
+  import PrizeApi from '@/sheep/api/prizeDraw'
+
+  const state = reactive({
+    selectedIndex: 0,
+		addressList: [],
+  });
+
+	// 获取收货地址
+	const getAddressList = async () => {
+		const list = (await AddressApi.getAddressList()).data;
+    state.addressList = list.map(e => {
+      return { text: e.areaName, value: e.id, ...e }
+    })
+	}
+
+  // 保存收货地址
+  const onSave = async () => {
+    if (!state.addressList || !state.addressList.length) {
+      uni.showToast({
+        title: '请新增收货地址',
+        icon: 'none',
+        duration: 2000
+      })
+      return
+    }
+    const address = state.addressList[state.selectedIndex]
+    if (!address || !Object.keys(address).length) {
+      uni.showToast({
+        title: '请选择收货地址',
+        icon: 'none',
+        duration: 2000
+      })
+      return
+    }
+    
+    const { code } = await PrizeApi.luckyLotteryRecordReceive({ id: receiveId.value, receiveInfo: JSON.stringify(address) })
+    if (code === 0) {
+      sheep.$router.back();
+    }
+  }
+
+	const receiveId = ref()
+  onLoad(async (options) => {
+		receiveId.value = options.id
+  })
+
+  onShow(async () => {
+    // 获取收货地址列表
+		await getAddressList()
+  })
+</script>
+
+<style lang="scss">
+  .address-item {
+    padding: 24rpx 30rpx;
+
+    .item-left {
+      width: 600rpx;
+    }
+
+    .area-text {
+      font-size: 26rpx;
+      font-weight: 400;
+      color: $dark-9;
+    }
+
+    .address-text {
+      font-size: 32rpx;
+      font-weight: 500;
+      color: #333333;
+      line-height: 48rpx;
+    }
+
+    .person-text {
+      font-size: 28rpx;
+      font-weight: 400;
+      color: $dark-9;
+    }
+  }
+  :deep() {
+    .uni-forms-item__label .label-text {
+      font-size: 28rpx !important;
+      color: #333333 !important;
+      line-height: normal !important;
+    }
+
+    .uni-easyinput__content-input {
+      font-size: 28rpx !important;
+      color: #333333 !important;
+      line-height: normal !important;
+      padding-left: 0 !important;
+    }
+
+    .uni-easyinput__content-textarea {
+      font-size: 28rpx !important;
+      color: #333333 !important;
+      line-height: normal !important;
+      margin-top: 8rpx !important;
+    }
+
+    .uni-icons {
+      font-size: 40rpx !important;
+    }
+
+    .is-textarea-icon {
+      margin-top: 22rpx;
+    }
+
+    .is-disabled {
+      color: #333333;
+    }
+
+    .uni-data-checklist .checklist-group {
+      display: block !important;
+    }
+  }
+
+  .default-box {
+    width: 100%;
+    box-sizing: border-box;
+    height: 100rpx;
+
+    .default-box-title {
+      font-size: 28rpx;
+      color: #333333;
+      line-height: normal;
+    }
+  }
+
+  .refresh-btn {
+    width: 200rpx;
+    height: 80rpx;
+    border-radius: 40rpx;
+  }
+
+  .footer-box {
+	  width: 100vw;
+    .save-btn {
+		  width: 100%;
+      height: 80rpx;
+      border-radius: 40rpx;
+      background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
+      color: $white;
+	    margin: 0 20rpx;
+    }
+  }
+</style>

+ 27 - 0
sheep/api/prizeDraw/index.js

@@ -28,6 +28,32 @@ const PrizeApi = {
     });
   },
 
+  // 抽奖记录分页
+  getLuckLotteryRecordPage: (params) => {
+    return request({
+      url: '/promotion/luck-lottery-record/page',
+      method: 'GET',
+      params
+    })
+  },
+
+  // 奖品领取
+  luckyLotteryRecordReceive: (data) => {
+    return request({
+      url: '/promotion/luck-lottery-record/receive',
+      method: 'POST',
+      data
+    })
+  },
+
+  // 放弃领取
+  luckyLotteryRecordGiveUp: (id) => {
+    return request({
+      url: '/promotion/luck-lottery-record/give-up?id=' + id,
+      method: 'POST'
+    })
+  },
+
   // 根据商品id活动对应的奖品区域信息
   getPrizeAreaByGoodsId: (params) => {
     return request({
@@ -66,4 +92,5 @@ const PrizeApi = {
   
 };
 
+
 export default PrizeApi;

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

@@ -163,6 +163,32 @@ const OrderApi = {
       data,
     });
   },
+  
+  // 根据订单id组获取中奖记录
+  getLuckLotteryRecordByOrderIds: (orderIds) => {
+    return request({
+  		url: '/promotion/luck-lottery-record/get/by-order-ids',
+		method: 'GET',
+  		params: { orderIds },
+		custom: {
+		  showLoading: false,
+		  auth: true,
+		},
+  	})
+  },
+  
+  // 根据订单id获取中奖记录
+  getLuckLotteryRecordByOrderId: (orderId) => {
+    return request({
+  		url: '/promotion/luck-lottery-record/get/by-order-id',
+  		method: 'GET',
+  		params: { orderId },
+  		custom: {
+  		  showLoading: false,
+  		  auth: true,
+  		},
+  	})
+  }
 };
 
 export default OrderApi;

+ 1 - 0
sheep/components/s-auth-modal/components/account-login.vue

@@ -70,6 +70,7 @@
     model: {
       phone: '13229740092', // 账号
       password: 'Citu123456', // 密码
+      autoRegister: true, // 是否自动注册
     },
     rules: {
       phone: mobile,

+ 22 - 14
sheep/components/s-goods-item/s-goods-item.vue

@@ -21,24 +21,19 @@
         </view>
         <view class="ss-flex">
           <view class="ss-flex ss-col-center">
-            <view
-              class="price-text ss-flex ss-col-center"
-              :style="[{ color: priceColor }]"
-              v-if="price && Number(price) > 0"
-            >
-              ¥{{ fen2yuan(price) }}
-            </view>
+            <view class="price-text ss-flex ss-col-center" :style="[{ color: priceColor }]" v-if="price && Number(price) > 0">¥{{ fen2yuan(price) }}</view>
             <view v-if="point && Number(price) > 0">+</view>
             <view class="price-text ss-flex ss-col-center" v-if="point">
-              <image
-                :src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
-                class="point-img"
-              ></image>
+              <image :src="sheep.$url.static('/static/img/shop/goods/score1.svg')" class="point-img"></image>
               <view>{{ point }}</view>
             </view>
             <view v-if="num" class="total-text ss-flex ss-col-center">x {{ num }}</view>
             <slot name="priceSuffix"></slot>
           </view>
+        </view>
+		    <view v-if="lottery && lottery?.length" @tap.stop="handleToMyPrize">
+          <span style="color: #2aae67; text-decoration: underline;">奖品:{{ lottery.map(e => e.prize.name).join('、') }}</span>
+          <span style="color: #999;">(10天内未领取的,则视为主动放弃当前奖品)</span>
         </view>
         <view class="tool-box">
           <slot name="tool"></slot>
@@ -108,7 +103,12 @@
       type: [String],
       default: '',
     },
+    lottery: {
+      type: Array,
+      default: () => []
+    }
   });
+
   const skuString = computed(() => {
     if (!props.skuText) {
       return '';
@@ -118,6 +118,11 @@
     }
     return props.skuText;
   });
+
+  // 我的奖品
+  const handleToMyPrize = () =>{
+    sheep.$router.go('/pages/user/prize/index');
+  }
 </script>
 
 <style lang="scss" scoped>
@@ -148,9 +153,12 @@
       position: relative;
 
       .tool-box {
-        position: absolute;
-        right: 0rpx;
-        bottom: -10rpx;
+        // position: absolute;
+        // right: 0rpx;
+        // bottom: -10rpx;
+        display: flex;
+        justify-content: flex-end;
+        margin-top: 10px;
       }
     }
 

+ 51 - 0
sheep/util/preview.js

@@ -0,0 +1,51 @@
+// 允许打开的文件类型
+const typeList = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'pdf']
+
+// 文件预览
+export function preview (url) {
+  uni.showLoading({
+    title: '文件加载中...'
+  })
+  wx.downloadFile({
+    url,
+    success: function (res) {
+      const filePath = res.tempFilePath
+      const arr = res.tempFilePath.split('.')
+      const fileType = arr[1]
+      if (!typeList.includes(fileType)) {
+        uni.showToast({
+          icon: "none",
+          title: '暂未支持此类型的文件查看',
+          duration: 2000,
+        })
+        return
+      } 
+      wx.openDocument({
+        filePath: filePath,
+        fileType,
+        showMenu: true, //显示右上角菜单
+        success: function (res) {
+          console.log(res, "openDocument")
+          console.log("打开文档成功")
+        },
+        fail: res => {
+          uni.showToast({
+            icon: 'none',
+            title: res.errMsg,
+            duration: 5000
+          })
+        }
+      })
+    },
+    fail: (res) => {
+      uni.showToast({
+        icon: 'none',
+        title: res.errMsg,
+        duration: 5000
+      })
+    },
+    complete: res => {
+      uni.hideLoading()
+    }
+  })
+}