detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. <template>
  2. <view>
  3. <van-tabs :active="showType" color="#09afff" @change="onTabChange">
  4. <van-tab title="待支付" name="1"></van-tab>
  5. <van-tab title="已支付" name="2"></van-tab>
  6. </van-tabs>
  7. <view class="orders">
  8. <view class="order" v-for="(item, index) in detailList" :key="index">
  9. <view class="h">
  10. <view class="l">订单编号:{{ item.orderSn }}</view>
  11. <view class="r">{{ item.orderStatusText }}</view>
  12. </view>
  13. <view v-if="showType == '1'" class="create-time">创建时间:{{ item.createTime }}</view>
  14. <view class="goods">
  15. <view class="img">
  16. <image :src="item.picUrl"></image>
  17. </view>
  18. <view class="info">
  19. <text class="name">{{ item.goodsName }}</text>
  20. <text class="number" v-if="showType == '2'">共{{ item.number }}件商品</text>
  21. </view>
  22. <!-- <view class="time">{{item.addTime}}</view> -->
  23. <view class="status">
  24. <view class="time">电话:{{ item.mobile }}</view>
  25. <view class="btn" :data-mobile="item.mobile" @tap="makeCall">拨打</view>
  26. </view>
  27. </view>
  28. <view class="flexb">
  29. <view class="flex">实付:¥{{ item.actualPrice }}</view>
  30. <!-- <view class="flex">分红:¥{{item.total}}</view> -->
  31. <view class="flex" v-if="showType == '2'">分佣状态:{{ item.commissionStatus }}</view>
  32. <view class="flex edit-wrapper" v-if="showType == '1'">
  33. <text class="edit-amount" @tap="showEditDialog" :data-id="item.id" :data-price="item.actualPrice">修改支付金额</text>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="no-order" v-if="detailList.length <= 0">
  39. <view class="c">
  40. <text>还没有任何客户订单呢</text>
  41. </view>
  42. </view>
  43. <van-dialog use-slot title="修改支付金额" :show="dialogShow" show-cancel-button @close="onClose" @confirm="editAmount">
  44. <view class="price-wrapper">
  45. <input class="weui-input" type="digit" placeholder="请输入支付金额" :value="actualPrice" @input="bindKeyInput" />
  46. </view>
  47. </van-dialog>
  48. </view>
  49. </template>
  50. <script>
  51. var util = require('../../../../utils/util.js');
  52. var api = require('../../../../config/api.js');
  53. export default {
  54. data() {
  55. return {
  56. dialogShow: false,
  57. detailList: [],
  58. showType: 1,
  59. page: 1,
  60. limit: 10,
  61. totalPages: 1,
  62. orderId: '',
  63. actualPrice: ''
  64. };
  65. }
  66. /**
  67. * 生命周期函数--监听页面加载
  68. */,
  69. onLoad: function (options) {},
  70. /**
  71. * 生命周期函数--监听页面初次渲染完成
  72. */
  73. onReady: function () {},
  74. /**
  75. * 生命周期函数--监听页面显示
  76. */
  77. onShow: function () {
  78. // this.getDetailList();
  79. this.getWaitDetailList();
  80. },
  81. /**
  82. * 生命周期函数--监听页面隐藏
  83. */
  84. onHide: function () {},
  85. /**
  86. * 生命周期函数--监听页面卸载
  87. */
  88. onUnload: function () {},
  89. /**
  90. * 页面相关事件处理函数--监听用户下拉动作
  91. */
  92. onPullDownRefresh: function () {},
  93. /**
  94. * 页面上拉触底事件的处理函数
  95. */
  96. onReachBottom: function () {
  97. if (this.totalPages > this.page) {
  98. this.setData({
  99. page: this.page + 1
  100. });
  101. if (this.showType == '2') {
  102. this.getWaitDetailList();
  103. } else {
  104. this.getDetailList();
  105. }
  106. } else {
  107. uni.showToast({
  108. title: '没有更多明细了',
  109. icon: 'none',
  110. duration: 2000
  111. });
  112. return false;
  113. }
  114. },
  115. /**
  116. * 用户点击右上角分享
  117. */
  118. onShareAppMessage: function () {},
  119. methods: {
  120. bindKeyInput(e) {
  121. this.setData({
  122. actualPrice: e.detail.value
  123. });
  124. },
  125. showEditDialog(e) {
  126. let id = e.currentTarget.dataset.id;
  127. let price = e.currentTarget.dataset.price;
  128. this.setData({
  129. orderId: id,
  130. actualPrice: price,
  131. dialogShow: true
  132. });
  133. },
  134. onClose() {
  135. this.setData({
  136. dialogShow: false
  137. });
  138. },
  139. editAmount() {
  140. util.request(
  141. api.OrderEdit,
  142. {
  143. orderId: this.orderId,
  144. actualPrice: this.actualPrice
  145. },
  146. 'POST'
  147. ).then((res) => {
  148. if (res.errno === 0) {
  149. console.log(res.data);
  150. this.setData({
  151. detailList: [],
  152. page: 1,
  153. limit: 10,
  154. totalPages: 1,
  155. dialogShow: false
  156. });
  157. this.getWaitDetailList();
  158. }
  159. });
  160. },
  161. onTabChange(e) {
  162. let showType = e.detail.name;
  163. this.setData({
  164. detailList: [],
  165. page: 1,
  166. limit: 10,
  167. totalPages: 1
  168. });
  169. if (showType == '2') {
  170. this.getDetailList();
  171. } else {
  172. this.getWaitDetailList();
  173. }
  174. },
  175. getWaitDetailList() {
  176. let that = this;
  177. util.request(api.DisCommissionWaitDetail, {
  178. page: that.page,
  179. limit: that.limit
  180. }).then(function (res) {
  181. if (res.errno === 0) {
  182. console.log(res.data);
  183. that.setData({
  184. detailList: that.detailList.concat(res.data.list),
  185. totalPages: res.data.pages
  186. });
  187. }
  188. });
  189. },
  190. getDetailList() {
  191. let that = this;
  192. util.request(api.DisCommissionDetail, {
  193. page: that.page,
  194. limit: that.limit
  195. }).then(function (res) {
  196. if (res.errno === 0) {
  197. console.log(res.data);
  198. that.setData({
  199. detailList: that.detailList.concat(res.data.list),
  200. totalPages: res.data.pages
  201. });
  202. }
  203. });
  204. },
  205. makeCall(e) {
  206. uni.makePhoneCall({
  207. phoneNumber: e.currentTarget.dataset.mobile
  208. });
  209. }
  210. }
  211. };
  212. </script>
  213. <style>
  214. page {
  215. height: 100%;
  216. width: 100%;
  217. background: #f4f4f4;
  218. }
  219. .orders-switch {
  220. width: 100%;
  221. background: #fff;
  222. height: 84rpx;
  223. /* border-bottom: 1px solid rgba(0,0,0,.15); */
  224. }
  225. .orders-switch .item {
  226. display: inline-block;
  227. height: 82rpx;
  228. width: 18%;
  229. padding: 0 15rpx;
  230. text-align: center;
  231. }
  232. .orders-switch .item .txt {
  233. display: inline-block;
  234. height: 82rpx;
  235. padding: 0 20rpx;
  236. line-height: 82rpx;
  237. color: #9a9ba1;
  238. font-size: 30rpx;
  239. width: 170rpx;
  240. }
  241. .orders-switch .item.active .txt {
  242. color: #ab956d;
  243. border-bottom: 4rpx solid #ab956d;
  244. }
  245. .no-order {
  246. width: 100%;
  247. height: auto;
  248. margin: 0 auto;
  249. }
  250. .no-order .c {
  251. width: 100%;
  252. height: auto;
  253. margin-top: 400rpx;
  254. }
  255. .no-order .c text {
  256. margin: 0 auto;
  257. display: block;
  258. width: 258rpx;
  259. height: 29rpx;
  260. line-height: 29rpx;
  261. text-align: center;
  262. font-size: 29rpx;
  263. color: #999;
  264. }
  265. .orders {
  266. height: auto;
  267. width: 100%;
  268. overflow: hidden;
  269. }
  270. .order {
  271. margin-top: 20rpx;
  272. background: #fff;
  273. }
  274. .order .h {
  275. height: 83.3rpx;
  276. line-height: 83.3rpx;
  277. margin-left: 31.25rpx;
  278. padding-right: 31.25rpx;
  279. border-bottom: 1px solid #f4f4f4;
  280. font-size: 30rpx;
  281. color: #333;
  282. }
  283. .order .h .l {
  284. float: left;
  285. }
  286. .order .h .r {
  287. float: right;
  288. color: #b4282d;
  289. font-size: 24rpx;
  290. }
  291. .order .goods {
  292. display: flex;
  293. align-items: center;
  294. height: 199rpx;
  295. margin-left: 31.25rpx;
  296. }
  297. .order .goods .img {
  298. height: 145.83rpx;
  299. width: 145.83rpx;
  300. background: #f4f4f4;
  301. }
  302. .order .goods .img image {
  303. height: 145.83rpx;
  304. width: 145.83rpx;
  305. }
  306. .order .goods .info {
  307. height: 145.83rpx;
  308. flex: 1;
  309. padding-left: 20rpx;
  310. }
  311. .order .goods .r {
  312. float: right;
  313. }
  314. .order .goods .name {
  315. margin-top: 30rpx;
  316. display: block;
  317. height: 44rpx;
  318. line-height: 44rpx;
  319. color: #333;
  320. font-size: 30rpx;
  321. }
  322. .order .goods .number {
  323. display: block;
  324. height: 37rpx;
  325. line-height: 37rpx;
  326. color: #666;
  327. font-size: 25rpx;
  328. }
  329. .order .goods .status {
  330. /* width: 105rpx; */
  331. display: flex;
  332. color: #b4282d;
  333. font-size: 25rpx;
  334. }
  335. .order .goods .status .btn {
  336. margin-left: 10rpx;
  337. margin-right: 10rpx;
  338. color: blue;
  339. }
  340. .order .b {
  341. height: 103rpx;
  342. line-height: 103rpx;
  343. margin-left: 31.25rpx;
  344. padding-right: 31.25rpx;
  345. border-top: 1px solid #f4f4f4;
  346. font-size: 30rpx;
  347. color: #333;
  348. }
  349. .order .b .l {
  350. float: left;
  351. }
  352. .order .b .r {
  353. float: right;
  354. }
  355. .order .b .rs {
  356. float: right;
  357. margin-right: 20rpx;
  358. }
  359. .time {
  360. float: right;
  361. display: block;
  362. }
  363. .order .b .rs .red {
  364. color: red;
  365. }
  366. .order .b .btn {
  367. margin-top: 19rpx;
  368. height: 64.5rpx;
  369. line-height: 64.5rpx;
  370. text-align: center;
  371. padding: 0 20rpx;
  372. border-radius: 5rpx;
  373. font-size: 28rpx;
  374. color: #fff;
  375. background: #b4282d;
  376. }
  377. .flexb {
  378. height: 103rpx;
  379. line-height: 103rpx;
  380. margin-left: 31.25rpx;
  381. padding-right: 31.25rpx;
  382. border-top: 1px solid #f4f4f4;
  383. font-size: 30rpx;
  384. color: #333;
  385. display: flex;
  386. flex-wrap: nowrap;
  387. }
  388. .flex {
  389. flex-grow: 1;
  390. }
  391. .create-time {
  392. color: #777;
  393. height: 40rpx;
  394. font-size: 24rpx;
  395. margin-left: 32rpx;
  396. }
  397. .edit-amount {
  398. border: 2rpx solid #09afff;
  399. padding: 6rpx 10rpx;
  400. border-radius: 8rpx;
  401. }
  402. .price-wrapper {
  403. padding: 20rpx 50rpx;
  404. }
  405. .price-wrapper input {
  406. height: 80rpx;
  407. padding: 0 20rpx;
  408. border: 2rpx solid #ccc;
  409. border-radius: 8rpx;
  410. }
  411. .van-dialog__header {
  412. color: #333;
  413. font-weight: bold;
  414. }
  415. .edit-wrapper {
  416. text-align: right;
  417. }
  418. </style>