detail.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <view>
  3. <view class="main" v-if="info">
  4. <view class="order-box-list">
  5. <view class="order-box-header">
  6. <text class="order-box-title">{{info.orgName}}</text>
  7. <text class="order-box-desc" v-if="info.status == 1">已预约</text>
  8. <text class="order-box-desc" v-if="info.status == 2">已取消</text>
  9. </view>
  10. <view v-for="(item,index) in info.goods" :key="index" class="order-box-body">
  11. <view class="order-box-body-left">
  12. <image :src="item.goodsImg"></image>
  13. </view>
  14. <view class="order-box-body-middle">
  15. <text class="order-box-body-desc">{{item.goodsName}}</text>
  16. <text class="order-box-body-cate">x{{item.nums}}</text>
  17. </view>
  18. <view class="order-box-body-right">
  19. ¥{{(item.nums*item.price).toFixed(2)}}
  20. </view>
  21. </view>
  22. <view class="order-box-footer">
  23. 合计 ¥{{info.amount}}
  24. </view>
  25. </view>
  26. <view class="box">
  27. <view class="box-title">配送信息</view>
  28. <view class="box-body">
  29. <view class="box-list">
  30. <text class="box-list-label">姓名</text>
  31. <text class="box-list-body">{{info.name}}</text>
  32. </view>
  33. <view class="box-list">
  34. <text class="box-list-label">电话</text>
  35. <text class="box-list-body">{{info.phone}}</text>
  36. </view>
  37. <view class="box-list">
  38. <text class="box-list-label">配送时间</text>
  39. <text class="box-list-body">{{info.deliveryTime}}</text>
  40. </view>
  41. <view class="box-list">
  42. <text class="box-list-label">配送地址</text>
  43. <text class="box-list-body">{{info.address}}</text>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="box">
  48. <view class="box-title">订单信息</view>
  49. <view class="box-body">
  50. <view class="box-list">
  51. <text class="box-list-label">订单编号</text>
  52. <text class="box-list-body">{{info.orderSn}}</text>
  53. </view>
  54. <view class="box-list">
  55. <text class="box-list-label">下单日期</text>
  56. <text class="box-list-body">{{info.createTime}}</text>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="uni-list">
  61. <radio-group @change="radioChange">
  62. <label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in items" :key="item.value">
  63. <view>
  64. <radio :value="item.value" :checked="index === current" />
  65. </view>
  66. <view>{{item.name}}</view>
  67. </label>
  68. </radio-group>
  69. </view>
  70. <view v-if="info.cancel == 1" class="cancel-btn" @click="cancelOrder">
  71. 取消订单
  72. </view>
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. var app = getApp();
  78. export default {
  79. data() {
  80. return {
  81. id: 0,
  82. info: null,
  83. }
  84. },
  85. onLoad(option) {
  86. this.id = option.id?option.id:0;
  87. this.getDetail();
  88. },
  89. onShow() {
  90. var that = this;
  91. app.ajaxReadyCallback = res => { //各个接口统一回调方法
  92. var apiname = res.data.apiname;
  93. console.log(res);
  94. if(apiname == 'order'){
  95. this.info = res.data.data;
  96. } else if (apiname == 'cancel'){
  97. that.getDetail();
  98. }
  99. }
  100. },
  101. methods: {
  102. getDetail(){
  103. app.ajax({
  104. url: app.globalData.serverUrl + 'shopOrder/orderDetails',
  105. type: 'POST',
  106. apiname: 'order',
  107. data: {
  108. id: this.id
  109. }
  110. });
  111. },
  112. cancelOrder(){
  113. var that = this;
  114. uni.showModal({
  115. title: '提示',
  116. content: '确定要取消此订单吗?',
  117. success: function (res) {
  118. if (res.confirm) {
  119. app.ajax({
  120. url: app.globalData.serverUrl + 'shopOrder/cancel',
  121. type: 'POST',
  122. apiname: 'cancel',
  123. data: {
  124. id: that.id
  125. }
  126. });
  127. } else if (res.cancel) {
  128. console.log('用户点击取消');
  129. }
  130. }
  131. });
  132. },
  133. }
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. .box{
  138. width: 680rpx;
  139. height: auto;
  140. border-radius: 8rpx;
  141. margin: 15rpx auto;
  142. background-color: #FFFFFF;
  143. padding: 10rpx 20rpx;
  144. overflow: hidden;
  145. }
  146. .box-title{
  147. width: 680rpx;
  148. height: 78rpx;
  149. line-height: 78rpx;
  150. border-bottom: 1rpx solid #F6F6F6;
  151. color: #333333;
  152. font-size: 34rpx;
  153. font-weight: bold;
  154. }
  155. .box-body{
  156. overflow: hidden;
  157. }
  158. .box-list{
  159. overflow: hidden;
  160. padding: 20rpx 0;
  161. }
  162. .box-list-label{
  163. display: inline-block;
  164. width: 130rpx;
  165. height: auto;
  166. float: left;
  167. color: #949494;
  168. font-size: 30rpx;
  169. }
  170. .box-list-body{
  171. display: inline-block;
  172. width: 500rpx;
  173. height: auto;
  174. float: right;
  175. color: #333333;
  176. font-size: 30rpx;
  177. text-align: right;
  178. }
  179. .order-box-list{
  180. width: 680rpx;
  181. height: auto;
  182. border-radius: 8rpx;
  183. margin: 15rpx auto;
  184. background-color: #FFFFFF;
  185. padding: 10rpx 20rpx;
  186. overflow: hidden;
  187. }
  188. .order-box-header{
  189. width: 680rpx;
  190. height: 78rpx;
  191. line-height: 78rpx;
  192. border-bottom: 1rpx solid #F6F6F6;
  193. }
  194. .order-box-title{
  195. display: inline-block;
  196. width: 500rpx;
  197. height: 100%;
  198. font-size: 34rpx;
  199. font-weight: bold;
  200. }
  201. .order-box-desc{
  202. display: inline-block;
  203. width: 180rpx;
  204. text-align: right;
  205. height: 100%;
  206. color: #949494;
  207. font-size: 30rpx;
  208. }
  209. .order-box-body{
  210. padding: 20rpx 0 30rpx 0;
  211. overflow: hidden;
  212. }
  213. .order-box-body-left{
  214. display: inline-block;
  215. width: 88rpx;
  216. height: 88rpx;
  217. float: left;
  218. }
  219. .order-box-body-left image{
  220. width: 100%;
  221. height: 100%;
  222. border-radius: 10rpx;
  223. }
  224. .order-box-body-middle{
  225. display: inline-block;
  226. width: 380rpx;
  227. float: left;
  228. padding-left: 20rpx;
  229. }
  230. .order-box-body-right{
  231. display: inline-block;
  232. width: 180rpx;
  233. height: 88rpx;
  234. line-height: 88rpx;
  235. text-align: right;
  236. float: right;
  237. }
  238. .order-box-body-desc{
  239. display: inline-block;
  240. width: 100%;
  241. font-size: 30rpx;
  242. font-weight: bold;
  243. color: #333333;
  244. }
  245. .order-box-body-cate{
  246. display: inline-block;
  247. width: 100%;
  248. font-size: 24rpx;
  249. color: #949494;
  250. }
  251. .order-box-footer{
  252. border-top: 1rpx solid #F6F6F6;
  253. padding: 20rpx;
  254. text-align: right;
  255. }
  256. .cancel-btn{
  257. width: 700rpx;
  258. height: 70rpx;
  259. line-height: 70rpx;
  260. color: #FFFFFF;
  261. background-color: #d9534f;
  262. border-radius: 10rpx;
  263. margin: 50rpx auto 20rpx auto;
  264. text-align: center;
  265. }
  266. </style>