order-confirm.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. <template>
  2. <view class="order-confirm">
  3. <view class="box address hflex acenter jbetween" @click="show_address = true">
  4. <image src="./static/address.png" mode="aspectFill"></image>
  5. <view class="address-text" v-if="JSON.stringify(address) == '{}'">收货地址</view>
  6. <view class="address-box vflex" v-else>
  7. <text>{{address.province}}{{address.city}}{{address.area}}{{address.address}}</text>
  8. <text>{{address.name}} {{address.mobile}}</text>
  9. </view>
  10. <u-icon name="arrow-right" color="#999999" size="14"></u-icon>
  11. </view>
  12. <view class="box good">
  13. <view class="title">商品</view>
  14. <view class="hflex good-detail">
  15. <image :src="detail.image" mode="aspectFill"></image>
  16. <view class="vflex center jbetween">
  17. <view class="name text_hide2">{{detail.name}}</view>
  18. <view class="spec">{{detail.spec}}</view>
  19. </view>
  20. <view class="right vflex aend">
  21. <view class="price">{{detail.price}}积分</view>
  22. <view class="num">X{{num}}</view>
  23. </view>
  24. </view>
  25. <view class="cell hflex acenter jbetween">
  26. <view class="label">优惠券</view>
  27. <view class="hflex acenter" @click="show_youhui = true">
  28. <view class="value">{{youhui_active == -1 ? '不使用' : youhui_list[youhui_active].tiaojian}}</view>
  29. <image src="static/down.png" mode="aspectFill"></image>
  30. </view>
  31. </view>
  32. <view class="cell hflex acenter jbetween" @click="show_vip = true">
  33. <view class="label">会员等级优惠</view>
  34. <view class="hflex acenter">
  35. <view class="value">{{vip_active == -1 ? '不使用' : '使用'}}</view>
  36. <image src="static/down.png" mode="aspectFill"></image>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="box">
  41. <view class="hflex acenter jbetween cell">
  42. <view class="label">运费</view>
  43. <view class="value">包邮</view>
  44. </view>
  45. <view class="hflex acenter jbetween cell">
  46. <view class="label">订单总积分</view>
  47. <view class="value">{{detail.total}}</view>
  48. </view>
  49. <view class="hflex acenter jbetween cell">
  50. <view class="label">优惠积分</view>
  51. <view class="value">{{detail.youhui}}</view>
  52. </view>
  53. <view class="hflex acenter jbetween cell">
  54. <view class="label">实付积分</view>
  55. <view class="value">{{total}}</view>
  56. </view>
  57. <view class="hflex acenter jbetween cell">
  58. <view class="label">备注信息</view>
  59. <u-input v-model="remarks" border="none" inputAlign="right" placeholder="选填"></u-input>
  60. </view>
  61. </view>
  62. <view style="height: 166rpx; "></view>
  63. <view class="bottom hflex acenter jend">
  64. <view class="money">总计<span class="money-text">{{total}}积分</span></view>
  65. <view class="btn" @click="submit">提交订单</view>
  66. </view>
  67. <u-popup :show="show_address" @close="toclose" mode="bottom" :round="13">
  68. <addressBox :list="address_list" @close="toclose" @select="selectAddress"></addressBox>
  69. </u-popup>
  70. <u-popup :show="show_youhui" @close="toclose" mode="bottom" :round="13">
  71. <youhui :index="youhui_active" :list="youhui_list" @close="toclose" @select="selectyouhui"></youhui>
  72. </u-popup>
  73. <u-popup :show="show_vip" @close="toclose" mode="bottom" :round="13">
  74. <youhui :index="vip_active" type="vip" :list="vip_list" @close="toclose" @select="selectvip"></youhui>
  75. </u-popup>
  76. <u-popup :show="show_submit" @close="toclose" mode="center" :round="10">
  77. <view class="popu1 vflex acenter">
  78. <image src="static/success.png" mode="aspectFill"></image>
  79. <view class="success">提交成功</view>
  80. <view class="success-text">请前往添加客服微信</view>
  81. <view class="hflex acenter btns">
  82. <view class="btn1" @click="tosubmit">稍后添加</view>
  83. <view class="btn2" @click="show_wx = true">添加客服</view>
  84. </view>
  85. </view>
  86. </u-popup>
  87. <u-popup :show="show_wx" @close="tosubmit" mode="center" :round="10">
  88. <kefu-wx :wxcode="wxcode" @submit="tosubmit"></kefu-wx>
  89. </u-popup>
  90. </view>
  91. </template>
  92. <script>
  93. import addressBox from './components/addressbox.vue'
  94. import youhui from './components/youhui.vue'
  95. import kefuWx from './components/kefu-wx.vue'
  96. import $api from '@/static/js/api.js'
  97. export default {
  98. components: {
  99. addressBox,
  100. youhui,
  101. kefuWx
  102. },
  103. data() {
  104. return {
  105. address_list: [],
  106. address: {},
  107. show_address: false,
  108. detail: {},
  109. youhui_list: [],
  110. show_youhui: false,
  111. show_vip: false,
  112. youhui_active: -1,
  113. vip_list: [],
  114. vip_active: -1,
  115. remarks: '',
  116. show_submit: false,
  117. show_wx: false,
  118. wxcode: 'https://dummyimage.com/750x750/e3e3e3/fff',
  119. num: 0,
  120. total: 0,
  121. }
  122. },
  123. onLoad(options) {
  124. this.detail = JSON.parse(options.good)
  125. console.log(this.detail)
  126. this.num = options.num
  127. console.log(this.num);
  128. this.getlist()
  129. // this.getdata()
  130. },
  131. methods: {
  132. tosubmit() {
  133. this.toclose()
  134. uni.redirectTo({
  135. url: '/pageB/order-detail'
  136. })
  137. },
  138. submit() {
  139. var _this = this
  140. if(JSON.stringify(this.address) == '{}') {
  141. $api.info('请先选择收货地址')
  142. return
  143. }
  144. uni.showModal({
  145. title: '',
  146. content: '是否提交订单',
  147. success: function (res) {
  148. if (res.confirm) {
  149. _this.show_submit = true
  150. }
  151. }
  152. });
  153. },
  154. selectyouhui(e) {
  155. this.youhui_active = e
  156. this.toclose()
  157. },
  158. selectvip(e) {
  159. this.vip_active = e
  160. this.toclose()
  161. },
  162. getdata() {
  163. },
  164. selectAddress(e) {
  165. this.address = this.address_list[e]
  166. this.toclose()
  167. },
  168. toclose() {
  169. this.show_address = false
  170. this.show_vip = false
  171. this.show_youhui = false
  172. this.show_submit = false
  173. this.show_wx = false
  174. },
  175. getlist() {
  176. var _this = this
  177. $api.req({
  178. url: 'address',
  179. method: 'GET',
  180. data: {
  181. is_page: 0
  182. }
  183. }, function(res) {
  184. if(res.code == 10000) {
  185. _this.address_list = res.data
  186. }
  187. })
  188. },
  189. }
  190. }
  191. </script>
  192. <style lang="scss">
  193. .order-confirm::v-deep {
  194. background: #F4F4F4;
  195. padding: 20rpx 24rpx;
  196. box-sizing: border-box;
  197. min-height: 100vh;
  198. .popu1 {
  199. width: 510rpx;
  200. padding: 46rpx 0;
  201. .top {
  202. width: 100%;
  203. .top-title {
  204. font-size: 32rpx;
  205. font-family: PingFangSC, PingFang SC;
  206. font-weight: 600;
  207. color: #000000;
  208. text-align: center;
  209. padding-left: 100rpx;
  210. }
  211. image {
  212. width: 36rpx;
  213. height: 36rpx;
  214. }
  215. }
  216. .center {
  217. image {
  218. width: 310rpx;
  219. height: 310rpx;
  220. }
  221. text {
  222. font-size: 22rpx;
  223. font-family: PingFangSC, PingFang SC;
  224. font-weight: 400;
  225. color: rgba(0, 0, 0, .42);
  226. }
  227. }
  228. image {
  229. width: 78rpx;
  230. height: 78rpx;
  231. margin: 12rpx 36rpx;
  232. }
  233. .success {
  234. font-size: 30rpx;
  235. font-family: PingFangSC, PingFang SC;
  236. font-weight: 400;
  237. color: #000000;
  238. }
  239. .success-text {
  240. font-size: 24rpx;
  241. font-family: PingFangSC, PingFang SC;
  242. font-weight: 400;
  243. color: rgba(0, 0, 0, .6);
  244. padding: 8rpx 0 42rpx;
  245. }
  246. .btns {
  247. .btn1 {
  248. width: 204rpx;
  249. height: 72rpx;
  250. background: #E7E7E7;
  251. border-radius: 40rpx;
  252. font-size: 28rpx;
  253. font-family: PingFangSC, PingFang SC;
  254. font-weight: 400;
  255. color: #666666;
  256. line-height: 72rpx;
  257. text-align: center;
  258. }
  259. .btn2 {
  260. width: 204rpx;
  261. height: 72rpx;
  262. background: #00B0B0;
  263. border-radius: 40rpx;
  264. font-size: 28rpx;
  265. font-family: PingFangSC, PingFang SC;
  266. font-weight: 400;
  267. color: #FFFFFF;
  268. line-height: 72rpx;
  269. text-align: center;
  270. margin: 0 0 0 26rpx;
  271. }
  272. }
  273. }
  274. .bottom {
  275. position: fixed;
  276. bottom: 0;
  277. left: 0;
  278. width: 750rpx;
  279. height: 166rpx;
  280. background: #FFFFFF;
  281. box-sizing: border-box;
  282. padding: 12rpx 28rpx 68rpx;
  283. .money {
  284. font-size: 24rpx;
  285. font-family: PingFangSC, PingFang SC;
  286. font-weight: 400;
  287. color: #222222;
  288. .money-text {
  289. font-size: 40rpx;
  290. font-family: SFPro, SFPro;
  291. font-weight: 500;
  292. color: #FF4954;
  293. padding: 0 20rpx 0 12rpx;
  294. }
  295. }
  296. .btn {
  297. width: 232rpx;
  298. height: 86rpx;
  299. background: #00B0B0;
  300. border-radius: 44rpx;
  301. font-size: 32rpx;
  302. font-family: PingFangSC, PingFang SC;
  303. font-weight: 500;
  304. color: #FFFFFF;
  305. line-height: 86rpx;
  306. text-align: center;
  307. }
  308. }
  309. .box {
  310. background: #FFFFFF;
  311. border-radius: 16rpx;
  312. margin: 0 0 20rpx;
  313. padding: 28rpx 20rpx 0;
  314. .cell {
  315. padding: 0 0 36rpx;
  316. .label {
  317. font-size: 28rpx;
  318. font-family: PingFangSC, PingFang SC;
  319. font-weight: 400;
  320. color: #222222;
  321. }
  322. .value {
  323. font-size: 28rpx;
  324. font-family: PingFangSC, PingFang SC;
  325. font-weight: 400;
  326. color: #333333;
  327. }
  328. image {
  329. width: 28rpx;
  330. height: 28rpx;
  331. margin: 0 0 0 16rpx;
  332. }
  333. }
  334. }
  335. .good {
  336. padding: 24rpx 20rpx;
  337. box-sizing: border-box;
  338. .title {
  339. font-size: 32rpx;
  340. font-family: PingFangSC, PingFang SC;
  341. font-weight: 500;
  342. color: #222222;
  343. padding: 0 0 26rpx;
  344. }
  345. .good-detail {
  346. padding: 0 0 40rpx;
  347. .right {
  348. .price {
  349. font-size: 28rpx;
  350. font-family: SFPro, SFPro;
  351. font-weight: 500;
  352. color: #FF4954;
  353. }
  354. .num {
  355. font-size: 24rpx;
  356. font-family: SFPro, SFPro;
  357. font-weight: 400;
  358. color: #999999;
  359. padding: 18rpx 0 0;
  360. }
  361. }
  362. image {
  363. width: 160rpx;
  364. height: 160rpx;
  365. margin: 0 20rpx 0 0;
  366. }
  367. .center {
  368. width: 330rpx;
  369. .name {
  370. font-size: 28rpx;
  371. font-family: PingFangSC, PingFang SC;
  372. font-weight: 400;
  373. color: #222222;
  374. }
  375. .spec {
  376. max-width: max-content;
  377. background: #F3F3F3;
  378. border-radius: 6rpx;
  379. font-size: 20rpx;
  380. font-family: SFPro, SFPro;
  381. font-weight: 400;
  382. color: #222222;
  383. padding: 6rpx 18rpx;
  384. margin: 16rpx 0 0;
  385. }
  386. }
  387. }
  388. }
  389. .address {
  390. padding: 28rpx;
  391. width: 100%;
  392. box-sizing: border-box;
  393. image {
  394. width: 32rpx;
  395. height: 32rpx;
  396. margin: 0 16rpx 0 0;
  397. }
  398. .address-box {
  399. width: 550rpx;
  400. text:first-child {
  401. font-size: 30rpx;
  402. font-family: PingFangSC, PingFang SC;
  403. font-weight: 600;
  404. color: #222222;
  405. }
  406. text:last-child {
  407. font-size: 24rpx;
  408. font-family: JDZhengHT, JDZhengHT;
  409. font-weight: 300;
  410. color: #666666;
  411. padding: 10rpx 0 0 ;
  412. }
  413. }
  414. .address-text {
  415. width: 550rpx;
  416. font-size: 28rpx;
  417. font-family: PingFangSC, PingFang SC;
  418. font-weight: 500;
  419. color: #333333;
  420. }
  421. }
  422. }
  423. </style>