index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. <template>
  2. <view class="orderVerifica">
  3. <capsule :showBorder="true">
  4. <template v-slot:top>
  5. <view class="shop-top">
  6. <view class="back-icon" @click="back">
  7. <tui-icon name="arrowleft" :size="36" color="#000"></tui-icon>
  8. </view>
  9. <view class="shop-name">订单核销</view>
  10. </view>
  11. </template>
  12. </capsule>
  13. <template v-if="!flag">
  14. <view class="order-number"
  15. >订单编号:{{ orderDetail.orderFormid || "" }}</view
  16. >
  17. <view class="verifica-container">
  18. <view class="verifica-info">
  19. <view class="info-state">
  20. <template v-if="orderDetail.state == 8"
  21. >订单状态:(待核销)</template
  22. >
  23. <template v-if="orderDetail.state == 9"
  24. >订单状态:(待核销已付款)</template
  25. >
  26. <template v-if="orderDetail.state == 10"
  27. >订单状态:<text style="color: #ea1717;">(已核销)</text></template
  28. >
  29. </view>
  30. <view class="info-state">商户: {{ shopInfo.shopName }} </view>
  31. <view class="info-price">
  32. <view class="all-price">
  33. 商品总价:¥<text>{{
  34. orderDetail.price ? Number(orderDetail.price).toFixed(2) : ""
  35. }}</text>
  36. </view>
  37. <view class="all-price">
  38. 实付款:¥<text>{{
  39. orderDetail.orderPrice
  40. ? Number(orderDetail.orderPrice).toFixed(2)
  41. : ""
  42. }}</text>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="verifica-product">
  47. <view class="verifica-time">
  48. <text>创建时间</text>
  49. <text>{{ orderDetail.createTime }}</text>
  50. </view>
  51. <view class="commodity-list">
  52. <view
  53. class="commodity-item"
  54. v-for="item in orderDetail.products"
  55. :key="item.productId"
  56. >
  57. <view class="item-left">
  58. <view class="left-image">
  59. <image :src="item.image" />
  60. </view>
  61. <view class="left-text">
  62. <view class="text-title">{{ item.productName }}</view>
  63. <!-- <template v-if="item2.productName == '扫码付款商品'">
  64. <view class="text-price">扫码付款商品</view>
  65. </template> -->
  66. <template>
  67. <view class="text-price">{{
  68. item.skuDetails[0].skuName
  69. }}</view>
  70. <view class="text-price">x{{ item.number }}</view>
  71. </template>
  72. </view>
  73. </view>
  74. <view class="item-right"
  75. >¥{{ item.productPrice.toFixed(2) }}</view
  76. >
  77. </view>
  78. </view>
  79. <!-- <view class="gifts">
  80. <view class="gifs-left">赠送代金券</view>
  81. <view class="gifs-right">¥1 x 1</view>
  82. </view> -->
  83. <view class="verifica-code">
  84. <text>核销码</text>
  85. <text>{{ code }}</text>
  86. </view>
  87. <view class="verifica-code">
  88. <text>支付方式</text>
  89. <text>
  90. <template v-if="orderDetail.paymentMode == 1"
  91. >微信</template
  92. >
  93. <template v-else-if="orderDetail.paymentMode == 2"
  94. >支付宝</template
  95. >
  96. <template v-else-if="orderDetail.paymentMode == 3"
  97. >花呗分期</template
  98. >
  99. <template v-else-if="orderDetail.paymentMode == 4"
  100. >通联支付</template
  101. >
  102. <template v-else-if="orderDetail.paymentMode == 5"
  103. >平台余额支付</template
  104. >
  105. <template v-else-if="orderDetail.paymentMode == 6"
  106. >商家余额支付</template
  107. >
  108. <template v-else-if="orderDetail.paymentMode == 7"
  109. >佣金支付</template
  110. >
  111. <template v-else-if="orderDetail.paymentMode == 8"
  112. >消费金支付</template
  113. >
  114. <template v-else-if="orderDetail.paymentMode == 9"
  115. >惠市宝支付</template
  116. >
  117. <template v-else
  118. >用户暂未支付该订单</template
  119. >
  120. </text>
  121. </view>
  122. <view class="verifica-code">
  123. <text>支付时间</text>
  124. <text>{{ orderDetail.paymentTime || "用户暂未支付该订单" }}</text>
  125. </view>
  126. </view>
  127. <view class="verifica-btn">
  128. <template v-if="orderDetail.state == 9">
  129. <view class="btn" @click="confirmBtn">确认核销</view>
  130. </template>
  131. <template v-else-if="orderDetail.state == 8">
  132. <view class="btn disable" @click="disableBtn">确认核销</view>
  133. </template>
  134. </view>
  135. </view>
  136. <modal
  137. :showModal="modal"
  138. :promptList="promptList"
  139. @closeModal="closeModal"
  140. @btnClick="backClick"
  141. :showBtn="showBtn"
  142. :showText="showText"
  143. ></modal>
  144. </template>
  145. <template v-else>
  146. <view class="success-container">
  147. <image class="" src="@/static/image/code/success.png" />
  148. <text>核销成功</text>
  149. <view class="success-back" @click="back">返回</view>
  150. </view>
  151. </template>
  152. </view>
  153. </template>
  154. <script>
  155. import { orderGetById, orderVerify } from "@/config/index.js";
  156. export default {
  157. created() {
  158. // 拿到本地的 店铺数据
  159. this.shopInfo = uni.getStorageSync("shopInfo");
  160. },
  161. onLoad(props) {
  162. this.orderId = props.orderId;
  163. this.code = props.code.split("~")[1];
  164. this.getOrderDetail();
  165. },
  166. data() {
  167. return {
  168. shopInfo: {},
  169. // 订单详情
  170. orderDetail: {},
  171. orderId: null,
  172. code: "",
  173. // 下面是弹框
  174. modal: false,
  175. showBtn: false,
  176. promptList: [],
  177. showText: "返回扫码",
  178. // 判断是否核销成功
  179. flag: false,
  180. };
  181. },
  182. methods: {
  183. // 获取订单详情
  184. async getOrderDetail() {
  185. try {
  186. let res = await orderGetById({ orderId: this.orderId });
  187. if (Object.keys(res.data).length <= 0) {
  188. this.modal = true;
  189. this.showBtn = true;
  190. this.showText = "返回扫码";
  191. this.promptList = [
  192. "您扫描的当前订单",
  193. "可能不是您家下的单,请于用户确认",
  194. ];
  195. }
  196. this.orderDetail = res.data;
  197. } catch (error) {}
  198. },
  199. confirmBtn() {
  200. this.showText = "确认";
  201. this.modal = true;
  202. this.showBtn = true;
  203. this.promptList = ["确认订单信息", "用户商品是否是您家下的"];
  204. },
  205. disableBtn() {
  206. this.modal = true;
  207. this.showBtn = false;
  208. this.promptList = ["您不能进行核销", "当前订单处于未支付状态"];
  209. },
  210. // 关闭弹框
  211. closeModal() {
  212. this.modal = false;
  213. },
  214. async backClick() {
  215. if (this.showText == "返回扫码") {
  216. this.back();
  217. return;
  218. }
  219. if (this.showText == "确认") {
  220. let res = await orderVerify({ orderId: this.orderId, noticeId: 0 });
  221. if(res.code == ""){
  222. this.flag = true;
  223. }
  224. }
  225. },
  226. // 返回扫码
  227. back() {
  228. uni.navigateBack({
  229. delta: 1,
  230. fail: () => {
  231. uni.redirectTo({
  232. url: "/pages_module/scanCoupons/index",
  233. });
  234. },
  235. });
  236. },
  237. },
  238. };
  239. </script>
  240. <style lang="scss" scoped>
  241. .orderVerifica {
  242. .shop-top {
  243. width: 100%;
  244. height: 100%;
  245. position: relative;
  246. z-index: 999;
  247. @include flex(center);
  248. .back-icon {
  249. position: absolute;
  250. left: 0;
  251. top: 50%;
  252. transform: translateY(-50%);
  253. }
  254. .shop-name {
  255. color: #000;
  256. }
  257. }
  258. .order-number {
  259. margin: 32rpx 0;
  260. color: #999999;
  261. font-size: 28rpx;
  262. padding-left: 32rpx;
  263. }
  264. .verifica-container {
  265. padding: 0 60rpx;
  266. .verifica-info {
  267. display: flex;
  268. flex-direction: column;
  269. gap: 12rpx;
  270. color: #3d3d3d;
  271. font-size: 28rpx;
  272. font-weight: 600;
  273. padding-bottom: 20rpx;
  274. border-bottom: 2rpx solid #d8d8d8;
  275. text {
  276. color: #ea1717;
  277. }
  278. .info-price {
  279. @include flex(space-between);
  280. }
  281. }
  282. .verifica-product {
  283. padding: 12rpx 0 20rpx;
  284. border-bottom: 2rpx solid #d8d8d8;
  285. .verifica-time {
  286. @include flex(space-between);
  287. color: #999999;
  288. font-size: 24rpx;
  289. }
  290. .commodity-list {
  291. width: 100%;
  292. display: flex;
  293. justify-content: center;
  294. gap: 12rpx;
  295. flex-direction: column;
  296. margin: 20rpx 0 36rpx;
  297. .commodity-item {
  298. display: flex;
  299. justify-content: space-between;
  300. .item-left {
  301. display: flex;
  302. gap: 12rpx;
  303. .left-image {
  304. width: 124rpx;
  305. height: 124rpx;
  306. image {
  307. width: 100%;
  308. height: 100%;
  309. border-radius: 12rpx;
  310. }
  311. }
  312. .left-text {
  313. display: flex;
  314. flex-direction: column;
  315. gap: 6rpx;
  316. .text-title {
  317. color: #333333;
  318. font-size: 28rpx;
  319. }
  320. .text-price {
  321. font-size: 24rpx;
  322. color: #999999;
  323. }
  324. }
  325. }
  326. .item-right {
  327. color: #333333;
  328. font-size: 28rpx;
  329. }
  330. }
  331. }
  332. .gifts {
  333. @include flex(space-between);
  334. font-size: 28rpx;
  335. .gifs-right {
  336. color: #ea1717;
  337. }
  338. }
  339. .verifica-code {
  340. color: #3d3d3d;
  341. font-size: 28rpx;
  342. @include flex(space-between);
  343. margin-top: 32rpx;
  344. }
  345. }
  346. .verifica-btn {
  347. padding-top: 72rpx;
  348. display: flex;
  349. justify-content: flex-end;
  350. .btn {
  351. width: 246rpx;
  352. height: 88rpx;
  353. text-align: center;
  354. line-height: 88rpx;
  355. color: #ffffff;
  356. font-size: 28rpx;
  357. border-radius: 50rpx;
  358. background: linear-gradient(180deg, #fe4b1e 0%, #fb8857 100%);
  359. }
  360. .disable {
  361. background: linear-gradient(180deg, #3b3b3b 0%, #a3a3a3 100%);
  362. }
  363. }
  364. }
  365. .success-container {
  366. margin-top: 208rpx;
  367. width: 100%;
  368. @include flex(center, column);
  369. image {
  370. width: 300rpx;
  371. height: 300rpx;
  372. display: block;
  373. }
  374. text {
  375. margin-top: 25rpx;
  376. color: #666666;
  377. font-size: 28rpx;
  378. }
  379. .success-back {
  380. margin-top: 52rpx;
  381. border-radius: 100rpx;
  382. background-color: #05c160;
  383. width: 246rpx;
  384. height: 88rpx;
  385. text-align: center;
  386. line-height: 88rpx;
  387. color: #ffffff;
  388. font-size: 28rpx;
  389. }
  390. }
  391. }
  392. </style>