sellerOrderButton.vue 4.4 KB

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