orderListButton.vue 5.3 KB

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