自主产品,供应链食堂系统。将两个端拆开了。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

251 lines
6.3 KiB

5 years ago
5 years ago
5 years ago
  1. <template>
  2. <view>
  3. <view class="head">
  4. <view class="lf-row-between list">
  5. <view>批次号</view>
  6. <view class="lf-color-black">{{ order.batch_sn }}</view>
  7. </view>
  8. <view class="lf-row-between list">
  9. <view>订单编号</view>
  10. <view class="lf-color-black">{{ order.q_sn }}</view>
  11. </view>
  12. <view class="lf-row-between list">
  13. <view>订单状态</view>
  14. <view :class="stateClass(order.state)">{{ order.state }}</view>
  15. </view>
  16. <view class="lf-row-between list">
  17. <view>报价商</view>
  18. <view class="lf-color-black">{{ order.q_name }}</view>
  19. </view>
  20. <view class="lf-row-between list">
  21. <view>关联食堂</view>
  22. <view class="lf-color-black">{{ (order.canteen && order.canteen.canteen_name) || '' }}</view>
  23. </view>
  24. <view class="lf-row-between list">
  25. <view>创建时间</view>
  26. <view class="lf-color-black">{{ order.created_at }}</view>
  27. </view>
  28. <view class="lf-row-between list">
  29. <view>过期时间</view>
  30. <view class="lf-color-black">{{ order.deadline_text }}</view>
  31. </view>
  32. </view>
  33. <self-line></self-line>
  34. <view class="lf-m-t-30 lf-m-l-32 lf-m-r-32">
  35. <view class="lf-font-32 lf-color-black lf-font-bold lf-m-b-20">报价明细</view>
  36. <wyb-table :headers="headers" :contents="contents" :first-line-fixed="true" contentBgColor="#eef6fe" width="max-content" height="80vh"></wyb-table>
  37. </view>
  38. <view style="height: 140rpx;"></view>
  39. <!-- 操作按钮 -->
  40. <view class="fixed-bottom" v-if="$isRight(order) && type != 0">
  41. <view v-if="type == 1" class="lf-row-flex-end">
  42. <button class="btn btn2" style="background-color: #FF0000;" @click="orderStateChange('待发起')">撤销订单</button>
  43. </view>
  44. <view v-if="type == 2" class="lf-row-flex-end">
  45. <button class="btn btn1" @click="$url('/pages/offer/index?type=1&code='+ order.q_sn)">编辑</button>
  46. <button class="btn btn2" @click="orderStateChange('待审核')">发起报价</button>
  47. </view>
  48. <view v-if="type == 3 || type == 4" class="lf-row-between">
  49. <button class="btn btn1" @click="$url('/pages/offer/index?type=2&code='+ order.q_sn)">复用报价单</button>
  50. <button class="btn btn1" @click="$url('/pages/offer/index?type=3&code='+ order.batch_sn)">复用本批次</button>
  51. <view class="lf-font-32" style="color: #11D189;" v-if="type == 3">报价已通过</view>
  52. <view class="lf-font-32" style="color: #FF0000;" v-if="type == 4">报价已被拒绝</view>
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. import wybTable from '@/components/wyb-table/wyb-table';
  59. export default {
  60. components: { wybTable },
  61. data(){
  62. return {
  63. type: 0,
  64. order: {},
  65. headers: [{
  66. label: '物资名称',
  67. key: 'name'
  68. },{
  69. label: '规格',
  70. key: 'spec'
  71. },{
  72. label: '单位',
  73. key: 'unit'
  74. },{
  75. label: '分类',
  76. key: 'category'
  77. },{
  78. label: '品牌',
  79. key: 'brand'
  80. },{
  81. label: '品级',
  82. key: 'quality_level'
  83. },{
  84. label: '编号',
  85. key: 'number'
  86. },{
  87. label: '起购数',
  88. key: 'purchase_limit'
  89. },{
  90. label: '含税价',
  91. key: 'tax_price'
  92. },{
  93. label: '不含税价',
  94. key: 'non_tax_price'
  95. }],
  96. contents: [],
  97. q_sn: '', // 订单号
  98. show_count: 0
  99. }
  100. },
  101. computed: {
  102. stateClass(){
  103. return function(val){
  104. let class_name = {
  105. '已通过': 'passed',
  106. '待发起': 'wait',
  107. '待审核': 'quoted-price',
  108. '未通过': 'refuse'
  109. }
  110. return class_name[val];
  111. }
  112. }
  113. },
  114. onLoad(options){
  115. this.q_sn = options.q_sn;
  116. this.getDetail();
  117. },
  118. onShow(options){
  119. this.show_count++;
  120. if(this.show_count > 1){
  121. this.getDetail();
  122. }
  123. },
  124. methods: {
  125. stateType(val){
  126. let type = 0;
  127. switch(val){
  128. case '待审核': type = 1; break;
  129. case '待发起': type = 2; break;
  130. case '已通过': type = 3; break;
  131. case '未通过': type = 4; break;
  132. }
  133. this.type = type;
  134. },
  135. getDetail(){
  136. this.$http(this.API.API_SUPPLIER_QUOTATIONDETAIL, {
  137. q_sn: this.q_sn
  138. }).then(res => {
  139. console.log("getDetail", res);
  140. this.stateType(res.data.order.state);
  141. this.order = res.data.order || {};
  142. let list = res.data.order.item || [];
  143. let contents = list.map(item => {
  144. let obj = {
  145. name: item.material?.m_name || '',
  146. material_id: item.material?.id,
  147. spec: item.spec?.name || '',
  148. spec_id: item.spec?.id,
  149. brand: item?.material?.brand || '',
  150. quality_level: item?.material?.quality_level || '',
  151. number: item?.material?.m_sn || '',
  152. tax_price: item.tax_price,
  153. non_tax_price: item.non_tax_price,
  154. purchase_limit: item.purchase_limit,
  155. unit: item?.material?.unit?.unit_name || '',
  156. category: item?.material?.category?.m_cate_name || ''
  157. }
  158. return obj;
  159. });
  160. this.contents = contents;
  161. }).catch(err => {
  162. this.$toBack();
  163. })
  164. },
  165. // 改变订单状态
  166. orderStateChange(state){
  167. this.$http(this.API.API_SUPPLIER_QUOTATIONUPDATE, {
  168. q_sn: this.q_sn,
  169. state: state
  170. }).then(res => {
  171. console.log("revokeOrder", res);
  172. this.$msg('操作成功');
  173. this.getDetail(); // 更新当前页面数据
  174. })
  175. }
  176. }
  177. }
  178. </script>
  179. <style lang="scss" scoped="scoped">
  180. .head{
  181. padding: 0 32rpx;
  182. width: 750rpx;
  183. box-sizing: border-box;
  184. height: auto;
  185. .list{
  186. padding: 30rpx 0;
  187. // border-bottom: 1rpx solid #e5e5e5;
  188. font-size: 28rpx;
  189. color: #555555;
  190. &:last-child{
  191. border-bottom: none;
  192. }
  193. }
  194. }
  195. .fixed-bottom{
  196. position: fixed;
  197. bottom: 0rpx;
  198. left: 0rpx;
  199. z-index: 99;
  200. width: 750rpx;
  201. height: 98rpx;
  202. display: flex;
  203. // justify-content: flex-end;
  204. align-items: center;
  205. border-top: 1rpx solid #E5E5E5;
  206. background-color: #FFFFFF;
  207. box-sizing: border-box;
  208. padding: 0 32rpx;
  209. .btn{
  210. width: 212rpx;
  211. height: 82rpx;
  212. border-radius: 41rpx;
  213. margin: 0;
  214. padding: 0;
  215. font-size: 32rpx;
  216. display: flex;
  217. justify-content: center;
  218. align-items: center;
  219. }
  220. .btn1{
  221. border: 2rpx solid #555555;
  222. opacity: .5;
  223. }
  224. .btn2{
  225. background: #1833F2;
  226. color: #FFFFFF;
  227. margin-left: 20rpx;
  228. }
  229. }
  230. .fixed-bottom>view{
  231. width: 100%;
  232. }
  233. // 已报价,等待审核
  234. .quoted-price{
  235. color: #777777;
  236. }
  237. // 等待报价
  238. .wait{
  239. color: #1833F2;
  240. }
  241. // 已通过审核
  242. .passed{
  243. color: #0BCE5F;
  244. }
  245. // 报价被拒绝
  246. .refuse{
  247. color: #FF0000;
  248. }
  249. </style>