index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <view class="px32rpx py20rpx" v-if="data">
  3. <view class="flex items-center">
  4. <image src="@/subPack/static/map.png" class="w30rpx h30rpx mr20rpx">
  5. </image>
  6. <view class="font-semibold text-32rpx">{{ data.siteName }}</view>
  7. </view>
  8. <view
  9. class="mt20rpx bg-white px-24rpx py-28rpx rounded-32rpx"
  10. v-if="data.appOrderProInfoVerifyVOS"
  11. >
  12. <wd-checkbox-group v-model="checkedAll">
  13. <!-- 无固定场 -->
  14. <template v-if="type >= GoodsType.noFixed">
  15. <view class="flex items-center">
  16. <image
  17. :src="data.productImage"
  18. class="w200rpx h-200rpx rounded-32rpx min-w-200rpx"
  19. />
  20. <view class="ml20rpx flex-1">
  21. <view class="text-32rpx">{{ data.productName }}</view>
  22. <view class="mt26rpx flex items-center justify-between">
  23. <view class="text-#FB5B5B">
  24. ¥<text class="text-48rpx">{{ data.price }}</text>
  25. </view>
  26. <view class="text-[rgb(0,0,0,0.3)]">×{{ data.amount }}</view>
  27. </view>
  28. </view>
  29. </view>
  30. <view
  31. class="flex items-center justify-between mb20rpx mt24rpx"
  32. v-for="item in data.appOrderProInfoVerifyVOS"
  33. :key="item.appOrderProInfo.id"
  34. >
  35. <view v-if="item.appOrderProInfo.type != 6"
  36. >券号:{{ item.appOrderProInfo.ticketNo }}</view
  37. >
  38. <wd-checkbox
  39. :model-value="item.isinId"
  40. checked-color="#fdd143"
  41. v-if="item.isinStatus == 0"
  42. >
  43. </wd-checkbox>
  44. <wd-tag
  45. v-if="item.appOrderProInfo.orderStatus == 6"
  46. bg-color="rgba(0,0,0,0.1)"
  47. color="rgba(0,0,0,0.3)"
  48. >已退款</wd-tag
  49. >
  50. <wd-tag
  51. v-if="item.appOrderProInfo.orderStatus == 2"
  52. bg-color="rgba(0,0,0,0.1)"
  53. color="rgba(0,0,0,0.3)"
  54. >已使用</wd-tag
  55. >
  56. <wd-tag
  57. v-if="item.appOrderProInfo.orderStatus == 3"
  58. bg-color="rgba(0,0,0,0.1)"
  59. color="rgba(0,0,0,0.3)"
  60. >已到期</wd-tag
  61. >
  62. </view>
  63. </template>
  64. <!-- 包场 -->
  65. <template v-else>
  66. <view
  67. class="flex justify-between items-center w-full mb20rpx"
  68. v-for="item in data.appOrderProInfoVerifyVOS"
  69. :key="item.id"
  70. >
  71. <view>场次</view>
  72. <view class="flex-1">
  73. <view class="flex items-center justify-between ml20rpx">
  74. <view class="">
  75. {{ item.appOrderProInfo.productName }} ¥{{
  76. item.appOrderProInfo.price
  77. }}
  78. </view>
  79. <wd-tag
  80. v-if="item.appOrderProInfo.orderStatus == 6"
  81. bg-color="rgba(0,0,0,0.1)"
  82. color="rgba(0,0,0,0.3)"
  83. >已退款</wd-tag
  84. >
  85. <wd-tag
  86. v-if="item.appOrderProInfo.orderStatus == 2"
  87. bg-color="rgba(0,0,0,0.1)"
  88. color="rgba(0,0,0,0.3)"
  89. >已使用</wd-tag
  90. >
  91. <wd-tag
  92. v-if="item.appOrderProInfo.orderStatus == 3"
  93. bg-color="rgba(0,0,0,0.1)"
  94. color="rgba(0,0,0,0.3)"
  95. >已到期</wd-tag
  96. >
  97. <wd-checkbox
  98. :model-value="item.isinId"
  99. checked-color="#fdd143"
  100. v-if="item.isinStatus == 0"
  101. ></wd-checkbox>
  102. </view>
  103. </view>
  104. </view>
  105. </template>
  106. </wd-checkbox-group>
  107. <wd-divider color="#F0F0F0"></wd-divider>
  108. <view class="flex items-center justify-between">
  109. <view class="text-28rpx">消费张数</view>
  110. <view class="font-semibold text-#FB5B5B"
  111. >本次核销{{ checkedAll.length }}张</view
  112. >
  113. </view>
  114. <view class="mt12rpx text-#FB5B5B"> 共{{ AvailableNumber }}张可用</view>
  115. </view>
  116. <view class="mt20rpx flex items-center">
  117. <image src="@/subPack/static/i.png" class="w30rpx h30rpx mr6rpx" />
  118. <view>核销前请与顾客确认核销券数</view>
  119. </view>
  120. </view>
  121. <fixdbtn
  122. block
  123. size="large"
  124. :disabled="!checkedAll.length"
  125. v-if="data"
  126. @click="handleSubmit"
  127. >确认核销({{ checkedAll.length }})</fixdbtn
  128. >
  129. </template>
  130. <script setup lang="ts">
  131. import { GoodsType } from "@/config";
  132. import { createGlobalLoadingMiddleware } from "@/api/core/middleware";
  133. import router from "@/router";
  134. const { isShowLoging } = storeToRefs(useUserStore());
  135. const checkedAll = ref([]);
  136. const { data, send: getOrder } = useRequest(
  137. (id: string) =>
  138. Apis.app.scanCodeQueryOrder({
  139. params: {
  140. orderId: id,
  141. },
  142. }),
  143. {
  144. immediate: false,
  145. },
  146. ).onError((err) => {
  147. console.log(err, "asdasdsad");
  148. router.replace({ name: "error" });
  149. });
  150. const { send: submit } = useRequest(
  151. (orderProInfoIds: string[]) =>
  152. Apis.app.scanCodeVerification({
  153. data: orderProInfoIds,
  154. }),
  155. {
  156. immediate: false,
  157. middleware: createGlobalLoadingMiddleware({ loadingText: "核销中..." }),
  158. },
  159. );
  160. const AvailableNumber = computed(
  161. //消费张数,几张可用
  162. () =>
  163. data.value.appOrderProInfoVerifyVOS?.filter((it) => it.isinStatus == 0)
  164. .length,
  165. );
  166. onLoad(async (query: any) => {
  167. getOrder(query.id);
  168. });
  169. const type = computed(() => {
  170. //如果是-1则找不到
  171. // 商品类型(1-学校 2-包场 3-无固定场 4-个人赛 5-团队赛 6-课程 7-保险)
  172. if (data.value.appOrderProInfoVerifyVOS) {
  173. return data.value.appOrderProInfoVerifyVOS[0].appOrderProInfo?.type || -1;
  174. }
  175. return -1;
  176. });
  177. async function handleSubmit() {
  178. console.log(checkedAll.value, "核销");
  179. try {
  180. await submit(checkedAll.value);
  181. uni.navigateBack({
  182. success: () => {
  183. isShowLoging.value = true;
  184. },
  185. });
  186. } catch (error) {
  187. console.log(error);
  188. router.push({ name: "error" });
  189. }
  190. }
  191. </script>
  192. <style scoped>
  193. :deep(.wd-checkbox) {
  194. margin-bottom: 0px !important;
  195. }
  196. </style>
  197. <route lang="json">
  198. {
  199. "name": "writeOff",
  200. "style": {
  201. "navigationBarTitleText": "扫码核销"
  202. }
  203. }
  204. </route>