createOrder.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. <template>
  2. <view>
  3. <view class="vheigh"></view>
  4. <!-- 金额明细 -->
  5. <view class="yt-list">
  6. <view class="yt-list-cell b-b">
  7. <text class="cell-tit clamp">积分和钱抵扣</text>
  8. <view class="cell-tip"><radio @click="jf()" color=" #5dbc7c" :checked="integral" /></view>
  9. </view>
  10. <view class="yt-list-cell b-b">
  11. <text class="cell-tit clamp">{{ '(当前积分:' + integralAll + ')' }}{{ '(当前钱:' + integralyw + ')' }}</text>
  12. </view>
  13. </view>
  14. <view class="yt-list">
  15. <view class="yt-list-cell b-b">
  16. <text class="cell-tit clamp">支付金额</text>
  17. <text class="cell-tip">¥{{ info.price }}</text>
  18. </view>
  19. <view class="yt-list-cell b-b" v-if="integral">
  20. <text class="cell-tit clamp">积分抵扣</text>
  21. <text class="cell-tip">-¥{{ info.sy_integral }}</text>
  22. </view>
  23. <view class="yt-list-cell b-b" v-if="integral">
  24. <text class="cell-tit clamp">钱抵扣</text>
  25. <text class="cell-tip">-¥{{ info.sy_barter_integral }}</text>
  26. </view>
  27. </view>
  28. <!-- 底部 -->
  29. <view class="footer">
  30. <view class="price-content">
  31. <text>实付款</text>
  32. <text class="price-tip">¥</text>
  33. <text class="price">{{ info.pay_price }}</text>
  34. </view>
  35. <text class="submit" :class="{ submitNo: !payType }" @click="payType ? submit() : ''">提交订单</text>
  36. </view>
  37. <!-- 优惠券面板 -->
  38. </view>
  39. </template>
  40. <script>
  41. import { calculation } from '@/api/order.js';
  42. import { getUserInfo } from '@/api/user.js';
  43. export default {
  44. data() {
  45. return {
  46. payType: true, //是否可支付
  47. store_id: '',
  48. info: {},
  49. integralAll: 0, //可使用的积分
  50. integralyw: 0, //可使用的易物积分
  51. integral: true //是否积分抵扣
  52. };
  53. },
  54. onLoad(opt) {
  55. this.price = opt.money;
  56. this.store_id = opt.id;
  57. this.loadData();
  58. this.getUserInfo();
  59. },
  60. methods: {
  61. loadData() {
  62. calculation({ price: this.price, store_id: this.store_id, integral: this.integral ? 1 : 0 }).then(({ data }) => {
  63. this.info = data;
  64. });
  65. },
  66. // 加载用户基础信息
  67. getUserInfo() {
  68. getUserInfo({}).then(({ data }) => {
  69. this.integralAll = data.integral;
  70. this.integralyw = data.barter_integral;
  71. });
  72. },
  73. jf() {
  74. this.integral = !this.integral;
  75. this.loadData;
  76. },
  77. submit() {
  78. let url = '/pages/store/pay?key=' + this.info.cache + '&money=' + this.info.pay_price;
  79. uni.navigateTo({
  80. url
  81. });
  82. }
  83. }
  84. };
  85. </script>
  86. <style lang="scss">
  87. page {
  88. background: #fff;
  89. padding-bottom: 100rpx;
  90. }
  91. .vheigh {
  92. height: var(--status-bar-height);
  93. background-color: #fff;
  94. }
  95. .yt-list {
  96. margin-top: 16rpx;
  97. background: #fff;
  98. }
  99. .yt-list-cell {
  100. display: flex;
  101. align-items: center;
  102. padding: 10rpx 30rpx 10rpx 40rpx;
  103. line-height: 70rpx;
  104. position: relative;
  105. &.cell-hover {
  106. background: #fafafa;
  107. }
  108. &.b-b:after {
  109. left: 30rpx;
  110. }
  111. .cell-icon {
  112. height: 32rpx;
  113. width: 32rpx;
  114. font-size: 22rpx;
  115. color: #fff;
  116. text-align: center;
  117. line-height: 32rpx;
  118. background: #f85e52;
  119. border-radius: 4rpx;
  120. margin-right: 12rpx;
  121. &.hb {
  122. background: #ffaa0e;
  123. }
  124. &.lpk {
  125. background: #3ab54a;
  126. }
  127. }
  128. .cell-more {
  129. align-self: center;
  130. font-size: 24rpx;
  131. color: $font-color-light;
  132. margin-left: 8rpx;
  133. margin-right: -10rpx;
  134. }
  135. .cell-tit {
  136. flex: 1;
  137. font-size: 26rpx;
  138. color: $font-color-light;
  139. margin-right: 10rpx;
  140. }
  141. .cell-tip {
  142. font-size: 26rpx;
  143. color: $font-color-dark;
  144. &.disabled {
  145. color: $font-color-light;
  146. }
  147. &.active {
  148. color: $base-color;
  149. }
  150. &.red {
  151. color: $base-color;
  152. }
  153. }
  154. &.desc-cell {
  155. .cell-tit {
  156. max-width: 90rpx;
  157. }
  158. }
  159. .desc {
  160. flex: 1;
  161. text-align: right;
  162. font-size: $font-base;
  163. color: $font-color-dark;
  164. }
  165. }
  166. /* 支付列表 */
  167. .pay-list {
  168. padding-left: 40rpx;
  169. margin-top: 16rpx;
  170. background: #fff;
  171. .pay-item {
  172. display: flex;
  173. align-items: center;
  174. padding-right: 20rpx;
  175. line-height: 1;
  176. height: 110rpx;
  177. position: relative;
  178. }
  179. .icon-weixinzhifu {
  180. width: 80rpx;
  181. font-size: 40rpx;
  182. color: #6bcc03;
  183. }
  184. .icon-alipay {
  185. width: 80rpx;
  186. font-size: 40rpx;
  187. color: #06b4fd;
  188. }
  189. .icon-xuanzhong2 {
  190. display: flex;
  191. align-items: center;
  192. justify-content: center;
  193. width: 60rpx;
  194. height: 60rpx;
  195. font-size: 40rpx;
  196. color: $base-color;
  197. }
  198. .tit {
  199. font-size: 32rpx;
  200. color: $font-color-dark;
  201. flex: 1;
  202. }
  203. }
  204. .footer {
  205. position: fixed;
  206. left: 0;
  207. bottom: 0;
  208. z-index: 995;
  209. display: flex;
  210. align-items: center;
  211. width: 100%;
  212. height: 90rpx;
  213. justify-content: space-between;
  214. font-size: 30rpx;
  215. background-color: #fff;
  216. z-index: 998;
  217. color: $font-color-base;
  218. box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.1);
  219. .price-content {
  220. padding-left: 30rpx;
  221. }
  222. .price-tip {
  223. color: $font-color-base;
  224. margin-left: 8rpx;
  225. }
  226. .price {
  227. font-size: 36rpx;
  228. color: $font-color-base;
  229. }
  230. .submit {
  231. display: flex;
  232. align-items: center;
  233. justify-content: center;
  234. width: 280rpx;
  235. height: 100%;
  236. color: #fff;
  237. font-size: 32rpx;
  238. background-color: $base-color;
  239. &.submitNo {
  240. background-color: $font-color-disabled;
  241. }
  242. }
  243. }
  244. /* 优惠券面板 */
  245. .mask {
  246. display: flex;
  247. align-items: flex-end;
  248. position: fixed;
  249. left: 0;
  250. top: var(--window-top);
  251. bottom: 0;
  252. width: 100%;
  253. background: rgba(0, 0, 0, 0);
  254. z-index: 9995;
  255. transition: 0.3s;
  256. .mask-content {
  257. width: 100%;
  258. max-height: 70vh;
  259. background: #f3f3f3;
  260. transform: translateY(100%);
  261. transition: 0.3s;
  262. overflow-y: scroll;
  263. }
  264. &.none {
  265. display: none;
  266. }
  267. &.show {
  268. background: rgba(0, 0, 0, 0.4);
  269. .mask-content {
  270. transform: translateY(0);
  271. }
  272. }
  273. }
  274. /* 优惠券列表 */
  275. .coupon-item {
  276. display: flex;
  277. flex-direction: column;
  278. margin: 20rpx 24rpx;
  279. background: #fff;
  280. .con {
  281. display: flex;
  282. align-items: center;
  283. position: relative;
  284. height: 120rpx;
  285. padding: 0 30rpx;
  286. &:after {
  287. position: absolute;
  288. left: 0;
  289. bottom: 0;
  290. content: '';
  291. width: 100%;
  292. height: 0;
  293. border-bottom: 1px dashed #f3f3f3;
  294. transform: scaleY(50%);
  295. }
  296. }
  297. .left {
  298. display: flex;
  299. flex-direction: column;
  300. justify-content: center;
  301. flex: 1;
  302. overflow: hidden;
  303. height: 100rpx;
  304. }
  305. .title {
  306. font-size: 32rpx;
  307. color: $font-color-dark;
  308. margin-bottom: 10rpx;
  309. }
  310. .time {
  311. font-size: 24rpx;
  312. color: $font-color-light;
  313. }
  314. .right {
  315. display: flex;
  316. flex-direction: column;
  317. justify-content: center;
  318. align-items: center;
  319. font-size: 26rpx;
  320. color: $font-color-base;
  321. height: 100rpx;
  322. }
  323. .price {
  324. font-size: 44rpx;
  325. color: $base-color;
  326. &:before {
  327. content: '¥';
  328. font-size: 34rpx;
  329. }
  330. }
  331. .tips {
  332. font-size: 24rpx;
  333. color: $font-color-light;
  334. line-height: 60rpx;
  335. padding-left: 30rpx;
  336. }
  337. .circle {
  338. position: absolute;
  339. left: -6rpx;
  340. bottom: -10rpx;
  341. z-index: 10;
  342. width: 20rpx;
  343. height: 20rpx;
  344. background: #f3f3f3;
  345. border-radius: 100px;
  346. &.r {
  347. left: auto;
  348. right: -6rpx;
  349. }
  350. }
  351. }
  352. .personal {
  353. margin-top: 15rpx;
  354. display: flex;
  355. flex-direction: column;
  356. background-color: #ffffff;
  357. .box-right {
  358. width: 100%;
  359. font-size: 30rpx;
  360. text-align: right;
  361. padding-right: 25rpx;
  362. }
  363. .info {
  364. padding: 10rpx 25rpx;
  365. display: flex;
  366. align-items: center;
  367. font-size: 30rpx;
  368. justify-content: space-between;
  369. .name {
  370. width: 120rpx;
  371. }
  372. input {
  373. margin-left: 12rpx;
  374. width: 100%;
  375. // background-color: pink;
  376. display: block;
  377. color: #999999;
  378. }
  379. }
  380. }
  381. </style>