settlement.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <view>
  3. <!--标题栏-->
  4. <bar-title bgColor='bg-white' title="确认订单">
  5. <block slot="content">确认订单</block>
  6. </bar-title>
  7. <!--收货地址-->
  8. <view class="margin-tb-sm zaiui-view-box">
  9. <view class="bg-white zaiui-card address-view" @click="toAddress">
  10. <view class="cu-list menu-avatar">
  11. <view class="cu-item">
  12. <view class="bg-grey icon-view">
  13. <text class="cuIcon-locationfill"/>
  14. </view>
  15. <view class="content" v-if="address.id">
  16. <view class="text-black">
  17. <text>{{address.name}}</text>
  18. <text class="margin-left">{{address.phone}}</text>
  19. </view>
  20. <view class="text-gray text-sm flex">
  21. <view class="text-cut">{{address.area_string}}{{address.address}}</view>
  22. </view>
  23. </view>
  24. <view class="content" v-else>
  25. <view class="text-black">
  26. <text>暂无地址</text>
  27. </view>
  28. <view class="text-gray text-sm flex">
  29. <view class="text-cut">请点击选择</view>
  30. </view>
  31. </view>
  32. <view class="action">
  33. <text class="text-gray cuIcon-right"/>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="address-line"/>
  38. </view>
  39. </view>
  40. <!--商品信息-->
  41. <view class="margin-tb-sm zaiui-view-box">
  42. <view class="bg-white zaiui-card goods-view">
  43. <!-- <view class="margin-bottom-sm title-view">
  44. <view class="cu-avatar sm round" style="background-image:url(/static/images/avatar/1.jpg)"/>
  45. <view class="title-box">
  46. <text class="text-black margin-right-xs">仔仔自营</text>
  47. <text class="bg-red cu-tag sm radius">自营</text>
  48. </view>
  49. </view> -->
  50. <view class="goods-info-view-box" v-for="goods in goodsList" :key="goods.id">
  51. <view class="cu-avatar radius lg" :style="[{backgroundImage:'url('+ goods.pic +')'}]"/>
  52. <view class="goods-info-view">
  53. <view class="text-cut text-black">{{goods.name}}</view>
  54. <view class="text-sm text-gray">{{goods.sku_name}}</view>
  55. <!-- <view class="zaiui-tag-view">
  56. <text class="cu-tag line-blue sm radius">移动5G</text>
  57. <text class="cu-tag line-blue sm radius">联通5G</text>
  58. <text class="cu-tag line-blue sm radius">电信5G</text>
  59. </view> -->
  60. <view class="goods-price-view">
  61. <text class="text-price text-red text-lg">{{goods.price.value}}</text>
  62. </view>
  63. </view>
  64. </view>
  65. <!-- <view class="margin-tb text-sm text-gray">赠品</view>
  66. <view class="text-black zaiui-gift-list">
  67. <view class="text-cut title">机身清洁 + 180天质保,机身清洁 + 180天质保</view>
  68. <text class="text-right">¥ 0</text>
  69. </view>
  70. <view class="text-black zaiui-gift-list">
  71. <view class="text-cut title">品胜充电器 + 数据线</view>
  72. <text class="text-right">¥ 0</text>
  73. </view> -->
  74. <!-- <view class="margin-top-lg checked-view">
  75. <checkbox class='round red sm zaiui-checked checked'/>
  76. <view class="text-black-view">
  77. <text class="text-black">平台服务保障(推荐选购)</text>
  78. <text class="text-gray cuIcon-question"/>
  79. </view>
  80. </view> -->
  81. <!-- <view class="margin-top-sm flex zaiui-service-view">
  82. <view class="flex-sub bg-page padding-sm margin-xs radius">
  83. <view class="text-black text-cut">碎屏保障服务180天</view>
  84. <view class="text-gray text-sm text-cut">免费更换一次原厂品质屏</view>
  85. <view class="text-black">
  86. <text class="margin-right-xs">¥ 95.00</text>
  87. <text class="cu-tag line-red sm radius">限时5折</text>
  88. </view>
  89. <view class="zaiui-corner-mark"/>
  90. <text class="cuIcon-check check-icon"/>
  91. </view>
  92. <view class="flex-sub bg-page padding-sm margin-xs radius">
  93. <view class="text-black text-cut">意外保障服务90天</view>
  94. <view class="text-gray text-sm text-cut">意外硬件损坏免费维修</view>
  95. <view class="text-black">
  96. <text class="margin-right-xs">¥ 65.00</text>
  97. <text class="cu-tag line-red sm radius">限时5折</text>
  98. </view>
  99. <view class="zaiui-corner-mark check"/>
  100. <text class="cuIcon-check check-icon check"/>
  101. </view>
  102. </view> -->
  103. </view>
  104. </view>
  105. <!--支付方式-->
  106. <view class="margin-tb-sm zaiui-view-box">
  107. <view class="bg-white zaiui-card pay-view">
  108. <view class="text-lg text-black title-view">
  109. <text class="text-left">支付方式</text>
  110. <text class="text-right">在线支付</text>
  111. </view>
  112. <!-- <view class="tag-view-box">
  113. <text class="cu-tag line-green sm radius">微信支付</text>
  114. <text class="cu-tag line-blue sm radius">支付宝支付</text>
  115. <text class="cu-tag line-blue sm radius">花呗分期</text>
  116. <text class="cu-tag line-pink sm radius">乐卡分期</text>
  117. <text class="cu-tag line-pink sm radius">发条分期</text>
  118. <text class="cu-tag line-red sm radius">京东支付</text>
  119. <text class="cu-tag line-orange sm radius">组合支付</text>
  120. </view> -->
  121. <view class="cu-list menu">
  122. <view class="cu-item">
  123. <view class="content">
  124. <text class="text-black">配送方式</text>
  125. </view>
  126. <view class="action">
  127. <text class="text-black">快递 ¥0.00</text>
  128. </view>
  129. </view>
  130. <!-- <view class="cu-item arrow">
  131. <view class="content">
  132. <text class="text-black">促销优惠</text>
  133. </view>
  134. <view class="action">
  135. <text class="cu-tag bg-red sm radius">秒杀</text>
  136. <text class="text-gray">已优惠180</text>
  137. </view>
  138. </view>
  139. <view class="cu-item arrow">
  140. <view class="content">
  141. <text class="text-black">红包</text>
  142. </view>
  143. <view class="action">
  144. <text class="text-gray">暂无可用红包</text>
  145. </view>
  146. </view> -->
  147. </view>
  148. </view>
  149. </view>
  150. <!--商品价格计算-->
  151. <view class="margin-tb-sm zaiui-view-box">
  152. <view class="bg-white zaiui-card zaiui-price-view">
  153. <view class="text-black item-view">
  154. <view class="text-cut title">商品总额</view>
  155. <text class="text-red text-price text-right">{{orderInfo.value}}</text>
  156. </view>
  157. <!-- <view class="text-black item-view">
  158. <view class="text-cut title">
  159. <text class="margin-right-xs">运费</text>
  160. <text class="cuIcon-question icon"/>
  161. </view>
  162. <text class="text-right">+ ¥0.00</text>
  163. </view>
  164. <view class="text-black item-view">
  165. <view class="text-cut title">促销优惠</view>
  166. <text class="text-right">- ¥180.00</text>
  167. </view> -->
  168. </view>
  169. </view>
  170. <!--服务协议-->
  171. <!-- <view class="margin-tb agreement-checked-view">
  172. <checkbox class='round red sm zaiui-checked checked'/>
  173. <view class="text-black-view">
  174. <text class="text-black">我已阅读并同意</text>
  175. <text class="text-blue">《平台优品放心买用户服务协议》</text>
  176. </view>
  177. </view> -->
  178. <!--占位底部距离-->
  179. <view class="cu-tabbar-height"/>
  180. <!--底部操作-->
  181. <view class="bg-white zaiui-footer-fixed zaiui-foot-padding-bottom">
  182. <view class="cu-bar padding-lr">
  183. <view class="text-black text-bold price-view">
  184. <text>合计:¥{{orderInfo.value}}</text>
  185. </view>
  186. <view class="btn-view">
  187. <button class="cu-btn radius bg-red" @tap="submitPay">确认下单</button>
  188. </view>
  189. </view>
  190. </view>
  191. </view>
  192. </template>
  193. <script>
  194. import barTitle from '@/components/zaiui-common/basics/bar-title';
  195. import _tool from '@/static/zaiui/util/tools.js'; //工具函数
  196. export default {
  197. components: {
  198. barTitle,
  199. },
  200. data() {
  201. return {
  202. goodsList: [], checkAll: true, goods_img: '/static/images/home/goods/1.png',
  203. address: {},
  204. orderInfo: {}
  205. }
  206. },
  207. onLoad() {
  208. this.loadConfirm()
  209. this.getDefaultAddress()
  210. },
  211. onReady() {
  212. _tool.setBarColor(true);
  213. uni.pageScrollTo({
  214. scrollTop: 0,
  215. duration: 0
  216. });
  217. },
  218. methods: {
  219. setAddress(address) {
  220. this.address = address;
  221. },
  222. toAddress() {
  223. uni.navigateTo({
  224. url: "/pages/my/address?from=cart"
  225. });
  226. },
  227. payTap() {
  228. uni.navigateTo({
  229. url: "/pages/goods/pay"
  230. });
  231. },
  232. loadConfirm() {
  233. this.reqByuser({
  234. url: '?l=cart.confirm',
  235. data: {},
  236. success: res => {
  237. if(res.data.status == 1) {
  238. let {detail, ...rest} = res.data.data;
  239. this.goodsList = detail;
  240. this.orderInfo = rest;
  241. }else {
  242. uni.showToast({
  243. icon: 'error',
  244. title: res.data.msg
  245. })
  246. }
  247. }
  248. })
  249. },
  250. submitPay() {
  251. this.reqByuser({
  252. url: '?l=cart.pay',
  253. data: {
  254. account: 'wechat',
  255. env: 3,
  256. address_id: this.address.id
  257. },
  258. success: res => {
  259. if(res.data.status == 1) {
  260. console.log(res.data.data)
  261. location.href = res.data.data.pay.link;
  262. }else {
  263. uni.showToast({
  264. icon: 'error',
  265. title: res.data.msg
  266. })
  267. }
  268. }
  269. })
  270. },
  271. getDefaultAddress() {
  272. this.reqByuser({
  273. url: '?l=address.getDefault',
  274. data: {},
  275. success: res => {
  276. if(res.data.status == 1) {
  277. this.address = res.data.data;
  278. }else {
  279. uni.showToast({
  280. icon: 'error',
  281. title: res.data.msg
  282. })
  283. }
  284. }
  285. })
  286. }
  287. }
  288. }
  289. </script>
  290. <style lang="scss">
  291. /* #ifdef APP-PLUS */
  292. @import "../../static/colorui/main.css";
  293. @import "../../static/colorui/icon.css";
  294. @import "../../static/zaiui/style/app.scss";
  295. /* #endif */
  296. @import "../../static/zaiui/style/settlement.scss";
  297. </style>