Browse Source

Merge branch 'dev' of https://git.citupro.com/zhengnaiwen_citu/menduner into dev

lifanagju_citu 4 tháng trước cách đây
mục cha
commit
b365847667

+ 9 - 2
src/views/mall/components/details/s-select-sku.vue

@@ -16,7 +16,7 @@
           size="small"
           label
           density="comfortable"
-          color="primary"
+          color="grey"
           variant="outlined"
           :disabled="value.disabled === true"
           @click="onSelectSku(property.id, value.id)"
@@ -72,6 +72,7 @@ const props = defineProps({
   });
 
   const propertyList = convertProductPropertyList(props.goodsInfo.skus);
+
   // SKU 列表
   const skuList = computed(() => {
     let skuPrices = props.goodsInfo.skus;
@@ -263,7 +264,13 @@ const props = defineProps({
   }
 
   changeDisabled(false);
-  // TODO 芋艿:待讨论的优化点:1)单规格,要不要默认选中;2)默认要不要选中第一个规格
+
+  // 默认选中第一个规格
+  if (propertyList && propertyList.length) {
+    propertyList.forEach((e) => {
+      if (e.values && e.values.length) onSelectSku(e.id, e.values[0].id)
+    })
+  }
 </script>
 
 <style lang="scss" scoped>

+ 10 - 19
src/views/mall/components/prizeDraw.vue

@@ -1,19 +1,19 @@
 <template>
   <div class="prizeDrawBox">
-    <city @inputChange="null"></city>
-    <gridPage v-if="props.type === '1'" :disabled="!Number(luckyDrawsNum)" :lotteryId="props.lotteryId" @end="endCallback"></gridPage>
-    <slotMachinePage v-if="props.type === '2'" :disabled="!Number(luckyDrawsNum)" :lotteryId="props.lotteryId" @end="endCallback"></slotMachinePage>
-    <div class="numberBox mt-5">您还剩余<span class="colorBase">{{ luckyDrawsNum }}</span>次抽奖机会</div>
+    <!-- <city @inputChange="null"></city> -->
+    <div class="numberBox mb-5">恭喜您获得<span class="colorBase">1</span>次抽奖机会</div>
+    <gridPage v-if="props.type === '1'" :lotteryId="props.lotteryId" @end="endCallback"></gridPage>
+    <slotMachinePage v-if="props.type === '2'" :lotteryId="props.lotteryId" height="120" @end="endCallback"></slotMachinePage>
 
     <CtDialog :visible="showDialog" titleClass="text-h6" :footer="false" :widthType="3" title="抽奖详情" @close="showDialog = false">
       <div class="d-flex align-center flex-column">
         <svg-icon name="submit" size="300"></svg-icon>
-        <!-- {{ prizeData?.prompt }}
-        <div class="mt-5 font-weight-bold color-primary text-decoration-underline cursor-pointer" @click="emit('success')">点击前往“我的-我的奖品”中领取</div> -->
-        <!-- <div class="my-10">
+        {{ prizeData?.prompt }}
+        <!-- <div class="mt-5 font-weight-bold color-primary text-decoration-underline cursor-pointer" @click="emit('success')">点击前往“我的-我的奖品”中领取</div> -->
+        <div class="my-10">
           <v-btn color="primary" variant="outlined" width="120" @click="showDialog = false">取 消</v-btn>
           <v-btn color="primary" width="120" class="ml-5" @click.stop="handleReceive">前往领取</v-btn>
-        </div> -->
+        </div>
       </div>
     </CtDialog>
   </div>
@@ -21,11 +21,10 @@
 
 <script setup>
 defineOptions({ name: 'prizeDraw'})
-import city from './prizeDraw/city.vue'
+// import city from './prizeDraw/city.vue'
 import gridPage from './prizeDraw/grid.vue'
 import slotMachinePage from './prizeDraw/slotMachine.vue'
 import { ref } from 'vue'
-import { getNumByLotteryId } from '@/api/mall/prize'
 
 const emit = defineEmits(['success'])
 const props = defineProps({
@@ -36,13 +35,6 @@ const props = defineProps({
   }
 })
 
-// 获取抽奖次数
-const luckyDrawsNum = ref(0)
-const getLuckyNum = async () => {
-  luckyDrawsNum.value = await getNumByLotteryId(props.lotteryId)
-}
-getLuckyNum()
-
 // 抽中奖品信息
 const showDialog = ref(false)
 const prizeData = ref({})
@@ -50,7 +42,6 @@ const endCallback  = (value) => {
   console.log(value.prize, '抽中的奖品')
   prizeData.value = value.prize
   showDialog.value = true
-  getLuckyNum()
 }
 
 // const handleReceive = () => {
@@ -60,7 +51,7 @@ const endCallback  = (value) => {
 
 <style scoped lang="scss">
 .prizeDrawBox {
-  padding: 40px;
+  padding: 20px 40px;
   background-color: var(--default-bgc);
   display: flex;
   flex-direction: column;

+ 1 - 3
src/views/mall/components/prizeDraw/grid.vue

@@ -9,7 +9,6 @@
       :blocks="blocks"
       :buttons="buttons"
       :default-config="defaultConfig"
-      :disabled="true"
       class="prizeDraw"
       @start="startCallback"
       @end="endCallback"
@@ -23,7 +22,7 @@ import { getPrizeByLotteryId } from '@/api/mall/prize'
 import Snackbar from '@/plugins/snackbar'
 import { ref } from 'vue'
 const emit = defineEmits(['start', 'end'])
-const props = defineProps({ lotteryId: [Number, String], disabled: [Number, Boolean] })
+const props = defineProps({ lotteryId: [Number, String] })
 
 const myLucky = ref()
 // 背景样式
@@ -75,7 +74,6 @@ const getPrizeData = async (lotteryId) => {
 if (props.lotteryId) getPrizeData()
 
 const startCallback = () => {
-  if (props.disabled) return Snackbar.warning('抽奖次数已用完!')
   emit('start')
   // 调用抽奖组件的play方法开始游戏
   myLucky.value.play()

+ 6 - 8
src/views/mall/components/prizeDraw/slotMachine.vue

@@ -4,14 +4,13 @@
     <SlotMachine
       ref="myLucky"
       width="300px"
-      height="300px"
+      :height="height + 'px'"
       :prizes="prizes"
       :blocks="blocks"
       :slots="slots"
       accelerationTime="1000"
       decelerationTime="10000"
       :default-config="defaultConfig"
-      :disabled="true"
       class="prizeDraw"
       @start="startCallback"
       @end="endCallback"
@@ -31,7 +30,7 @@ import { getPrizeByLotteryId } from '@/api/mall/prize'
 import Snackbar from '@/plugins/snackbar'
 import { ref } from 'vue'
 const emit = defineEmits(['start', 'end'])
-const props = defineProps({ lotteryId: [Number, String], disabled: [Number, Boolean] })
+const props = defineProps({ lotteryId: [Number, String], height: [Number, String] })
 
 const myLucky = ref()
 // 背景样式
@@ -40,10 +39,10 @@ const blocks = [
 ]
 // 转速与方向
 const slots = [
-    { speed: 15, direction: -1 },
-    { speed: 15, direction: 1 },
-    { speed: 15, direction: -1 },
-  ]
+  { speed: 15, direction: -1 },
+  { speed: 15, direction: 1 },
+  { speed: 15, direction: -1 },
+]
 const prizes = ref([])
 const defaultConfig = {
   rowSpacing: '10px',
@@ -73,7 +72,6 @@ const getPrizeData = async (lotteryId) => {
 if (props.lotteryId) getPrizeData()
 
 const startCallback = () => {
-  if (props.disabled) return Snackbar.warning('抽奖次数已用完!')
   emit('start')
   // 调用抽奖组件的play方法开始游戏
   myLucky.value.play()

+ 1 - 1
src/views/mall/home/components/hotGoods.vue

@@ -2,7 +2,7 @@
   <div>
     <div class="d-flex justify-space-between color-666">
       <div class="color-primary" style="font-size: 25px;">热门商品</div>
-      <div class="cursor-pointer" @click="router.push('/mall/goodsList')">查看更多</div>
+      <!-- <div class="cursor-pointer" @click="router.push('/mall/goodsList')">查看更多</div> -->
     </div>
     <div v-if="goodList.length" class="goods-box mt-5">
       <v-card v-for="val in goodList" :key="val.id" class="goods-box-item" hover elevation="2" @click="handleClickGood(val)">

+ 2 - 2
src/views/mall/payOver/components/show.vue

@@ -2,8 +2,8 @@
 <template>
   <div class="d-flex flex-column align-center">
     <div style="color: #37ad1e; font-size: 60px;" class="mdi mdi-check-circle mt-5"></div>
-    <div style="font-weight: 600; color: #777;">支付成功</div>
-    <div style="font-weight: 500; color: #777;" class="mt-3">¥{{ price || 0.00 }}</div>
+    <div style="font-weight: 600; color: #777;">支付成功 ¥{{ price || 0.00 }}</div>
+    <!-- <div style="font-weight: 500; color: #777;" class="mt-3"></div> -->
     <div class="mt-3">
       <v-btn class="mx-3" color="primary" variant="outlined" @click="router.push('/mall')">商城首页</v-btn>
       <v-btn class="mx-3" color="primary" variant="outlined" to="/mall/user/order">查看订单</v-btn>

+ 1 - 1
src/views/mall/payOver/index.vue

@@ -1,7 +1,7 @@
 <!--  -->
 <template>
   <Navbar class="mb-3" />
-  <v-card class="default-width my-3">
+  <v-card class="default-width my-3" style="height: calc(100vh - 356px)">
     <showText :class="showPrizeDraw ? '' : 'mb-15'"></showText>
 
     <!-- 抽奖 -->

+ 29 - 29
src/views/mall/user/order/index.vue

@@ -21,8 +21,8 @@
           <div>共{{ val.productCount }}件商品,合计:¥{{ fen2yuan(val.payPrice) }}</div>
           <v-btn v-if="val.buttons.length === 0" class="mt-2" variant="tonal" rounded="xl" @click.stop="handleDetail(val)">查看详情</v-btn>
           <v-btn v-if="val.buttons.includes('confirm')" class="mt-2" variant="tonal" color="success" rounded="xl" @click.stop="handleConfirm(val)">确认收货</v-btn>
-          <v-btn v-if="val.buttons.includes('comment')" class="mt-2" variant="tonal" rounded="xl" @click.stop="handleComment(val)">评价</v-btn>
-          <v-btn v-if="val.buttons.includes('express')" class="mt-2" variant="tonal" rounded="xl">查看物流</v-btn>
+          <!-- <v-btn v-if="val.buttons.includes('comment')" class="mt-2" variant="tonal" rounded="xl" @click.stop="handleComment(val)">评价</v-btn> -->
+          <!-- <v-btn v-if="val.buttons.includes('express')" class="mt-2" variant="tonal" rounded="xl">查看物流</v-btn> -->
           <v-btn v-if="val.buttons.includes('cancel')" class="mt-2" variant="tonal" rounded="xl" @click.stop="handleCancel(val)">取消订单</v-btn>
           <v-btn v-if="val.buttons.includes('delete')" class="mt-2" variant="tonal" color="error" rounded="xl" @click.stop="handleDelete(val)">删除订单</v-btn>
           <v-btn v-if="val.buttons.includes('pay')" class="mt-2 ml-3" variant="tonal" rounded="xl" @click.stop="handlePay(val)">继续支付</v-btn>
@@ -123,33 +123,33 @@ const handleCancel = async ({ id }) => {
 }
 
 // 商品评论
-const showDialog = ref(false)
-const commentOrderId = ref(null) // 订单id
-const commentFormRef = ref()
-const handleComment = (val) => {
-  commentOrderId.value = val.id
-  showDialog.value = true
-}
-const handleClose = () => {
-  commentOrderId.value = null
-  showDialog.value = false
-}
-const handleSubmit = async () => {
-  const commentList = commentFormRef.value.commentList
-  for (const comment of commentList) {
-    await createOrderItemComment(comment)
-  }
-  Snackbar.success('评论成功')
-  handleClose()
-  getOrderPage()
-}
-
-// 收货成功后提示去评论
-const handlePromptComment = (id) => {
-  Confirm('确认收货成功', '是否前往评价?', { sureText: '立即评价', cancelText: '关闭' }).then(() => {
-    handleComment({ id })
-  })
-}
+// const showDialog = ref(false)
+// const commentOrderId = ref(null) // 订单id
+// const commentFormRef = ref()
+// const handleComment = (val) => {
+//   commentOrderId.value = val.id
+//   showDialog.value = true
+// }
+// const handleClose = () => {
+//   commentOrderId.value = null
+//   showDialog.value = false
+// }
+// const handleSubmit = async () => {
+//   const commentList = commentFormRef.value.commentList
+//   for (const comment of commentList) {
+//     await createOrderItemComment(comment)
+//   }
+//   Snackbar.success('评论成功')
+//   handleClose()
+//   getOrderPage()
+// }
+
+// // 收货成功后提示去评论
+// const handlePromptComment = (id) => {
+//   Confirm('确认收货成功', '是否前往评价?', { sureText: '立即评价', cancelText: '关闭' }).then(() => {
+//     handleComment({ id })
+//   })
+// }
 
 // 确认收货
 const handleConfirm = ({ id }) => {