done.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. <template>
  2. <view class="content">
  3. <template v-if="loading">
  4. <view class="skeleton">
  5. <view class="skeleton-line max animate" style="height: 200upx;"></view>
  6. <view class="skeleton-line animate"></view>
  7. <view class="skeleton-line min animate"></view>
  8. <view class="skeleton-line min animate"></view>
  9. <view class="skeleton-line max animate" style="height: 200upx;"></view>
  10. <view class="skeleton-line max animate" style="height: 200upx;"></view>
  11. </view>
  12. </template>
  13. <template v-else>
  14. <scroll-view class="goods-body" scroll-y scroll-with-animation>
  15. <view class="order-body" v-if="orderData">
  16. <view class="item-goods">
  17. <view class="item-goods-body">
  18. <view class="image">
  19. <image :src="orderData.img"></image>
  20. </view>
  21. <view class="info">
  22. <view class="title">
  23. <view class="name">{{ orderData.product.product_name }}</view>
  24. <view class="num">x{{ orderData.number }}</view>
  25. </view>
  26. <view class="tags">
  27. {{orderData.sku_name?orderData.sku_name:'默认'}}
  28. <view class="price">{{ $dialog.formatMoney(orderData.price,true) }}</view>
  29. </view>
  30. <view class="price-right">实付 <text>{{ $dialog.formatMoney(orderData.pay_money,true) }}</text></view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="order-info">
  35. <view class="title-h">完善信息</view>
  36. <view class="form-feedbak">
  37. <view class="title"><text>*</text>姓名</view>
  38. <view class="form-textarea">
  39. <input :value="addressForm.nickname" data-field="nickname" placeholder="请输入" class="u-input" />
  40. </view>
  41. </view>
  42. <view class="form-feedbak">
  43. <view class="title"><text>*</text>手机号码</view>
  44. <view class="form-textarea">
  45. <input :value="addressForm.mobile" data-field="mobile" placeholder="请输入" class="u-input" />
  46. </view>
  47. </view>
  48. <view class="form-feedbak">
  49. <view class="title"><text>*</text>所属地区</view>
  50. <view class="form-textarea" @click="showAddress">
  51. {{addressData.name}}
  52. </view>
  53. </view>
  54. <view class="form-feedbak">
  55. <view class="title"><text>*</text>详细地址</view>
  56. <view class="form-textarea">
  57. <input :value="addressForm.address" data-field="address" placeholder="请输入" class="u-textarea" />
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. <view class="line-height"></view>
  63. </scroll-view>
  64. <view class="footer">
  65. <view class="footer-op">
  66. <view class="footer-left"></view>
  67. <view class="footer-right">
  68. <view class="btn">再次购买</view>
  69. </view>
  70. </view>
  71. <view class="footer-safe"></view>
  72. </view>
  73. </template>
  74. <uni-popup ref="addressPop" type="bottom" border-radius="10px 10px 0 0" background-color="#ffffff" :mask-click="false">
  75. <view class="address-pop">
  76. <view class="address-check">
  77. <view class="check-name" @click="addTop(1,fristData.index)">{{fristData.name}}</view>
  78. <view class="check-name" @click="addTop(2,fristData.index)">{{secondData.name}}</view>
  79. <view class="check-name" @click="addTop(3,secondData.index)">{{threeData.name}}</view>
  80. </view>
  81. <view class="address-scroll">
  82. <template v-if="fristData.list.length > 0">
  83. <view :class="fristData.index==indx?'item-name active':'item-name'" v-for="(item,indx) in fristData.list" :key="indx" @click="addClick(indx,1)">
  84. {{ item.text }}
  85. <view class="icon"><image src="/static/image/gou.svg"></image></view>
  86. </view>
  87. </template>
  88. <template v-if="secondData.list.length > 0">
  89. <view :class="secondData.index==indx?'item-name active':'item-name'" v-for="(item,indx) in secondData.list" :key="indx" @click="addClick(indx,2)">
  90. {{ item.text }}
  91. <view class="icon"><image src="/static/image/gou.svg"></image></view>
  92. </view>
  93. </template>
  94. <template v-if="threeData.list.length > 0">
  95. <view :class="threeData.index==indx?'item-name active':'item-name'" v-for="(item,indx) in threeData.list" :key="indx" @click="addClick(indx,3)">
  96. {{ item.text }}
  97. <view class="icon"><image src="/static/image/gou.svg"></image></view>
  98. </view>
  99. </template>
  100. </view>
  101. <view class="address-footer">
  102. <view class="footer-btn" @click="closeOrder">取消</view>
  103. <view class="footer-btn full">确定</view>
  104. </view>
  105. </view>
  106. </uni-popup>
  107. </view>
  108. </template>
  109. <script>
  110. var app;
  111. export default {
  112. data() {
  113. return {
  114. optionData:null,
  115. orderData:null,
  116. loading:false,
  117. cityData:[],
  118. addressForm:{},
  119. addressData:{
  120. index:0,
  121. name:"请选择"
  122. },
  123. fristData:{
  124. index:null,
  125. name:"",
  126. list:[]
  127. },
  128. secondData:{
  129. index:null,
  130. name:"",
  131. list:[]
  132. },
  133. threeData:{
  134. index:null,
  135. name:"",
  136. list:[]
  137. },
  138. }
  139. },
  140. onLoad(options) {
  141. app = this;
  142. app.optionData = options;
  143. this.getOrder();
  144. },
  145. methods: {
  146. addClick(indx,type) {
  147. if (type == 1) {
  148. app.fristData.index = indx;
  149. app.fristData.list = [];
  150. app.secondData.list = app.cityData[indx].children;
  151. app.fristData.name = app.cityData[indx].text;
  152. }
  153. if (type == 2) {
  154. app.secondData.index = indx;
  155. app.secondData.name = app.secondData.list[indx].text;
  156. app.threeData.list = app.secondData.list[indx].children;
  157. app.secondData.list = [];
  158. }
  159. if (type == 3) {
  160. app.threeData.index = indx;
  161. app.threeData.name = app.threeData.list[indx].text;
  162. }
  163. },
  164. addTop(type,index){
  165. if (type == 1) {
  166. app.fristData.list = app.cityData;
  167. app.secondData.list = [];
  168. app.secondData.index = null;
  169. app.secondData.name = null;
  170. app.threeData.list = [];
  171. app.threeData.index = null;
  172. app.threeData.name = null;
  173. }
  174. if (type == 2) {
  175. app.secondData.list = app.cityData[index].children;
  176. app.threeData.list = [];
  177. app.threeData.index = null;
  178. app.threeData.name = null;
  179. }
  180. },
  181. showAddress(){
  182. this.$refs.addressPop.open();
  183. },
  184. closeOrder(){
  185. this.$refs.addressPop.close();
  186. },
  187. addressChange(data){
  188. if (data.detail) {
  189. this.addressForm.city = JSON.stringify(data.detail.value);
  190. }
  191. },
  192. async getOrder(){
  193. app.loading = true;
  194. var res = await app.$api.order.detail.get({"order":app.optionData.order});
  195. app.loading = false;
  196. if (res.code && res.code == 0) {
  197. app.$dialog.showSuccess(res.msg);
  198. uni.navigateBack()
  199. return ;
  200. }
  201. app.orderData = res.data;
  202. app.getCity()
  203. },
  204. async getCity(){
  205. var resp = await app.$api.home.city.get();
  206. if (resp.code !== 1) return ;
  207. app.cityData = resp.data;
  208. app.fristData.index = 0;
  209. app.fristData.name = resp.data[0].text;
  210. app.fristData.list = resp.data
  211. }
  212. }
  213. }
  214. </script>
  215. <style lang="scss" scoped>
  216. .address-pop{
  217. .address-check{
  218. display: flex;
  219. align-items: center;
  220. justify-content: space-around;
  221. color: $main-text-color;
  222. background-color: #f1f1f1;
  223. .check-name{
  224. flex: 1;
  225. text-align: center;
  226. padding: 30rpx 0;
  227. }
  228. }
  229. .address-scroll{
  230. height: 50vh;
  231. overflow: auto;
  232. padding: 20rpx;
  233. .item-name{
  234. padding: 20rpx;
  235. border-bottom: 2rpx solid #f1f1f1;
  236. display: flex;
  237. align-items: center;
  238. justify-content: space-between;
  239. .icon{
  240. display: none;
  241. image {
  242. width: 40rpx;
  243. height: 40rpx;
  244. }
  245. }
  246. &.active{
  247. color: $main-color;
  248. .icon{
  249. display: block;
  250. }
  251. }
  252. }
  253. }
  254. .address-footer{
  255. display: flex;
  256. align-items: center;
  257. justify-content: space-around;
  258. gap: 20rpx;
  259. padding: 20rpx;
  260. .footer-btn{
  261. background-color: #fff;
  262. border: 2rpx solid $main-text-color;
  263. border-radius: 10rpx;
  264. color: $main-text-color;
  265. height: 80rpx;
  266. line-height: 80rpx;
  267. text-align: center;
  268. flex: 1;
  269. &.full{
  270. border: 2rpx solid $main-color;
  271. background-color: $main-color;
  272. color: #fff;
  273. }
  274. }
  275. }
  276. }
  277. .content{
  278. position: fixed;
  279. z-index: 1;
  280. top: 0;
  281. left: 0;
  282. bottom: 0;
  283. right: 0;
  284. background-color: #f1f1f1;
  285. display: flex;
  286. flex-direction: column;
  287. .line-height{
  288. height: 40rpx;
  289. width: 100%;
  290. }
  291. }
  292. .form-feedbak{
  293. background-color: #fff;
  294. border-radius: 20upx;
  295. }
  296. .form-feedbak .title{
  297. line-height: 80upx;
  298. font-size: 28upx;
  299. }
  300. .form-feedbak .title text{
  301. color: #f00;
  302. margin-right: 10upx;
  303. }
  304. .form-feedbak .form-textarea{
  305. background-color: #f8f8f8;
  306. padding: 20upx;
  307. }
  308. .order-body {
  309. width: 95%;
  310. margin: 20rpx auto;
  311. .order-info{
  312. border-radius: 20rpx;
  313. background-color: #fff;padding: 20upx;margin-top: 20upx;
  314. .title-h{font-size: 32upx;color: #333;font-weight: bold;margin-bottom: 20rpx;}
  315. }
  316. .item-goods{
  317. background-color: #fff;
  318. margin-top: 20rpx;
  319. border-radius: 20rpx;
  320. padding: 20rpx;
  321. .item-goods-body{
  322. display: flex;
  323. align-items: center;
  324. gap: 20rpx;
  325. }
  326. .stock{
  327. text-align: right;
  328. }
  329. .image {
  330. height: 140rpx;
  331. overflow: hidden;display: flex;align-items: center;min-width: 140rpx;
  332. position: relative;
  333. image {
  334. width: 140rpx;
  335. border-radius: 10upx;
  336. height: 100%;
  337. }
  338. }
  339. .info{
  340. flex: 1 1 0%;
  341. overflow: hidden;
  342. .title{
  343. display: flex;
  344. align-items: center;
  345. justify-content: space-between;
  346. .name {
  347. overflow: hidden;
  348. text-overflow: ellipsis;
  349. font-size: 32rpx;
  350. display: -webkit-box;
  351. -webkit-line-clamp: 2;
  352. -webkit-box-orient: vertical;
  353. color: #333;
  354. font-weight: 900;
  355. }
  356. }
  357. .price-right{
  358. text-align: right;
  359. color: $main-color;
  360. margin-top: 20rpx;
  361. font-size: 28rpx;
  362. text {
  363. font-size: 30rpx;
  364. font-weight: 800;
  365. }
  366. }
  367. .tags {
  368. color: #94a3b8;
  369. font-size: 24rpx;
  370. margin: 10rpx 0;
  371. display: flex;
  372. align-items: center;
  373. justify-content: space-between;
  374. .price {
  375. font-size: 28rpx;
  376. color: $main-text-color;
  377. font-weight: 600;
  378. }
  379. }
  380. }
  381. }
  382. }
  383. .goods-body{
  384. height: 0;
  385. flex: 1;
  386. }
  387. .footer{
  388. background-color: #fff;
  389. padding: 20upx 20upx 0 20upx;border-top: 2upx solid #f8f8f8;
  390. .footer-safe {
  391. height: env(safe-area-inset-bottom);width: 100%;
  392. }
  393. .footer-op{
  394. display: flex;
  395. align-items: center;
  396. justify-content: space-between;
  397. .footer-right{
  398. display: flex;
  399. align-items: center;
  400. gap: 20rpx;
  401. .btn{
  402. font-size: 28rpx;
  403. height: 80upx;
  404. border-radius: 10upx;
  405. line-height: 80upx;
  406. text-align: center;
  407. min-width: 200rpx;
  408. color: #333;
  409. border: 2rpx solid #ccc;
  410. &.full{
  411. background-color: $main-color;
  412. color: #fff;
  413. border: 2rpx solid $main-color;
  414. }
  415. }
  416. }
  417. }
  418. }
  419. </style>