sellerOrderButton.vue 4.4 KB

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