cm-list-button.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template name="button">
  2. <view class="button-template">
  3. <!-- 底部按钮 -->
  4. <view class="button-content">
  5. <view
  6. class="btn btn-payment"
  7. v-if="order.affirmPaymentFlag == 10"
  8. @click.stop="btnConfirm('payment', order)"
  9. >确认打款<text>供应商</text></view
  10. >
  11. <view class="btn btn-confirm" v-if="btnState.isConfirmation" @click.stop="btnConfirm('confirmation', order)"
  12. >确认订单</view
  13. >
  14. <view class="btn btn-pay" v-if="btnState.isPay" @click.stop="btnConfirm('pay', order)">付款</view>
  15. <view class="btn btn-cancel" v-if="order.checkFlag === 2" @click.stop="btnConfirm('upload', order)"
  16. >上传凭证</view
  17. >
  18. <view class="btn btn-share" @click.stop="onShareCode(order)">分享订单</view>
  19. <view class="btn btn-cancel" v-if="btnState.isCancel" @click.stop="btnConfirm('cancel', order)"
  20. >取消订单</view
  21. >
  22. <!-- <view class="btn btn-delete" v-if="btnState.isDelete" @click.stop="btnConfirm('delete',order)">删除订单</view> -->
  23. <view
  24. class="btn btn-query"
  25. v-if="btnState.isQuery && order.secondHandOrderFlag != 1"
  26. @click.stop="btnConfirm('query', order)"
  27. >查看物流</view
  28. >
  29. <view class="btn btn-firm" v-if="btnState.isConfirm" @click.stop="btnConfirm('confirm', order)">
  30. 确认收货 <view class="tips">采美豆<text class="line"></text></view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. export default {
  37. name: 'button',
  38. props: {
  39. status: {
  40. type: Number
  41. },
  42. order: {
  43. type: Object
  44. }
  45. },
  46. data() {
  47. return {
  48. isShare: true,
  49. shareCode: '',
  50. btnState: this.initStatus(),
  51. mapStateArr: [
  52. { label: 'isQuery', val: [2, 3, 5, 6, 12, 13, 22, 23, 32, 33], status: true },
  53. { label: 'isDelete', val: [4], status: true },
  54. { label: 'isCancel', val: [0, 11], status: true },
  55. { label: 'isConfirm', val: [33], status: true },
  56. { label: 'isConfirmation', val: [0], status: true },
  57. { label: 'isPay', val: [11, 12, 13, 21, 22, 23], status: true }
  58. ]
  59. }
  60. },
  61. created() {
  62. this.initData(this.status)
  63. },
  64. computed: {},
  65. watch: {
  66. status: {
  67. handler: function(val) {
  68. this.initData(val)
  69. },
  70. deep: true //对象内部的属性监听,也叫深度监听
  71. }
  72. },
  73. methods: {
  74. initData(resVal) {
  75. /**
  76. * @分享按钮统一显示
  77. * @按钮根据状态显示
  78. * @(4、5、7、12、22、23、32)显示[查看物流]按钮,其他隐藏
  79. * @(6)显示[删除订单],其他隐藏
  80. * @(0、111)显示[取消订单],其他隐藏
  81. * @(21,31)只显示分享
  82. * @(13,33)显示[确认收货]和[查看物流]
  83. */
  84. this.btnState = this.initStatus()
  85. this.mapStateArr.forEach(el => {
  86. el.val.forEach(value => {
  87. if (resVal === value) {
  88. this.btnState[el.label] = el.status
  89. }
  90. })
  91. })
  92. },
  93. initStatus() {
  94. let btnState = {
  95. isQuery: false,
  96. isDelete: false,
  97. isCancel: false,
  98. isConfirm: false,
  99. isShare: true,
  100. isConfirmation: false
  101. }
  102. return btnState
  103. },
  104. getShareCode(code) {
  105. this.shareCode = code
  106. },
  107. onShareCode(order) {
  108. this.$parent.isShareModal = true
  109. this.$parent.handleShopOrderId = order.shopOrderId
  110. },
  111. btnConfirm(type, order) {
  112. let data = {
  113. type: type,
  114. shopOrderId: order.shopOrderId,
  115. shopOrderNo: order.shopOrderNo,
  116. order: order,
  117. shopId: order.shopId
  118. }
  119. this.$emit('buttonConfirm', data)
  120. }
  121. }
  122. }
  123. </script>
  124. <style lang="scss">
  125. .button-template {
  126. width: 100%;
  127. height: auto;
  128. float: left;
  129. background: #ffffff;
  130. .button-content {
  131. height: auto;
  132. float: right;
  133. position: relative;
  134. .share-code {
  135. width: 200rpx;
  136. height: 64rpx;
  137. line-height: 64rpx;
  138. color: #2a45ff;
  139. text-align: left;
  140. position: absolute;
  141. font-size: $font-size-28;
  142. font-weight: bold;
  143. left: 24rpx;
  144. top: 24rpx;
  145. }
  146. .btn {
  147. width: 150rpx;
  148. height: 64rpx;
  149. margin: 22rpx 0 20rpx 15rpx;
  150. line-height: 64rpx;
  151. font-size: $font-size-26;
  152. color: #999999;
  153. text-align: center;
  154. float: right;
  155. border-radius: 34rpx;
  156. border: 2rpx solid #999999;
  157. &.btn-payment {
  158. line-height: 38rpx;
  159. font-size: 24rpx;
  160. background: #f9a94b;
  161. color: #fff;
  162. border: 2rpx solid #f9a94b;
  163. text {
  164. display: block;
  165. line-height: 15rpx;
  166. }
  167. }
  168. }
  169. .btn-color {
  170. background: $btn-confirm;
  171. // margin: 22rpx 0 22rpx 22rpx;
  172. }
  173. .btn-cancel {
  174. // background:#FFFFFF;
  175. // color: #999999;
  176. // float: left;
  177. // margin: 22rpx 0;
  178. text-align: center;
  179. }
  180. // .btn-delete{
  181. // background:linear-gradient(315deg,rgba(255,163,3,1) 0%,rgba(255,53,1,1) 100%);
  182. // }
  183. // .btn-query{
  184. // background:linear-gradient(135deg,rgba(255,212,129,1) 0%,rgba(198,129,0,1) 100%);
  185. // }
  186. .btn-confirm {
  187. background: $btn-confirm;
  188. border-color: #ff7a51;
  189. color: #ffffff;
  190. }
  191. .btn-pay {
  192. background: #07c160;
  193. color: #ffffff;
  194. border: 2rpx solid #07c160;
  195. }
  196. .btn-firm {
  197. position: relative;
  198. .tips {
  199. width: 74rpx;
  200. height: 32rpx;
  201. line-height: 32rpx;
  202. padding: 0 7rpx;
  203. border-radius: 16rpx;
  204. background-color: #ffe6dc;
  205. color: $color-system;
  206. text-align: center;
  207. font-size: $font-size-20;
  208. position: absolute;
  209. right: 0;
  210. top: -40rpx;
  211. z-index: 90;
  212. .line {
  213. display: block;
  214. width: 20rpx;
  215. height: 20rpx;
  216. background-color: #ffe6dc;
  217. position: relative;
  218. bottom: 18rpx;
  219. left: 15rpx;
  220. z-index: -1;
  221. transform: rotate(45deg);
  222. }
  223. }
  224. }
  225. .btn-share {
  226. // background:linear-gradient(315deg,rgba(0,212,150,1) 0%,rgba(126,243,174,1) 100%);
  227. position: relative;
  228. .tips {
  229. width: 160rpx;
  230. height: 34rpx;
  231. padding: 10rpx 10rpx;
  232. background: linear-gradient(45deg, rgba(0, 0, 0, 1) 0%, rgba(87, 87, 87, 1) 100%);
  233. box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.2);
  234. border-radius: 8rpx;
  235. position: absolute;
  236. color: #ffffff;
  237. line-height: 34rpx;
  238. font-size: $font-size-24;
  239. text-align: left;
  240. right: 0;
  241. top: -65rpx;
  242. &:before {
  243. content: '';
  244. width: 25rpx;
  245. height: 25rpx;
  246. background: linear-gradient(45deg, rgba(0, 0, 0, 1) 0%, rgba(87, 87, 87, 1) 100%);
  247. position: absolute;
  248. bottom: -8rpx;
  249. right: 30rpx;
  250. z-index: -1;
  251. transform: rotate(45deg);
  252. }
  253. }
  254. }
  255. }
  256. }
  257. </style>