index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  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="backClick">
  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. uni.navigateBack();
  217. return;
  218. }
  219. if (this.showText == "确认") {
  220. let res = await orderVerify({ orderId: this.orderId, noticeId: 0 });
  221. this.flag = true
  222. }
  223. },
  224. back(){
  225. uni.navigateBack();
  226. }
  227. },
  228. };
  229. </script>
  230. <style lang="scss" scoped>
  231. .orderVerifica {
  232. .shop-top {
  233. width: 100%;
  234. height: 100%;
  235. position: relative;
  236. z-index: 999;
  237. @include flex(center);
  238. .back-icon {
  239. position: absolute;
  240. left: 0;
  241. top: 50%;
  242. transform: translateY(-50%);
  243. }
  244. .shop-name {
  245. color: #000;
  246. }
  247. }
  248. .order-number {
  249. margin: 32rpx 0;
  250. color: #999999;
  251. font-size: 28rpx;
  252. padding-left: 32rpx;
  253. }
  254. .verifica-container {
  255. padding: 0 60rpx;
  256. .verifica-info {
  257. display: flex;
  258. flex-direction: column;
  259. gap: 12rpx;
  260. color: #3d3d3d;
  261. font-size: 28rpx;
  262. font-weight: 600;
  263. padding-bottom: 20rpx;
  264. border-bottom: 2rpx solid #d8d8d8;
  265. text {
  266. color: #ea1717;
  267. }
  268. .info-price {
  269. @include flex(space-between);
  270. }
  271. }
  272. .verifica-product {
  273. padding: 12rpx 0 20rpx;
  274. border-bottom: 2rpx solid #d8d8d8;
  275. .verifica-time {
  276. @include flex(space-between);
  277. color: #999999;
  278. font-size: 24rpx;
  279. }
  280. .commodity-list {
  281. width: 100%;
  282. display: flex;
  283. justify-content: center;
  284. gap: 12rpx;
  285. flex-direction: column;
  286. margin: 20rpx 0 36rpx;
  287. .commodity-item {
  288. display: flex;
  289. justify-content: space-between;
  290. .item-left {
  291. display: flex;
  292. gap: 12rpx;
  293. .left-image {
  294. width: 124rpx;
  295. height: 124rpx;
  296. image {
  297. width: 100%;
  298. height: 100%;
  299. border-radius: 12rpx;
  300. }
  301. }
  302. .left-text {
  303. display: flex;
  304. flex-direction: column;
  305. gap: 6rpx;
  306. .text-title {
  307. color: #333333;
  308. font-size: 28rpx;
  309. }
  310. .text-price {
  311. font-size: 24rpx;
  312. color: #999999;
  313. }
  314. }
  315. }
  316. .item-right {
  317. color: #333333;
  318. font-size: 28rpx;
  319. }
  320. }
  321. }
  322. .gifts {
  323. @include flex(space-between);
  324. font-size: 28rpx;
  325. .gifs-right {
  326. color: #ea1717;
  327. }
  328. }
  329. .verifica-code {
  330. color: #3d3d3d;
  331. font-size: 28rpx;
  332. @include flex(space-between);
  333. margin-top: 32rpx;
  334. }
  335. }
  336. .verifica-btn {
  337. padding-top: 72rpx;
  338. display: flex;
  339. justify-content: flex-end;
  340. .btn {
  341. width: 246rpx;
  342. height: 88rpx;
  343. text-align: center;
  344. line-height: 88rpx;
  345. color: #ffffff;
  346. font-size: 28rpx;
  347. border-radius: 50rpx;
  348. background: linear-gradient(180deg, #fe4b1e 0%, #fb8857 100%);
  349. }
  350. .disable {
  351. background: linear-gradient(180deg, #3b3b3b 0%, #a3a3a3 100%);
  352. }
  353. }
  354. }
  355. .success-container{
  356. margin-top: 208rpx;
  357. width: 100%;
  358. @include flex(center,column);
  359. image{
  360. width: 300rpx;
  361. height: 300rpx;
  362. display: block;
  363. }
  364. text{
  365. margin-top: 25rpx;
  366. color: #666666;
  367. font-size: 28rpx;
  368. }
  369. .success-back{
  370. margin-top: 52rpx;
  371. border-radius: 100rpx;
  372. background-color: #05C160;
  373. width: 246rpx;
  374. height: 88rpx;
  375. text-align: center;
  376. line-height: 88rpx;
  377. color: #FFFFFF;
  378. font-size: 28rpx;
  379. }
  380. }
  381. }
  382. </style>