cm-details-button.vue 5.6 KB

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